Skip to content

Commit 4fe8a81

Browse files
committed
Fix all of the dllexport warnings
1 parent 73f7d98 commit 4fe8a81

File tree

8 files changed

+145
-166
lines changed

8 files changed

+145
-166
lines changed

include/graphqlservice/GraphQLResponse.h

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
#define GRAPHQLRESPONSE_H
88

99
#ifdef GRAPHQL_DLLEXPORTS
10-
#ifdef IMPL_GRAPHQLRESPONSE_LIB
10+
#ifdef IMPL_GRAPHQLRESPONSE_DLL
1111
#define GRAPHQLRESPONSE_EXPORT __declspec(dllexport)
12-
#else // !IMPL_GRAPHQLRESPONSE_LIB
12+
#else // !IMPL_GRAPHQLRESPONSE_DLL
1313
#define GRAPHQLRESPONSE_EXPORT __declspec(dllimport)
14-
#endif // !IMPL_GRAPHQLRESPONSE_LIB
14+
#endif // !IMPL_GRAPHQLRESPONSE_DLL
1515
#else // !GRAPHQL_DLLEXPORTS
1616
#define GRAPHQLRESPONSE_EXPORT
1717
#endif // !GRAPHQL_DLLEXPORTS
@@ -110,49 +110,49 @@ struct ValueTypeTraits<IdType>
110110
struct TypedData;
111111

112112
// Represent a discriminated union of GraphQL response value types.
113-
struct GRAPHQLRESPONSE_EXPORT Value
113+
struct Value
114114
{
115-
Value(Type type = Type::Null);
116-
~Value();
115+
GRAPHQLRESPONSE_EXPORT Value(Type type = Type::Null);
116+
GRAPHQLRESPONSE_EXPORT ~Value();
117117

118-
explicit Value(const char* value);
119-
explicit Value(StringType&& value);
120-
explicit Value(BooleanType value);
121-
explicit Value(IntType value);
122-
explicit Value(FloatType value);
118+
GRAPHQLRESPONSE_EXPORT explicit Value(const char* value);
119+
GRAPHQLRESPONSE_EXPORT explicit Value(StringType&& value);
120+
GRAPHQLRESPONSE_EXPORT explicit Value(BooleanType value);
121+
GRAPHQLRESPONSE_EXPORT explicit Value(IntType value);
122+
GRAPHQLRESPONSE_EXPORT explicit Value(FloatType value);
123123

124-
Value(Value&& other) noexcept;
125-
explicit Value(const Value& other);
124+
GRAPHQLRESPONSE_EXPORT Value(Value&& other) noexcept;
125+
GRAPHQLRESPONSE_EXPORT explicit Value(const Value& other);
126126

127-
Value& operator=(Value&& rhs) noexcept;
128-
Value& operator=(const Value& rhs) = delete;
127+
GRAPHQLRESPONSE_EXPORT Value& operator=(Value&& rhs) noexcept;
128+
GRAPHQLRESPONSE_EXPORT Value& operator=(const Value& rhs) = delete;
129129

130130
// Comparison
131-
bool operator==(const Value& rhs) const noexcept;
132-
bool operator!=(const Value& rhs) const noexcept;
131+
GRAPHQLRESPONSE_EXPORT bool operator==(const Value& rhs) const noexcept;
132+
GRAPHQLRESPONSE_EXPORT bool operator!=(const Value& rhs) const noexcept;
133133

134134
// Check the Type
135-
Type type() const noexcept;
135+
GRAPHQLRESPONSE_EXPORT Type type() const noexcept;
136136

137137
// JSON doesn't distinguish between Type::String and Type::EnumValue, so if this value comes
138138
// from JSON and it's a string we need to track the fact that it can be interpreted as either.
139-
Value&& from_json() noexcept;
140-
bool maybe_enum() const noexcept;
139+
GRAPHQLRESPONSE_EXPORT Value&& from_json() noexcept;
140+
GRAPHQLRESPONSE_EXPORT bool maybe_enum() const noexcept;
141141

142142
// Valid for Type::Map or Type::List
143-
void reserve(size_t count);
144-
size_t size() const;
143+
GRAPHQLRESPONSE_EXPORT void reserve(size_t count);
144+
GRAPHQLRESPONSE_EXPORT size_t size() const;
145145

146146
// Valid for Type::Map
147-
void emplace_back(std::string&& name, Value&& value);
148-
MapType::const_iterator find(const std::string& name) const;
149-
MapType::const_iterator begin() const;
150-
MapType::const_iterator end() const;
151-
const Value& operator[](const std::string& name) const;
147+
GRAPHQLRESPONSE_EXPORT void emplace_back(std::string&& name, Value&& value);
148+
GRAPHQLRESPONSE_EXPORT MapType::const_iterator find(const std::string& name) const;
149+
GRAPHQLRESPONSE_EXPORT MapType::const_iterator begin() const;
150+
GRAPHQLRESPONSE_EXPORT MapType::const_iterator end() const;
151+
GRAPHQLRESPONSE_EXPORT const Value& operator[](const std::string& name) const;
152152

153153
// Valid for Type::List
154-
void emplace_back(Value&& value);
155-
const Value& operator[](size_t index) const;
154+
GRAPHQLRESPONSE_EXPORT void emplace_back(Value&& value);
155+
GRAPHQLRESPONSE_EXPORT const Value& operator[](size_t index) const;
156156

157157
// Specialized for all single-value Types.
158158
template <typename ValueType>

include/graphqlservice/GraphQLService.h

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ using field_path = std::queue<path_segment>;
5555

5656
GRAPHQLSERVICE_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
6565
GRAPHQLSERVICE_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
{
7070
public:
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

8484
private:
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
{
179179
public:
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&&)>;
222222
using 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
{
227227
public:
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

254254
private:
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
{
435435
public:
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

443443
protected:
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
{
843843
protected:
844-
explicit Request(TypeMap&& operationTypes);
845-
virtual ~Request() = default;
844+
GRAPHQLSERVICE_EXPORT explicit Request(TypeMap&& operationTypes);
845+
GRAPHQLSERVICE_EXPORT virtual ~Request() = default;
846846

847847
public:
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

871871
private:
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

Comments
 (0)