From d3be9498357eb3ebd0f7e682e25f780f060af727 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 2 Feb 2019 13:16:45 +0000 Subject: Remove boost::filesystem in favour of std::filesystem --- slicer/db/Jamfile.jam | 15 +++++---------- slicer/ice/Jamfile.jam | 6 ++---- slicer/json/Jamfile.jam | 7 +++---- slicer/json/serializer.cpp | 4 ++-- slicer/json/serializer.h | 8 ++++---- slicer/slicer/Jamfile.jam | 7 ++----- slicer/slicer/serializer.cpp | 6 ++---- slicer/slicer/serializer.h | 6 +++--- slicer/test/Jamfile.jam | 6 ++---- slicer/test/helpers.cpp | 2 +- slicer/test/helpers.h | 4 ++-- slicer/test/preprocessor.cpp | 2 +- slicer/test/serializers.cpp | 12 +++++------- slicer/tool/Jamfile.jam | 6 ++---- slicer/tool/parser.cpp | 7 +++---- slicer/tool/parser.h | 10 +++++----- slicer/xml/Jamfile.jam | 7 +++---- slicer/xml/serializer.cpp | 4 ++-- slicer/xml/serializer.h | 8 ++++---- 19 files changed, 53 insertions(+), 74 deletions(-) diff --git a/slicer/db/Jamfile.jam b/slicer/db/Jamfile.jam index 67226fb..7bf1d3d 100644 --- a/slicer/db/Jamfile.jam +++ b/slicer/db/Jamfile.jam @@ -4,8 +4,7 @@ import ../test/slicer.jam ; lib dbppcore : : : : /usr/include/dbpp ; lib dbpp-postgresql : : : : /usr/include/dbpp-postgresql ; -lib boost_system ; -lib boost_filesystem ; +lib stdc++fs ; lib boost_utf : : boost_unit_test_framework ; lib slicer-db : @@ -47,8 +46,7 @@ run testSelect.cpp slicer-db slicer-db dbpp-postgresql - boost_system - boost_filesystem + stdc++fs boost_utf ../test//types ../test//common @@ -67,8 +65,7 @@ run testInsert.cpp BOOST_TEST_DYN_LINK slicer-db dbpp-postgresql - boost_system - boost_filesystem + stdc++fs boost_utf ../test//types ../test//common @@ -87,8 +84,7 @@ run testPatch.cpp BOOST_TEST_DYN_LINK slicer-db dbpp-postgresql - boost_system - boost_filesystem + stdc++fs boost_utf ../test//types ../test//common @@ -106,8 +102,7 @@ run testUpdate.cpp slicer-db slicer-db dbpp-postgresql - boost_system - boost_filesystem + stdc++fs boost_utf ../test//types ../test//common diff --git a/slicer/ice/Jamfile.jam b/slicer/ice/Jamfile.jam index 82e7427..32ff6f4 100644 --- a/slicer/ice/Jamfile.jam +++ b/slicer/ice/Jamfile.jam @@ -1,16 +1,14 @@ import testing ; import package ; -lib boost_system ; -lib boost_filesystem ; +lib stdc++fs ; lib boost_utf : : boost_unit_test_framework ; lib slicer-ice : [ glob *.cpp : test*.cpp ] : .. - boost_system - boost_filesystem + stdc++fs ..//Ice ..//adhocutil ../slicer//slicer diff --git a/slicer/json/Jamfile.jam b/slicer/json/Jamfile.jam index ae85792..0f972a3 100644 --- a/slicer/json/Jamfile.jam +++ b/slicer/json/Jamfile.jam @@ -5,16 +5,14 @@ lib jsonpp : : : : ../..//glibmm ; -lib boost_system ; -lib boost_filesystem ; +lib stdc++fs ; lib boost_utf : : boost_unit_test_framework ; lib slicer-json : [ glob *.cpp : test*.cpp ] : .. - boost_system - boost_filesystem + stdc++fs jsonpp ../..//glibmm ..//adhocutil @@ -27,6 +25,7 @@ run testSpecifics.cpp : : : BOOST_TEST_DYN_LINK slicer-json + stdc++fs boost_utf ../test//types ../test//common diff --git a/slicer/json/serializer.cpp b/slicer/json/serializer.cpp index cd9b6b0..24cc746 100644 --- a/slicer/json/serializer.cpp +++ b/slicer/json/serializer.cpp @@ -330,12 +330,12 @@ namespace Slicer { json::serializeValue(doc, strm, "utf-8"); } - JsonFileSerializer::JsonFileSerializer(const boost::filesystem::path & p) : + JsonFileSerializer::JsonFileSerializer(const std::filesystem::path & p) : path(p) { } - JsonFileDeserializer::JsonFileDeserializer(const boost::filesystem::path & p) : + JsonFileDeserializer::JsonFileDeserializer(const std::filesystem::path & p) : path(p) { } diff --git a/slicer/json/serializer.h b/slicer/json/serializer.h index c096dca..15157d4 100644 --- a/slicer/json/serializer.h +++ b/slicer/json/serializer.h @@ -26,12 +26,12 @@ namespace Slicer { class DLL_PUBLIC JsonFileSerializer : public JsonSerializer { public: - JsonFileSerializer(const boost::filesystem::path &); + JsonFileSerializer(const std::filesystem::path &); virtual void Serialize(ModelPartForRootPtr) override; protected: - const boost::filesystem::path path; + const std::filesystem::path path; }; class DLL_PUBLIC JsonValueSerializer : public JsonSerializer { @@ -56,12 +56,12 @@ namespace Slicer { class DLL_PUBLIC JsonFileDeserializer : public Deserializer { public: - JsonFileDeserializer(const boost::filesystem::path &); + JsonFileDeserializer(const std::filesystem::path &); virtual void Deserialize(ModelPartForRootPtr) override; protected: - const boost::filesystem::path path; + const std::filesystem::path path; }; class DLL_PUBLIC JsonValueDeserializer : public Deserializer { diff --git a/slicer/slicer/Jamfile.jam b/slicer/slicer/Jamfile.jam index c513768..d4ee48e 100644 --- a/slicer/slicer/Jamfile.jam +++ b/slicer/slicer/Jamfile.jam @@ -1,21 +1,18 @@ import package ; -lib boost_system ; -lib boost_filesystem ; +lib stdc++fs ; lib slicer : [ glob *.cpp ] [ glob *.ice ] : ..//Ice - boost_system ..//adhocutil .. : : .. . - boost_system - boost_filesystem + stdc++fs ; alias install : install-lib install-slice ; diff --git a/slicer/slicer/serializer.cpp b/slicer/slicer/serializer.cpp index 4856350..ad64fd9 100644 --- a/slicer/slicer/serializer.cpp +++ b/slicer/slicer/serializer.cpp @@ -1,10 +1,8 @@ -#define BOOST_FILESYSTEM_DYN_LINK -#define BOOST_FILESYSTEM_SOURCE #include "serializer.h" #include INSTANTIATEFACTORY(Slicer::Serializer, std::ostream &); INSTANTIATEFACTORY(Slicer::Deserializer, std::istream &); -INSTANTIATEFACTORY(Slicer::Serializer, const boost::filesystem::path &); -INSTANTIATEFACTORY(Slicer::Deserializer, const boost::filesystem::path &); +INSTANTIATEFACTORY(Slicer::Serializer, const std::filesystem::path &); +INSTANTIATEFACTORY(Slicer::Deserializer, const std::filesystem::path &); diff --git a/slicer/slicer/serializer.h b/slicer/slicer/serializer.h index f4ed4a2..857fa65 100644 --- a/slicer/slicer/serializer.h +++ b/slicer/slicer/serializer.h @@ -1,7 +1,7 @@ #ifndef SLICER_SERIALIZER_H #define SLICER_SERIALIZER_H -#include +#include #include #include #include @@ -25,8 +25,8 @@ namespace Slicer { typedef AdHoc::Factory StreamSerializerFactory; typedef AdHoc::Factory StreamDeserializerFactory; - typedef AdHoc::Factory FileSerializerFactory; - typedef AdHoc::Factory FileDeserializerFactory; + typedef AdHoc::Factory FileSerializerFactory; + typedef AdHoc::Factory FileDeserializerFactory; } #endif diff --git a/slicer/test/Jamfile.jam b/slicer/test/Jamfile.jam index 8984242..ee6ca66 100644 --- a/slicer/test/Jamfile.jam +++ b/slicer/test/Jamfile.jam @@ -2,8 +2,7 @@ import testing ; import ./slicer.jam ; lib dl ; -lib boost_system ; -lib boost_filesystem ; +lib stdc++fs ; lib boost_date_time ; lib boost_utf : : boost_unit_test_framework ; @@ -30,8 +29,7 @@ lib types : path-constant me : . ; alias common : : : : - boost_filesystem - boost_system + stdc++fs BOOST_TEST_DYN_LINK boost_utf types diff --git a/slicer/test/helpers.cpp b/slicer/test/helpers.cpp index 956b626..cbc6623 100644 --- a/slicer/test/helpers.cpp +++ b/slicer/test/helpers.cpp @@ -3,7 +3,7 @@ #include void -diff(const boost::filesystem::path & left, const boost::filesystem::path & right) +diff(const std::filesystem::path & left, const std::filesystem::path & right) { std::ifstream fl(left.string()); std::ifstream fr(right.string()); diff --git a/slicer/test/helpers.h b/slicer/test/helpers.h index 95dbd4d..47754a9 100644 --- a/slicer/test/helpers.h +++ b/slicer/test/helpers.h @@ -3,12 +3,12 @@ #include #include -#include +#include // These are just thin wrappers that throw exceptions DLL_PUBLIC void -diff(const boost::filesystem::path & left, const boost::filesystem::path & right); +diff(const std::filesystem::path & left, const std::filesystem::path & right); #endif diff --git a/slicer/test/preprocessor.cpp b/slicer/test/preprocessor.cpp index ae93937..228ffe3 100644 --- a/slicer/test/preprocessor.cpp +++ b/slicer/test/preprocessor.cpp @@ -8,7 +8,7 @@ #include #include "helpers.h" -namespace fs = boost::filesystem; +namespace fs = std::filesystem; typedef std::map ComponentsCount; ComponentsCount COMPONENTS_IN_TEST_ICE = { diff --git a/slicer/test/serializers.cpp b/slicer/test/serializers.cpp index 775f04e..097a3fb 100644 --- a/slicer/test/serializers.cpp +++ b/slicer/test/serializers.cpp @@ -8,8 +8,6 @@ #include #include #include -#include -#include #include #include #include @@ -21,7 +19,7 @@ #include #include "conversions.h" -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace pl = std::placeholders; // LCOV_EXCL_START @@ -53,8 +51,8 @@ class FileBased { const fs::path tmpf = binDir / "byFile"; fs::create_directory(tmpf); const fs::path output = tmpf / infile; - const fs::path outputJson = tmpf / fs::change_extension(infile, "json"); - const fs::path outputXml = tmpf / fs::change_extension(infile, "xml"); + const fs::path outputJson = tmpf / fs::path(infile).replace_extension("json"); + const fs::path outputXml = tmpf / fs::path(infile).replace_extension("xml"); BOOST_TEST_CHECKPOINT("Deserialize: " << input); T p = Slicer::DeserializeAny(input); @@ -570,7 +568,7 @@ BOOST_AUTO_TEST_CASE( json_streams ) const auto tmpf = binDir / "byStream"; const auto inFile = rootDir / "initial" / "inherit-c.json"; const auto outFile = tmpf / "streamout.json"; - boost::filesystem::create_directories(tmpf); + std::filesystem::create_directories(tmpf); { std::ifstream in(inFile.string()); auto d = Slicer::DeserializeAny(in); @@ -586,7 +584,7 @@ BOOST_AUTO_TEST_CASE( xml_streams ) const auto tmpf = binDir / "byStream"; const auto inFile = rootDir / "initial" / "inherit-b.xml"; const auto outFile = tmpf / "streamout.xml"; - boost::filesystem::create_directories(tmpf); + fs::create_directories(tmpf); { std::ifstream in(inFile.string()); auto d = Slicer::DeserializeAny(in); diff --git a/slicer/tool/Jamfile.jam b/slicer/tool/Jamfile.jam index 2d22b55..a424301 100644 --- a/slicer/tool/Jamfile.jam +++ b/slicer/tool/Jamfile.jam @@ -1,8 +1,7 @@ import package ; lib po : : boost_program_options ; -lib boost_system ; -lib boost_filesystem ; +lib stdc++fs ; lib mcpp ; lib slicer-compiler : @@ -11,8 +10,7 @@ lib slicer-compiler : slice//Slice ..//Ice++11 mcpp - boost_system - boost_filesystem + stdc++fs ..//adhocutil ../slicer//slicer ../slicer//slicer diff --git a/slicer/tool/parser.cpp b/slicer/tool/parser.cpp index 043d10c..c712589 100644 --- a/slicer/tool/parser.cpp +++ b/slicer/tool/parser.cpp @@ -8,11 +8,10 @@ #include #include #include -#include #include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace Slicer { Slicer::Slicer() : @@ -97,7 +96,7 @@ namespace Slicer { if (!cpp) return true; fprintbf(cpp, "// Begin Slicer code\n\n"); - fprintbf(cpp, "#include <%s>\n\n", fs::change_extension(topLevelFile.filename(), ".h").string()); + fprintbf(cpp, "#include <%s>\n\n", fs::path(topLevelFile.filename()).replace_extension(".h").string()); fprintbf(cpp, "#include <%s>\n", (headerPrefix / "modelPartsTypes.impl.h").string()); fprintbf(cpp, "#include <%s>\n", (headerPrefix / "common.h").string()); for (const auto & m : u->modules()) { @@ -574,7 +573,7 @@ namespace Slicer { throw CompilerError("Both file handle and path provided."); } auto cppfile = std::unique_ptr( - cpp || cppPath.empty() ? cpp : fopen(cppPath.string(), "w"), + cpp || cppPath.empty() ? cpp : fopen(cppPath.c_str(), "w"), cppPath.empty() ? fflush : fclose); if (!cppfile && !cppPath.empty()) { throw CompilerError("Failed to open output file"); diff --git a/slicer/tool/parser.h b/slicer/tool/parser.h index 5be5fbb..139cd32 100644 --- a/slicer/tool/parser.h +++ b/slicer/tool/parser.h @@ -2,7 +2,7 @@ #define SLICER_PARSER_H #include -#include +#include #include namespace Slicer { @@ -23,10 +23,10 @@ namespace Slicer { Slicer(); FILE * cpp; - boost::filesystem::path slicePath; - boost::filesystem::path cppPath; - boost::filesystem::path headerPrefix; - std::vector includes; + std::filesystem::path slicePath; + std::filesystem::path cppPath; + std::filesystem::path headerPrefix; + std::vector includes; unsigned int Execute(); unsigned int Components() const; diff --git a/slicer/xml/Jamfile.jam b/slicer/xml/Jamfile.jam index 2886301..c841a87 100644 --- a/slicer/xml/Jamfile.jam +++ b/slicer/xml/Jamfile.jam @@ -1,8 +1,7 @@ import testing ; import package ; -lib boost_system ; -lib boost_filesystem ; +lib stdc++fs ; lib boost_utf : : boost_unit_test_framework ; lib slicer-xml : @@ -10,8 +9,7 @@ lib slicer-xml : [ glob *.ice ] : .. - boost_system - boost_filesystem + stdc++fs ..//Ice ../..//libxmlpp ..//adhocutil @@ -25,6 +23,7 @@ run testSpecifics.cpp : : : BOOST_TEST_DYN_LINK slicer-xml + stdc++fs slicer-xml boost_utf ../test//types diff --git a/slicer/xml/serializer.cpp b/slicer/xml/serializer.cpp index b5719a1..bcc291a 100644 --- a/slicer/xml/serializer.cpp +++ b/slicer/xml/serializer.cpp @@ -403,12 +403,12 @@ namespace Slicer { doc.write_to_stream(strm); } - XmlFileSerializer::XmlFileSerializer(const boost::filesystem::path & p) : + XmlFileSerializer::XmlFileSerializer(const std::filesystem::path & p) : path(p) { } - XmlFileDeserializer::XmlFileDeserializer(const boost::filesystem::path & p) : + XmlFileDeserializer::XmlFileDeserializer(const std::filesystem::path & p) : path(p) { } diff --git a/slicer/xml/serializer.h b/slicer/xml/serializer.h index e3b40f0..561b08f 100644 --- a/slicer/xml/serializer.h +++ b/slicer/xml/serializer.h @@ -34,12 +34,12 @@ namespace Slicer { class DLL_PUBLIC XmlFileSerializer : public XmlSerializer { public: - XmlFileSerializer(const boost::filesystem::path &); + XmlFileSerializer(const std::filesystem::path &); virtual void Serialize(ModelPartForRootPtr) override; protected: - const boost::filesystem::path path; + const std::filesystem::path path; }; class DLL_PUBLIC XmlDocumentSerializer : public XmlSerializer { @@ -73,12 +73,12 @@ namespace Slicer { class DLL_PUBLIC XmlFileDeserializer : public XmlDeserializer { public: - XmlFileDeserializer(const boost::filesystem::path &); + XmlFileDeserializer(const std::filesystem::path &); virtual void Deserialize(ModelPartForRootPtr) override; protected: - const boost::filesystem::path path; + const std::filesystem::path path; }; class DLL_PUBLIC XmlDocumentDeserializer : public XmlDeserializer { -- cgit v1.2.3