Skip to content

Commit ca9a408

Browse files
authored
Prefix all concepts in json_auto.h with json_auto_ (#1776)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent a1930d2 commit ca9a408

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/core/json/include/sourcemeta/core/json_auto.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,63 +22,63 @@ namespace sourcemeta::core {
2222

2323
/// @ingroup json
2424
template <typename, typename = void>
25-
struct to_json_has_mapped_type : std::false_type {};
25+
struct json_auto_has_mapped_type : std::false_type {};
2626
template <typename T>
27-
struct to_json_has_mapped_type<T, std::void_t<typename T::mapped_type>>
27+
struct json_auto_has_mapped_type<T, std::void_t<typename T::mapped_type>>
2828
: std::true_type {};
2929

3030
/// @ingroup json
31-
template <typename T> struct to_json_is_basic_string : std::false_type {};
31+
template <typename T> struct json_auto_is_basic_string : std::false_type {};
3232
template <typename CharT, typename Traits, typename Alloc>
33-
struct to_json_is_basic_string<std::basic_string<CharT, Traits, Alloc>>
33+
struct json_auto_is_basic_string<std::basic_string<CharT, Traits, Alloc>>
3434
: std::true_type {};
3535

3636
/// @ingroup json
3737
template <typename T>
38-
concept to_json_has_method = requires(const T value) {
38+
concept json_auto_has_method = requires(const T value) {
3939
{ value.to_json() } -> std::same_as<JSON>;
4040
};
4141

4242
/// @ingroup json
4343
/// Container-like classes can opt-out from automatic JSON
4444
/// serialisation by setting `using json_auto = std::false_type;`
4545
template <typename, typename = void>
46-
struct to_json_supports_auto_impl : std::true_type {};
46+
struct json_auto_supports_auto_impl : std::true_type {};
4747
template <typename T>
48-
struct to_json_supports_auto_impl<T, std::void_t<typename T::json_auto>>
48+
struct json_auto_supports_auto_impl<T, std::void_t<typename T::json_auto>>
4949
: std::bool_constant<
5050
!std::is_same_v<typename T::json_auto, std::false_type>> {};
5151
template <typename T>
52-
concept to_json_supports_auto = to_json_supports_auto_impl<T>::value;
52+
concept json_auto_supports_auto = json_auto_supports_auto_impl<T>::value;
5353

5454
/// @ingroup json
5555
template <typename T>
56-
concept to_json_list_like =
56+
concept json_auto_list_like =
5757
requires(T type) {
5858
typename T::value_type;
5959
typename T::const_iterator;
6060
{ type.cbegin() } -> std::same_as<typename T::const_iterator>;
6161
{ type.cend() } -> std::same_as<typename T::const_iterator>;
62-
} && to_json_supports_auto<T> && !to_json_has_mapped_type<T>::value &&
63-
!to_json_has_method<T> && !to_json_is_basic_string<T>::value;
62+
} && json_auto_supports_auto<T> && !json_auto_has_mapped_type<T>::value &&
63+
!json_auto_has_method<T> && !json_auto_is_basic_string<T>::value;
6464

6565
/// @ingroup json
6666
template <typename T>
67-
concept to_json_map_like =
67+
concept json_auto_map_like =
6868
requires(T type) {
6969
typename T::value_type;
7070
typename T::const_iterator;
7171
typename T::key_type;
7272
{ type.cbegin() } -> std::same_as<typename T::const_iterator>;
7373
{ type.cend() } -> std::same_as<typename T::const_iterator>;
74-
} && to_json_supports_auto<T> && to_json_has_mapped_type<T>::value &&
75-
!to_json_has_method<T> &&
74+
} && json_auto_supports_auto<T> && json_auto_has_mapped_type<T>::value &&
75+
!json_auto_has_method<T> &&
7676
std::is_same_v<typename T::key_type, JSON::String>;
7777

7878
/// @ingroup json
7979
/// If the value has a `.to_json()` method, always prefer that
8080
template <typename T>
81-
requires(to_json_has_method<T>)
81+
requires(json_auto_has_method<T>)
8282
auto to_json(const T &value) -> JSON {
8383
return value.to_json();
8484
}
@@ -124,7 +124,7 @@ template <typename T> auto to_json(const std::optional<T> &value) -> JSON {
124124
}
125125

126126
/// @ingroup json
127-
template <to_json_list_like T>
127+
template <json_auto_list_like T>
128128
auto to_json(typename T::const_iterator begin, typename T::const_iterator end)
129129
-> JSON {
130130
// TODO: Extend `make_array` to optionally take iterators, etc
@@ -137,7 +137,7 @@ auto to_json(typename T::const_iterator begin, typename T::const_iterator end)
137137
}
138138

139139
/// @ingroup json
140-
template <to_json_list_like T>
140+
template <json_auto_list_like T>
141141
auto to_json(
142142
typename T::const_iterator begin, typename T::const_iterator end,
143143
const std::function<JSON(const typename T::value_type &)> &callback)
@@ -152,12 +152,12 @@ auto to_json(
152152
}
153153

154154
/// @ingroup json
155-
template <to_json_list_like T> auto to_json(const T &value) -> JSON {
155+
template <json_auto_list_like T> auto to_json(const T &value) -> JSON {
156156
return to_json<T>(value.cbegin(), value.cend());
157157
}
158158

159159
/// @ingroup json
160-
template <to_json_list_like T>
160+
template <json_auto_list_like T>
161161
auto to_json(
162162
const T &value,
163163
const std::function<JSON(const typename T::value_type &)> &callback)
@@ -166,7 +166,7 @@ auto to_json(
166166
}
167167

168168
/// @ingroup json
169-
template <to_json_map_like T>
169+
template <json_auto_map_like T>
170170
auto to_json(typename T::const_iterator begin, typename T::const_iterator end)
171171
-> JSON {
172172
auto result{JSON::make_object()};
@@ -178,12 +178,12 @@ auto to_json(typename T::const_iterator begin, typename T::const_iterator end)
178178
}
179179

180180
/// @ingroup json
181-
template <to_json_map_like T> auto to_json(const T &value) -> JSON {
181+
template <json_auto_map_like T> auto to_json(const T &value) -> JSON {
182182
return to_json<T>(value.cbegin(), value.cend());
183183
}
184184

185185
/// @ingroup json
186-
template <to_json_map_like T>
186+
template <json_auto_map_like T>
187187
auto to_json(
188188
typename T::const_iterator begin, typename T::const_iterator end,
189189
const std::function<JSON(const typename T::mapped_type &)> &callback)
@@ -197,7 +197,7 @@ auto to_json(
197197
}
198198

199199
/// @ingroup json
200-
template <to_json_map_like T>
200+
template <json_auto_map_like T>
201201
auto to_json(
202202
const T &value,
203203
const std::function<JSON(const typename T::mapped_type &)> &callback)

0 commit comments

Comments
 (0)