Skip to content

Commit 5fb0f42

Browse files
committed
Export schema accessors for introspection in separate DLL
1 parent f9d584c commit 5fb0f42

File tree

1 file changed

+47
-45
lines changed

1 file changed

+47
-45
lines changed

include/graphqlservice/GraphQLSchema.h

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ class Schema : public std::enable_shared_from_this<Schema>
4747
GRAPHQLSERVICE_EXPORT void AddDirective(std::shared_ptr<Directive> directive);
4848

4949
// Accessors
50-
bool supportsIntrospection() const noexcept;
51-
const std::vector<std::pair<std::string_view, std::shared_ptr<BaseType>>>& types()
50+
GRAPHQLSERVICE_EXPORT bool supportsIntrospection() const noexcept;
51+
GRAPHQLSERVICE_EXPORT const std::vector<std::pair<std::string_view, std::shared_ptr<BaseType>>>&
52+
types()
53+
const noexcept;
54+
GRAPHQLSERVICE_EXPORT const std::shared_ptr<ObjectType>& queryType() const noexcept;
55+
GRAPHQLSERVICE_EXPORT const std::shared_ptr<ObjectType>& mutationType() const noexcept;
56+
GRAPHQLSERVICE_EXPORT const std::shared_ptr<ObjectType>& subscriptionType() const noexcept;
57+
GRAPHQLSERVICE_EXPORT const std::vector<std::shared_ptr<Directive>>& directives()
5258
const noexcept;
53-
const std::shared_ptr<ObjectType>& queryType() const noexcept;
54-
const std::shared_ptr<ObjectType>& mutationType() const noexcept;
55-
const std::shared_ptr<ObjectType>& subscriptionType() const noexcept;
56-
const std::vector<std::shared_ptr<Directive>>& directives() const noexcept;
5759

