diff --git a/BGL/include/CGAL/boost/graph/IO/OFF.h b/BGL/include/CGAL/boost/graph/IO/OFF.h index 4a577d86e2a..6f43f09ab27 100644 --- a/BGL/include/CGAL/boost/graph/IO/OFF.h +++ b/BGL/include/CGAL/boost/graph/IO/OFF.h @@ -186,7 +186,22 @@ bool write_OFF(std::ostream& os, const FaceGraph& g, const CGAL_BGL_NP_CLASS& np return IO::internal::write_OFF_BGL(os, g, np); } -// document that too +/*! + \ingroup PkgBGLIOFct + + writes the graph `g` in the file `fname`, in the OFF format. + + \cgalNamedParamsBegin + \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`. + If this parameter is omitted, an internal property map for + `CGAL::vertex_point_t` should be available in `FaceGraph` + \cgalParamEnd + \cgalNamedParamsEnd + + \sa Overloads of this function for specific models of the concept `FaceGraph`. + + \see \ref IOStreamOFF +*/ template bool write_OFF(const char* fname, const FaceGraph& g, const CGAL_BGL_NP_CLASS& np) { diff --git a/Stream_support/include/CGAL/IO/OFF.h b/Stream_support/include/CGAL/IO/OFF.h index a30cf810d35..9d7143a2b6d 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -176,6 +176,13 @@ bool read_OFF(std::istream& is, CGAL::Emptyset_iterator())); } +/*! + * \ingroup IOstreamFunctions + * + * reads the content of the file `fname` into `points` and `polygons`, in the OFF format. + * + * \see \ref IOStreamOFF + */ template bool read_OFF(const char* fname, PointRange& points, @@ -185,7 +192,7 @@ bool read_OFF(const char* fname, std::ifstream in(fname); return read_OFF(in, points, polygons, np); } -//todo doc this too + template bool read_OFF(const std::string& fname, PointRange& points, PolygonRange& polygons, const CGAL_BGL_NP_CLASS& np) { @@ -239,6 +246,50 @@ bool write_OFF(std::ostream& os, return write_OFF(os, points, polygons, parameters::all_default()); } +/*! + * \ingroup IOstreamFunctions + * + * writes the content of `points` and `polygons` in the file `fname`, in the OFF format. + * + * \see \ref IOStreamOFF + */ +template +bool write_OFF(const char* fname, + const PointRange& points, + const PolygonRange& polygons, + const CGAL_BGL_NP_CLASS& np) +{ + std::ofstream os(fname); + Generic_writer writer(os); + return writer(points, polygons, np); +} + +template +bool write_OFF(const char* fname, + const PointRange& points, + const PolygonRange& polygons) +{ + return write_OFF(fname, points, polygons, parameters::all_default()); +} + +template +bool write_OFF(const std::string& fname, + const PointRange& points, + const PolygonRange& polygons, + const CGAL_BGL_NP_CLASS& np) +{ + return write_OFF(fname.c_str(), points, polygons, np); +} + +template +bool write_OFF(const std::string& fname, + const PointRange& points, + const PolygonRange& polygons) +{ + return write_OFF(fname, points, polygons, parameters::all_default()); +} + + } // namespace CGAL #endif // CGAL_IO_OFF_H