Skip to content

Commit 31af73f

Browse files
authored
Merge pull request #245 from wravery/idtype-accessors
Add `response::IdType` accessors for backwards compatibility
2 parents c0d6bf1 + 773ef2a commit 31af73f

13 files changed

+368
-39
lines changed

cmake/version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.3.0
1+
4.3.1

include/graphqlservice/GraphQLResponse.h

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,16 @@ struct [[nodiscard]] IdType
6868
// Implicit ByteData constructors
6969
GRAPHQLRESPONSE_EXPORT IdType(size_t count, typename ByteData::value_type value = 0);
7070
GRAPHQLRESPONSE_EXPORT IdType(std::initializer_list<typename ByteData::value_type> values);
71-
GRAPHQLRESPONSE_EXPORT IdType(
72-
typename ByteData::const_iterator begin, typename ByteData::const_iterator end);
71+
template <typename InputIt>
72+
IdType(InputIt begin, InputIt end);
7373

7474
// Assignment
7575
GRAPHQLRESPONSE_EXPORT IdType& operator=(IdType&& rhs) noexcept;
7676
IdType& operator=(const IdType& rhs) = delete;
7777

7878
// Conversion
7979
GRAPHQLRESPONSE_EXPORT IdType(ByteData&& data) noexcept;
80-
GRAPHQLRESPONSE_EXPORT IdType& operator=(ByteData&& data) noexcept;
81-
8280
GRAPHQLRESPONSE_EXPORT IdType(OpaqueString&& opaque) noexcept;
83-
GRAPHQLRESPONSE_EXPORT IdType& operator=(OpaqueString&& opaque) noexcept;
8481

8582
template <typename ValueType>
8683
[[nodiscard]] const ValueType& get() const;
@@ -95,16 +92,60 @@ struct [[nodiscard]] IdType
9592

9693
GRAPHQLRESPONSE_EXPORT [[nodiscard]] bool operator<(const IdType& rhs) const noexcept;
9794

98-
// Check the Type
95+
// Check the type
9996
GRAPHQLRESPONSE_EXPORT [[nodiscard]] bool isBase64() const noexcept;
10097

98+
// Shared accessors
99+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] bool empty() const noexcept;
100+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] size_t size() const noexcept;
101+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] size_t max_size() const noexcept;
102+
GRAPHQLRESPONSE_EXPORT void reserve(size_t new_cap);
103+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] size_t capacity() const noexcept;
104+
GRAPHQLRESPONSE_EXPORT void shrink_to_fit();
105+
GRAPHQLRESPONSE_EXPORT void clear() noexcept;
106+
107+
// ByteData accessors
108+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] const std::uint8_t& at(size_t pos) const;
109+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] std::uint8_t& at(size_t pos);
110+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] const std::uint8_t& operator[](size_t pos) const;
111+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] std::uint8_t& operator[](size_t pos);
112+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] const std::uint8_t& front() const;
113+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] std::uint8_t& front();
114+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] const std::uint8_t& back() const;
115+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] std::uint8_t& back();
116+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] const std::uint8_t* data() const;
117+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] std::uint8_t* data();
118+
119+
// ByteData iterators
120+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] ByteData::const_iterator begin() const;
121+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] ByteData::iterator begin();
122+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] ByteData::const_iterator cbegin() const;
123+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] ByteData::const_iterator end() const;
124+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] ByteData::iterator end();
125+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] ByteData::const_iterator cend() const;
126+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] ByteData::const_reverse_iterator rbegin() const;
127+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] ByteData::reverse_iterator rbegin();
128+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] ByteData::const_reverse_iterator crbegin() const;
129+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] ByteData::const_reverse_iterator rend() const;
130+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] ByteData::reverse_iterator rend();
131+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] ByteData::const_reverse_iterator crend() const;
132+
133+
// OpaqueString accessors
134+
GRAPHQLRESPONSE_EXPORT [[nodiscard]] const char* c_str() const;
135+
101136
private:
102137
std::variant<ByteData, OpaqueString> _data;
103138
};
104139

