From 26c930bc209a106b652289f2319323cbbf8c1d1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 17 Jul 2020 15:16:32 +0200 Subject: [PATCH] Uniformize whether std::string or const char* is used in the doc --- .../CGAL/boost/graph/IO/polygon_mesh_io.h | 196 +++++++++--------- Point_set_3/include/CGAL/Point_set_3/IO.h | 118 ++++++----- .../include/CGAL/IO/read_points.h | 97 ++++----- .../include/CGAL/IO/write_points.h | 66 +++--- Stream_support/include/CGAL/IO/OBJ.h | 14 +- .../include/CGAL/IO/polygon_soup_io.h | 151 +++++++++----- 6 files changed, 350 insertions(+), 292 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/IO/polygon_mesh_io.h b/BGL/include/CGAL/boost/graph/IO/polygon_mesh_io.h index 7ae18668fa9..b4b7241e1b4 100644 --- a/BGL/include/CGAL/boost/graph/IO/polygon_mesh_io.h +++ b/BGL/include/CGAL/boost/graph/IO/polygon_mesh_io.h @@ -75,6 +75,55 @@ bool read_polygon_mesh(std::istream& is, } */ +/// \cond SKIP_IN_MANUAL + +template +bool read_polygon_mesh(const std::string& fname, + Graph& g, + const NamedParameters& np) +{ + const bool verbose = parameters::choose_parameter(parameters::get_parameter(np, internal_np::verbose), false); + + const std::string ext = IO::internal::get_file_extension(fname); + if(ext == std::string()) + { + if(verbose) + std::cerr << "Error: cannot read from file without extension" << std::endl; + return false; + } + + if(ext == "obj") + return read_OBJ(fname, g, np); + else if(ext == "off") + return read_OFF(fname, g, np); + else if(ext == "ply") + return read_PLY(fname, g, np); + else if(ext == "stl") + return read_STL(fname, g, np); + else if(ext == "ts") + return read_GOCAD(fname, g, np); +#ifdef CGAL_USE_VTK + else if(ext == "vtp") + return read_VTP(fname, g, np); +#endif + + if(verbose) + { + std::cerr << "Error: unknown input file extension: " << ext << "\n" + << "Please refer to the documentation for the list of supported file formats" << std::endl; + } + + return false; +} + +template +bool read_polygon_mesh(const std::string& fname, Graph& g) +{ + return read_polygon_mesh(fname, g, parameters::all_default()); +} + +/// \endcond + /*! * \ingroup PkgBGLIOFct * @@ -130,59 +179,14 @@ bool read_polygon_mesh(std::istream& is, * * \sa \link PMP_IO_grp `CGAL::Polygon_mesh_processing::read_polygon_mesh()`\endlink if the data is not 2-manifold */ -template -bool read_polygon_mesh(const std::string& fname, - Graph& g, - const NamedParameters& np) -{ - const bool verbose = parameters::choose_parameter(parameters::get_parameter(np, internal_np::verbose), false); - - const std::string ext = IO::internal::get_file_extension(fname); - if(ext == std::string()) - { - if(verbose) - std::cerr << "Error: cannot read from file without extension" << std::endl; - return false; - } - - if(ext == "obj") - return read_OBJ(fname, g, np); - else if(ext == "off") - return read_OFF(fname, g, np); - else if(ext == "ply") - return read_PLY(fname, g, np); - else if(ext == "stl") - return read_STL(fname, g, np); - else if(ext == "ts") - return read_GOCAD(fname, g, np); -#ifdef CGAL_USE_VTK - else if(ext == "vtp") - return read_VTP(fname, g, np); -#endif - - if(verbose) - { - std::cerr << "Error: unknown input file extension: " << ext << "\n" - << "Please refer to the documentation for the list of supported file formats" << std::endl; - } - - return false; -} - -/// \cond SKIP_IN_MANUAL - -template -bool read_polygon_mesh(const std::string& fname, Graph& g) -{ - return read_polygon_mesh(fname, g, parameters::all_default()); -} - template bool read_polygon_mesh(const char* fname, Graph& g, const NamedParameters& np) { return read_polygon_mesh(std::string(fname), g, np); } +/// \cond SKIP_IN_MANUAL + template bool read_polygon_mesh(const char* fname, Graph& g) { @@ -195,6 +199,55 @@ bool read_polygon_mesh(const char* fname, Graph& g) //////////////////////////////////////////////////////////////////////////////////////////////////// // Write +/// \cond SKIP_IN_MANUAL + +template +bool write_polygon_mesh(const std::string& fname, + Graph& g, + const NamedParameters& np) +{ + const bool verbose = parameters::choose_parameter(parameters::get_parameter(np, internal_np::verbose), false); + + const std::string ext = IO::internal::get_file_extension(fname); + if(ext == std::string()) + { + if(verbose) + std::cerr << "Error: trying to output to file without extension" << std::endl; + return false; + } + + if(ext == "obj") + return write_OBJ(fname, g, np); + else if(ext == "off") + return write_OFF(fname, g, np); + else if(ext == "ply") + return write_PLY(fname, g, np); + else if(ext == "stl") + return write_STL(fname, g, np); + else if(ext == "ts") + return write_GOCAD(fname, g, np); +#ifdef CGAL_USE_VTK + else if(ext == "vtp") + return write_VTP(fname, g, np); +#endif + + if(verbose) + { + std::cerr << "Error: unknown output file extension: " << ext << "\n" + << "Please refer to the documentation for the list of supported file formats" << std::endl; + } + + return false; +} + +template +bool write_polygon_mesh(const std::string& fname, Graph& g) +{ + return write_polygon_mesh(fname, g, parameters::all_default()); +} + +/// \endcond + /*! * \ingroup PkgBGLIOFct * @@ -251,59 +304,14 @@ bool read_polygon_mesh(const char* fname, Graph& g) * * \return `true` if writing was successful, `false` otherwise. */ -template -bool write_polygon_mesh(const std::string& fname, - Graph& g, - const NamedParameters& np) -{ - const bool verbose = parameters::choose_parameter(parameters::get_parameter(np, internal_np::verbose), false); - - const std::string ext = IO::internal::get_file_extension(fname); - if(ext == std::string()) - { - if(verbose) - std::cerr << "Error: trying to output to file without extension" << std::endl; - return false; - } - - if(ext == "obj") - return write_OBJ(fname, g, np); - else if(ext == "off") - return write_OFF(fname, g, np); - else if(ext == "ply") - return write_PLY(fname, g, np); - else if(ext == "stl") - return write_STL(fname, g, np); - else if(ext == "ts") - return write_GOCAD(fname, g, np); -#ifdef CGAL_USE_VTK - else if(ext == "vtp") - return write_VTP(fname, g, np); -#endif - - if(verbose) - { - std::cerr << "Error: unknown output file extension: " << ext << "\n" - << "Please refer to the documentation for the list of supported file formats" << std::endl; - } - - return false; -} - -/// \cond SKIP_IN_MANUAL - -template -bool write_polygon_mesh(const std::string& fname, Graph& g) -{ - return write_polygon_mesh(fname, g, parameters::all_default()); -} - template bool write_polygon_mesh(const char* fname, Graph& g, const NamedParameters& np) { return write_polygon_mesh(std::string(fname), g, np); } +/// \cond SKIP_IN_MANUAL + template bool write_polygon_mesh(const char* fname, Graph& g) { diff --git a/Point_set_3/include/CGAL/Point_set_3/IO.h b/Point_set_3/include/CGAL/Point_set_3/IO.h index 1d1e9feee66..f26f081ef5c 100644 --- a/Point_set_3/include/CGAL/Point_set_3/IO.h +++ b/Point_set_3/include/CGAL/Point_set_3/IO.h @@ -82,6 +82,31 @@ std::istream& operator>>(std::istream& is, return is; } +/// \cond SKIP_IN_MANUAL + +template +bool read_point_set(const std::string& fname, + CGAL::Point_set_3& ps) +{ + const std::string ext = IO::internal::get_file_extension(fname); + + if(ext == "xyz") + return read_XYZ(fname, ps); + else if(ext == "off") + return read_OFF(fname, ps); + else if(ext =="ply") + return read_PLY(fname, ps); +#ifdef CGAL_LINKED_WITH_LASLIB + else if(ext == "las") + return read_LAS(fname, ps); +#endif + + return false; +} + +/// \endcond + /*! \ingroup PkgPointSet3IO @@ -100,42 +125,17 @@ std::istream& operator>>(std::istream& is, \tparam Point a `CGAL::Point_3` \tparam Vector a `CGAL::Vector_3` - \param filename the path to the input file + \param fname the path to the input file \param ps the point set \return `true` if the reading was successful, `false` otherwise. */ -template -bool read_point_set(const std::string& filename, - CGAL::Point_set_3& ps) -{ - const std::string ext = IO::internal::get_file_extension(filename); - - if(ext == "xyz") - return read_XYZ(filename, ps); - else if(ext == "off") - return read_OFF(filename, ps); - else if(ext =="ply") - return read_PLY(filename, ps); -#ifdef CGAL_LINKED_WITH_LASLIB - else if(ext == "las") - return read_LAS(filename, ps); -#endif - - return false; -} - -/// \cond SKIP_IN_MANUAL - template -bool read_point_set(const char* filename, CGAL::Point_set_3& ps) +bool read_point_set(const char* fname, CGAL::Point_set_3& ps) { - return read_point_set(std::string(filename), ps); + return read_point_set(std::string(fname), ps); } -/// \endcond - //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// // Write @@ -164,6 +164,31 @@ std::ostream& operator<<(std::ostream& os, return os; } +/// \cond SKIP_IN_MANUAL + +template +bool write_point_set(const std::string& fname, + CGAL::Point_set_3& ps, + const CGAL_BGL_NP_CLASS& np) +{ + const std::string ext = IO::internal::get_file_extension(fname); + + if(ext == "xyz") + return write_XYZ(fname, ps, np); + else if(ext == "off") + return write_OFF(fname, ps, np); + else if(ext == "ply") + return write_PLY(fname, ps, np); +#ifdef CGAL_LINKED_WITH_LASLIB + else if(ext == "las") + return write_LAS(fname, ps, np); +#endif + + return false; +} + +/// \endcond + /*! \ingroup PkgPointSet3IO @@ -181,7 +206,7 @@ std::ostream& operator<<(std::ostream& os, \tparam Vector a `CGAL::Vector_3` \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - \param filename the path to the output file + \param fname the path to the output file \param ps the point set \param np an optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below @@ -196,46 +221,25 @@ std::ostream& operator<<(std::ostream& os, \return `true` if the writing was successful, `false` otherwise. */ template -bool write_point_set(const std::string& filename, +bool write_point_set(const char* fname, CGAL::Point_set_3& ps, const CGAL_BGL_NP_CLASS& np) { - const std::string ext = IO::internal::get_file_extension(filename); - - if(ext == "xyz") - return write_XYZ(filename, ps, np); - else if(ext == "off") - return write_OFF(filename, ps, np); - else if(ext == "ply") - return write_PLY(filename, ps, np); -#ifdef CGAL_LINKED_WITH_LASLIB - else if(ext == "las") - return write_LAS(filename, ps, np); -#endif - - return false; + return write_point_set(std::string(fname), ps, np); } /// \cond SKIP_IN_MANUAL -template -bool write_point_set(const char* filename, - CGAL::Point_set_3& ps, - const CGAL_BGL_NP_CLASS& np) +template +bool write_point_set(const char* fname, CGAL::Point_set_3& ps) { - return write_point_set(std::string(filename), ps, np); + return write_point_set(fname, ps, parameters::all_default()); } template -bool write_point_set(const char* filename, CGAL::Point_set_3& ps) +bool write_point_set(const std::string& fname, CGAL::Point_set_3& ps) { - return write_point_set(filename, ps, parameters::all_default()); -} - -template -bool write_point_set(const std::string& filename, CGAL::Point_set_3& ps) -{ - return write_point_set(filename.c_str(), ps, parameters::all_default()); + return write_point_set(fname.c_str(), ps, parameters::all_default()); } /// \endcond diff --git a/Point_set_processing_3/include/CGAL/IO/read_points.h b/Point_set_processing_3/include/CGAL/IO/read_points.h index f988b943f2b..45b0fe10926 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_points.h @@ -28,6 +28,53 @@ namespace CGAL { +/// \cond SKIP_IN_MANUAL + +template +bool read_points(const std::string& fname, + PointOutputIterator output, + const NamedParameters& np) +{ + const std::string ext = IO::internal::get_file_extension(fname); + + if(ext == "xyz") + return read_XYZ(fname, output, np); + else if(ext == "off") + return read_OFF(fname, output, np); + else if(ext == "ply") + return read_PLY(fname, output, np); +#ifdef CGAL_LINKED_WITH_LASLIB + else if(ext == "las") + return read_LAS(fname, output, np); +#endif + + return false; +} + +// variant with default OutputIteratorType +template +bool read_points(const std::string& fname, OutputIterator output, const NamedParameters& np) +{ + return read_points::type>(fname, output, np); +} + +template +bool read_points(const std::string& fname, OutputIterator output) +{ + return read_points(fname, output, parameters::all_default()); +} + +// variant with all default +template +bool read_points(const std::string& fname, OutputIterator output) +{ + return read_points::type>(fname, output, parameters::all_default()); +} + +/// \endcond + /** \ingroup PkgPointSetProcessing3IO @@ -72,60 +119,14 @@ namespace CGAL { \returns `true` if reading was successful, `false` otherwise. */ -template -bool read_points(const std::string& fname, - PointOutputIterator output, - const NamedParameters& np) -{ - const std::string ext = IO::internal::get_file_extension(fname); - - if(ext == "xyz") - return read_XYZ(fname, output, np); - else if(ext == "off") - return read_OFF(fname, output, np); - else if(ext == "ply") - return read_PLY(fname, output, np); -#ifdef CGAL_LINKED_WITH_LASLIB - else if(ext == "las") - return read_LAS(fname, output, np); -#endif - - return false; -} - -/// \cond SKIP_IN_MANUAL - -// variant with default OutputIteratorType -template -bool read_points(const std::string& fname, OutputIterator output, const NamedParameters& np) -{ - return read_points::type>(fname, output, np); -} - -// variant with default np -template -bool read_points(const std::string& fname, OutputIterator output) -{ - return read_points(fname, output, parameters::all_default()); -} - -// variant with all default -template -bool read_points(const std::string& fname, OutputIterator output) -{ - return read_points::type>(fname, output, parameters::all_default()); -} - -// variants with char* - template bool read_points(const char* fname, OutputIterator output, const NamedParameters& np) { return read_points(std::string(fname), output, np); } +/// \cond SKIP_IN_MANUAL + template bool read_points(const char* fname, OutputIterator output, const NamedParameters& np) { diff --git a/Point_set_processing_3/include/CGAL/IO/write_points.h b/Point_set_processing_3/include/CGAL/IO/write_points.h index 10d508db0d0..84c52cdb955 100644 --- a/Point_set_processing_3/include/CGAL/IO/write_points.h +++ b/Point_set_processing_3/include/CGAL/IO/write_points.h @@ -33,6 +33,39 @@ namespace CGAL { +/// \cond SKIP_IN_MANUAL + +template +bool write_points(const std::string& fname, + const PointRange& points, + const CGAL_BGL_NP_CLASS& np, + typename boost::enable_if >::type* = nullptr) +{ + const std::string ext = IO::internal::get_file_extension(fname); + + if(ext == "xyz") + return write_XYZ(fname, points, np); + else if(ext == "off") + return write_OFF(fname, points, np); + else if(ext == "ply") + return write_PLY(fname, points, np); +#ifdef CGAL_LINKED_WITH_LASLIB + else if(ext == "las") + return write_LAS(fname, points, np); + +#endif + return false; +} + +template +bool write_points(const std::string& fname,const PointRange& points, + typename boost::enable_if >::type* = nullptr) +{ + return write_points(fname, points, parameters::all_default()); +} + +/// \endcond + /** \ingroup PkgPointSetProcessing3IO @@ -83,45 +116,16 @@ namespace CGAL { \returns `true` if writing was successful, `false` otherwise. */ template -bool write_points(const std::string& fname, - const PointRange& points, - const CGAL_BGL_NP_CLASS& np +bool write_points(const char* fname, const PointRange& points, const CGAL_BGL_NP_CLASS& np #ifndef DOXYGEN_RUNNING , typename boost::enable_if >::type* = nullptr #endif ) -{ - const std::string ext = IO::internal::get_file_extension(fname); - - if(ext == "xyz") - return write_XYZ(fname, points, np); - else if(ext == "off") - return write_OFF(fname, points, np); - else if(ext == "ply") - return write_PLY(fname, points, np); -#ifdef CGAL_LINKED_WITH_LASLIB - else if(ext == "las") - return write_LAS(fname, points, np); - -#endif - return false; -} - -/// \cond SKIP_IN_MANUAL - -template -bool write_points(const char* fname, const PointRange& points, const CGAL_BGL_NP_CLASS& np, - typename boost::enable_if >::type* = nullptr) { return write_points(std::string(fname), points, np); } -template -bool write_points(const std::string& fname,const PointRange& points, - typename boost::enable_if >::type* = nullptr) -{ - return write_points(fname, points, parameters::all_default()); -} +/// \cond SKIP_IN_MANUAL template bool write_points(const char* fname,const PointRange& points, diff --git a/Stream_support/include/CGAL/IO/OBJ.h b/Stream_support/include/CGAL/IO/OBJ.h index 73eba6483b6..0fa8218324b 100644 --- a/Stream_support/include/CGAL/IO/OBJ.h +++ b/Stream_support/include/CGAL/IO/OBJ.h @@ -277,13 +277,6 @@ bool read_OBJ(const char* fname, /// \cond SKIP_IN_MANUAL -template -bool read_OBJ(const std::string& fname, PointRange& points, PolygonRange& polygons, const CGAL_BGL_NP_CLASS& np, - typename boost::enable_if >::type* = nullptr) -{ - return read_OBJ(fname.c_str(), points, polygons, np); -} - template bool read_OBJ(const char* fname, PointRange& points, PolygonRange& polygons, typename boost::enable_if >::type* = nullptr) @@ -291,6 +284,13 @@ bool read_OBJ(const char* fname, PointRange& points, PolygonRange& polygons, return read_OBJ(fname, points, polygons, parameters::all_default()); } +template +bool read_OBJ(const std::string& fname, PointRange& points, PolygonRange& polygons, const CGAL_BGL_NP_CLASS& np, + typename boost::enable_if >::type* = nullptr) +{ + return read_OBJ(fname.c_str(), points, polygons, np); +} + template bool read_OBJ(const std::string& fname, PointRange& points, PolygonRange& polygons, typename boost::enable_if >::type* = nullptr) diff --git a/Stream_support/include/CGAL/IO/polygon_soup_io.h b/Stream_support/include/CGAL/IO/polygon_soup_io.h index 54219c07c0d..6f89bf9b62b 100644 --- a/Stream_support/include/CGAL/IO/polygon_soup_io.h +++ b/Stream_support/include/CGAL/IO/polygon_soup_io.h @@ -33,44 +33,12 @@ namespace CGAL { -/*! - * \ingroup IOstreamFunctions - * - * \brief reads a polygon soup from a file. - * - * Supported file formats are the following: - * - \ref IOStreamOFF (`.off`) - * - \ref IOStreamOBJ (`.obj`) - * - \ref IOStreamSTL (`.stl`) - * - \ref IOStreamPLY (`.ply`) - * - \ref IOStreamGocad (`.ts`) - * - \ref IOStreamVTK (`.vtp`) - * - * The format is detected from the filename extension. - * - * \tparam PolygonRange a model of the concept `RandomAccessContainer` - * whose value_type is a model of the concept `RandomAccessContainer` - * whose value_type is `std::size_t`. - * \tparam PointRange a model of the concept `RandomAccessContainer` - * whose value type is the point type - * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" - * - * \param fname the name of the file. - * \param polygons each element in the range describes a polygon - * using the indices of the vertices. - * \param points points of the soup of polygons - * \param np optional \ref bgl_namedparameters "Named Parameters" described below - * - * \cgalNamedParamsBegin - * \cgalParamNBegin{verbose} - * \cgalParamDescription{indicates whether output warnings and error messages should be printed or not.} - * \cgalParamType{Boolean} - * \cgalParamDefault{`true`} - * \cgalParamNEnd - * \cgalNamedParamsEnd - * - * \return `true` if reading was successful, `false` otherwise. - */ +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Read + +/// \cond SKIP_IN_MANUAL + template bool read_polygon_soup(const std::string& fname, PointRange& points, @@ -111,12 +79,8 @@ bool read_polygon_soup(const std::string& fname, return false; } -/// \cond SKIP_IN_MANUAL - template -bool read_polygon_soup(const std::string& fname, - PointRange& points, - PolygonRange& polygons) +bool read_polygon_soup(const std::string& fname, PointRange& points, PolygonRange& polygons) { return read_polygon_soup(fname, points, polygons, parameters::all_default()); } @@ -126,7 +90,7 @@ bool read_polygon_soup(const std::string& fname, /*! * \ingroup IOstreamFunctions * - * \brief writes the content of `points` and `polygons` in a file. + * \brief reads a polygon soup from a file. * * Supported file formats are the following: * - \ref IOStreamOFF (`.off`) @@ -139,19 +103,48 @@ bool read_polygon_soup(const std::string& fname, * The format is detected from the filename extension. * * \tparam PolygonRange a model of the concept `RandomAccessContainer` - * whose value_type is a model of the concept `RandomAccessContainer` - * whose value_type is `std::size_t`. - * \tparam PointRange a model of the concept `RandomAccessContainer` - * whose value type is the point type + * whose value_type is a model of the concept `RandomAccessContainer` + * whose value_type is `std::size_t`. + * \tparam PointRange a model of the concept `RandomAccessContainer` whose value type is the point type + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" * * \param fname the name of the file. - * \param polygons each element in the range describes a polygon - * using the indices of the vertices. * \param points points of the soup of polygons - * \param verbose: if `true`, will output warnings and error messages. + * \param polygons each element in the range describes a polygon using the indices of the vertices. + * \param np optional \ref bgl_namedparameters "Named Parameters" described below * - * \return `true` if writing was successful, `false` otherwise. + * \cgalNamedParamsBegin + * \cgalParamNBegin{verbose} + * \cgalParamDescription{indicates whether output warnings and error messages should be printed or not.} + * \cgalParamType{Boolean} + * \cgalParamDefault{`true`} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \return `true` if reading was successful, `false` otherwise. */ +template +bool read_polygon_soup(const char* fname, PointRange& points, PolygonRange& polygons, const CGAL_BGL_NP_CLASS& np) +{ + return read_OBJ(std::string(fname), points, polygons, np); +} + +/// \cond SKIP_IN_MANUAL + +template +bool read_polygon_soup(const char* fname, PointRange& points, PolygonRange& polygons) +{ + return read_OBJ(fname, points, polygons, parameters::all_default()); +} + +/// \endcond + +//////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Write + +/// \cond SKIP_IN_MANUAL + template bool write_polygon_soup(const std::string& fname, const PointRange& points, @@ -197,12 +190,60 @@ bool write_polygon_soup(const std::string& fname, return false; } +template +bool write_polygon_soup(const std::string& fname, PointRange& points, PolygonRange& polygons) +{ + return write_polygon_soup(fname, points, polygons, parameters::all_default()); +} + +/// \endcond + +/*! + * \ingroup IOstreamFunctions + * + * \brief writes the content of `points` and `polygons` in a file. + * + * Supported file formats are the following: + * - \ref IOStreamOFF (`.off`) + * - \ref IOStreamOBJ (`.obj`) + * - \ref IOStreamSTL (`.stl`) + * - \ref IOStreamPLY (`.ply`) + * - \ref IOStreamGocad (`.ts`) + * - \ref IOStreamVTK (`.vtp`) + * + * The format is detected from the filename extension. + * + * \tparam PolygonRange a model of the concept `RandomAccessContainer` + * whose value_type is a model of the concept `RandomAccessContainer` + * whose value_type is `std::size_t`. + * \tparam PointRange a model of the concept `RandomAccessContainer` whose value type is the point type + * \tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters" + * + * \param fname the name of the file. + * \param points points of the soup of polygons + * \param polygons each element in the range describes a polygon using the indices of the vertices. + * \param np optional \ref bgl_namedparameters "Named Parameters" described below + * + * \cgalNamedParamsBegin + * \cgalParamNBegin{verbose} + * \cgalParamDescription{indicates whether output warnings and error messages should be printed or not.} + * \cgalParamType{Boolean} + * \cgalParamDefault{`true`} + * \cgalParamNEnd + * \cgalNamedParamsEnd + * + * \return `true` if writing was successful, `false` otherwise. + */ +template +bool write_polygon_soup(const char* fname, PointRange& points, PolygonRange& polygons, const CGAL_BGL_NP_CLASS& np) +{ + return write_polygon_soup(std::string(fname), points, polygons, np); +} + /// \cond SKIP_IN_MANUAL template -bool write_polygon_soup(const std::string& fname, - PointRange& points, - PolygonRange& polygons) +bool write_polygon_soup(const char* fname, PointRange& points, PolygonRange& polygons) { return write_polygon_soup(fname, points, polygons, parameters::all_default()); }