rails-graphql 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +31 -0
- data/ext/depend +3 -0
- data/ext/extconf.rb +57 -0
- data/ext/graphqlparser/Ast.cpp +346 -0
- data/ext/graphqlparser/Ast.h +1214 -0
- data/ext/graphqlparser/AstNode.h +36 -0
- data/ext/graphqlparser/AstVisitor.h +137 -0
- data/ext/graphqlparser/GraphQLParser.cpp +76 -0
- data/ext/graphqlparser/GraphQLParser.h +55 -0
- data/ext/graphqlparser/JsonVisitor.cpp +161 -0
- data/ext/graphqlparser/JsonVisitor.cpp.inc +456 -0
- data/ext/graphqlparser/JsonVisitor.h +121 -0
- data/ext/graphqlparser/JsonVisitor.h.inc +110 -0
- data/ext/graphqlparser/VERSION +1 -0
- data/ext/graphqlparser/c/GraphQLAst.cpp +324 -0
- data/ext/graphqlparser/c/GraphQLAst.h +180 -0
- data/ext/graphqlparser/c/GraphQLAstForEachConcreteType.h +44 -0
- data/ext/graphqlparser/c/GraphQLAstNode.cpp +25 -0
- data/ext/graphqlparser/c/GraphQLAstNode.h +33 -0
- data/ext/graphqlparser/c/GraphQLAstToJSON.cpp +21 -0
- data/ext/graphqlparser/c/GraphQLAstToJSON.h +24 -0
- data/ext/graphqlparser/c/GraphQLAstVisitor.cpp +55 -0
- data/ext/graphqlparser/c/GraphQLAstVisitor.h +53 -0
- data/ext/graphqlparser/c/GraphQLParser.cpp +35 -0
- data/ext/graphqlparser/c/GraphQLParser.h +54 -0
- data/ext/graphqlparser/dump_json_ast.cpp +48 -0
- data/ext/graphqlparser/lexer.lpp +324 -0
- data/ext/graphqlparser/parser.ypp +693 -0
- data/ext/graphqlparser/parsergen/lexer.cpp +2633 -0
- data/ext/graphqlparser/parsergen/lexer.h +528 -0
- data/ext/graphqlparser/parsergen/location.hh +189 -0
- data/ext/graphqlparser/parsergen/parser.tab.cpp +3300 -0
- data/ext/graphqlparser/parsergen/parser.tab.hpp +646 -0
- data/ext/graphqlparser/parsergen/position.hh +179 -0
- data/ext/graphqlparser/parsergen/stack.hh +156 -0
- data/ext/graphqlparser/syntaxdefs.h +19 -0
- data/ext/libgraphqlparser/AstNode.h +36 -0
- data/ext/libgraphqlparser/CMakeLists.txt +148 -0
- data/ext/libgraphqlparser/CONTRIBUTING.md +23 -0
- data/ext/libgraphqlparser/GraphQLParser.cpp +76 -0
- data/ext/libgraphqlparser/GraphQLParser.h +55 -0
- data/ext/libgraphqlparser/JsonVisitor.cpp +161 -0
- data/ext/libgraphqlparser/JsonVisitor.h +121 -0
- data/ext/libgraphqlparser/LICENSE +22 -0
- data/ext/libgraphqlparser/README.clang-tidy +7 -0
- data/ext/libgraphqlparser/README.md +84 -0
- data/ext/libgraphqlparser/ast/ast.ast +203 -0
- data/ext/libgraphqlparser/ast/ast.py +61 -0
- data/ext/libgraphqlparser/ast/c.py +100 -0
- data/ext/libgraphqlparser/ast/c.pyc +0 -0
- data/ext/libgraphqlparser/ast/c_impl.py +61 -0
- data/ext/libgraphqlparser/ast/c_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/c_visitor_impl.py +39 -0
- data/ext/libgraphqlparser/ast/c_visitor_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/casing.py +26 -0
- data/ext/libgraphqlparser/ast/casing.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx.py +197 -0
- data/ext/libgraphqlparser/ast/cxx.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_impl.py +61 -0
- data/ext/libgraphqlparser/ast/cxx_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_json_visitor_header.py +42 -0
- data/ext/libgraphqlparser/ast/cxx_json_visitor_header.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_json_visitor_impl.py +80 -0
- data/ext/libgraphqlparser/ast/cxx_json_visitor_impl.pyc +0 -0
- data/ext/libgraphqlparser/ast/cxx_visitor.py +64 -0
- data/ext/libgraphqlparser/ast/cxx_visitor.pyc +0 -0
- data/ext/libgraphqlparser/ast/js.py +65 -0
- data/ext/libgraphqlparser/ast/license.py +10 -0
- data/ext/libgraphqlparser/ast/license.pyc +0 -0
- data/ext/libgraphqlparser/c/GraphQLAstNode.cpp +25 -0
- data/ext/libgraphqlparser/c/GraphQLAstNode.h +33 -0
- data/ext/libgraphqlparser/c/GraphQLAstToJSON.cpp +21 -0
- data/ext/libgraphqlparser/c/GraphQLAstToJSON.h +24 -0
- data/ext/libgraphqlparser/c/GraphQLAstVisitor.cpp +55 -0
- data/ext/libgraphqlparser/c/GraphQLAstVisitor.h +53 -0
- data/ext/libgraphqlparser/c/GraphQLParser.cpp +35 -0
- data/ext/libgraphqlparser/c/GraphQLParser.h +54 -0
- data/ext/libgraphqlparser/clang-tidy-all.sh +3 -0
- data/ext/libgraphqlparser/cmake/version.cmake +16 -0
- data/ext/libgraphqlparser/dump_json_ast.cpp +48 -0
- data/ext/libgraphqlparser/go/README.md +20 -0
- data/ext/libgraphqlparser/go/callbacks.go +18 -0
- data/ext/libgraphqlparser/go/gotest.go +64 -0
- data/ext/libgraphqlparser/lexer.lpp +324 -0
- data/ext/libgraphqlparser/libgraphqlparser.pc.in +11 -0
- data/ext/libgraphqlparser/parser.ypp +693 -0
- data/ext/libgraphqlparser/parsergen/lexer.cpp +2633 -0
- data/ext/libgraphqlparser/parsergen/lexer.h +528 -0
- data/ext/libgraphqlparser/parsergen/location.hh +189 -0
- data/ext/libgraphqlparser/parsergen/parser.tab.cpp +3300 -0
- data/ext/libgraphqlparser/parsergen/parser.tab.hpp +646 -0
- data/ext/libgraphqlparser/parsergen/position.hh +179 -0
- data/ext/libgraphqlparser/parsergen/stack.hh +156 -0
- data/ext/libgraphqlparser/python/CMakeLists.txt +14 -0
- data/ext/libgraphqlparser/python/README.md +5 -0
- data/ext/libgraphqlparser/python/example.py +31 -0
- data/ext/libgraphqlparser/syntaxdefs.h +19 -0
- data/ext/libgraphqlparser/test/BuildCAPI.c +5 -0
- data/ext/libgraphqlparser/test/CMakeLists.txt +25 -0
- data/ext/libgraphqlparser/test/JsonVisitorTests.cpp +28 -0
- data/ext/libgraphqlparser/test/ParserTests.cpp +352 -0
- data/ext/libgraphqlparser/test/kitchen-sink.graphql +59 -0
- data/ext/libgraphqlparser/test/kitchen-sink.json +1 -0
- data/ext/libgraphqlparser/test/schema-kitchen-sink.graphql +78 -0
- data/ext/libgraphqlparser/test/schema-kitchen-sink.json +1 -0
- data/ext/libgraphqlparser/test/valgrind.supp +33 -0
- data/ext/version.cpp +21 -0
- data/lib/generators/graphql/controller_generator.rb +22 -0
- data/lib/generators/graphql/schema_generator.rb +22 -0
- data/lib/generators/graphql/templates/controller.erb +5 -0
- data/lib/generators/graphql/templates/schema.erb +6 -0
- data/lib/graphqlparser.so +0 -0
- data/lib/rails-graphql.rb +2 -0
- data/lib/rails/graphql.rake +1 -0
- data/lib/rails/graphql.rb +185 -0
- data/lib/rails/graphql/adapters/mysql_adapter.rb +0 -0
- data/lib/rails/graphql/adapters/pg_adapter.rb +50 -0
- data/lib/rails/graphql/adapters/sqlite_adapter.rb +39 -0
- data/lib/rails/graphql/argument.rb +220 -0
- data/lib/rails/graphql/callback.rb +124 -0
- data/lib/rails/graphql/collectors.rb +14 -0
- data/lib/rails/graphql/collectors/hash_collector.rb +83 -0
- data/lib/rails/graphql/collectors/idented_collector.rb +73 -0
- data/lib/rails/graphql/collectors/json_collector.rb +114 -0
- data/lib/rails/graphql/config.rb +61 -0
- data/lib/rails/graphql/directive.rb +203 -0
- data/lib/rails/graphql/directive/deprecated_directive.rb +59 -0
- data/lib/rails/graphql/directive/include_directive.rb +24 -0
- data/lib/rails/graphql/directive/skip_directive.rb +24 -0
- data/lib/rails/graphql/errors.rb +42 -0
- data/lib/rails/graphql/event.rb +141 -0
- data/lib/rails/graphql/field.rb +318 -0
- data/lib/rails/graphql/field/input_field.rb +92 -0
- data/lib/rails/graphql/field/mutation_field.rb +52 -0
- data/lib/rails/graphql/field/output_field.rb +96 -0
- data/lib/rails/graphql/field/proxied_field.rb +131 -0
- data/lib/rails/graphql/field/resolved_field.rb +96 -0
- data/lib/rails/graphql/field/scoped_config.rb +22 -0
- data/lib/rails/graphql/field/typed_field.rb +104 -0
- data/lib/rails/graphql/helpers.rb +40 -0
- data/lib/rails/graphql/helpers/attribute_delegator.rb +39 -0
- data/lib/rails/graphql/helpers/inherited_collection.rb +152 -0
- data/lib/rails/graphql/helpers/leaf_from_ar.rb +141 -0
- data/lib/rails/graphql/helpers/registerable.rb +103 -0
- data/lib/rails/graphql/helpers/with_arguments.rb +125 -0
- data/lib/rails/graphql/helpers/with_assignment.rb +113 -0
- data/lib/rails/graphql/helpers/with_callbacks.rb +55 -0
- data/lib/rails/graphql/helpers/with_directives.rb +126 -0
- data/lib/rails/graphql/helpers/with_events.rb +81 -0
- data/lib/rails/graphql/helpers/with_fields.rb +141 -0
- data/lib/rails/graphql/helpers/with_namespace.rb +40 -0
- data/lib/rails/graphql/helpers/with_owner.rb +35 -0
- data/lib/rails/graphql/helpers/with_schema_fields.rb +230 -0
- data/lib/rails/graphql/helpers/with_validator.rb +52 -0
- data/lib/rails/graphql/introspection.rb +53 -0
- data/lib/rails/graphql/native.rb +56 -0
- data/lib/rails/graphql/native/functions.rb +38 -0
- data/lib/rails/graphql/native/location.rb +41 -0
- data/lib/rails/graphql/native/pointers.rb +23 -0
- data/lib/rails/graphql/native/visitor.rb +349 -0
- data/lib/rails/graphql/railtie.rb +85 -0
- data/lib/rails/graphql/railties/base_generator.rb +35 -0
- data/lib/rails/graphql/railties/controller.rb +101 -0
- data/lib/rails/graphql/railties/controller_runtime.rb +40 -0
- data/lib/rails/graphql/railties/log_subscriber.rb +62 -0
- data/lib/rails/graphql/request.rb +343 -0
- data/lib/rails/graphql/request/arguments.rb +93 -0
- data/lib/rails/graphql/request/component.rb +100 -0
- data/lib/rails/graphql/request/component/field.rb +225 -0
- data/lib/rails/graphql/request/component/fragment.rb +118 -0
- data/lib/rails/graphql/request/component/operation.rb +178 -0
- data/lib/rails/graphql/request/component/operation/subscription.rb +16 -0
- data/lib/rails/graphql/request/component/spread.rb +119 -0
- data/lib/rails/graphql/request/component/typename.rb +82 -0
- data/lib/rails/graphql/request/context.rb +51 -0
- data/lib/rails/graphql/request/errors.rb +54 -0
- data/lib/rails/graphql/request/event.rb +112 -0
- data/lib/rails/graphql/request/helpers/directives.rb +64 -0
- data/lib/rails/graphql/request/helpers/selection_set.rb +87 -0
- data/lib/rails/graphql/request/helpers/value_writers.rb +115 -0
- data/lib/rails/graphql/request/steps/organizable.rb +146 -0
- data/lib/rails/graphql/request/steps/prepareable.rb +33 -0
- data/lib/rails/graphql/request/steps/resolveable.rb +32 -0
- data/lib/rails/graphql/request/strategy.rb +249 -0
- data/lib/rails/graphql/request/strategy/dynamic_instance.rb +41 -0
- data/lib/rails/graphql/request/strategy/multi_query_strategy.rb +36 -0
- data/lib/rails/graphql/request/strategy/sequenced_strategy.rb +28 -0
- data/lib/rails/graphql/schema.rb +272 -0
- data/lib/rails/graphql/shortcuts.rb +77 -0
- data/lib/rails/graphql/source.rb +371 -0
- data/lib/rails/graphql/source/active_record/builders.rb +154 -0
- data/lib/rails/graphql/source/active_record_source.rb +231 -0
- data/lib/rails/graphql/source/scoped_arguments.rb +87 -0
- data/lib/rails/graphql/to_gql.rb +368 -0
- data/lib/rails/graphql/type.rb +138 -0
- data/lib/rails/graphql/type/enum.rb +206 -0
- data/lib/rails/graphql/type/enum/directive_location_enum.rb +30 -0
- data/lib/rails/graphql/type/enum/type_kind_enum.rb +57 -0
- data/lib/rails/graphql/type/input.rb +134 -0
- data/lib/rails/graphql/type/interface.rb +82 -0
- data/lib/rails/graphql/type/object.rb +111 -0
- data/lib/rails/graphql/type/object/directive_object.rb +34 -0
- data/lib/rails/graphql/type/object/enum_value_object.rb +25 -0
- data/lib/rails/graphql/type/object/field_object.rb +54 -0
- data/lib/rails/graphql/type/object/input_value_object.rb +49 -0
- data/lib/rails/graphql/type/object/schema_object.rb +40 -0
- data/lib/rails/graphql/type/object/type_object.rb +136 -0
- data/lib/rails/graphql/type/scalar.rb +71 -0
- data/lib/rails/graphql/type/scalar/bigint_scalar.rb +34 -0
- data/lib/rails/graphql/type/scalar/binary_scalar.rb +30 -0
- data/lib/rails/graphql/type/scalar/boolean_scalar.rb +37 -0
- data/lib/rails/graphql/type/scalar/date_scalar.rb +34 -0
- data/lib/rails/graphql/type/scalar/date_time_scalar.rb +32 -0
- data/lib/rails/graphql/type/scalar/decimal_scalar.rb +35 -0
- data/lib/rails/graphql/type/scalar/float_scalar.rb +32 -0
- data/lib/rails/graphql/type/scalar/id_scalar.rb +39 -0
- data/lib/rails/graphql/type/scalar/int_scalar.rb +36 -0
- data/lib/rails/graphql/type/scalar/string_scalar.rb +28 -0
- data/lib/rails/graphql/type/scalar/time_scalar.rb +40 -0
- data/lib/rails/graphql/type/union.rb +87 -0
- data/lib/rails/graphql/type_map.rb +347 -0
- data/lib/rails/graphql/version.rb +7 -0
- data/test/assets/introspection-db.json +0 -0
- data/test/assets/introspection-mem.txt +1 -0
- data/test/assets/introspection.gql +91 -0
- data/test/assets/luke.jpg +0 -0
- data/test/assets/mem.gql +428 -0
- data/test/assets/sqlite.gql +423 -0
- data/test/config.rb +80 -0
- data/test/graphql/request/context_test.rb +70 -0
- data/test/graphql/schema_test.rb +190 -0
- data/test/graphql/source_test.rb +237 -0
- data/test/graphql/type/enum_test.rb +203 -0
- data/test/graphql/type/input_test.rb +138 -0
- data/test/graphql/type/interface_test.rb +72 -0
- data/test/graphql/type/object_test.rb +104 -0
- data/test/graphql/type/scalar/bigint_scalar_test.rb +42 -0
- data/test/graphql/type/scalar/binary_scalar_test.rb +17 -0
- data/test/graphql/type/scalar/boolean_scalar_test.rb +40 -0
- data/test/graphql/type/scalar/date_scalar_test.rb +29 -0
- data/test/graphql/type/scalar/date_time_scalar_test.rb +29 -0
- data/test/graphql/type/scalar/decimal_scalar_test.rb +28 -0
- data/test/graphql/type/scalar/float_scalar_test.rb +22 -0
- data/test/graphql/type/scalar/id_scalar_test.rb +26 -0
- data/test/graphql/type/scalar/int_scalar_test.rb +26 -0
- data/test/graphql/type/scalar/string_scalar_test.rb +17 -0
- data/test/graphql/type/scalar/time_scalar_test.rb +36 -0
- data/test/graphql/type/scalar_test.rb +45 -0
- data/test/graphql/type/union_test.rb +82 -0
- data/test/graphql/type_map_test.rb +362 -0
- data/test/graphql/type_test.rb +68 -0
- data/test/graphql_test.rb +55 -0
- data/test/integration/config.rb +56 -0
- data/test/integration/memory/star_wars_introspection_test.rb +144 -0
- data/test/integration/memory/star_wars_query_test.rb +184 -0
- data/test/integration/memory/star_wars_validation_test.rb +99 -0
- data/test/integration/schemas/memory.rb +232 -0
- data/test/integration/schemas/sqlite.rb +82 -0
- data/test/integration/sqlite/star_wars_introspection_test.rb +15 -0
- data/test/integration/sqlite/star_wars_mutation_test.rb +82 -0
- data/test/integration/sqlite/star_wars_query_test.rb +71 -0
- data/test/test_ext.rb +48 -0
- metadata +509 -0
@@ -0,0 +1,1214 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright 2019-present GraphQL Foundation
|
3
|
+
* This source code is licensed under the MIT license found in the
|
4
|
+
* LICENSE file in the root directory of this source tree.
|
5
|
+
*/
|
6
|
+
/** @generated */
|
7
|
+
#pragma once
|
8
|
+
|
9
|
+
#include "AstNode.h"
|
10
|
+
|
11
|
+
#include <memory>
|
12
|
+
#include <string>
|
13
|
+
#include <utility>
|
14
|
+
#include <vector>
|
15
|
+
|
16
|
+
namespace facebook {
|
17
|
+
namespace graphql {
|
18
|
+
namespace ast {
|
19
|
+
|
20
|
+
// The parser uses strdup to move from yytext to the heap, so we need
|
21
|
+
// to use free instead of delete.
|
22
|
+
struct CDeleter {
|
23
|
+
void operator()(const char *p) const { free((void *)p); }
|
24
|
+
};
|
25
|
+
|
26
|
+
class Definition;
|
27
|
+
class Document;
|
28
|
+
class OperationDefinition;
|
29
|
+
class VariableDefinition;
|
30
|
+
class SelectionSet;
|
31
|
+
class Selection;
|
32
|
+
class Field;
|
33
|
+
class Argument;
|
34
|
+
class FragmentSpread;
|
35
|
+
class InlineFragment;
|
36
|
+
class FragmentDefinition;
|
37
|
+
class Value;
|
38
|
+
class Variable;
|
39
|
+
class IntValue;
|
40
|
+
class FloatValue;
|
41
|
+
class StringValue;
|
42
|
+
class BooleanValue;
|
43
|
+
class NullValue;
|
44
|
+
class EnumValue;
|
45
|
+
class ListValue;
|
46
|
+
class ObjectValue;
|
47
|
+
class ObjectField;
|
48
|
+
class Directive;
|
49
|
+
class Type;
|
50
|
+
class NamedType;
|
51
|
+
class ListType;
|
52
|
+
class NonNullType;
|
53
|
+
class Name;
|
54
|
+
class SchemaDefinition;
|
55
|
+
class OperationTypeDefinition;
|
56
|
+
class ScalarTypeDefinition;
|
57
|
+
class ObjectTypeDefinition;
|
58
|
+
class FieldDefinition;
|
59
|
+
class InputValueDefinition;
|
60
|
+
class InterfaceTypeDefinition;
|
61
|
+
class UnionTypeDefinition;
|
62
|
+
class EnumTypeDefinition;
|
63
|
+
class EnumValueDefinition;
|
64
|
+
class InputObjectTypeDefinition;
|
65
|
+
class TypeExtensionDefinition;
|
66
|
+
class DirectiveDefinition;
|
67
|
+
|
68
|
+
class Definition : public Node {
|
69
|
+
public:
|
70
|
+
explicit Definition(
|
71
|
+
const yy::location &location
|
72
|
+
|
73
|
+
)
|
74
|
+
: Node(location)
|
75
|
+
|
76
|
+
{}
|
77
|
+
};
|
78
|
+
|
79
|
+
class Document : public Node {
|
80
|
+
std::unique_ptr<std::vector<std::unique_ptr<Definition>>> definitions_;
|
81
|
+
public:
|
82
|
+
explicit Document(
|
83
|
+
const yy::location &location,
|
84
|
+
std::vector<std::unique_ptr<Definition>> * definitions
|
85
|
+
)
|
86
|
+
: Node(location),
|
87
|
+
definitions_(definitions)
|
88
|
+
{}
|
89
|
+
|
90
|
+
~Document() {}
|
91
|
+
|
92
|
+
Document(const Document&) = delete;
|
93
|
+
Document& operator=(const Document&) = delete;
|
94
|
+
|
95
|
+
const std::vector<std::unique_ptr<Definition>>& getDefinitions() const
|
96
|
+
{ return *definitions_; }
|
97
|
+
|
98
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
99
|
+
};
|
100
|
+
|
101
|
+
|
102
|
+
class OperationDefinition : public Definition {
|
103
|
+
std::unique_ptr<const char, CDeleter> operation_;
|
104
|
+
std::unique_ptr<Name> name_;
|
105
|
+
std::unique_ptr<std::vector<std::unique_ptr<VariableDefinition>>> variableDefinitions_;
|
106
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
107
|
+
std::unique_ptr<SelectionSet> selectionSet_;
|
108
|
+
public:
|
109
|
+
explicit OperationDefinition(
|
110
|
+
const yy::location &location,
|
111
|
+
const char * operation,
|
112
|
+
Name * name,
|
113
|
+
std::vector<std::unique_ptr<VariableDefinition>> * variableDefinitions,
|
114
|
+
std::vector<std::unique_ptr<Directive>> * directives,
|
115
|
+
SelectionSet * selectionSet
|
116
|
+
)
|
117
|
+
: Definition(location),
|
118
|
+
operation_(operation),
|
119
|
+
name_(name),
|
120
|
+
variableDefinitions_(variableDefinitions),
|
121
|
+
directives_(directives),
|
122
|
+
selectionSet_(selectionSet)
|
123
|
+
{}
|
124
|
+
|
125
|
+
~OperationDefinition() {}
|
126
|
+
|
127
|
+
OperationDefinition(const OperationDefinition&) = delete;
|
128
|
+
OperationDefinition& operator=(const OperationDefinition&) = delete;
|
129
|
+
|
130
|
+
const char * getOperation() const
|
131
|
+
{ return operation_.get(); }
|
132
|
+
|
133
|
+
const Name* getName() const
|
134
|
+
{ return name_.get(); }
|
135
|
+
|
136
|
+
const std::vector<std::unique_ptr<VariableDefinition>>* getVariableDefinitions() const
|
137
|
+
{ return variableDefinitions_.get(); }
|
138
|
+
|
139
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
140
|
+
{ return directives_.get(); }
|
141
|
+
|
142
|
+
const SelectionSet& getSelectionSet() const
|
143
|
+
{ return *selectionSet_; }
|
144
|
+
|
145
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
146
|
+
};
|
147
|
+
|
148
|
+
|
149
|
+
class VariableDefinition : public Node {
|
150
|
+
std::unique_ptr<Variable> variable_;
|
151
|
+
std::unique_ptr<Type> type_;
|
152
|
+
std::unique_ptr<Value> defaultValue_;
|
153
|
+
public:
|
154
|
+
explicit VariableDefinition(
|
155
|
+
const yy::location &location,
|
156
|
+
Variable * variable,
|
157
|
+
Type * type,
|
158
|
+
Value * defaultValue
|
159
|
+
)
|
160
|
+
: Node(location),
|
161
|
+
variable_(variable),
|
162
|
+
type_(type),
|
163
|
+
defaultValue_(defaultValue)
|
164
|
+
{}
|
165
|
+
|
166
|
+
~VariableDefinition() {}
|
167
|
+
|
168
|
+
VariableDefinition(const VariableDefinition&) = delete;
|
169
|
+
VariableDefinition& operator=(const VariableDefinition&) = delete;
|
170
|
+
|
171
|
+
const Variable& getVariable() const
|
172
|
+
{ return *variable_; }
|
173
|
+
|
174
|
+
const Type& getType() const
|
175
|
+
{ return *type_; }
|
176
|
+
|
177
|
+
const Value* getDefaultValue() const
|
178
|
+
{ return defaultValue_.get(); }
|
179
|
+
|
180
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
181
|
+
};
|
182
|
+
|
183
|
+
|
184
|
+
class SelectionSet : public Node {
|
185
|
+
std::unique_ptr<std::vector<std::unique_ptr<Selection>>> selections_;
|
186
|
+
public:
|
187
|
+
explicit SelectionSet(
|
188
|
+
const yy::location &location,
|
189
|
+
std::vector<std::unique_ptr<Selection>> * selections
|
190
|
+
)
|
191
|
+
: Node(location),
|
192
|
+
selections_(selections)
|
193
|
+
{}
|
194
|
+
|
195
|
+
~SelectionSet() {}
|
196
|
+
|
197
|
+
SelectionSet(const SelectionSet&) = delete;
|
198
|
+
SelectionSet& operator=(const SelectionSet&) = delete;
|
199
|
+
|
200
|
+
const std::vector<std::unique_ptr<Selection>>& getSelections() const
|
201
|
+
{ return *selections_; }
|
202
|
+
|
203
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
204
|
+
};
|
205
|
+
|
206
|
+
|
207
|
+
class Selection : public Node {
|
208
|
+
public:
|
209
|
+
explicit Selection(
|
210
|
+
const yy::location &location
|
211
|
+
|
212
|
+
)
|
213
|
+
: Node(location)
|
214
|
+
|
215
|
+
{}
|
216
|
+
};
|
217
|
+
|
218
|
+
class Field : public Selection {
|
219
|
+
std::unique_ptr<Name> alias_;
|
220
|
+
std::unique_ptr<Name> name_;
|
221
|
+
std::unique_ptr<std::vector<std::unique_ptr<Argument>>> arguments_;
|
222
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
223
|
+
std::unique_ptr<SelectionSet> selectionSet_;
|
224
|
+
public:
|
225
|
+
explicit Field(
|
226
|
+
const yy::location &location,
|
227
|
+
Name * alias,
|
228
|
+
Name * name,
|
229
|
+
std::vector<std::unique_ptr<Argument>> * arguments,
|
230
|
+
std::vector<std::unique_ptr<Directive>> * directives,
|
231
|
+
SelectionSet * selectionSet
|
232
|
+
)
|
233
|
+
: Selection(location),
|
234
|
+
alias_(alias),
|
235
|
+
name_(name),
|
236
|
+
arguments_(arguments),
|
237
|
+
directives_(directives),
|
238
|
+
selectionSet_(selectionSet)
|
239
|
+
{}
|
240
|
+
|
241
|
+
~Field() {}
|
242
|
+
|
243
|
+
Field(const Field&) = delete;
|
244
|
+
Field& operator=(const Field&) = delete;
|
245
|
+
|
246
|
+
const Name* getAlias() const
|
247
|
+
{ return alias_.get(); }
|
248
|
+
|
249
|
+
const Name& getName() const
|
250
|
+
{ return *name_; }
|
251
|
+
|
252
|
+
const std::vector<std::unique_ptr<Argument>>* getArguments() const
|
253
|
+
{ return arguments_.get(); }
|
254
|
+
|
255
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
256
|
+
{ return directives_.get(); }
|
257
|
+
|
258
|
+
const SelectionSet* getSelectionSet() const
|
259
|
+
{ return selectionSet_.get(); }
|
260
|
+
|
261
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
262
|
+
};
|
263
|
+
|
264
|
+
|
265
|
+
class Argument : public Node {
|
266
|
+
std::unique_ptr<Name> name_;
|
267
|
+
std::unique_ptr<Value> value_;
|
268
|
+
public:
|
269
|
+
explicit Argument(
|
270
|
+
const yy::location &location,
|
271
|
+
Name * name,
|
272
|
+
Value * value
|
273
|
+
)
|
274
|
+
: Node(location),
|
275
|
+
name_(name),
|
276
|
+
value_(value)
|
277
|
+
{}
|
278
|
+
|
279
|
+
~Argument() {}
|
280
|
+
|
281
|
+
Argument(const Argument&) = delete;
|
282
|
+
Argument& operator=(const Argument&) = delete;
|
283
|
+
|
284
|
+
const Name& getName() const
|
285
|
+
{ return *name_; }
|
286
|
+
|
287
|
+
const Value& getValue() const
|
288
|
+
{ return *value_; }
|
289
|
+
|
290
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
291
|
+
};
|
292
|
+
|
293
|
+
|
294
|
+
class FragmentSpread : public Selection {
|
295
|
+
std::unique_ptr<Name> name_;
|
296
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
297
|
+
public:
|
298
|
+
explicit FragmentSpread(
|
299
|
+
const yy::location &location,
|
300
|
+
Name * name,
|
301
|
+
std::vector<std::unique_ptr<Directive>> * directives
|
302
|
+
)
|
303
|
+
: Selection(location),
|
304
|
+
name_(name),
|
305
|
+
directives_(directives)
|
306
|
+
{}
|
307
|
+
|
308
|
+
~FragmentSpread() {}
|
309
|
+
|
310
|
+
FragmentSpread(const FragmentSpread&) = delete;
|
311
|
+
FragmentSpread& operator=(const FragmentSpread&) = delete;
|
312
|
+
|
313
|
+
const Name& getName() const
|
314
|
+
{ return *name_; }
|
315
|
+
|
316
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
317
|
+
{ return directives_.get(); }
|
318
|
+
|
319
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
320
|
+
};
|
321
|
+
|
322
|
+
|
323
|
+
class InlineFragment : public Selection {
|
324
|
+
std::unique_ptr<NamedType> typeCondition_;
|
325
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
326
|
+
std::unique_ptr<SelectionSet> selectionSet_;
|
327
|
+
public:
|
328
|
+
explicit InlineFragment(
|
329
|
+
const yy::location &location,
|
330
|
+
NamedType * typeCondition,
|
331
|
+
std::vector<std::unique_ptr<Directive>> * directives,
|
332
|
+
SelectionSet * selectionSet
|
333
|
+
)
|
334
|
+
: Selection(location),
|
335
|
+
typeCondition_(typeCondition),
|
336
|
+
directives_(directives),
|
337
|
+
selectionSet_(selectionSet)
|
338
|
+
{}
|
339
|
+
|
340
|
+
~InlineFragment() {}
|
341
|
+
|
342
|
+
InlineFragment(const InlineFragment&) = delete;
|
343
|
+
InlineFragment& operator=(const InlineFragment&) = delete;
|
344
|
+
|
345
|
+
const NamedType* getTypeCondition() const
|
346
|
+
{ return typeCondition_.get(); }
|
347
|
+
|
348
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
349
|
+
{ return directives_.get(); }
|
350
|
+
|
351
|
+
const SelectionSet& getSelectionSet() const
|
352
|
+
{ return *selectionSet_; }
|
353
|
+
|
354
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
355
|
+
};
|
356
|
+
|
357
|
+
|
358
|
+
class FragmentDefinition : public Definition {
|
359
|
+
std::unique_ptr<Name> name_;
|
360
|
+
std::unique_ptr<NamedType> typeCondition_;
|
361
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
362
|
+
std::unique_ptr<SelectionSet> selectionSet_;
|
363
|
+
public:
|
364
|
+
explicit FragmentDefinition(
|
365
|
+
const yy::location &location,
|
366
|
+
Name * name,
|
367
|
+
NamedType * typeCondition,
|
368
|
+
std::vector<std::unique_ptr<Directive>> * directives,
|
369
|
+
SelectionSet * selectionSet
|
370
|
+
)
|
371
|
+
: Definition(location),
|
372
|
+
name_(name),
|
373
|
+
typeCondition_(typeCondition),
|
374
|
+
directives_(directives),
|
375
|
+
selectionSet_(selectionSet)
|
376
|
+
{}
|
377
|
+
|
378
|
+
~FragmentDefinition() {}
|
379
|
+
|
380
|
+
FragmentDefinition(const FragmentDefinition&) = delete;
|
381
|
+
FragmentDefinition& operator=(const FragmentDefinition&) = delete;
|
382
|
+
|
383
|
+
const Name& getName() const
|
384
|
+
{ return *name_; }
|
385
|
+
|
386
|
+
const NamedType& getTypeCondition() const
|
387
|
+
{ return *typeCondition_; }
|
388
|
+
|
389
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
390
|
+
{ return directives_.get(); }
|
391
|
+
|
392
|
+
const SelectionSet& getSelectionSet() const
|
393
|
+
{ return *selectionSet_; }
|
394
|
+
|
395
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
396
|
+
};
|
397
|
+
|
398
|
+
|
399
|
+
class Value : public Node {
|
400
|
+
public:
|
401
|
+
explicit Value(
|
402
|
+
const yy::location &location
|
403
|
+
|
404
|
+
)
|
405
|
+
: Node(location)
|
406
|
+
|
407
|
+
{}
|
408
|
+
};
|
409
|
+
|
410
|
+
class Variable : public Value {
|
411
|
+
std::unique_ptr<Name> name_;
|
412
|
+
public:
|
413
|
+
explicit Variable(
|
414
|
+
const yy::location &location,
|
415
|
+
Name * name
|
416
|
+
)
|
417
|
+
: Value(location),
|
418
|
+
name_(name)
|
419
|
+
{}
|
420
|
+
|
421
|
+
~Variable() {}
|
422
|
+
|
423
|
+
Variable(const Variable&) = delete;
|
424
|
+
Variable& operator=(const Variable&) = delete;
|
425
|
+
|
426
|
+
const Name& getName() const
|
427
|
+
{ return *name_; }
|
428
|
+
|
429
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
430
|
+
};
|
431
|
+
|
432
|
+
|
433
|
+
class IntValue : public Value {
|
434
|
+
std::unique_ptr<const char, CDeleter> value_;
|
435
|
+
public:
|
436
|
+
explicit IntValue(
|
437
|
+
const yy::location &location,
|
438
|
+
const char * value
|
439
|
+
)
|
440
|
+
: Value(location),
|
441
|
+
value_(value)
|
442
|
+
{}
|
443
|
+
|
444
|
+
~IntValue() {}
|
445
|
+
|
446
|
+
IntValue(const IntValue&) = delete;
|
447
|
+
IntValue& operator=(const IntValue&) = delete;
|
448
|
+
|
449
|
+
const char * getValue() const
|
450
|
+
{ return value_.get(); }
|
451
|
+
|
452
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
453
|
+
};
|
454
|
+
|
455
|
+
|
456
|
+
class FloatValue : public Value {
|
457
|
+
std::unique_ptr<const char, CDeleter> value_;
|
458
|
+
public:
|
459
|
+
explicit FloatValue(
|
460
|
+
const yy::location &location,
|
461
|
+
const char * value
|
462
|
+
)
|
463
|
+
: Value(location),
|
464
|
+
value_(value)
|
465
|
+
{}
|
466
|
+
|
467
|
+
~FloatValue() {}
|
468
|
+
|
469
|
+
FloatValue(const FloatValue&) = delete;
|
470
|
+
FloatValue& operator=(const FloatValue&) = delete;
|
471
|
+
|
472
|
+
const char * getValue() const
|
473
|
+
{ return value_.get(); }
|
474
|
+
|
475
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
476
|
+
};
|
477
|
+
|
478
|
+
|
479
|
+
class StringValue : public Value {
|
480
|
+
std::unique_ptr<const char, CDeleter> value_;
|
481
|
+
public:
|
482
|
+
explicit StringValue(
|
483
|
+
const yy::location &location,
|
484
|
+
const char * value
|
485
|
+
)
|
486
|
+
: Value(location),
|
487
|
+
value_(value)
|
488
|
+
{}
|
489
|
+
|
490
|
+
~StringValue() {}
|
491
|
+
|
492
|
+
StringValue(const StringValue&) = delete;
|
493
|
+
StringValue& operator=(const StringValue&) = delete;
|
494
|
+
|
495
|
+
const char * getValue() const
|
496
|
+
{ return value_.get(); }
|
497
|
+
|
498
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
499
|
+
};
|
500
|
+
|
501
|
+
|
502
|
+
class BooleanValue : public Value {
|
503
|
+
bool value_;
|
504
|
+
public:
|
505
|
+
explicit BooleanValue(
|
506
|
+
const yy::location &location,
|
507
|
+
bool value
|
508
|
+
)
|
509
|
+
: Value(location),
|
510
|
+
value_(value)
|
511
|
+
{}
|
512
|
+
|
513
|
+
~BooleanValue() {}
|
514
|
+
|
515
|
+
BooleanValue(const BooleanValue&) = delete;
|
516
|
+
BooleanValue& operator=(const BooleanValue&) = delete;
|
517
|
+
|
518
|
+
bool getValue() const
|
519
|
+
{ return value_; }
|
520
|
+
|
521
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
522
|
+
};
|
523
|
+
|
524
|
+
|
525
|
+
class NullValue : public Value {
|
526
|
+
public:
|
527
|
+
explicit NullValue(
|
528
|
+
const yy::location &location
|
529
|
+
|
530
|
+
)
|
531
|
+
: Value(location)
|
532
|
+
|
533
|
+
{}
|
534
|
+
|
535
|
+
~NullValue() {}
|
536
|
+
|
537
|
+
NullValue(const NullValue&) = delete;
|
538
|
+
NullValue& operator=(const NullValue&) = delete;
|
539
|
+
|
540
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
541
|
+
};
|
542
|
+
|
543
|
+
|
544
|
+
class EnumValue : public Value {
|
545
|
+
std::unique_ptr<const char, CDeleter> value_;
|
546
|
+
public:
|
547
|
+
explicit EnumValue(
|
548
|
+
const yy::location &location,
|
549
|
+
const char * value
|
550
|
+
)
|
551
|
+
: Value(location),
|
552
|
+
value_(value)
|
553
|
+
{}
|
554
|
+
|
555
|
+
~EnumValue() {}
|
556
|
+
|
557
|
+
EnumValue(const EnumValue&) = delete;
|
558
|
+
EnumValue& operator=(const EnumValue&) = delete;
|
559
|
+
|
560
|
+
const char * getValue() const
|
561
|
+
{ return value_.get(); }
|
562
|
+
|
563
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
564
|
+
};
|
565
|
+
|
566
|
+
|
567
|
+
class ListValue : public Value {
|
568
|
+
std::unique_ptr<std::vector<std::unique_ptr<Value>>> values_;
|
569
|
+
public:
|
570
|
+
explicit ListValue(
|
571
|
+
const yy::location &location,
|
572
|
+
std::vector<std::unique_ptr<Value>> * values
|
573
|
+
)
|
574
|
+
: Value(location),
|
575
|
+
values_(values)
|
576
|
+
{}
|
577
|
+
|
578
|
+
~ListValue() {}
|
579
|
+
|
580
|
+
ListValue(const ListValue&) = delete;
|
581
|
+
ListValue& operator=(const ListValue&) = delete;
|
582
|
+
|
583
|
+
const std::vector<std::unique_ptr<Value>>& getValues() const
|
584
|
+
{ return *values_; }
|
585
|
+
|
586
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
587
|
+
};
|
588
|
+
|
589
|
+
|
590
|
+
class ObjectValue : public Value {
|
591
|
+
std::unique_ptr<std::vector<std::unique_ptr<ObjectField>>> fields_;
|
592
|
+
public:
|
593
|
+
explicit ObjectValue(
|
594
|
+
const yy::location &location,
|
595
|
+
std::vector<std::unique_ptr<ObjectField>> * fields
|
596
|
+
)
|
597
|
+
: Value(location),
|
598
|
+
fields_(fields)
|
599
|
+
{}
|
600
|
+
|
601
|
+
~ObjectValue() {}
|
602
|
+
|
603
|
+
ObjectValue(const ObjectValue&) = delete;
|
604
|
+
ObjectValue& operator=(const ObjectValue&) = delete;
|
605
|
+
|
606
|
+
const std::vector<std::unique_ptr<ObjectField>>& getFields() const
|
607
|
+
{ return *fields_; }
|
608
|
+
|
609
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
610
|
+
};
|
611
|
+
|
612
|
+
|
613
|
+
class ObjectField : public Node {
|
614
|
+
std::unique_ptr<Name> name_;
|
615
|
+
std::unique_ptr<Value> value_;
|
616
|
+
public:
|
617
|
+
explicit ObjectField(
|
618
|
+
const yy::location &location,
|
619
|
+
Name * name,
|
620
|
+
Value * value
|
621
|
+
)
|
622
|
+
: Node(location),
|
623
|
+
name_(name),
|
624
|
+
value_(value)
|
625
|
+
{}
|
626
|
+
|
627
|
+
~ObjectField() {}
|
628
|
+
|
629
|
+
ObjectField(const ObjectField&) = delete;
|
630
|
+
ObjectField& operator=(const ObjectField&) = delete;
|
631
|
+
|
632
|
+
const Name& getName() const
|
633
|
+
{ return *name_; }
|
634
|
+
|
635
|
+
const Value& getValue() const
|
636
|
+
{ return *value_; }
|
637
|
+
|
638
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
639
|
+
};
|
640
|
+
|
641
|
+
|
642
|
+
class Directive : public Node {
|
643
|
+
std::unique_ptr<Name> name_;
|
644
|
+
std::unique_ptr<std::vector<std::unique_ptr<Argument>>> arguments_;
|
645
|
+
public:
|
646
|
+
explicit Directive(
|
647
|
+
const yy::location &location,
|
648
|
+
Name * name,
|
649
|
+
std::vector<std::unique_ptr<Argument>> * arguments
|
650
|
+
)
|
651
|
+
: Node(location),
|
652
|
+
name_(name),
|
653
|
+
arguments_(arguments)
|
654
|
+
{}
|
655
|
+
|
656
|
+
~Directive() {}
|
657
|
+
|
658
|
+
Directive(const Directive&) = delete;
|
659
|
+
Directive& operator=(const Directive&) = delete;
|
660
|
+
|
661
|
+
const Name& getName() const
|
662
|
+
{ return *name_; }
|
663
|
+
|
664
|
+
const std::vector<std::unique_ptr<Argument>>* getArguments() const
|
665
|
+
{ return arguments_.get(); }
|
666
|
+
|
667
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
668
|
+
};
|
669
|
+
|
670
|
+
|
671
|
+
class Type : public Node {
|
672
|
+
public:
|
673
|
+
explicit Type(
|
674
|
+
const yy::location &location
|
675
|
+
|
676
|
+
)
|
677
|
+
: Node(location)
|
678
|
+
|
679
|
+
{}
|
680
|
+
};
|
681
|
+
|
682
|
+
class NamedType : public Type {
|
683
|
+
std::unique_ptr<Name> name_;
|
684
|
+
public:
|
685
|
+
explicit NamedType(
|
686
|
+
const yy::location &location,
|
687
|
+
Name * name
|
688
|
+
)
|
689
|
+
: Type(location),
|
690
|
+
name_(name)
|
691
|
+
{}
|
692
|
+
|
693
|
+
~NamedType() {}
|
694
|
+
|
695
|
+
NamedType(const NamedType&) = delete;
|
696
|
+
NamedType& operator=(const NamedType&) = delete;
|
697
|
+
|
698
|
+
const Name& getName() const
|
699
|
+
{ return *name_; }
|
700
|
+
|
701
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
702
|
+
};
|
703
|
+
|
704
|
+
|
705
|
+
class ListType : public Type {
|
706
|
+
std::unique_ptr<Type> type_;
|
707
|
+
public:
|
708
|
+
explicit ListType(
|
709
|
+
const yy::location &location,
|
710
|
+
Type * type
|
711
|
+
)
|
712
|
+
: Type(location),
|
713
|
+
type_(type)
|
714
|
+
{}
|
715
|
+
|
716
|
+
~ListType() {}
|
717
|
+
|
718
|
+
ListType(const ListType&) = delete;
|
719
|
+
ListType& operator=(const ListType&) = delete;
|
720
|
+
|
721
|
+
const Type& getType() const
|
722
|
+
{ return *type_; }
|
723
|
+
|
724
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
725
|
+
};
|
726
|
+
|
727
|
+
|
728
|
+
class NonNullType : public Type {
|
729
|
+
std::unique_ptr<Type> type_;
|
730
|
+
public:
|
731
|
+
explicit NonNullType(
|
732
|
+
const yy::location &location,
|
733
|
+
Type * type
|
734
|
+
)
|
735
|
+
: Type(location),
|
736
|
+
type_(type)
|
737
|
+
{}
|
738
|
+
|
739
|
+
~NonNullType() {}
|
740
|
+
|
741
|
+
NonNullType(const NonNullType&) = delete;
|
742
|
+
NonNullType& operator=(const NonNullType&) = delete;
|
743
|
+
|
744
|
+
const Type& getType() const
|
745
|
+
{ return *type_; }
|
746
|
+
|
747
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
748
|
+
};
|
749
|
+
|
750
|
+
|
751
|
+
class Name : public Node {
|
752
|
+
std::unique_ptr<const char, CDeleter> value_;
|
753
|
+
public:
|
754
|
+
explicit Name(
|
755
|
+
const yy::location &location,
|
756
|
+
const char * value
|
757
|
+
)
|
758
|
+
: Node(location),
|
759
|
+
value_(value)
|
760
|
+
{}
|
761
|
+
|
762
|
+
~Name() {}
|
763
|
+
|
764
|
+
Name(const Name&) = delete;
|
765
|
+
Name& operator=(const Name&) = delete;
|
766
|
+
|
767
|
+
const char * getValue() const
|
768
|
+
{ return value_.get(); }
|
769
|
+
|
770
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
771
|
+
};
|
772
|
+
|
773
|
+
|
774
|
+
class SchemaDefinition : public Definition {
|
775
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
776
|
+
std::unique_ptr<std::vector<std::unique_ptr<OperationTypeDefinition>>> operationTypes_;
|
777
|
+
public:
|
778
|
+
explicit SchemaDefinition(
|
779
|
+
const yy::location &location,
|
780
|
+
std::vector<std::unique_ptr<Directive>> * directives,
|
781
|
+
std::vector<std::unique_ptr<OperationTypeDefinition>> * operationTypes
|
782
|
+
)
|
783
|
+
: Definition(location),
|
784
|
+
directives_(directives),
|
785
|
+
operationTypes_(operationTypes)
|
786
|
+
{}
|
787
|
+
|
788
|
+
~SchemaDefinition() {}
|
789
|
+
|
790
|
+
SchemaDefinition(const SchemaDefinition&) = delete;
|
791
|
+
SchemaDefinition& operator=(const SchemaDefinition&) = delete;
|
792
|
+
|
793
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
794
|
+
{ return directives_.get(); }
|
795
|
+
|
796
|
+
const std::vector<std::unique_ptr<OperationTypeDefinition>>& getOperationTypes() const
|
797
|
+
{ return *operationTypes_; }
|
798
|
+
|
799
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
800
|
+
};
|
801
|
+
|
802
|
+
|
803
|
+
class OperationTypeDefinition : public Node {
|
804
|
+
std::unique_ptr<const char, CDeleter> operation_;
|
805
|
+
std::unique_ptr<NamedType> type_;
|
806
|
+
public:
|
807
|
+
explicit OperationTypeDefinition(
|
808
|
+
const yy::location &location,
|
809
|
+
const char * operation,
|
810
|
+
NamedType * type
|
811
|
+
)
|
812
|
+
: Node(location),
|
813
|
+
operation_(operation),
|
814
|
+
type_(type)
|
815
|
+
{}
|
816
|
+
|
817
|
+
~OperationTypeDefinition() {}
|
818
|
+
|
819
|
+
OperationTypeDefinition(const OperationTypeDefinition&) = delete;
|
820
|
+
OperationTypeDefinition& operator=(const OperationTypeDefinition&) = delete;
|
821
|
+
|
822
|
+
const char * getOperation() const
|
823
|
+
{ return operation_.get(); }
|
824
|
+
|
825
|
+
const NamedType& getType() const
|
826
|
+
{ return *type_; }
|
827
|
+
|
828
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
829
|
+
};
|
830
|
+
|
831
|
+
|
832
|
+
class ScalarTypeDefinition : public Definition {
|
833
|
+
std::unique_ptr<Name> name_;
|
834
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
835
|
+
public:
|
836
|
+
explicit ScalarTypeDefinition(
|
837
|
+
const yy::location &location,
|
838
|
+
Name * name,
|
839
|
+
std::vector<std::unique_ptr<Directive>> * directives
|
840
|
+
)
|
841
|
+
: Definition(location),
|
842
|
+
name_(name),
|
843
|
+
directives_(directives)
|
844
|
+
{}
|
845
|
+
|
846
|
+
~ScalarTypeDefinition() {}
|
847
|
+
|
848
|
+
ScalarTypeDefinition(const ScalarTypeDefinition&) = delete;
|
849
|
+
ScalarTypeDefinition& operator=(const ScalarTypeDefinition&) = delete;
|
850
|
+
|
851
|
+
const Name& getName() const
|
852
|
+
{ return *name_; }
|
853
|
+
|
854
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
855
|
+
{ return directives_.get(); }
|
856
|
+
|
857
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
858
|
+
};
|
859
|
+
|
860
|
+
|
861
|
+
class ObjectTypeDefinition : public Definition {
|
862
|
+
std::unique_ptr<Name> name_;
|
863
|
+
std::unique_ptr<std::vector<std::unique_ptr<NamedType>>> interfaces_;
|
864
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
865
|
+
std::unique_ptr<std::vector<std::unique_ptr<FieldDefinition>>> fields_;
|
866
|
+
public:
|
867
|
+
explicit ObjectTypeDefinition(
|
868
|
+
const yy::location &location,
|
869
|
+
Name * name,
|
870
|
+
std::vector<std::unique_ptr<NamedType>> * interfaces,
|
871
|
+
std::vector<std::unique_ptr<Directive>> * directives,
|
872
|
+
std::vector<std::unique_ptr<FieldDefinition>> * fields
|
873
|
+
)
|
874
|
+
: Definition(location),
|
875
|
+
name_(name),
|
876
|
+
interfaces_(interfaces),
|
877
|
+
directives_(directives),
|
878
|
+
fields_(fields)
|
879
|
+
{}
|
880
|
+
|
881
|
+
~ObjectTypeDefinition() {}
|
882
|
+
|
883
|
+
ObjectTypeDefinition(const ObjectTypeDefinition&) = delete;
|
884
|
+
ObjectTypeDefinition& operator=(const ObjectTypeDefinition&) = delete;
|
885
|
+
|
886
|
+
const Name& getName() const
|
887
|
+
{ return *name_; }
|
888
|
+
|
889
|
+
const std::vector<std::unique_ptr<NamedType>>* getInterfaces() const
|
890
|
+
{ return interfaces_.get(); }
|
891
|
+
|
892
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
893
|
+
{ return directives_.get(); }
|
894
|
+
|
895
|
+
const std::vector<std::unique_ptr<FieldDefinition>>& getFields() const
|
896
|
+
{ return *fields_; }
|
897
|
+
|
898
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
899
|
+
};
|
900
|
+
|
901
|
+
|
902
|
+
class FieldDefinition : public Node {
|
903
|
+
std::unique_ptr<Name> name_;
|
904
|
+
std::unique_ptr<std::vector<std::unique_ptr<InputValueDefinition>>> arguments_;
|
905
|
+
std::unique_ptr<Type> type_;
|
906
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
907
|
+
public:
|
908
|
+
explicit FieldDefinition(
|
909
|
+
const yy::location &location,
|
910
|
+
Name * name,
|
911
|
+
std::vector<std::unique_ptr<InputValueDefinition>> * arguments,
|
912
|
+
Type * type,
|
913
|
+
std::vector<std::unique_ptr<Directive>> * directives
|
914
|
+
)
|
915
|
+
: Node(location),
|
916
|
+
name_(name),
|
917
|
+
arguments_(arguments),
|
918
|
+
type_(type),
|
919
|
+
directives_(directives)
|
920
|
+
{}
|
921
|
+
|
922
|
+
~FieldDefinition() {}
|
923
|
+
|
924
|
+
FieldDefinition(const FieldDefinition&) = delete;
|
925
|
+
FieldDefinition& operator=(const FieldDefinition&) = delete;
|
926
|
+
|
927
|
+
const Name& getName() const
|
928
|
+
{ return *name_; }
|
929
|
+
|
930
|
+
const std::vector<std::unique_ptr<InputValueDefinition>>* getArguments() const
|
931
|
+
{ return arguments_.get(); }
|
932
|
+
|
933
|
+
const Type& getType() const
|
934
|
+
{ return *type_; }
|
935
|
+
|
936
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
937
|
+
{ return directives_.get(); }
|
938
|
+
|
939
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
940
|
+
};
|
941
|
+
|
942
|
+
|
943
|
+
class InputValueDefinition : public Node {
|
944
|
+
std::unique_ptr<Name> name_;
|
945
|
+
std::unique_ptr<Type> type_;
|
946
|
+
std::unique_ptr<Value> defaultValue_;
|
947
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
948
|
+
public:
|
949
|
+
explicit InputValueDefinition(
|
950
|
+
const yy::location &location,
|
951
|
+
Name * name,
|
952
|
+
Type * type,
|
953
|
+
Value * defaultValue,
|
954
|
+
std::vector<std::unique_ptr<Directive>> * directives
|
955
|
+
)
|
956
|
+
: Node(location),
|
957
|
+
name_(name),
|
958
|
+
type_(type),
|
959
|
+
defaultValue_(defaultValue),
|
960
|
+
directives_(directives)
|
961
|
+
{}
|
962
|
+
|
963
|
+
~InputValueDefinition() {}
|
964
|
+
|
965
|
+
InputValueDefinition(const InputValueDefinition&) = delete;
|
966
|
+
InputValueDefinition& operator=(const InputValueDefinition&) = delete;
|
967
|
+
|
968
|
+
const Name& getName() const
|
969
|
+
{ return *name_; }
|
970
|
+
|
971
|
+
const Type& getType() const
|
972
|
+
{ return *type_; }
|
973
|
+
|
974
|
+
const Value* getDefaultValue() const
|
975
|
+
{ return defaultValue_.get(); }
|
976
|
+
|
977
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
978
|
+
{ return directives_.get(); }
|
979
|
+
|
980
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
981
|
+
};
|
982
|
+
|
983
|
+
|
984
|
+
class InterfaceTypeDefinition : public Definition {
|
985
|
+
std::unique_ptr<Name> name_;
|
986
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
987
|
+
std::unique_ptr<std::vector<std::unique_ptr<FieldDefinition>>> fields_;
|
988
|
+
public:
|
989
|
+
explicit InterfaceTypeDefinition(
|
990
|
+
const yy::location &location,
|
991
|
+
Name * name,
|
992
|
+
std::vector<std::unique_ptr<Directive>> * directives,
|
993
|
+
std::vector<std::unique_ptr<FieldDefinition>> * fields
|
994
|
+
)
|
995
|
+
: Definition(location),
|
996
|
+
name_(name),
|
997
|
+
directives_(directives),
|
998
|
+
fields_(fields)
|
999
|
+
{}
|
1000
|
+
|
1001
|
+
~InterfaceTypeDefinition() {}
|
1002
|
+
|
1003
|
+
InterfaceTypeDefinition(const InterfaceTypeDefinition&) = delete;
|
1004
|
+
InterfaceTypeDefinition& operator=(const InterfaceTypeDefinition&) = delete;
|
1005
|
+
|
1006
|
+
const Name& getName() const
|
1007
|
+
{ return *name_; }
|
1008
|
+
|
1009
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
1010
|
+
{ return directives_.get(); }
|
1011
|
+
|
1012
|
+
const std::vector<std::unique_ptr<FieldDefinition>>& getFields() const
|
1013
|
+
{ return *fields_; }
|
1014
|
+
|
1015
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
1016
|
+
};
|
1017
|
+
|
1018
|
+
|
1019
|
+
class UnionTypeDefinition : public Definition {
|
1020
|
+
std::unique_ptr<Name> name_;
|
1021
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
1022
|
+
std::unique_ptr<std::vector<std::unique_ptr<NamedType>>> types_;
|
1023
|
+
public:
|
1024
|
+
explicit UnionTypeDefinition(
|
1025
|
+
const yy::location &location,
|
1026
|
+
Name * name,
|
1027
|
+
std::vector<std::unique_ptr<Directive>> * directives,
|
1028
|
+
std::vector<std::unique_ptr<NamedType>> * types
|
1029
|
+
)
|
1030
|
+
: Definition(location),
|
1031
|
+
name_(name),
|
1032
|
+
directives_(directives),
|
1033
|
+
types_(types)
|
1034
|
+
{}
|
1035
|
+
|
1036
|
+
~UnionTypeDefinition() {}
|
1037
|
+
|
1038
|
+
UnionTypeDefinition(const UnionTypeDefinition&) = delete;
|
1039
|
+
UnionTypeDefinition& operator=(const UnionTypeDefinition&) = delete;
|
1040
|
+
|
1041
|
+
const Name& getName() const
|
1042
|
+
{ return *name_; }
|
1043
|
+
|
1044
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
1045
|
+
{ return directives_.get(); }
|
1046
|
+
|
1047
|
+
const std::vector<std::unique_ptr<NamedType>>& getTypes() const
|
1048
|
+
{ return *types_; }
|
1049
|
+
|
1050
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
1051
|
+
};
|
1052
|
+
|
1053
|
+
|
1054
|
+
class EnumTypeDefinition : public Definition {
|
1055
|
+
std::unique_ptr<Name> name_;
|
1056
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
1057
|
+
std::unique_ptr<std::vector<std::unique_ptr<EnumValueDefinition>>> values_;
|
1058
|
+
public:
|
1059
|
+
explicit EnumTypeDefinition(
|
1060
|
+
const yy::location &location,
|
1061
|
+
Name * name,
|
1062
|
+
std::vector<std::unique_ptr<Directive>> * directives,
|
1063
|
+
std::vector<std::unique_ptr<EnumValueDefinition>> * values
|
1064
|
+
)
|
1065
|
+
: Definition(location),
|
1066
|
+
name_(name),
|
1067
|
+
directives_(directives),
|
1068
|
+
values_(values)
|
1069
|
+
{}
|
1070
|
+
|
1071
|
+
~EnumTypeDefinition() {}
|
1072
|
+
|
1073
|
+
EnumTypeDefinition(const EnumTypeDefinition&) = delete;
|
1074
|
+
EnumTypeDefinition& operator=(const EnumTypeDefinition&) = delete;
|
1075
|
+
|
1076
|
+
const Name& getName() const
|
1077
|
+
{ return *name_; }
|
1078
|
+
|
1079
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
1080
|
+
{ return directives_.get(); }
|
1081
|
+
|
1082
|
+
const std::vector<std::unique_ptr<EnumValueDefinition>>& getValues() const
|
1083
|
+
{ return *values_; }
|
1084
|
+
|
1085
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
1086
|
+
};
|
1087
|
+
|
1088
|
+
|
1089
|
+
class EnumValueDefinition : public Node {
|
1090
|
+
std::unique_ptr<Name> name_;
|
1091
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
1092
|
+
public:
|
1093
|
+
explicit EnumValueDefinition(
|
1094
|
+
const yy::location &location,
|
1095
|
+
Name * name,
|
1096
|
+
std::vector<std::unique_ptr<Directive>> * directives
|
1097
|
+
)
|
1098
|
+
: Node(location),
|
1099
|
+
name_(name),
|
1100
|
+
directives_(directives)
|
1101
|
+
{}
|
1102
|
+
|
1103
|
+
~EnumValueDefinition() {}
|
1104
|
+
|
1105
|
+
EnumValueDefinition(const EnumValueDefinition&) = delete;
|
1106
|
+
EnumValueDefinition& operator=(const EnumValueDefinition&) = delete;
|
1107
|
+
|
1108
|
+
const Name& getName() const
|
1109
|
+
{ return *name_; }
|
1110
|
+
|
1111
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
1112
|
+
{ return directives_.get(); }
|
1113
|
+
|
1114
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
1115
|
+
};
|
1116
|
+
|
1117
|
+
|
1118
|
+
class InputObjectTypeDefinition : public Definition {
|
1119
|
+
std::unique_ptr<Name> name_;
|
1120
|
+
std::unique_ptr<std::vector<std::unique_ptr<Directive>>> directives_;
|
1121
|
+
std::unique_ptr<std::vector<std::unique_ptr<InputValueDefinition>>> fields_;
|
1122
|
+
public:
|
1123
|
+
explicit InputObjectTypeDefinition(
|
1124
|
+
const yy::location &location,
|
1125
|
+
Name * name,
|
1126
|
+
std::vector<std::unique_ptr<Directive>> * directives,
|
1127
|
+
std::vector<std::unique_ptr<InputValueDefinition>> * fields
|
1128
|
+
)
|
1129
|
+
: Definition(location),
|
1130
|
+
name_(name),
|
1131
|
+
directives_(directives),
|
1132
|
+
fields_(fields)
|
1133
|
+
{}
|
1134
|
+
|
1135
|
+
~InputObjectTypeDefinition() {}
|
1136
|
+
|
1137
|
+
InputObjectTypeDefinition(const InputObjectTypeDefinition&) = delete;
|
1138
|
+
InputObjectTypeDefinition& operator=(const InputObjectTypeDefinition&) = delete;
|
1139
|
+
|
1140
|
+
const Name& getName() const
|
1141
|
+
{ return *name_; }
|
1142
|
+
|
1143
|
+
const std::vector<std::unique_ptr<Directive>>* getDirectives() const
|
1144
|
+
{ return directives_.get(); }
|
1145
|
+
|
1146
|
+
const std::vector<std::unique_ptr<InputValueDefinition>>& getFields() const
|
1147
|
+
{ return *fields_; }
|
1148
|
+
|
1149
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
1150
|
+
};
|
1151
|
+
|
1152
|
+
|
1153
|
+
class TypeExtensionDefinition : public Definition {
|
1154
|
+
std::unique_ptr<ObjectTypeDefinition> definition_;
|
1155
|
+
public:
|
1156
|
+
explicit TypeExtensionDefinition(
|
1157
|
+
const yy::location &location,
|
1158
|
+
ObjectTypeDefinition * definition
|
1159
|
+
)
|
1160
|
+
: Definition(location),
|
1161
|
+
definition_(definition)
|
1162
|
+
{}
|
1163
|
+
|
1164
|
+
~TypeExtensionDefinition() {}
|
1165
|
+
|
1166
|
+
TypeExtensionDefinition(const TypeExtensionDefinition&) = delete;
|
1167
|
+
TypeExtensionDefinition& operator=(const TypeExtensionDefinition&) = delete;
|
1168
|
+
|
1169
|
+
const ObjectTypeDefinition& getDefinition() const
|
1170
|
+
{ return *definition_; }
|
1171
|
+
|
1172
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
1173
|
+
};
|
1174
|
+
|
1175
|
+
|
1176
|
+
class DirectiveDefinition : public Definition {
|
1177
|
+
std::unique_ptr<Name> name_;
|
1178
|
+
std::unique_ptr<std::vector<std::unique_ptr<InputValueDefinition>>> arguments_;
|
1179
|
+
std::unique_ptr<std::vector<std::unique_ptr<Name>>> locations_;
|
1180
|
+
public:
|
1181
|
+
explicit DirectiveDefinition(
|
1182
|
+
const yy::location &location,
|
1183
|
+
Name * name,
|
1184
|
+
std::vector<std::unique_ptr<InputValueDefinition>> * arguments,
|
1185
|
+
std::vector<std::unique_ptr<Name>> * locations
|
1186
|
+
)
|
1187
|
+
: Definition(location),
|
1188
|
+
name_(name),
|
1189
|
+
arguments_(arguments),
|
1190
|
+
locations_(locations)
|
1191
|
+
{}
|
1192
|
+
|
1193
|
+
~DirectiveDefinition() {}
|
1194
|
+
|
1195
|
+
DirectiveDefinition(const DirectiveDefinition&) = delete;
|
1196
|
+
DirectiveDefinition& operator=(const DirectiveDefinition&) = delete;
|
1197
|
+
|
1198
|
+
const Name& getName() const
|
1199
|
+
{ return *name_; }
|
1200
|
+
|
1201
|
+
const std::vector<std::unique_ptr<InputValueDefinition>>* getArguments() const
|
1202
|
+
{ return arguments_.get(); }
|
1203
|
+
|
1204
|
+
const std::vector<std::unique_ptr<Name>>& getLocations() const
|
1205
|
+
{ return *locations_; }
|
1206
|
+
|
1207
|
+
void accept(visitor::AstVisitor *visitor) const override;
|
1208
|
+
};
|
1209
|
+
|
1210
|
+
|
1211
|
+
|
1212
|
+
}
|
1213
|
+
}
|
1214
|
+
}
|