@@ -111,14 +111,11 @@ std::vector<std::string> Generator::Build() const noexcept
111
111
builtFiles.push_back (_sourcePath);
112
112
}
113
113
114
- if (!_options.mergeFiles )
115
- {
116
- auto separateFiles = outputSeparateFiles ();
114
+ auto separateFiles = outputSeparateFiles ();
117
115
118
- for (auto & file : separateFiles)
119
- {
120
- builtFiles.push_back (std::move (file));
121
- }
116
+ for (auto & file : separateFiles)
117
+ {
118
+ builtFiles.push_back (std::move (file));
122
119
}
123
120
124
121
return builtFiles;
@@ -303,90 +300,6 @@ static_assert(graphql::internal::MinorVersion == )cpp"
303
300
headerFile << std::endl;
304
301
}
305
302
306
- if (_options.mergeFiles )
307
- {
308
- if (!_loader.getInterfaceTypes ().empty ())
309
- {
310
- // Output the full declarations
311
- for (const auto & interfaceType : _loader.getInterfaceTypes ())
312
- {
313
- outputInterfaceDeclaration (headerFile, interfaceType.cppType );
314
- headerFile << std::endl;
315
- }
316
- }
317
-
318
- if (!_loader.getUnionTypes ().empty ())
319
- {
320
- // Output the full declarations
321
- for (const auto & unionType : _loader.getUnionTypes ())
322
- {
323
- outputInterfaceDeclaration (headerFile, unionType.cppType );
324
- headerFile << std::endl;
325
- }
326
- }
327
-
328
- if (!_loader.getObjectTypes ().empty ())
329
- {
330
- if (!_loader.isIntrospection ())
331
- {
332
- objectNamespace.enter ();
333
-
334
- NamespaceScope implementsNamespace { headerFile, R"cpp( implements)cpp" , true };
335
-
336
- for (const auto & objectType : _loader.getObjectTypes ())
337
- {
338
- if (objectType.interfaces .empty ())
339
- {
340
- continue ;
341
- }
342
-
343
- if (implementsNamespace.enter ())
344
- {
345
- headerFile << std::endl;
346
- }
347
-
348
- // Output the implements concept declarations
349
- outputObjectImplements (headerFile, objectType);
350
- }
351
-
352
- if (implementsNamespace.exit ())
353
- {
354
- headerFile << std::endl;
355
- }
356
-
357
- NamespaceScope stubNamespace { headerFile, " methods" , true };
358
-
359
- // Output the stub concept declarations
360
- for (const auto & objectType : _loader.getObjectTypes ())
361
- {
362
- if (!stubNamespace.enter ())
363
- {
364
- headerFile << std::endl;
365
- }
366
-
367
- std::ostringstream ossConceptNamespace;
368
-
369
- ossConceptNamespace << objectType.cppType << R"cpp( Has)cpp" ;
370
-
371
- const auto conceptNamespace = ossConceptNamespace.str ();
372
- NamespaceScope conceptSubNamespace { headerFile, conceptNamespace };
373
-
374
- outputObjectStubs (headerFile, objectType);
375
- }
376
-
377
- stubNamespace.exit ();
378
- headerFile << std::endl;
379
- }
380
-
381
- // Output the full declarations
382
- for (const auto & objectType : _loader.getObjectTypes ())
383
- {
384
- outputObjectDeclaration (headerFile, objectType, objectType.type == queryType);
385
- headerFile << std::endl;
386
- }
387
- }
388
- }
389
-
390
303
if (objectNamespace.exit ())
391
304
{
392
305
headerFile << std::endl;
@@ -490,49 +403,46 @@ static_assert(graphql::internal::MinorVersion == )cpp"
490
403
)cpp" ;
491
404
}
492
405
493
- if (!_options. mergeFiles )
406
+ if (!_loader. getInterfaceTypes (). empty () )
494
407
{
495
- if (! _loader.getInterfaceTypes (). empty ())
408
+ for ( const auto & interfaceType : _loader.getInterfaceTypes ())
496
409
{
497
- for (const auto & interfaceType : _loader.getInterfaceTypes ())
498
- {
499
- headerFile << R"cpp( void Add)cpp" << interfaceType.cppType
500
- << R"cpp( Details(const std::shared_ptr<schema::InterfaceType>& type)cpp"
501
- << interfaceType.cppType
502
- << R"cpp( , const std::shared_ptr<schema::Schema>& schema);
410
+ headerFile << R"cpp( void Add)cpp" << interfaceType.cppType
411
+ << R"cpp( Details(const std::shared_ptr<schema::InterfaceType>& type)cpp"
412
+ << interfaceType.cppType
413
+ << R"cpp( , const std::shared_ptr<schema::Schema>& schema);
503
414
)cpp" ;
504
- }
505
-
506
- headerFile << std::endl;
507
415
}
508
416
509
- if (!_loader.getUnionTypes ().empty ())
417
+ headerFile << std::endl;
418
+ }
419
+
420
+ if (!_loader.getUnionTypes ().empty ())
421
+ {
422
+ for (const auto & unionType : _loader.getUnionTypes ())
510
423
{
511
- for (const auto & unionType : _loader.getUnionTypes ())
512
- {
513
- headerFile << R"cpp( void Add)cpp" << unionType.cppType
514
- << R"cpp( Details(const std::shared_ptr<schema::UnionType>& type)cpp"
515
- << unionType.cppType
516
- << R"cpp( , const std::shared_ptr<schema::Schema>& schema);
424
+ headerFile << R"cpp( void Add)cpp" << unionType.cppType
425
+ << R"cpp( Details(const std::shared_ptr<schema::UnionType>& type)cpp"
426
+ << unionType.cppType
427
+ << R"cpp( , const std::shared_ptr<schema::Schema>& schema);
517
428
)cpp" ;
518
- }
519
-
520
- headerFile << std::endl;
521
429
}
522
430
523
- if (!_loader.getObjectTypes ().empty ())
431
+ headerFile << std::endl;
432
+ }
433
+
434
+ if (!_loader.getObjectTypes ().empty ())
435
+ {
436
+ for (const auto & objectType : _loader.getObjectTypes ())
524
437
{
525
- for (const auto & objectType : _loader.getObjectTypes ())
526
- {
527
- headerFile << R"cpp( void Add)cpp" << objectType.cppType
528
- << R"cpp( Details(const std::shared_ptr<schema::ObjectType>& type)cpp"
529
- << objectType.cppType
530
- << R"cpp( , const std::shared_ptr<schema::Schema>& schema);
438
+ headerFile << R"cpp( void Add)cpp" << objectType.cppType
439
+ << R"cpp( Details(const std::shared_ptr<schema::ObjectType>& type)cpp"
440
+ << objectType.cppType
441
+ << R"cpp( , const std::shared_ptr<schema::Schema>& schema);
531
442
)cpp" ;
532
- }
533
-
534
- headerFile << std::endl;
535
443
}
444
+
445
+ headerFile << std::endl;
536
446
}
537
447
538
448
if (_loader.isIntrospection ())
@@ -1156,24 +1066,13 @@ bool Generator::outputSource() const noexcept
1156
1066
1157
1067
if (!_loader.isIntrospection ())
1158
1068
{
1159
- if (_options. mergeFiles )
1069
+ for ( const auto & operation : _loader. getOperationTypes () )
1160
1070
{
1161
-
1162
- sourceFile << R"cpp( #include ")cpp" << fs::path (_headerPath).filename ().string ()
1163
- << R"cpp( "
1164
-
1071
+ sourceFile << R"cpp( #include ")cpp" << operation.cppType << R"cpp( Object.h"
1165
1072
)cpp" ;
1166
1073
}
1167
- else
1168
- {
1169
- for (const auto & operation : _loader.getOperationTypes ())
1170
- {
1171
- sourceFile << R"cpp( #include ")cpp" << operation.cppType << R"cpp( Object.h"
1172
- )cpp" ;
1173
- }
1174
1074
1175
- sourceFile << std::endl;
1176
- }
1075
+ sourceFile << std::endl;
1177
1076
}
1178
1077
1179
1078
if (_loader.isIntrospection ())
@@ -1388,44 +1287,6 @@ service::AwaitableResolver ModifiedResult<)cpp"
1388
1287
}
1389
1288
}
1390
1289
1391
- if (_options.mergeFiles )
1392
- {
1393
- NamespaceScope objectNamespace { sourceFile, " object" , true };
1394
-
1395
- for (const auto & interfaceType : _loader.getInterfaceTypes ())
1396
- {
1397
- if (objectNamespace.enter ())
1398
- {
1399
- sourceFile << std::endl;
1400
- }
1401
-
1402
- outputInterfaceImplementation (sourceFile, interfaceType.cppType );
1403
- sourceFile << std::endl;
1404
- }
1405
-
1406
- for (const auto & unionType : _loader.getUnionTypes ())
1407
- {
1408
- if (objectNamespace.enter ())
1409
- {
1410
- sourceFile << std::endl;
1411
- }
1412
-
1413
- outputInterfaceImplementation (sourceFile, unionType.cppType );
1414
- sourceFile << std::endl;
1415
- }
1416
-
1417
- for (const auto & objectType : _loader.getObjectTypes ())
1418
- {
1419
- if (objectNamespace.enter ())
1420
- {
1421
- sourceFile << std::endl;
1422
- }
1423
-
1424
- outputObjectImplementation (sourceFile, objectType, objectType.type == queryType);
1425
- sourceFile << std::endl;
1426
- }
1427
- }
1428
-
1429
1290
if (!_loader.isIntrospection ())
1430
1291
{
1431
1292
bool firstOperation = true ;
@@ -1733,16 +1594,9 @@ Operations::Operations()cpp";
1733
1594
1734
1595
for (const auto & interfaceType : _loader.getInterfaceTypes ())
1735
1596
{
1736
- if (!_options.mergeFiles )
1737
- {
1738
- sourceFile << R"cpp( Add)cpp" << interfaceType.cppType << R"cpp( Details(type)cpp"
1739
- << interfaceType.cppType << R"cpp( , schema);
1597
+ sourceFile << R"cpp( Add)cpp" << interfaceType.cppType << R"cpp( Details(type)cpp"
1598
+ << interfaceType.cppType << R"cpp( , schema);
1740
1599
)cpp" ;
1741
- }
1742
- else
1743
- {
1744
- outputInterfaceIntrospection (sourceFile, interfaceType);
1745
- }
1746
1600
}
1747
1601
}
1748
1602
@@ -1752,16 +1606,9 @@ Operations::Operations()cpp";
1752
1606
1753
1607
for (const auto & unionType : _loader.getUnionTypes ())
1754
1608
{
1755
- if (!_options.mergeFiles )
1756
- {
1757
- sourceFile << R"cpp( Add)cpp" << unionType.cppType << R"cpp( Details(type)cpp"
1758
- << unionType.cppType << R"cpp( , schema);
1609
+ sourceFile << R"cpp( Add)cpp" << unionType.cppType << R"cpp( Details(type)cpp"
1610
+ << unionType.cppType << R"cpp( , schema);
1759
1611
)cpp" ;
1760
- }
1761
- else
1762
- {
1763
- outputUnionIntrospection (sourceFile, unionType);
1764
- }
1765
1612
}
1766
1613
}
1767
1614
@@ -1771,16 +1618,9 @@ Operations::Operations()cpp";
1771
1618
1772
1619
for (const auto & objectType : _loader.getObjectTypes ())
1773
1620
{
1774
- if (!_options.mergeFiles )
1775
- {
1776
- sourceFile << R"cpp( Add)cpp" << objectType.cppType << R"cpp( Details(type)cpp"
1777
- << objectType.cppType << R"cpp( , schema);
1621
+ sourceFile << R"cpp( Add)cpp" << objectType.cppType << R"cpp( Details(type)cpp"
1622
+ << objectType.cppType << R"cpp( , schema);
1778
1623
)cpp" ;
1779
- }
1780
- else
1781
- {
1782
- outputObjectIntrospection (sourceFile, objectType);
1783
- }
1784
1624
}
1785
1625
}
1786
1626
@@ -2285,16 +2125,9 @@ void Generator::outputObjectIntrospection(
2285
2125
2286
2126
firstInterface = false ;
2287
2127
2288
- if (!_options.mergeFiles )
2289
- {
2290
- sourceFile
2291
- << R"cpp( std::static_pointer_cast<const schema::InterfaceType>(schema->LookupType(R"gql()cpp"
2292
- << interfaceName << R"cpp( )gql"sv)))cpp" ;
2293
- }
2294
- else
2295
- {
2296
- sourceFile << R"cpp( type)cpp" << _loader.getSafeCppName (interfaceName);
2297
- }
2128
+ sourceFile
2129
+ << R"cpp( std::static_pointer_cast<const schema::InterfaceType>(schema->LookupType(R"gql()cpp"
2130
+ << interfaceName << R"cpp( )gql"sv)))cpp" ;
2298
2131
}
2299
2132
2300
2133
sourceFile << R"cpp(
@@ -3197,7 +3030,6 @@ int main(int argc, char** argv)
3197
3030
std::move (sourceDir) },
3198
3031
verbose,
3199
3032
stubs, // stubs
3200
- !buildCustom, // mergeFiles
3201
3033
noIntrospection, // noIntrospection
3202
3034
})
3203
3035
.Build ();
0 commit comments