Skip to content

Commit 6e69e4a

Browse files
committed
add alloctor type to std::vector TypeHandlers
1 parent 19a71df commit 6e69e4a

3 files changed

Lines changed: 20 additions & 20 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### Project
22
cmake_minimum_required(VERSION 3.15)
3-
project(json_struct VERSION "1.0.0" HOMEPAGE_URL "https://github.com/jorgen/json_struct" DESCRIPTION "A library for parsing JSON directly to C++ structs and vice versa." LANGUAGES CXX)
3+
project(json_struct VERSION "1.0.3" HOMEPAGE_URL "https://github.com/jorgen/json_struct" DESCRIPTION "A library for parsing JSON directly to C++ structs and vice versa." LANGUAGES CXX)
44
set(CPACK_PACKAGE_VENDOR "Jørgen Lind")
55

66
set(ADDITIONAL_MODULES_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake")

include/json_struct/json_struct.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7361,10 +7361,10 @@ struct TypeHandler<T, typename std::enable_if_t<Internal::is_specialization<T, s
73617361
#endif
73627362

73637363
/// \private
7364-
template <typename T>
7365-
struct TypeHandler<std::vector<T>>
7364+
template <typename T, typename A>
7365+
struct TypeHandler<std::vector<T, A>>
73667366
{
7367-
static inline Error to(std::vector<T> &to_type, ParseContext &context)
7367+
static inline Error to(std::vector<T, A> &to_type, ParseContext &context)
73687368
{
73697369
if (context.token.value_type != JS::Type::ArrayStart)
73707370
return Error::ExpectedArrayStart;
@@ -7387,7 +7387,7 @@ struct TypeHandler<std::vector<T>>
73877387
return error;
73887388
}
73897389

7390-
static inline void from(const std::vector<T> &vec, Token &token, Serializer &serializer)
7390+
static inline void from(const std::vector<T, A> &vec, Token &token, Serializer &serializer)
73917391
{
73927392
token.value_type = Type::ArrayStart;
73937393
token.value = DataRef("[");
@@ -7409,11 +7409,11 @@ struct TypeHandler<std::vector<T>>
74097409
};
74107410

74117411
/// \private
7412-
template <>
7413-
struct TypeHandler<std::vector<bool>>
7412+
template <typename A>
7413+
struct TypeHandler<std::vector<bool, A>>
74147414
{
74157415
public:
7416-
static inline Error to(std::vector<bool> &to_type, ParseContext &context)
7416+
static inline Error to(std::vector<bool, A> &to_type, ParseContext &context)
74177417
{
74187418
if (context.token.value_type != JS::Type::ArrayStart)
74197419
return Error::ExpectedArrayStart;
@@ -7438,7 +7438,7 @@ struct TypeHandler<std::vector<bool>>
74387438
return error;
74397439
}
74407440

7441-
static inline void from(const std::vector<bool> &vec, Token &token, Serializer &serializer)
7441+
static inline void from(const std::vector<bool, A> &vec, Token &token, Serializer &serializer)
74427442
{
74437443
token.value_type = Type::ArrayStart;
74447444
token.value = DataRef("[");
@@ -7477,20 +7477,20 @@ struct TypeHandler<SilentString>
74777477
};
74787478

74797479
/// \private
7480-
template <typename T>
7481-
struct TypeHandler<SilentVector<T>>
7480+
template <typename T, typename A>
7481+
struct TypeHandler<SilentVector<T, A>>
74827482
{
74837483
public:
7484-
static inline Error to(SilentVector<T> &to_type, ParseContext &context)
7484+
static inline Error to(SilentVector<T, A> &to_type, ParseContext &context)
74857485
{
7486-
return TypeHandler<std::vector<T>>::to(to_type.data, context);
7486+
return TypeHandler<std::vector<T, A>>::to(to_type.data, context);
74877487
}
74887488

7489-
static inline void from(const SilentVector<T> &vec, Token &token, Serializer &serializer)
7489+
static inline void from(const SilentVector<T, A> &vec, Token &token, Serializer &serializer)
74907490
{
74917491
if (vec.data.size())
74927492
{
7493-
TypeHandler<std::vector<T>>::from(vec.data, token, serializer);
7493+
TypeHandler<std::vector<T, A>>::from(vec.data, token, serializer);
74947494
}
74957495
}
74967496
};
@@ -7515,11 +7515,11 @@ struct TypeHandler<SilentUniquePtr<T>>
75157515
};
75167516

75177517
/// \private
7518-
template <>
7519-
struct TypeHandler<std::vector<Token>>
7518+
template <typename A>
7519+
struct TypeHandler<std::vector<Token, A>>
75207520
{
75217521
public:
7522-
static inline Error to(std::vector<Token> &to_type, ParseContext &context)
7522+
static inline Error to(std::vector<Token, A> &to_type, ParseContext &context)
75237523
{
75247524
if (context.token.value_type != JS::Type::ArrayStart && context.token.value_type != JS::Type::ObjectStart)
75257525
{
@@ -7544,7 +7544,7 @@ struct TypeHandler<std::vector<Token>>
75447544
return error;
75457545
}
75467546

7547-
static inline void from(const std::vector<Token> &from_type, Token &token, Serializer &serializer)
7547+
static inline void from(const std::vector<Token, A> &from_type, Token &token, Serializer &serializer)
75487548
{
75497549
for (auto &t : from_type)
75507550
{

test_package/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.21)
1+
cmake_minimum_required(VERSION 3.15)
22

33
project(JsonStructTester
44
DESCRIPTION "Tester package for json_struct"

0 commit comments

Comments
 (0)