From ee7bd58a9ffc1fc588d045ca183b2496c208107c Mon Sep 17 00:00:00 2001 From: Hanif Koh Date: Wed, 7 Oct 2026 18:31:22 +0800 Subject: [PATCH] Stop Exporting Names Through Usings in the Remaining Headers The last headers with a using or namespace alias at namespace scope: - TCPConsole.hpp imported boost::asio::ip::tcp into Slic3r::Utils for two member declarations. The alias is now a private member of the class. - WebSocketClient.hpp declared four namespace aliases and a tcp alias at global scope, each used only by the header. The names are spelled out. - Repair.hpp aliased CGAL::Polygon_mesh_processing as PMP in Slic3r::tex2color. The three functions that use it declare the alias themselves. - PreciseSeam.hpp, Thumbnails.hpp and MarchingSquares.hpp used a using-declaration or directive for one or two spots each; those spots are qualified. Thumbnails.hpp's "PNG"sv default argument becomes "PNG", which converts to the std::string_view parameter the same way. - tests/sla_print/sla_test_utils.hpp had "using namespace Slic3r;" and tests/filament_group/fg_test_serialization.hpp "using json = nlohmann::json;" at global scope. The headers qualify their own names; the two SLA test sources get the directive themselves. Also removed: twelve type aliases in headers that nothing references (ConflictObjName, CircleSqf, CircleSqd, TRawBuffer, DistanceFunction, SamePair, ExtruderNozzleInfos, Vec2dEvent, Vec2dsEvent, Vec3dEvent, t_option, t_optgroups, Plater::fs_path) and a duplicate fn_ft_job_msg_destroy alias in FileTransferUtils.hpp. --- src/libslic3r/GCode/ConflictChecker.hpp | 2 - src/libslic3r/GCode/PreciseSeam.hpp | 5 +- src/libslic3r/GCode/Thumbnails.hpp | 3 +- src/libslic3r/Geometry/Circle.hpp | 2 - src/libslic3r/MarchingSquares.hpp | 7 +- src/libslic3r/SLA/AGGRaster.hpp | 1 - src/libslic3r/TextureToColor/ColorUtils.hpp | 3 - src/libslic3r/TextureToColor/Repair.hpp | 5 +- src/libslic3r/libslic3r.h | 2 - src/slic3r/GUI/DeviceCore/DevDefs.h | 3 - src/slic3r/GUI/GLCanvas3D.hpp | 3 - src/slic3r/GUI/OptionsGroup.hpp | 1 - src/slic3r/GUI/Plater.hpp | 2 - src/slic3r/Utils/FileTransferUtils.hpp | 1 - src/slic3r/Utils/TCPConsole.hpp | 4 +- src/slic3r/Utils/WebSocketClient.hpp | 27 ++-- .../filament_group/fg_test_serialization.hpp | 118 +++++++++--------- tests/sla_print/sla_print_tests.cpp | 2 + tests/sla_print/sla_test_utils.cpp | 2 + tests/sla_print/sla_test_utils.hpp | 74 ++++++----- 20 files changed, 119 insertions(+), 148 deletions(-) diff --git a/src/libslic3r/GCode/ConflictChecker.hpp b/src/libslic3r/GCode/ConflictChecker.hpp index fb1e02ec3f..85fabec585 100644 --- a/src/libslic3r/GCode/ConflictChecker.hpp +++ b/src/libslic3r/GCode/ConflictChecker.hpp @@ -148,8 +148,6 @@ struct ConflictComputeResult using ConflictComputeOpt = std::optional; -using ConflictObjName = std::optional>; - struct ConflictChecker { static ConflictResultOpt find_inter_of_lines_in_diff_objs(PrintObjectPtrs objs, std::optional wtdptr); diff --git a/src/libslic3r/GCode/PreciseSeam.hpp b/src/libslic3r/GCode/PreciseSeam.hpp index bbb4d98532..f9e1b1ddf3 100644 --- a/src/libslic3r/GCode/PreciseSeam.hpp +++ b/src/libslic3r/GCode/PreciseSeam.hpp @@ -22,9 +22,6 @@ namespace Slic3r { namespace PreciseSeam { -// Import EnforcedBlockedSeamPoint from SeamPlacerImpl namespace for convenience -using SeamPlacerImpl::EnforcedBlockedSeamPoint; - // Geometry and its exterior bounds are prepared together, then treated as read-only. struct ModifierRegion { ExPolygon polygon; @@ -137,7 +134,7 @@ SegmentExtraction extract_perimeter_segments(const PreparedPerimeter &prepared, // Result of weak modifier segment processing struct WeakModifierSegment { - EnforcedBlockedSeamPoint type; // Enforced/Blocked/Neutral + SeamPlacerImpl::EnforcedBlockedSeamPoint type; // Enforced/Blocked/Neutral Point left_point; // Coordinates of left (first) point of segment PerimeterPosition left_position; // Position on the source perimeter before insertion/refinement. Point right_point; // Coordinates of right (last) point of segment diff --git a/src/libslic3r/GCode/Thumbnails.hpp b/src/libslic3r/GCode/Thumbnails.hpp index a5fd598519..bbe8039d80 100644 --- a/src/libslic3r/GCode/Thumbnails.hpp +++ b/src/libslic3r/GCode/Thumbnails.hpp @@ -40,8 +40,7 @@ std::string get_error_string(const ThumbnailErrors& errors); typedef std::vector> GCodeThumbnailDefinitionsList; -using namespace std::literals; -std::pair make_and_check_thumbnail_list(const std::string& thumbnails_string, const std::string_view def_ext = "PNG"sv); +std::pair make_and_check_thumbnail_list(const std::string& thumbnails_string, const std::string_view def_ext = "PNG"); std::pair make_and_check_thumbnail_list(const ConfigBase &config); diff --git a/src/libslic3r/Geometry/Circle.hpp b/src/libslic3r/Geometry/Circle.hpp index 8f8655df65..aee93efa83 100644 --- a/src/libslic3r/Geometry/Circle.hpp +++ b/src/libslic3r/Geometry/Circle.hpp @@ -94,8 +94,6 @@ struct Circle { using Circlef = Circle; using Circled = Circle; -using CircleSqf = CircleSq; -using CircleSqd = CircleSq; /// Find the center of the circle corresponding to the vector of Points as an arc. Point circle_center_taubin_newton(const Points::const_iterator& input_start, const Points::const_iterator& input_end, size_t cycles = 20); diff --git a/src/libslic3r/MarchingSquares.hpp b/src/libslic3r/MarchingSquares.hpp index e123dd14e0..73b8f9bd23 100644 --- a/src/libslic3r/MarchingSquares.hpp +++ b/src/libslic3r/MarchingSquares.hpp @@ -154,13 +154,12 @@ template struct _Loop }; // Add Specialization for using ExecutionTBB for parallel loops. -using namespace Slic3r; -template<> struct _Loop +template<> struct _Loop { template static void for_each_idx(It from, It to, Fn&& fn) { - execution::for_each( - ex_tbb, size_t(0), size_t(to - from), [&from, &fn](size_t i) { fn(from[i], i); }, execution::max_concurrency(ex_tbb)); + Slic3r::execution::for_each( + Slic3r::ex_tbb, size_t(0), size_t(to - from), [&from, &fn](size_t i) { fn(from[i], i); }, Slic3r::execution::max_concurrency(Slic3r::ex_tbb)); } }; diff --git a/src/libslic3r/SLA/AGGRaster.hpp b/src/libslic3r/SLA/AGGRaster.hpp index 52c95eae5b..4651454dde 100644 --- a/src/libslic3r/SLA/AGGRaster.hpp +++ b/src/libslic3r/SLA/AGGRaster.hpp @@ -49,7 +49,6 @@ public: using TColor = typename PixelRenderer::color_type; using TValue = typename TColor::value_type; using TPixel = typename PixelRenderer::pixel_type; - using TRawBuffer = agg::rendering_buffer; protected: diff --git a/src/libslic3r/TextureToColor/ColorUtils.hpp b/src/libslic3r/TextureToColor/ColorUtils.hpp index e9b1be3623..efea0ecb36 100644 --- a/src/libslic3r/TextureToColor/ColorUtils.hpp +++ b/src/libslic3r/TextureToColor/ColorUtils.hpp @@ -17,9 +17,6 @@ typedef std::vector ColorList; typedef std::array ColorDouble; typedef std::array RGB; -// Function pointer type that points to a specific color-difference function based on the chosen method. -using DistanceFunction = double (*)(const Color&, const Color&); - // Color space used for computing color differences. enum struct ColorDifferenceMethod : std::size_t { RGB = 0, // Simplest and fastest diff --git a/src/libslic3r/TextureToColor/Repair.hpp b/src/libslic3r/TextureToColor/Repair.hpp index 092c0623fb..e1b6cf3bb2 100644 --- a/src/libslic3r/TextureToColor/Repair.hpp +++ b/src/libslic3r/TextureToColor/Repair.hpp @@ -23,8 +23,6 @@ namespace Slic3r { namespace tex2color { -namespace PMP = CGAL::Polygon_mesh_processing; - // Default upper bound on the number of half-edges in any single boundary cycle // that CloseBoundariesAndRepairManifoldness will attempt to triangulate. The // cost of triangulate_hole grows non-linearly with cycle length, so this caps @@ -60,6 +58,7 @@ struct BoundaryEdgeStats // any pre-processing (e.g. stitch_borders) needed for the count to be meaningful. inline BoundaryEdgeStats ComputeBoundaryEdgeStats(const cgalutils::CGALMesh& cgal_mesh) { + namespace PMP = CGAL::Polygon_mesh_processing; using CGALMesh = cgalutils::CGALMesh; using HalfedgeDescriptor = boost::graph_traits::halfedge_descriptor; @@ -86,6 +85,7 @@ inline BoundaryEdgeStats ComputeBoundaryEdgeStats(const cgalutils::CGALMesh& cga // boundary statistics; entering this function always triggers triangulation. inline void CloseBoundariesAndRepairManifoldness(cgalutils::CGALMesh& cgal_mesh) { + namespace PMP = CGAL::Polygon_mesh_processing; using CGALMesh = cgalutils::CGALMesh; using HalfedgeDescriptor = boost::graph_traits::halfedge_descriptor; using FaceDescriptor = boost::graph_traits::face_descriptor; @@ -111,6 +111,7 @@ inline bool RepairMesh(const TriMesh& mesh, AlgoCancelCallback cancel_callback = nullptr, const RepairSetting& setting = RepairSetting{}) { + namespace PMP = CGAL::Polygon_mesh_processing; using Clock = std::chrono::steady_clock; auto elapsed_ms = [](Clock::time_point t0) { return std::chrono::duration_cast(Clock::now() - t0).count(); diff --git a/src/libslic3r/libslic3r.h b/src/libslic3r/libslic3r.h index d3b0faa57f..b0a5250532 100644 --- a/src/libslic3r/libslic3r.h +++ b/src/libslic3r/libslic3r.h @@ -432,8 +432,6 @@ inline IntegerOnly fast_round_up(double a) return a == 0.49999999999999994 ? I(0) : I(floor(a + 0.5)); } -template using SamePair = std::pair; - } // namespace Slic3r #endif diff --git a/src/slic3r/GUI/DeviceCore/DevDefs.h b/src/slic3r/GUI/DeviceCore/DevDefs.h index 6332d6b109..aa12482849 100644 --- a/src/slic3r/GUI/DeviceCore/DevDefs.h +++ b/src/slic3r/GUI/DeviceCore/DevDefs.h @@ -198,6 +198,3 @@ template<> struct std::hash return h1 ^ (h2 + 0x9e3779b9 + (h1 << 6) + (h1 >> 2)); }; }; - -// key(extruder_id) -> { key1(nozzle type info), val1( number of the nozzle type)} -using ExtruderNozzleInfos = std::unordered_map>; \ No newline at end of file diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index faf826ed7c..23fdfbb66d 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -183,13 +183,10 @@ wxDECLARE_EVENT(EVT_GLCANVAS_PLATE_NAME_CHANGE, SimpleEvent); //BBS: declare EVT_GLCANVAS_PLATE_SELECT wxDECLARE_EVENT(EVT_GLCANVAS_PLATE_SELECT, SimpleEvent); -using Vec2dEvent = Event; // _bool_ value is used as a indicator of selection in the 3DScene using RBtnEvent = Event>; using RBtnPlateEvent = Event>; -template using Vec2dsEvent = ArrayEvent; -using Vec3dEvent = Event; template using Vec3dsEvent = ArrayEvent; using HeightProfileSmoothEvent = Event; diff --git a/src/slic3r/GUI/OptionsGroup.hpp b/src/slic3r/GUI/OptionsGroup.hpp index 63ebee7176..0943922925 100644 --- a/src/slic3r/GUI/OptionsGroup.hpp +++ b/src/slic3r/GUI/OptionsGroup.hpp @@ -54,7 +54,6 @@ struct Option { Option(const ConfigOptionDef& _opt, t_config_option_key id) : opt(_opt), opt_id(id) {} }; -using t_option = std::unique_ptr