5860
private:
5961
const bool _noIntrospection = false;
@@ -72,15 +74,15 @@ class BaseType : public std::enable_shared_from_this<BaseType>
7274
{
7375
public:
7476
// Accessors
75-
introspection::TypeKind kind() const noexcept;
76-
virtual std::string_view name() const noexcept;
77-
std::string_view description() const noexcept;
78-
virtual const std::vector<std::shared_ptr<Field>>& fields() const noexcept;
79-
virtual const std::vector<std::shared_ptr<InterfaceType>>& interfaces() const noexcept;
80-
virtual const std::vector<std::weak_ptr<BaseType>>& possibleTypes() const noexcept;
81-
virtual const std::vector<std::shared_ptr<EnumValue>>& enumValues() const noexcept;
82-
virtual const std::vector<std::shared_ptr<InputValue>>& inputFields() const noexcept;
83-
virtual const std::weak_ptr<BaseType>& ofType() const noexcept;
77+
GRAPHQLSERVICE_EXPORT introspection::TypeKind kind() const noexcept;
78+
GRAPHQLSERVICE_EXPORT virtual std::string_view name() const noexcept;
79+
GRAPHQLSERVICE_EXPORT std::string_view description() const noexcept;
80+
GRAPHQLSERVICE_EXPORT virtual const std::vector<std::shared_ptr<Field>>& fields() const noexcept;
81+
GRAPHQLSERVICE_EXPORT virtual const std::vector<std::shared_ptr<InterfaceType>>& interfaces() const noexcept;
82+
GRAPHQLSERVICE_EXPORT virtual const std::vector<std::weak_ptr<BaseType>>& possibleTypes() const noexcept;
83+
GRAPHQLSERVICE_EXPORT virtual const std::vector<std::shared_ptr<EnumValue>>& enumValues() const noexcept;
84+
GRAPHQLSERVICE_EXPORT virtual const std::vector<std::shared_ptr<InputValue>>& inputFields() const noexcept;
85+
GRAPHQLSERVICE_EXPORT virtual const std::weak_ptr<BaseType>& ofType() const noexcept;
8486

8587
protected:
8688
BaseType(introspection::TypeKind kind, std::string_view description);
@@ -96,7 +98,7 @@ class ScalarType : public BaseType
9698
GRAPHQLSERVICE_EXPORT explicit ScalarType(std::string_view name, std::string_view description);
9799

98100
// Accessors
99-
std::string_view name() const noexcept final;
101+
GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept final;
100102

101103
private:
102104
const std::string_view _name;
@@ -112,9 +114,9 @@ class ObjectType : public BaseType
112114
GRAPHQLSERVICE_EXPORT void AddFields(std::vector<std::shared_ptr<Field>> fields);
113115

114116
// Accessors
115-
std::string_view name() const noexcept final;
116-
const std::vector<std::shared_ptr<Field>>& fields() const noexcept final;
117-
const std::vector<std::shared_ptr<InterfaceType>>& interfaces() const noexcept final;
117+
GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept final;
118+
GRAPHQLSERVICE_EXPORT const std::vector<std::shared_ptr<Field>>& fields() const noexcept final;
119+
GRAPHQLSERVICE_EXPORT const std::vector<std::shared_ptr<InterfaceType>>& interfaces() const noexcept final;
118120

119121
private:
120122
const std::string_view _name;
@@ -133,9 +135,9 @@ class InterfaceType : public BaseType
133135
GRAPHQLSERVICE_EXPORT void AddFields(std::vector<std::shared_ptr<Field>> fields);
134136

135137
// Accessors
136-
std::string_view name() const noexcept final;
137-
const std::vector<std::shared_ptr<Field>>& fields() const noexcept final;
138-
const std::vector<std::weak_ptr<BaseType>>& possibleTypes() const noexcept final;
138+
GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept final;
139+
GRAPHQLSERVICE_EXPORT const std::vector<std::shared_ptr<Field>>& fields() const noexcept final;
140+
GRAPHQLSERVICE_EXPORT const std::vector<std::weak_ptr<BaseType>>& possibleTypes() const noexcept final;
139141

140142
private:
141143
const std::string_view _name;
@@ -152,8 +154,8 @@ class UnionType : public BaseType
152154
GRAPHQLSERVICE_EXPORT void AddPossibleTypes(std::vector<std::weak_ptr<BaseType>> possibleTypes);
153155

154156
// Accessors
155-
std::string_view name() const noexcept final;
156-
const std::vector<std::weak_ptr<BaseType>>& possibleTypes() const noexcept final;
157+
GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept final;
158+
GRAPHQLSERVICE_EXPORT const std::vector<std::weak_ptr<BaseType>>& possibleTypes() const noexcept final;
157159

158160
private:
159161
const std::string_view _name;
@@ -176,8 +178,8 @@ class EnumType : public BaseType
176178
GRAPHQLSERVICE_EXPORT void AddEnumValues(std::vector<EnumValueType> enumValues);
177179

178180
// Accessors
179-
std::string_view name() const noexcept final;
180-
const std::vector<std::shared_ptr<EnumValue>>& enumValues() const noexcept final;
181+
GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept final;
182+
GRAPHQLSERVICE_EXPORT const std::vector<std::shared_ptr<EnumValue>>& enumValues() const noexcept final;
181183

182184
private:
183185
const std::string_view _name;
@@ -194,8 +196,8 @@ class InputObjectType : public BaseType
194196
GRAPHQLSERVICE_EXPORT void AddInputValues(std::vector<std::shared_ptr<InputValue>> inputValues);
195197

196198
// Accessors
197-
std::string_view name() const noexcept final;
198-
const std::vector<std::shared_ptr<InputValue>>& inputFields() const noexcept final;
199+
GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept final;
200+
GRAPHQLSERVICE_EXPORT const std::vector<std::shared_ptr<InputValue>>& inputFields() const noexcept final;
199201

200202
private:
201203
const std::string_view _name;
@@ -210,7 +212,7 @@ class WrapperType : public BaseType
210212
introspection::TypeKind kind, const std::shared_ptr<BaseType>& ofType);
211213

