[Small Feature] Use CGAL_DEPRECATED and protect deprecated functions

This commit is contained in:
Yliess Bellargui 2025-07-16 13:56:17 +02:00
parent 289716dbab
commit 66de6cba3d
7 changed files with 67 additions and 16 deletions

View File

@ -23,6 +23,7 @@
#include <map>
#include <vector>
#include <list>
#include <CGAL/config.h>
namespace CGAL {
@ -130,8 +131,12 @@ namespace CGAL {
return first;
}
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\deprecated This function is deprecated since CGAL 5.6. Use `read_plane_graph_in_lcc()` instead.
*/
template< class LCC >
[[deprecated("Use read_plane_graph_in_lcc instead")]]
CGAL_DEPRECATED
typename LCC::Dart_descriptor
import_from_plane_graph(LCC& alcc,
const std::vector<typename LCC::Point>& vertices,
@ -139,6 +144,7 @@ import_from_plane_graph(LCC& alcc,
{
return read_plane_graph_in_lcc(alcc, vertices, edge_indices);
}
#endif
/**
* Imports a plane-embedded graph from a file into a LinearCellComplex.
@ -198,13 +204,18 @@ import_from_plane_graph(LCC& alcc,
return read_plane_graph_in_lcc(alcc, vertices, edge_indices);
}
template <class LCC>
[[deprecated("Use read_plane_graph_in_lcc instead")]]
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\deprecated This function is deprecated since CGAL 5.6. Use `read_plane_graph_in_lcc()` instead.
*/
template< class LCC >
CGAL_DEPRECATED
typename LCC::Dart_descriptor
import_from_plane_graph(LCC& alcc, std::istream& ais)
{
return read_plane_graph_in_lcc(alcc, ais);
}
#endif
template < class LCC >
typename LCC::Dart_descriptor
@ -215,13 +226,18 @@ import_from_plane_graph(LCC& alcc, std::istream& ais)
return read_plane_graph_in_lcc(alcc, input);
}
template <class LCC>
[[deprecated("Use read_plane_graph_in_lcc instead")]]
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\deprecated This function is deprecated since CGAL 5.6. Use `read_plane_graph_in_lcc()` instead.
*/
template< class LCC >
CGAL_DEPRECATED
typename LCC::Dart_descriptor
import_from_plane_graph(LCC& alcc, const char* filename)
{
return read_plane_graph_in_lcc(alcc, filename);
}
#endif
template < class LCC >
bool load_off(LCC& alcc, std::istream& in)

View File

@ -38,4 +38,22 @@ cgal_add_compilation_test(Linear_cell_complex_4_test_index)
add_executable(Linear_cell_complex_copy_test_index Linear_cell_complex_copy_test.cpp ${hfiles})
target_compile_definitions(Linear_cell_complex_copy_test_index PRIVATE USE_COMPACT_CONTAINER_WITH_INDEX)
target_link_libraries(Linear_cell_complex_copy_test_index PRIVATE CGAL CGAL::Data)
cgal_add_compilation_test(Linear_cell_complex_copy_test_index)
cgal_add_compilation_test(Linear_cell_complex_copy_test_index)
# Test sans warning de dépréciation pour test_plane_graph_alias
add_executable(test_plane_graph_alias_nowarn test_plane_graph_alias.cpp ${hfiles})
target_compile_definitions(test_plane_graph_alias_nowarn PRIVATE CGAL_NO_DEPRECATION_WARNINGS)
target_link_libraries(test_plane_graph_alias_nowarn PRIVATE CGAL CGAL::Data)
cgal_add_compilation_test(test_plane_graph_alias_nowarn)
# Test sans warning de dépréciation pour test_polyhedron_3_alias
add_executable(test_polyhedron_3_alias_nowarn test_polyhedron_3_alias.cpp ${hfiles})
target_compile_definitions(test_polyhedron_3_alias_nowarn PRIVATE CGAL_NO_DEPRECATION_WARNINGS)
target_link_libraries(test_polyhedron_3_alias_nowarn PRIVATE CGAL CGAL::Data)
cgal_add_compilation_test(test_polyhedron_3_alias_nowarn)
# Test sans warning de dépréciation pour test_triangulation_alias
add_executable(test_triangulation_alias_nowarn test_triangulation_alias.cpp ${hfiles})
target_compile_definitions(test_triangulation_alias_nowarn PRIVATE CGAL_NO_DEPRECATION_WARNINGS)
target_link_libraries(test_triangulation_alias_nowarn PRIVATE CGAL CGAL::Data)
cgal_add_compilation_test(test_triangulation_alias_nowarn)

View File

@ -1,3 +1,4 @@
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/Linear_cell_complex_constructors.h>
#include <cassert>
@ -22,7 +23,7 @@ int main()
input.clear();
input.seekg(0, std::ios::beg);
#if !defined(CGAL_NO_DEPRECATED_CODE) && !defined(CGAL_NO_DEPRECATION_WARNINGS)
#ifndef CGAL_NO_DEPRECATED_CODE
// Test deprecated function
auto d2 = CGAL::import_from_plane_graph(lcc2, input);
assert(d2 != LCC::null_descriptor);

View File

@ -1,4 +1,5 @@
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Polyhedron_3_to_lcc.h>
#include <sstream>
@ -20,7 +21,7 @@ int main()
auto d1 = CGAL::polyhedron_3_to_lcc(lcc1, P);
assert(d1 == LCC::null_descriptor);
#if !defined(CGAL_NO_DEPRECATED_CODE) && !defined(CGAL_NO_DEPRECATION_WARNINGS)
#ifndef CGAL_NO_DEPRECATED_CODE
auto d2 = CGAL::import_from_polyhedron_3<LCC>(lcc2, P);
assert(d2 == LCC::null_descriptor);
#endif

View File

@ -1,4 +1,5 @@
#include <CGAL/Linear_cell_complex_for_combinatorial_map.h>
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Triangulation_3_to_lcc.h>
#include <cassert>
@ -17,7 +18,7 @@ int main()
auto d1 = CGAL::triangulation_3_to_lcc(lcc1, T);
assert(d1 == LCC_3::null_descriptor);
#if !defined(CGAL_NO_DEPRECATED_CODE) && !defined(CGAL_NO_DEPRECATION_WARNINGS)
#ifndef CGAL_NO_DEPRECATED_CODE
auto d2 = CGAL::import_from_triangulation_3(lcc2, T);
assert(d2 == LCC_3::null_descriptor);
#endif

View File

@ -21,6 +21,7 @@
#include <iostream>
#include <map>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/config.h>
namespace CGAL {
@ -94,14 +95,21 @@ namespace CGAL {
return firstAll;
}
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\deprecated This function is deprecated since CGAL 5.6. Use `polyhedron_3_to_lcc()` instead.
*/
template< class LCC, class Polyhedron >
[[deprecated("Use polyhedron_3_to_lcc instead")]]
CGAL_DEPRECATED
typename LCC::Dart_descriptor
import_from_polyhedron_3(LCC& alcc, const Polyhedron &apoly)
{
return polyhedron_3_to_lcc<LCC, Polyhedron>(alcc, apoly);
}
#endif // CGAL_NO_DEPRECATED_CODE
/** Convert a Polyhedron_3 read into a flux into 3D linear cell complex.
* @param alcc the linear cell complex where Polyhedron_3 will be converted.
* @param ais the istream where read the Polyhedron_3.

View File

@ -19,6 +19,7 @@
#include <CGAL/assertions.h>
#include <map>
#include <CGAL/Weighted_point_3.h>
#include <CGAL/config.h>
namespace CGAL {
@ -149,15 +150,20 @@ namespace CGAL {
return dart;
}
template < class LCC, class Triangulation >
[[deprecated("Use triangulation_3_to_lcc instead")]]
typename LCC::Dart_descriptor import_from_triangulation_3
(LCC& alcc, const Triangulation &atr,
std::map<typename Triangulation::Cell_handle,
typename LCC::Dart_descriptor >* avol_to_dart=nullptr)
#ifndef CGAL_NO_DEPRECATED_CODE
/*!
\deprecated This function is deprecated since CGAL 5.6. Use `triangulation_3_to_lcc()` instead.
*/
template <class LCC, class Triangulation>
CGAL_DEPRECATED
typename LCC::Dart_descriptor
import_from_triangulation_3(LCC& alcc, const Triangulation& atr,
std::map<typename Triangulation::Cell_handle,
typename LCC::Dart_descriptor>* avol_to_dart = nullptr)
{
return triangulation_3_to_lcc(alcc, atr, avol_to_dart);
}
#endif
} // namespace CGAL