@@ -22,7 +22,7 @@ namespace fs = std::filesystem;
2222
2323
2424namespace graphql ::schema {
25-
25+
2626NamespaceScope::NamespaceScope (std::ostream& outputFile, std::string_view cppNamespace, bool deferred /* = false*/ ) noexcept
2727 : _outputFile(outputFile)
2828 , _cppNamespace(cppNamespace)
@@ -1506,7 +1506,6 @@ bool Generator::outputHeader() const noexcept
15061506 NamespaceScope graphqlNamespace{ headerFile, " graphql" };
15071507 NamespaceScope introspectionNamespace{ headerFile, s_introspectionNamespace };
15081508 NamespaceScope schemaNamespace{ headerFile, _schemaNamespace, true };
1509- NamespaceScope objectNamespace{ headerFile, " object" , true };
15101509
15111510 headerFile << R"cpp(
15121511class Schema;
@@ -1600,7 +1599,7 @@ class Schema;
16001599
16011600 if (!_objectTypes.empty ())
16021601 {
1603- objectNamespace. enter () ;
1602+ NamespaceScope objectNamespace{ headerFile, " object " } ;
16041603 headerFile << std::endl;
16051604
16061605 // Forward declare all of the object types
@@ -1615,10 +1614,7 @@ class Schema;
16151614
16161615 if (!_interfaceTypes.empty ())
16171616 {
1618- if (objectNamespace.exit ())
1619- {
1620- headerFile << std::endl;
1621- }
1617+ headerFile << std::endl;
16221618
16231619 // Forward declare all of the interface types
16241620 if (_interfaceTypes.size () > 1 )
@@ -1652,10 +1648,8 @@ class Schema;
16521648
16531649 if (!_objectTypes.empty () && !_options.separateFiles )
16541650 {
1655- if (objectNamespace.enter ())
1656- {
1657- headerFile << std::endl;
1658- }
1651+ NamespaceScope objectNamespace{ headerFile, " object" };
1652+ headerFile << std::endl;
16591653
16601654 // Output the full declarations
16611655 for (const auto & objectType : _objectTypes)
@@ -1664,7 +1658,6 @@ class Schema;
16641658 headerFile << std::endl;
16651659 }
16661660
1667- objectNamespace.exit ();
16681661 headerFile << std::endl;
16691662 }
16701663
@@ -1674,7 +1667,8 @@ class Schema;
16741667 {
16751668 bool firstOperation = true ;
16761669
1677- headerFile << R"cpp( class Operations
1670+ headerFile << R"cpp(
1671+ class Operations
16781672 : public service::Request
16791673{
16801674public:
@@ -3242,7 +3236,7 @@ std::vector<std::string> Generator::outputSeparateFiles() const noexcept
32423236 {
32433237 files.push_back ({ _objectHeaderPath });
32443238 }
3245-
3239+
32463240 for (const auto & objectType : _objectTypes)
32473241 {
32483242 std::ostringstream ossNamespace;
@@ -3468,7 +3462,7 @@ int main(int argc, char** argv)
34683462 << " column: " << position.byte_in_line
34693463 << std::endl;
34703464 }
3471-
3465+
34723466 return 1 ;
34733467 }
34743468 catch (const std::runtime_error& ex)
0 commit comments