212214
// Accessors
213-
const std::weak_ptr<BaseType>& ofType() const noexcept final;
215+
GRAPHQLSERVICE_EXPORT const std::weak_ptr<BaseType>& ofType() const noexcept final;
214216

215217
private:
216218
const std::weak_ptr<BaseType> _ofType;
@@ -224,11 +226,11 @@ class Field : public std::enable_shared_from_this<Field>
224226
std::vector<std::shared_ptr<InputValue>>&& args, const std::shared_ptr<BaseType>& type);
225227

226228
// Accessors
227-
std::string_view name() const noexcept;
228-
std::string_view description() const noexcept;
229-
const std::vector<std::shared_ptr<InputValue>>& args() const noexcept;
230-
const std::weak_ptr<BaseType>& type() const noexcept;
231-
const std::optional<std::string_view>& deprecationReason() const noexcept;
229+
GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept;
230+
GRAPHQLSERVICE_EXPORT std::string_view description() const noexcept;
231+
GRAPHQLSERVICE_EXPORT const std::vector<std::shared_ptr<InputValue>>& args() const noexcept;
232+
GRAPHQLSERVICE_EXPORT const std::weak_ptr<BaseType>& type() const noexcept;
233+
GRAPHQLSERVICE_EXPORT const std::optional<std::string_view>& deprecationReason() const noexcept;
232234

233235
private:
234236
const std::string_view _name;
@@ -245,10 +247,10 @@ class InputValue : public std::enable_shared_from_this<InputValue>
245247
const std::shared_ptr<BaseType>& type, std::string_view defaultValue);
246248

247249
// Accessors
248-
std::string_view name() const noexcept;
249-
std::string_view description() const noexcept;
250-
const std::weak_ptr<BaseType>& type() const noexcept;
251-
std::string_view defaultValue() const noexcept;
250+
GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept;
251+
GRAPHQLSERVICE_EXPORT std::string_view description() const noexcept;
252+
GRAPHQLSERVICE_EXPORT const std::weak_ptr<BaseType>& type() const noexcept;
253+
GRAPHQLSERVICE_EXPORT std::string_view defaultValue() const noexcept;
252254

253255
private:
254256
const std::string_view _name;
@@ -264,9 +266,9 @@ class EnumValue : public std::enable_shared_from_this<EnumValue>
264266
std::optional<std::string_view> deprecationReason);
265267

266268
// Accessors
267-
std::string_view name() const noexcept;
268-
std::string_view description() const noexcept;
269-
const std::optional<std::string_view>& deprecationReason() const noexcept;
269+
GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept;
270+
GRAPHQLSERVICE_EXPORT std::string_view description() const noexcept;
271+
GRAPHQLSERVICE_EXPORT const std::optional<std::string_view>& deprecationReason() const noexcept;
270272

271273
private:
272274
const std::string_view _name;
@@ -282,10 +284,10 @@ class Directive : public std::enable_shared_from_this<Directive>
282284
std::vector<std::shared_ptr<InputValue>>&& args);
283285

284286
// Accessors
285-
std::string_view name() const noexcept;
286-
std::string_view description() const noexcept;
287-
const std::vector<introspection::DirectiveLocation>& locations() const noexcept;
288-
const std::vector<std::shared_ptr<InputValue>>& args() const noexcept;
287+
GRAPHQLSERVICE_EXPORT std::string_view name() const noexcept;
288+
GRAPHQLSERVICE_EXPORT std::string_view description() const noexcept;
289+
GRAPHQLSERVICE_EXPORT const std::vector<introspection::DirectiveLocation>& locations() const noexcept;
290+
GRAPHQLSERVICE_EXPORT const std::vector<std::shared_ptr<InputValue>>& args() const noexcept;
289291

290292
private:
291293
const std::string_view _name;

0 commit comments

Comments
 (0)