Documentation + better comment parameter

This commit is contained in:
Simon Giraudot 2019-01-23 14:43:21 +01:00
parent 0d2f06d8a9
commit 2e13c54913
1 changed files with 26 additions and 13 deletions

View File

@ -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 <typename P>
#ifdef DOXYGEN_RUNNING
bool write_ply(std::ostream& os, const Surface_mesh<P>& sm)
#else
bool write_ply(std::ostream& os, const Surface_mesh<P>& sm, std::string* comments = NULL)
#endif
bool write_ply(std::ostream& os, const Surface_mesh<P>& sm, const std::string& comments = std::string())
{
typedef Surface_mesh<P> 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 <typename P>
#ifdef DOXYGEN_RUNNING
bool read_ply(std::istream& is, Surface_mesh<P>& sm)
#else
bool read_ply(std::istream& is, Surface_mesh<P>& 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 <typename P>
bool read_ply(std::istream& is, Surface_mesh<P>& 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)
{