105140
#ifdef GRAPHQL_DLLEXPORTS
106141
// Export all of the specialized template methods
107142
template <>
143+
GRAPHQLRESPONSE_EXPORT IdType::IdType(
144+
typename ByteData::const_iterator begin, typename ByteData::const_iterator end);
145+
template <>
146+
GRAPHQLRESPONSE_EXPORT IdType::IdType(
147+
typename ByteData::const_pointer begin, typename ByteData::const_pointer end);
148+
template <>
108149
GRAPHQLRESPONSE_EXPORT const IdType::ByteData& IdType::get<IdType::ByteData>() const;
109150
template <>
110151
GRAPHQLRESPONSE_EXPORT const IdType::OpaqueString& IdType::get<IdType::OpaqueString>() const;

include/graphqlservice/internal/Version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
namespace graphql::internal {
1212

13-
constexpr std::string_view FullVersion { "4.3.0" };
13+
constexpr std::string_view FullVersion { "4.3.1" };
1414

1515
constexpr size_t MajorVersion = 4;
1616
constexpr size_t MinorVersion = 3;
17-
constexpr size_t PatchVersion = 0;
17+
constexpr size_t PatchVersion = 1;
1818

1919
} // namespace graphql::internal
2020

res/ClientGen.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#include <winver.h>
55

6-
#define GRAPHQL_RC_VERSION 4,3,0,0
7-
#define GRAPHQL_RC_VERSION_STR "4.3.0"
6+
#define GRAPHQL_RC_VERSION 4,3,1,0
7+
#define GRAPHQL_RC_VERSION_STR "4.3.1"
88

99
#ifndef DEBUG
1010
#define VER_DEBUG 0

res/SchemaGen.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#include <winver.h>
55

6-
#define GRAPHQL_RC_VERSION 4,3,0,0
7-
#define GRAPHQL_RC_VERSION_STR "4.3.0"
6+
#define GRAPHQL_RC_VERSION 4,3,1,0
7+
#define GRAPHQL_RC_VERSION_STR "4.3.1"
88

99
#ifndef DEBUG
1010
#define VER_DEBUG 0

res/graphqlclient_version.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#include <winver.h>
55

6-
#define GRAPHQL_RC_VERSION 4,3,0,0
7-
#define GRAPHQL_RC_VERSION_STR "4.3.0"
6+
#define GRAPHQL_RC_VERSION 4,3,1,0
7+
#define GRAPHQL_RC_VERSION_STR "4.3.1"
88

99
#ifndef DEBUG
1010
#define VER_DEBUG 0

res/graphqljson_version.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#include <winver.h>
55

6-
#define GRAPHQL_RC_VERSION 4,3,0,0
7-
#define GRAPHQL_RC_VERSION_STR "4.3.0"
6+
#define GRAPHQL_RC_VERSION 4,3,1,0
7+
#define GRAPHQL_RC_VERSION_STR "4.3.1"
88

99
#ifndef DEBUG
1010
#define VER_DEBUG 0

res/graphqlpeg_version.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#include <winver.h>
55

6-
#define GRAPHQL_RC_VERSION 4,3,0,0
7-
#define GRAPHQL_RC_VERSION_STR "4.3.0"
6+
#define GRAPHQL_RC_VERSION 4,3,1,0
7+
#define GRAPHQL_RC_VERSION_STR "4.3.1"
88

99
#ifndef DEBUG
1010
#define VER_DEBUG 0

res/graphqlresponse_version.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#include <winver.h>
55

6-
#define GRAPHQL_RC_VERSION 4,3,0,0
7-
#define GRAPHQL_RC_VERSION_STR "4.3.0"
6+
#define GRAPHQL_RC_VERSION 4,3,1,0
7+
#define GRAPHQL_RC_VERSION_STR "4.3.1"
88

99
#ifndef DEBUG
1010
#define VER_DEBUG 0

res/graphqlservice_version.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#include <winver.h>
55

6-
#define GRAPHQL_RC_VERSION 4,3,0,0
7-
#define GRAPHQL_RC_VERSION_STR "4.3.0"
6+
#define GRAPHQL_RC_VERSION 4,3,1,0
7+
#define GRAPHQL_RC_VERSION_STR "4.3.1"
88

99
#ifndef DEBUG
1010
#define VER_DEBUG 0

0 commit comments

Comments
 (0)