1616#pragma warning(pop)
1717#endif // _MSC_VER
1818
19- // clang-format off
20- #ifdef USE_STD_FILESYSTEM
21- #include < filesystem>
22- namespace fs = std::filesystem;
23- #else
24- #ifdef USE_STD_EXPERIMENTAL_FILESYSTEM
25- #include < experimental/filesystem>
26- namespace fs = std::experimental::filesystem;
27- #else
28- #ifdef USE_BOOST_FILESYSTEM
29- #include < boost/filesystem.hpp>
30- namespace fs = boost::filesystem;
31- #else
32- #error "No std::filesystem implementation defined"
33- #endif
34- #endif
35- #endif
36- // clang-format on
37-
3819#include < cctype>
20+ #include < filesystem>
3921#include < fstream>
4022#include < iostream>
4123#include < regex>
@@ -61,7 +43,7 @@ std::string Generator::getHeaderDir() const noexcept
6143{
6244 if (!_options.paths .headerPath .empty ())
6345 {
64- return fs ::path { _options.paths .headerPath }.string ();
46+ return std::filesystem ::path { _options.paths .headerPath }.string ();
6547 }
6648 else
6749 {
@@ -73,7 +55,7 @@ std::string Generator::getSourceDir() const noexcept
7355{
7456 if (!_options.paths .sourcePath .empty ())
7557 {
76- return fs ::path (_options.paths .sourcePath ).string ();
58+ return std::filesystem ::path (_options.paths .sourcePath ).string ();
7759 }
7860 else
7961 {
@@ -83,15 +65,15 @@ std::string Generator::getSourceDir() const noexcept
8365
8466std::string Generator::getHeaderPath () const noexcept
8567{
86- fs ::path fullPath { _headerDir };
68+ std::filesystem ::path fullPath { _headerDir };
8769
8870 fullPath /= (std::string { _loader.getFilenamePrefix () } + " Schema.h" );
8971 return fullPath.string ();
9072}
9173
9274std::string Generator::getSourcePath () const noexcept
9375{
94- fs ::path fullPath { _sourceDir };
76+ std::filesystem ::path fullPath { _sourceDir };
9577
9678 fullPath /= (std::string { _loader.getFilenamePrefix () } + " Schema.cpp" );
9779 return fullPath.string ();
@@ -124,7 +106,8 @@ std::vector<std::string> Generator::Build() const noexcept
124106bool Generator::outputHeader () const noexcept
125107{
126108 std::ofstream headerFile (_headerPath, std::ios_base::trunc);
127- IncludeGuardScope includeGuard { headerFile, fs::path (_headerPath).filename ().string () };
109+ IncludeGuardScope includeGuard { headerFile,
110+ std::filesystem::path (_headerPath).filename ().string () };
128111
129112 headerFile << R"cpp( #include "graphqlservice/internal/Schema.h"
130113
@@ -977,7 +960,8 @@ void Generator::outputObjectDeclaration(
977960
978961 for (auto unionName : objectType.unions )
979962 {
980- headerFile << R"cpp( friend )cpp" << _loader.getSafeCppName (unionName) << R"cpp( ;
963+ headerFile << R"cpp( friend )cpp" << _loader.getSafeCppName (unionName)
964+ << R"cpp( ;
981965)cpp" ;
982966 }
983967
@@ -1758,7 +1742,8 @@ Operations::Operations()cpp";
17581742 )cpp" ;
17591743 }
17601744 sourceFile << R"cpp( }, )cpp"
1761- << (directive.isRepeatable ? R"cpp( true)cpp" : R"cpp( false)cpp" ) << R"cpp( ));
1745+ << (directive.isRepeatable ? R"cpp( true)cpp" : R"cpp( false)cpp" )
1746+ << R"cpp( ));
17621747)cpp" ;
17631748 }
17641749 }
@@ -2655,8 +2640,8 @@ std::string Generator::getIntrospectionType(
26552640
26562641std::vector<std::string> Generator::outputSeparateFiles () const noexcept
26572642{
2658- const fs ::path headerDir (_headerDir);
2659- const fs ::path sourceDir (_sourceDir);
2643+ const std::filesystem ::path headerDir (_headerDir);
2644+ const std::filesystem ::path sourceDir (_sourceDir);
26602645 std::vector<std::string> files;
26612646 std::string_view queryType;
26622647
@@ -2676,7 +2661,8 @@ std::vector<std::string> Generator::outputSeparateFiles() const noexcept
26762661 std::ofstream headerFile (headerPath, std::ios_base::trunc);
26772662 IncludeGuardScope includeGuard { headerFile, headerFilename };
26782663
2679- headerFile << R"cpp( #include ")cpp" << fs::path (_headerPath).filename ().string () << R"cpp( "
2664+ headerFile << R"cpp( #include ")cpp"
2665+ << std::filesystem::path (_headerPath).filename ().string () << R"cpp( "
26802666
26812667)cpp" ;
26822668
@@ -2766,7 +2752,8 @@ using namespace std::literals;
27662752 std::ofstream headerFile (headerPath, std::ios_base::trunc);
27672753 IncludeGuardScope includeGuard { headerFile, headerFilename };
27682754
2769- headerFile << R"cpp( #include ")cpp" << fs::path (_headerPath).filename ().string () << R"cpp( "
2755+ headerFile << R"cpp( #include ")cpp"
2756+ << std::filesystem::path (_headerPath).filename ().string () << R"cpp( "
27702757
27712758)cpp" ;
27722759
@@ -2856,7 +2843,8 @@ using namespace std::literals;
28562843 std::ofstream headerFile (headerPath, std::ios_base::trunc);
28572844 IncludeGuardScope includeGuard { headerFile, headerFilename };
28582845
2859- headerFile << R"cpp( #include ")cpp" << fs::path (_headerPath).filename ().string () << R"cpp( "
2846+ headerFile << R"cpp( #include ")cpp"
2847+ << std::filesystem::path (_headerPath).filename ().string () << R"cpp( "
28602848
28612849)cpp" ;
28622850
@@ -3053,8 +3041,8 @@ int main(int argc, char** argv)
30533041 po::value (&headerDir),
30543042 " Target path for the <prefix>Schema.h header file" )(" stubs" ,
30553043 po::bool_switch (&stubs),
3056- " Unimplemented fields throw runtime exceptions instead of compiler errors" )(
3057- " no- introspection" ,
3044+ " Unimplemented fields throw runtime exceptions instead of compiler errors" )(" no- "
3045+ " introspection" ,
30583046 po::bool_switch (&noIntrospection),
30593047 " Do not generate support for Introspection" );
30603048 positional.add (" schema" , 1 ).add (" prefix" , 1 ).add (" namespace" , 1 );
0 commit comments