diff --git a/Surface_mesh/doc/Surface_mesh/PackageDescription.txt b/Surface_mesh/doc/Surface_mesh/PackageDescription.txt index 9ba18c274e7..f85b321c688 100644 --- a/Surface_mesh/doc/Surface_mesh/PackageDescription.txt +++ b/Surface_mesh/doc/Surface_mesh/PackageDescription.txt @@ -11,6 +11,9 @@ /// \defgroup PkgSurfaceMeshIOFunc I/O Functions /// \ingroup PkgSurface_mesh +/// \defgroup PkgSurfaceMeshIOFuncDeprecated I/O Functions (Deprecated) +/// \ingroup PkgSurfaceMeshIOFunc + /*! \addtogroup PkgSurface_mesh \cgalPkgDescriptionBegin{Surface Mesh,PkgSurfaceMesh} diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO.h b/Surface_mesh/include/CGAL/Surface_mesh/IO.h index c9aaff8da6a..e36675f51f3 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO.h @@ -15,107 +15,37 @@ #include -#include +#include -#include -#include -#include - -#include -#include -#include - -#include +#include #include -#include -#include -#include -#include -#include -#include namespace CGAL { -// @todo move that to read_polygon_mesh in BGL +#ifndef CGAL_NO_DEPRECATED_CODE -/// \addtogroup PkgSurfaceMeshIO -/// -/// I/O functionality for `Surface_mesh`. The top-level functions -/// `read_mesh()` and `write_mesh()` dispatch on the available readers -/// according to the file extension. Currently only `OFF` files are -/// supported. -/// -/// @{ - -#if 0 -/// Read a file into a `Surface_mesh`. The extension of the -/// filename determines which reader is used. -/// -/// Mapping from extension to reader: -/// - off/OFF -> `read_OFF()` -/// -/// @param mesh The mesh that should contain the input. -/// @param filename The name of the file to be read. -/// -/// @return `true`, if reading succeeded, `false` otherwise -/// -#endif +/*! + \ingroup PkgSurfaceMeshIOFuncDeprecated + \deprecated This function is deprecated since \cgal 5.2, `CGAL::read_polygon_mesh()` should be used instead. +*/ template -bool read_mesh(Surface_mesh& mesh, const std::string& filename) +CGAL_DEPRECATED bool read_mesh(Surface_mesh& sm, const std::string& filename) { - // clear mesh before reading from file - mesh.clear(); - - // extract file extension - std::string::size_type dot(filename.rfind(".")); - if(dot == std::string::npos) return false; - std::string ext = filename.substr(dot+1, filename.length()-dot-1); - std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower); - - // extension determines reader - if(ext == "off") - { - return read_OFF(filename, mesh); - } - - // we didn't find a reader module - return false; + return read_polygon_mesh(filename, sm); } -#if 0 -/// Write a `Surface_mesh` to a file. The extension of the -/// filename determines which writer is used. -/// -/// Mapping from extension to writer: -/// - off/OFF -> `write_off()` -/// -/// @param mesh The mesh to be written. -/// @param filename The name of the file to be written. -/// -/// @return `true`, if writing succeeded, `false` otherwise -/// -#endif +/*! + \ingroup PkgSurfaceMeshIOFuncDeprecated + \deprecated This function is deprecated since \cgal 5.2, `CGAL::write_polygon_mesh()` should be used instead. +*/ template -bool write_mesh(const Surface_mesh& mesh, const std::string& filename) +CGAL_DEPRECATED bool write_mesh(const Surface_mesh& mesh, const std::string& filename) { - // extract file extension - std::string::size_type dot(filename.rfind(".")); - if(dot == std::string::npos) return false; - std::string ext = filename.substr(dot+1, filename.length()-dot-1); - std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower); - - // extension determines reader - if(ext == "off") - { - return write_OFF(filename, mesh); - } - - // we didn't find a writer module - return false; + return write_polygon_mesh(filename, mesh); } -/// @} +#endif // CGAL_NO_DEPRECATED_CODE } // namespace CGAL diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO/3MF.h b/Surface_mesh/include/CGAL/Surface_mesh/IO/3MF.h index e9ac6e976ac..fdb5e7b075f 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO/3MF.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO/3MF.h @@ -130,6 +130,7 @@ int read_3MF(const std::string& filename, #ifndef CGAL_NO_DEPRECATED_CODE /*! + \ingroup PkgSurfaceMeshIOFuncDeprecated \deprecated This function is deprecated since \cgal 5.2, `CGAL::read_3MF()` should be used instead. */ template diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO/OFF.h b/Surface_mesh/include/CGAL/Surface_mesh/IO/OFF.h index 6202a7c9b9f..6e8d2bb1e74 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO/OFF.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO/OFF.h @@ -346,23 +346,35 @@ bool read_OFF(std::istream& is, #ifndef CGAL_NO_DEPRECATED_CODE /*! + \ingroup PkgSurfaceMeshIOFuncDeprecated \deprecated This function is deprecated since \cgal 5.2, `CGAL::read_OFF(std::istream&, const Surface_mesh&)` should be used instead. */ template -bool read_off(std::istream& is, Surface_mesh& sm, const CGAL_BGL_NP_CLASS& np) +CGAL_DEPRECATED bool read_off(std::istream& is, Surface_mesh& sm, const CGAL_BGL_NP_CLASS& np) { return read_OFF(is, sm, np); } /*! + \ingroup PkgSurfaceMeshIOFuncDeprecated \deprecated This function is deprecated since \cgal 5.2, `CGAL::read_OFF(std::istream&, const Surface_mesh&)` should be used instead. */ template -bool read_off(std::istream& is, Surface_mesh& sm) +CGAL_DEPRECATED bool read_off(std::istream& is, Surface_mesh& sm) { return read_OFF(is, sm, parameters::all_default()); } +/*! + \ingroup PkgSurfaceMeshIOFuncDeprecated + \deprecated This function is deprecated since \cgal 5.2, `CGAL::read_OFF(std::istream&, const Surface_mesh&)` should be used instead. +*/ +template +CGAL_DEPRECATED bool read_off(Surface_mesh& sm, const std::string& filename) +{ + return read_OFF(filename, sm, parameters::all_default()); +} + #endif // CGAL_NO_DEPRECATED_CODE //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -573,23 +585,35 @@ bool write_OFF(std::ostream& os, const Surface_mesh& sm) #ifndef CGAL_NO_DEPRECATED_CODE /*! + \ingroup PkgSurfaceMeshIOFuncDeprecated \deprecated This function is deprecated since \cgal 5.2, `CGAL::write_OFF(std::ostream&, const Surface_mesh&)` should be used instead. */ template -bool write_off(std::ostream& os, const Surface_mesh& sm, const CGAL_BGL_NP_CLASS& np) +CGAL_DEPRECATED bool write_off(std::ostream& os, const Surface_mesh& sm, const CGAL_BGL_NP_CLASS& np) { return write_OFF(os, sm, np); } /*! + \ingroup PkgSurfaceMeshIOFuncDeprecated \deprecated This function is deprecated since \cgal 5.2, `CGAL::write_OFF(std::ostream&, const Surface_mesh&)` should be used instead. */ template -bool write_off(std::ostream& os, const Surface_mesh& sm) +CGAL_DEPRECATED bool write_off(std::ostream& os, const Surface_mesh& sm) { return write_OFF(os, sm, parameters::all_default()); } +/*! + \ingroup PkgSurfaceMeshIOFuncDeprecated + \deprecated This function is deprecated since \cgal 5.2, `CGAL::write_OFF(std::ostream&, const Surface_mesh&)` should be used instead. +*/ +template +CGAL_DEPRECATED bool write_off(const Surface_mesh& sm, const std::string& filename) +{ + return write_OFF(filename, sm, parameters::all_default()); +} + #endif // CGAL_NO_DEPRECATED_CODE } // namespace CGAL diff --git a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h index 23ae67de6f9..ae8e67105e4 100644 --- a/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h +++ b/Surface_mesh/include/CGAL/Surface_mesh/IO/PLY.h @@ -848,11 +848,12 @@ bool read_PLY(std::istream& is, Surface_mesh

& sm) #ifndef CGAL_NO_DEPRECATED_CODE /*! + \ingroup PkgSurfaceMeshIOFuncDeprecated \deprecated This function is deprecated since \cgal 5.2, `CGAL::read_PLY(std::ostream&, const Surface_mesh&)` should be used instead. */ template -bool read_ply(std::istream& is, Surface_mesh

& sm, std::string& comments) +CGAL_DEPRECATED bool read_ply(std::istream& is, Surface_mesh

& sm, std::string& comments) { return read_PLY(is, sm, comments); } @@ -1116,11 +1117,12 @@ bool write_PLY(std::ostream& os, const Surface_mesh

& sm) #ifndef CGAL_NO_DEPRECATED_CODE /*! + \ingroup PkgSurfaceMeshIOFuncDeprecated \deprecated This function is deprecated since \cgal 5.2, `CGAL::write_PLY(std::ostream&, const Surface_mesh&)` should be used instead. */ template -bool write_ply(std::istream& is, Surface_mesh

& sm, std::string& comments) +CGAL_DEPRECATED bool write_ply(std::istream& is, Surface_mesh

& sm, std::string& comments) { return write_PLY(is, sm, comments); }