|
9 | 9 | #include "graphqlservice/GraphQLParse.h" |
10 | 10 | #include "graphqlservice/GraphQLService.h" |
11 | 11 |
|
12 | | -namespace graphql::runtime { |
| 12 | +namespace graphql::generator { |
13 | 13 |
|
14 | | -// ValueVisitor visits the AST and builds a response::Value representation of any value |
15 | | -// hardcoded or referencing a variable in an operation. |
16 | | -class ValueVisitor |
| 14 | +class RequestLoader |
17 | 15 | { |
18 | 16 | public: |
19 | | - GRAPHQLSERVICE_EXPORT ValueVisitor(const response::Value& variables); |
| 17 | + explicit RequestLoader(); |
20 | 18 |
|
21 | | - GRAPHQLSERVICE_EXPORT void visit(const peg::ast_node& value); |
22 | | - |
23 | | - GRAPHQLSERVICE_EXPORT response::Value getValue(); |
24 | | - |
25 | | -private: |
26 | | - void visitVariable(const peg::ast_node& variable); |
27 | | - void visitIntValue(const peg::ast_node& intValue); |
28 | | - void visitFloatValue(const peg::ast_node& floatValue); |
29 | | - void visitStringValue(const peg::ast_node& stringValue); |
30 | | - void visitBooleanValue(const peg::ast_node& booleanValue); |
31 | | - void visitNullValue(const peg::ast_node& nullValue); |
32 | | - void visitEnumValue(const peg::ast_node& enumValue); |
33 | | - void visitListValue(const peg::ast_node& listValue); |
34 | | - void visitObjectValue(const peg::ast_node& objectValue); |
35 | | - |
36 | | - const response::Value& _variables; |
37 | | - response::Value _value; |
38 | | -}; |
39 | | - |
40 | | -// DirectiveVisitor visits the AST and builds a 2-level map of directive names to argument |
41 | | -// name/value pairs. |
42 | | -class DirectiveVisitor |
43 | | -{ |
44 | | -public: |
45 | | - GRAPHQLSERVICE_EXPORT explicit DirectiveVisitor(const response::Value& variables); |
46 | | - |
47 | | - GRAPHQLSERVICE_EXPORT void visit(const peg::ast_node& directives); |
48 | | - |
49 | | - GRAPHQLSERVICE_EXPORT bool shouldSkip() const; |
50 | | - GRAPHQLSERVICE_EXPORT response::Value getDirectives(); |
51 | | - |
52 | | -private: |
53 | | - const response::Value& _variables; |
54 | | - |
55 | | - response::Value _directives; |
56 | | -}; |
57 | | - |
58 | | -// FragmentDefinitionVisitor visits the AST and collects all of the fragment |
59 | | -// definitions in the document. |
60 | | -class FragmentDefinitionVisitor |
61 | | -{ |
62 | | -public: |
63 | | - GRAPHQLSERVICE_EXPORT FragmentDefinitionVisitor(const response::Value& variables); |
64 | | - |
65 | | - GRAPHQLSERVICE_EXPORT service::FragmentMap getFragments(); |
66 | | - |
67 | | - GRAPHQLSERVICE_EXPORT void visit(const peg::ast_node& fragmentDefinition); |
| 19 | + void visit(const peg::ast& request, std::string_view operationName); |
68 | 20 |
|
69 | 21 | private: |
70 | | - const response::Value& _variables; |
71 | 22 |
|
72 | | - service::FragmentMap _fragments; |
73 | 23 | }; |
74 | 24 |
|
75 | | -} /* namespace graphql::runtime */ |
| 25 | +} /* namespace graphql::generator */ |
76 | 26 |
|
77 | 27 | #endif // REQUESTLOADER_H |
0 commit comments