@@ -55,7 +55,7 @@ using field_path = std::queue<path_segment>;
5555
5656GRAPHQLSERVICE_EXPORT void addErrorPath (field_path&& path, response::Value& error);
5757
58- struct GRAPHQLSERVICE_EXPORT schema_error
58+ struct schema_error
5959{
6060 std::string message;
6161 schema_location location;
@@ -65,21 +65,21 @@ struct GRAPHQLSERVICE_EXPORT schema_error
6565GRAPHQLSERVICE_EXPORT response::Value buildErrorValues (const std::vector<schema_error>& structuredErrors);
6666
6767// This exception bubbles up 1 or more error messages to the JSON results.
68- class GRAPHQLSERVICE_EXPORT schema_exception : public std::exception
68+ class schema_exception : public std ::exception
6969{
7070public:
71- explicit schema_exception (std::vector<schema_error>&& structuredErrors);
72- explicit schema_exception (std::vector<std::string>&& messages);
71+ GRAPHQLSERVICE_EXPORT explicit schema_exception (std::vector<schema_error>&& structuredErrors);
72+ GRAPHQLSERVICE_EXPORT explicit schema_exception (std::vector<std::string>&& messages);
7373
7474 schema_exception () = delete ;
7575
76- const char * what () const noexcept override ;
76+ GRAPHQLSERVICE_EXPORT const char * what () const noexcept override ;
7777
78- const std::vector<schema_error>& getStructuredErrors () const noexcept ;
79- std::vector<schema_error> getStructuredErrors () noexcept ;
78+ GRAPHQLSERVICE_EXPORT const std::vector<schema_error>& getStructuredErrors () const noexcept ;
79+ GRAPHQLSERVICE_EXPORT std::vector<schema_error> getStructuredErrors () noexcept ;
8080
81- const response::Value& getErrors () const noexcept ;
82- response::Value getErrors () noexcept ;
81+ GRAPHQLSERVICE_EXPORT const response::Value& getErrors () const noexcept ;
82+ GRAPHQLSERVICE_EXPORT response::Value getErrors () noexcept ;
8383
8484private:
8585 static std::vector<schema_error> convertMessages (std::vector<std::string>&& messages) noexcept ;
@@ -92,7 +92,7 @@ class GRAPHQLSERVICE_EXPORT schema_exception : public std::exception
9292// per-request state that you want to maintain throughout the request (e.g. optimizing or batching
9393// backend requests), you can inherit from RequestState and pass it to Request::resolve to correlate the
9494// asynchronous/recursive callbacks and accumulate state in it.
95- struct GRAPHQLSERVICE_EXPORT RequestState : std::enable_shared_from_this<RequestState>
95+ struct RequestState : std::enable_shared_from_this<RequestState>
9696{
9797};
9898
@@ -114,7 +114,7 @@ constexpr std::string_view strSubscription { "subscription"sv };
114114}
115115
116116// Pass a common bundle of parameters to all of the generated Object::getField accessors in a SelectionSet
117- struct GRAPHQLSERVICE_EXPORT SelectionSetParams
117+ struct SelectionSetParams
118118{
119119 // The lifetime of each of these borrowed references is guaranteed until the future returned
120120 // by the accessor is resolved or destroyed. They are owned by the OperationData shared pointer.
@@ -136,9 +136,9 @@ struct GRAPHQLSERVICE_EXPORT SelectionSetParams
136136};
137137
138138// Pass a common bundle of parameters to all of the generated Object::getField accessors.
139- struct GRAPHQLSERVICE_EXPORT FieldParams : SelectionSetParams
139+ struct FieldParams : SelectionSetParams
140140{
141- explicit FieldParams (const SelectionSetParams& selectionSetParams, response::Value&& directives);
141+ GRAPHQLSERVICE_EXPORT explicit FieldParams (const SelectionSetParams& selectionSetParams, response::Value&& directives);
142142
143143 // Each field owns its own field-specific directives. Once the accessor returns it will be destroyed,
144144 // but you can move it into another instance of response::Value to keep it alive longer.
@@ -174,7 +174,7 @@ class FieldResult
174174// Fragments are referenced by name and have a single type condition (except for inline
175175// fragments, where the type condition is common but optional). They contain a set of fields
176176// (with optional aliases and sub-selections) and potentially references to other fragments.
177- class GRAPHQLSERVICE_EXPORT Fragment
177+ class Fragment
178178{
179179public:
180180 explicit Fragment (const peg::ast_node& fragmentDefinition, const response::Value& variables);
@@ -197,13 +197,13 @@ using FragmentMap = std::unordered_map<std::string, Fragment>;
197197// Resolver functors take a set of arguments encoded as members on a JSON object
198198// with an optional selection set for complex types and return a JSON value for
199199// a single field.
200- struct GRAPHQLSERVICE_EXPORT ResolverParams : SelectionSetParams
200+ struct ResolverParams : SelectionSetParams
201201{
202- explicit ResolverParams (const SelectionSetParams& selectionSetParams, const peg::ast_node& field,
202+ GRAPHQLSERVICE_EXPORT explicit ResolverParams (const SelectionSetParams& selectionSetParams, const peg::ast_node& field,
203203 std::string&& fieldName, response::Value&& arguments, response::Value&& fieldDirectives,
204204 const peg::ast_node* selection, const FragmentMap& fragments, const response::Value& variables);
205205
206- schema_location getLocation () const ;
206+ GRAPHQLSERVICE_EXPORT schema_location getLocation () const ;
207207
208208 // These values are different for each resolver.
209209 const peg::ast_node& field;
@@ -222,7 +222,7 @@ using Resolver = std::function<std::future<response::Value>(ResolverParams&&)>;
222222using ResolverMap = std::unordered_map<std::string, Resolver>;
223223
224224// Binary data and opaque strings like IDs are encoded in Base64.
225- class GRAPHQLSERVICE_EXPORT Base64
225+ class Base64
226226{
227227public:
228228 // Map a single Base64-encoded character to its 6-bit integer value.
@@ -236,7 +236,7 @@ class GRAPHQLSERVICE_EXPORT Base64
236236 }
237237
238238 // Convert a Base64-encoded string to a vector of bytes.
239- static std::vector<uint8_t > fromBase64 (const char * encoded, size_t count);
239+ GRAPHQLSERVICE_EXPORT static std::vector<uint8_t > fromBase64 (const char * encoded, size_t count);
240240
241241 // Map a single 6-bit integer value to its Base64-encoded character.
242242 static constexpr char toBase64 (uint8_t i) noexcept
@@ -249,7 +249,7 @@ class GRAPHQLSERVICE_EXPORT Base64
249249 }
250250
251251 // Convert a set of bytes to Base64.
252- static std::string toBase64 (const std::vector<uint8_t >& bytes);
252+ GRAPHQLSERVICE_EXPORT static std::string toBase64 (const std::vector<uint8_t >& bytes);
253253
254254private:
255255 static constexpr char padding = ' =' ;
@@ -430,24 +430,24 @@ using TypeNames = std::unordered_set<std::string>;
430430// and @skip directives, and calls through to the resolver functor for each selected field with
431431// its arguments. This may be a recursive process for fields which return another complex type,
432432// in which case it requires its own selection set.
433- class GRAPHQLSERVICE_EXPORT Object : public std::enable_shared_from_this<Object>
433+ class Object : public std ::enable_shared_from_this<Object>
434434{
435435public:
436- explicit Object (TypeNames&& typeNames, ResolverMap&& resolvers);
437- virtual ~Object () = default ;
436+ GRAPHQLSERVICE_EXPORT explicit Object (TypeNames&& typeNames, ResolverMap&& resolvers);
437+ GRAPHQLSERVICE_EXPORT virtual ~Object () = default ;
438438
439- std::future<response::Value> resolve (const SelectionSetParams& selectionSetParams, const peg::ast_node& selection, const FragmentMap& fragments, const response::Value& variables) const ;
439+ GRAPHQLSERVICE_EXPORT std::future<response::Value> resolve (const SelectionSetParams& selectionSetParams, const peg::ast_node& selection, const FragmentMap& fragments, const response::Value& variables) const ;
440440
441- bool matchesType (const std::string& typeName) const ;
441+ GRAPHQLSERVICE_EXPORT bool matchesType (const std::string& typeName) const ;
442442
443443protected:
444444 // These callbacks are optional, you may override either, both, or neither of them. The implementer
445445 // can use these to to accumulate state for the entire SelectionSet on this object, as well as
446446 // testing directives which were included at the operation or fragment level. It's up to sub-classes
447447 // to decide if they want to use const_cast, mutable members, or separate storage in the RequestState
448448 // to accumulate state. By default these callbacks should treat the Object itself as const.
449- virtual void beginSelectionSet (const SelectionSetParams& params) const ;
450- virtual void endSelectionSet (const SelectionSetParams& params) const ;
449+ GRAPHQLSERVICE_EXPORT virtual void beginSelectionSet (const SelectionSetParams& params) const ;
450+ GRAPHQLSERVICE_EXPORT virtual void endSelectionSet (const SelectionSetParams& params) const ;
451451
452452 std::mutex _resolverMutex {};
453453
@@ -783,7 +783,7 @@ using TypeMap = std::unordered_map<std::string, std::shared_ptr<Object>>;
783783// You can still sub-class RequestState and use that in the state parameter to Request::subscribe
784784// to add your own state to the service callbacks that you receive while executing the subscription
785785// query.
786- struct GRAPHQLSERVICE_EXPORT SubscriptionParams
786+ struct SubscriptionParams
787787{
788788 std::shared_ptr<RequestState> state;
789789 peg::ast query;
@@ -838,35 +838,35 @@ struct SubscriptionData : std::enable_shared_from_this<SubscriptionData>
838838// Request scans the fragment definitions and finds the right operation definition to interpret
839839// depending on the operation name (which might be empty for a single-operation document). It
840840// also needs the values of the request variables.
841- class GRAPHQLSERVICE_EXPORT Request : public std::enable_shared_from_this<Request>
841+ class Request : public std ::enable_shared_from_this<Request>
842842{
843843protected:
844- explicit Request (TypeMap&& operationTypes);
845- virtual ~Request () = default ;
844+ GRAPHQLSERVICE_EXPORT explicit Request (TypeMap&& operationTypes);
845+ GRAPHQLSERVICE_EXPORT virtual ~Request () = default ;
846846
847847public:
848- std::vector<schema_error> validate (peg::ast& query) const ;
848+ GRAPHQLSERVICE_EXPORT std::vector<schema_error> validate (peg::ast& query) const ;
849849
850- std::pair<std::string, const peg::ast_node*> findOperationDefinition (const peg::ast_node& root, const std::string& operationName) const ;
850+ GRAPHQLSERVICE_EXPORT std::pair<std::string, const peg::ast_node*> findOperationDefinition (const peg::ast_node& root, const std::string& operationName) const ;
851851
852- std::future<response::Value> resolve (const std::shared_ptr<RequestState>& state, peg::ast& query, const std::string& operationName, response::Value&& variables) const ;
853- std::future<response::Value> resolve (std::launch launch, const std::shared_ptr<RequestState>& state, peg::ast& query, const std::string& operationName, response::Value&& variables) const ;
852+ GRAPHQLSERVICE_EXPORT std::future<response::Value> resolve (const std::shared_ptr<RequestState>& state, peg::ast& query, const std::string& operationName, response::Value&& variables) const ;
853+ GRAPHQLSERVICE_EXPORT std::future<response::Value> resolve (std::launch launch, const std::shared_ptr<RequestState>& state, peg::ast& query, const std::string& operationName, response::Value&& variables) const ;
854854
855- SubscriptionKey subscribe (SubscriptionParams&& params, SubscriptionCallback&& callback);
856- void unsubscribe (SubscriptionKey key);
855+ GRAPHQLSERVICE_EXPORT SubscriptionKey subscribe (SubscriptionParams&& params, SubscriptionCallback&& callback);
856+ GRAPHQLSERVICE_EXPORT void unsubscribe (SubscriptionKey key);
857857
858- void deliver (const SubscriptionName& name, const std::shared_ptr<Object>& subscriptionObject) const ;
859- void deliver (const SubscriptionName& name, const SubscriptionArguments& arguments, const std::shared_ptr<Object>& subscriptionObject) const ;
860- void deliver (const SubscriptionName& name, const SubscriptionFilterCallback& apply, const std::shared_ptr<Object>& subscriptionObject) const ;
858+ GRAPHQLSERVICE_EXPORT void deliver (const SubscriptionName& name, const std::shared_ptr<Object>& subscriptionObject) const ;
859+ GRAPHQLSERVICE_EXPORT void deliver (const SubscriptionName& name, const SubscriptionArguments& arguments, const std::shared_ptr<Object>& subscriptionObject) const ;
860+ GRAPHQLSERVICE_EXPORT void deliver (const SubscriptionName& name, const SubscriptionFilterCallback& apply, const std::shared_ptr<Object>& subscriptionObject) const ;
861861
862- void deliver (std::launch launch, const SubscriptionName& name, const std::shared_ptr<Object>& subscriptionObject) const ;
863- void deliver (std::launch launch, const SubscriptionName& name, const SubscriptionArguments& arguments, const std::shared_ptr<Object>& subscriptionObject) const ;
864- void deliver (std::launch launch, const SubscriptionName& name, const SubscriptionFilterCallback& apply, const std::shared_ptr<Object>& subscriptionObject) const ;
862+ GRAPHQLSERVICE_EXPORT void deliver (std::launch launch, const SubscriptionName& name, const std::shared_ptr<Object>& subscriptionObject) const ;
863+ GRAPHQLSERVICE_EXPORT void deliver (std::launch launch, const SubscriptionName& name, const SubscriptionArguments& arguments, const std::shared_ptr<Object>& subscriptionObject) const ;
864+ GRAPHQLSERVICE_EXPORT void deliver (std::launch launch, const SubscriptionName& name, const SubscriptionFilterCallback& apply, const std::shared_ptr<Object>& subscriptionObject) const ;
865865
866866 [[deprecated(" Use the Request::resolve overload which takes a peg::ast reference instead." )]]
867- std::future<response::Value> resolve (const std::shared_ptr<RequestState>& state, const peg::ast_node& root, const std::string& operationName, response::Value&& variables) const ;
867+ GRAPHQLSERVICE_EXPORT std::future<response::Value> resolve (const std::shared_ptr<RequestState>& state, const peg::ast_node& root, const std::string& operationName, response::Value&& variables) const ;
868868 [[deprecated(" Use the Request::resolve overload which takes a peg::ast reference instead." )]]
869- std::future<response::Value> resolve (std::launch launch, const std::shared_ptr<RequestState>& state, const peg::ast_node& root, const std::string& operationName, response::Value&& variables) const ;
869+ GRAPHQLSERVICE_EXPORT std::future<response::Value> resolve (std::launch launch, const std::shared_ptr<RequestState>& state, const peg::ast_node& root, const std::string& operationName, response::Value&& variables) const ;
870870
871871private:
872872 std::future<response::Value> resolveValidated (std::launch launch, const std::shared_ptr<RequestState>& state, const peg::ast_node& root, const std::string& operationName, response::Value&& variables) const ;
0 commit comments