diff --git a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h index e9e082df793..24cb74fa0e4 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/Surface_mesh.h @@ -2158,12 +2158,12 @@ private: //------------------------------------------------------- private data } #if !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE) && !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) + + /// \relates Surface_mesh + /// Inserts the surface mesh in an output stream in PLY format. + /// All vertex and face properties with simple types are inserted in the stream. template -#ifdef DOXYGEN_RUNNING - bool write_ply(std::ostream& os, const Surface_mesh

& sm) -#else - bool write_ply(std::ostream& os, const Surface_mesh

& sm, std::string* comments = NULL) -#endif + bool write_ply(std::ostream& os, const Surface_mesh

& sm, const std::string& comments = std::string()) { typedef Surface_mesh

SMesh; typedef typename SMesh::Vertex_index VIndex; @@ -2191,9 +2191,9 @@ private: //------------------------------------------------------- private data << ((get_mode(os) == IO::BINARY) ? "format binary_little_endian 1.0" : "format ascii 1.0") << std::endl << "comment Generated by the CGAL library" << std::endl; - if (comments != NULL) + if (comments != std::string()) { - std::istringstream iss (*comments); + std::istringstream iss (comments); std::string line; while (getline(iss, line)) { @@ -2607,12 +2607,26 @@ private: //------------------------------------------------------- private data } #if !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE) && !defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) + + /// \cond SKIP_IN_MANUAL template -#ifdef DOXYGEN_RUNNING bool read_ply(std::istream& is, Surface_mesh

& sm) -#else - bool read_ply(std::istream& is, Surface_mesh

& sm, std::string* comments = NULL) -#endif + { + std::string dummy; + return read_ply (is, sm, dummy); + } + /// \endcond + + /// \relates Surface_mesh + /// Extracts the surface mesh from an input stream in Ascii or + /// Binary PLY format and appends it to the surface mesh `sm`. The + /// operator reads all properties for vertices and faces found in + /// the PLY input. + /// \pre The data in the stream must represent a two-manifold. If this is not the case + /// the `failbit` of `is` is set and the mesh cleared. + + template + bool read_ply(std::istream& is, Surface_mesh

& sm, std::string& comments) { if(!is) { @@ -2629,8 +2643,7 @@ private: //------------------------------------------------------- private data return false; } - if (comments != NULL) - *comments = reader.comments(); + comments = reader.comments(); for (std::size_t i = 0; i < reader.number_of_elements(); ++ i) {