FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cppgraphqlgen/include/SchemaGenerator.h at main · gitmodimo/cppgraphqlgen · GitHub
gitmodimo
cppgraphqlgen
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cppgraphqlgen
/
include
/
SchemaGenerator.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
89 lines (73 loc) · 3.64 KB
Breadcrumbs
cppgraphqlgen
/
include
/
SchemaGenerator.h
Copy path
File metadata and controls
89 lines (73 loc) · 3.64 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//
Copyright (c) Microsoft Corporation. All rights reserved.
//
Licensed under the MIT License.
#
pragma
once
#
ifndef
SCHEMAGENERATOR_H
#
define
SCHEMAGENERATOR_H
#
include
"
SchemaLoader.h
"
namespace
graphql
::generator::schema {
struct
[[nodiscard]]
GeneratorPaths
{
const
std::string headerPath;
const
std::string sourcePath;
};
struct
[[nodiscard]]
GeneratorOptions
{
const
GeneratorPaths paths;
const
bool
verbose =
false
;
const
bool
stubs =
false
;
const
bool
noIntrospection =
false
;
};
class
[[nodiscard]]
Generator
{
public:
//
Initialize the generator with the introspection schema or a custom GraphQL schema.
explicit
Generator
(SchemaOptions&& schemaOptions, GeneratorOptions&& options);
//
Run the generator and return a list of filenames that were output.
[[nodiscard]]
std::vector<std::string>
Build
()
const
noexcept
;
private:
[[nodiscard]]
std::string
getHeaderDir
()
const
noexcept
;
[[nodiscard]]
std::string
getSourceDir
()
const
noexcept
;
[[nodiscard]]
std::string
getHeaderPath
()
const
noexcept
;
[[nodiscard]]
std::string
getSourcePath
()
const
noexcept
;
[[nodiscard]]
bool
outputHeader
()
const
noexcept
;
void
outputInterfaceDeclaration
(std::ostream& headerFile, std::string_view cppType)
const
;
void
outputObjectImplements
(std::ostream& headerFile,
const
ObjectType& objectType)
const
;
void
outputObjectStubs
(std::ostream& headerFile,
const
ObjectType& objectType)
const
;
void
outputObjectDeclaration
(
std::ostream& headerFile,
const
ObjectType& objectType,
bool
isQueryType)
const
;
[[nodiscard]]
std::string
getFieldDeclaration
(
const
InputField& inputField)
const
noexcept
;
[[nodiscard]]
std::string
getFieldDeclaration
(
const
OutputField& outputField)
const
noexcept
;
[[nodiscard]]
std::string
getResolverDeclaration
(
const
OutputField& outputField)
const
noexcept
;
[[nodiscard]]
bool
outputSource
()
const
noexcept
;
void
outputInterfaceImplementation
(std::ostream& sourceFile, std::string_view cppType)
const
;
void
outputInterfaceIntrospection
(
std::ostream& sourceFile,
const
InterfaceType& interfaceType)
const
;
void
outputUnionIntrospection
(std::ostream& sourceFile,
const
UnionType& unionType)
const
;
void
outputObjectImplementation
(
std::ostream& sourceFile,
const
ObjectType& objectType,
bool
isQueryType)
const
;
void
outputObjectIntrospection
(std::ostream& sourceFile,
const
ObjectType& objectType)
const
;
void
outputIntrospectionInterfaces
(std::ostream& sourceFile, std::string_view cppType,
const
std::vector<std::string_view>& interfaces)
const
;
void
outputIntrospectionFields
(
std::ostream& sourceFile, std::string_view cppType,
const
OutputFieldList& fields)
const
;
[[nodiscard]]
std::string
getArgumentDefaultValue
(
size_t
level,
const
response::Value& defaultValue)
const
noexcept
;
[[nodiscard]]
std::string
getArgumentDeclaration
(
const
InputField& argument,
const
char
* prefixToken,
const
char
* argumentsToken,
const
char
* defaultToken)
const
noexcept
;
[[nodiscard]]
std::string
getArgumentAccessType
(
const
InputField& argument)
const
noexcept
;
[[nodiscard]]
std::string
getResultAccessType
(
const
OutputField& result)
const
noexcept
;
[[nodiscard]]
std::string
getTypeModifiers
(
const
TypeModifierStack& modifiers)
const
noexcept
;
[[nodiscard]]
std::string
getIntrospectionType
(
std::string_view type,
const
TypeModifierStack& modifiers)
const
noexcept
;
[[nodiscard]]
std::vector<std::string>
outputSeparateFiles
()
const
noexcept
;
static
const
std::string s_currentDirectory;
SchemaLoader _loader;
const
GeneratorOptions _options;
const
std::string _headerDir;
const
std::string _sourceDir;
const
std::string _headerPath;
const
std::string _sourcePath;
};
}
//
namespace graphql::generator::schema
#
endif
//
SCHEMAGENERATOR_H
Back
|
FazBrowse Home
|
New Git URL