Skip to content

Commit d722eab

Browse files
committed
decode_traits -> deserializer, encode_traits -> serializer
1 parent 1e04c69 commit d722eab

17 files changed

Lines changed: 133 additions & 133 deletions

include/jsoncons/decode_json.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ try_decode_json(const StringViewLike& s,
6565
{
6666
return result_type{jsoncons::unexpect, ec, cursor.line(), cursor.column()};
6767
}
68-
return reflect::deserializer<T>::try_deserialize(make_alloc_set(), cursor);
68+
return reflect::deserializer<T>::deserialize(make_alloc_set(), cursor);
6969
}
7070

7171
template <typename T,typename CharT>
@@ -105,7 +105,7 @@ try_decode_json(std::basic_istream<CharT>& is,
105105
{
106106
return result_type{jsoncons::unexpect, ec, cursor.line(), cursor.column()};
107107
}
108-
return reflect::deserializer<T>::try_deserialize(make_alloc_set(), cursor);
108+
return reflect::deserializer<T>::deserialize(make_alloc_set(), cursor);
109109
}
110110

111111
template <typename T,typename InputIt>
@@ -150,7 +150,7 @@ try_decode_json(InputIt first, InputIt last,
150150
{
151151
return result_type{jsoncons::unexpect, ec, cursor.line(), cursor.column()};
152152
}
153-
return reflect::deserializer<T>::try_deserialize(make_alloc_set(), cursor);
153+
return reflect::deserializer<T>::deserialize(make_alloc_set(), cursor);
154154
}
155155

156156
// With leading allocator_set parameter
@@ -200,7 +200,7 @@ try_decode_json(const allocator_set<Alloc,TempAlloc>& aset,
200200
{
201201
return result_type{jsoncons::unexpect, ec, cursor.line(), cursor.column()};
202202
}
203-
return reflect::deserializer<T>::try_deserialize(aset, cursor);
203+
return reflect::deserializer<T>::deserialize(aset, cursor);
204204
}
205205

206206
template <typename T,typename CharT,typename Alloc,typename TempAlloc >
@@ -251,7 +251,7 @@ try_decode_json(const allocator_set<Alloc,TempAlloc>& aset,
251251
{
252252
return result_type{jsoncons::unexpect, ec, cursor.line(), cursor.column()};
253253
}
254-
return reflect::deserializer<value_type>::try_deserialize(aset, cursor);
254+
return reflect::deserializer<value_type>::deserialize(aset, cursor);
255255
}
256256

257257
template <typename T, typename... Args>

include/jsoncons/encode_json.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ template <typename T,typename CharT>
3131
typename std::enable_if<!ext_traits::is_basic_json<T>::value,write_result>::type
3232
try_encode_json(const T& val, basic_json_visitor<CharT>& encoder)
3333
{
34-
auto r = reflect::serializer<T>::try_serialize(make_alloc_set(), val, encoder);
34+
auto r = reflect::serializer<T>::serialize(make_alloc_set(), val, encoder);
3535
encoder.flush();
3636
return r;
3737
}
@@ -49,7 +49,7 @@ typename std::enable_if<!ext_traits::is_basic_json<T>::value, write_result>::typ
4949
try_encode_json(const allocator_set<Alloc, TempAlloc>& aset,
5050
const T& val, basic_json_visitor<CharT>& encoder)
5151
{
52-
auto r = reflect::serializer<T>::try_serialize(aset, val, encoder);
52+
auto r = reflect::serializer<T>::serialize(aset, val, encoder);
5353
encoder.flush();
5454
return r;
5555
}

include/jsoncons/reflect/deserializer.hpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct deserializer
4545
using result_type = read_result<value_type>;
4646

4747
template <typename Alloc,typename TempAlloc,typename CharT>
48-
static result_type try_deserialize(const allocator_set<Alloc,TempAlloc>& aset,
48+
static result_type deserialize(const allocator_set<Alloc,TempAlloc>& aset,
4949
basic_staj_cursor<CharT>& cursor)
5050
{
5151
std::size_t line = cursor.line();
@@ -76,7 +76,7 @@ struct deserializer<T,
7676
using result_type = read_result<value_type>;
7777

7878
template <typename Alloc,typename TempAlloc,typename CharT>
79-
static result_type try_deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
79+
static result_type deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
8080
{
8181
auto j_result = try_to_json<T>(aset, cursor);
8282
if (JSONCONS_UNLIKELY(!j_result))
@@ -100,7 +100,7 @@ struct deserializer<T,
100100
using result_type = read_result<value_type>;
101101

102102
template <typename Alloc,typename TempAlloc,typename CharT>
103-
static result_type try_deserialize(const allocator_set<Alloc,TempAlloc>&, basic_staj_cursor<CharT>& cursor)
103+
static result_type deserialize(const allocator_set<Alloc,TempAlloc>&, basic_staj_cursor<CharT>& cursor)
104104
{
105105
std::error_code ec;
106106

@@ -121,7 +121,7 @@ struct deserializer<T,
121121
using string_view_type = basic_string_view<char_type>;
122122

123123
template <typename Alloc,typename TempAlloc,typename CharT>
124-
static result_type try_deserialize(const allocator_set<Alloc,TempAlloc>& aset,
124+
static result_type deserialize(const allocator_set<Alloc,TempAlloc>& aset,
125125
basic_staj_cursor<CharT>& cursor,
126126
typename std::enable_if<std::is_same<typename T::value_type,CharT>::value,int>::type = 0)
127127
{
@@ -137,7 +137,7 @@ struct deserializer<T,
137137
}
138138

139139
template <typename Alloc,typename TempAlloc,typename CharT>
140-
static result_type try_deserialize(const allocator_set<Alloc,TempAlloc>& aset,
140+
static result_type deserialize(const allocator_set<Alloc,TempAlloc>& aset,
141141
basic_staj_cursor<CharT>& cursor,
142142
typename std::enable_if<!std::is_same<typename T::value_type,CharT>::value,int>::type = 0)
143143
{
@@ -166,7 +166,7 @@ struct deserializer<std::pair<T1, T2>>
166166
using result_type = read_result<value_type>;
167167

168168
template <typename Alloc,typename TempAlloc,typename CharT>
169-
static result_type try_deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
169+
static result_type deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
170170
{
171171
std::error_code ec;
172172

@@ -185,7 +185,7 @@ struct deserializer<std::pair<T1, T2>>
185185
return result_type(jsoncons::unexpect, ec, cursor.line(), cursor.column());
186186
}
187187

188-
auto r1 = deserializer<T1>::try_deserialize(aset, cursor);
188+
auto r1 = deserializer<T1>::deserialize(aset, cursor);
189189
if (JSONCONS_UNLIKELY(!r1))
190190
{
191191
return result_type(jsoncons::unexpect, r1.error());
@@ -195,7 +195,7 @@ struct deserializer<std::pair<T1, T2>>
195195
{
196196
return result_type(jsoncons::unexpect, ec, cursor.line(), cursor.column());
197197
}
198-
auto r2 = deserializer<T2>::try_deserialize(aset, cursor);
198+
auto r2 = deserializer<T2>::deserialize(aset, cursor);
199199
if (JSONCONS_UNLIKELY(!r2))
200200
{
201201
return result_type(jsoncons::unexpect, r2.error());
@@ -228,7 +228,7 @@ struct deserializer<T,
228228
using result_type = read_result<value_type>;
229229

230230
template <typename Alloc,typename TempAlloc,typename CharT>
231-
static result_type try_deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
231+
static result_type deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
232232
{
233233
std::error_code ec;
234234
T v(jsoncons::make_obj_using_allocator<T>(aset.get_allocator()));
@@ -246,7 +246,7 @@ struct deserializer<T,
246246
if (JSONCONS_UNLIKELY(ec)) { return result_type(jsoncons::unexpect, ec, cursor.line(), cursor.column()); }
247247
while (cursor.current().event_type() != staj_events::end_array && !ec)
248248
{
249-
auto r = deserializer<element_type>::try_deserialize(aset, cursor);
249+
auto r = deserializer<element_type>::deserialize(aset, cursor);
250250
if (!r)
251251
{
252252
return result_type(jsoncons::unexpect, r.error());
@@ -272,7 +272,7 @@ struct deserializer<T,
272272
using result_type = read_result<value_type>;
273273

274274
template <typename Alloc,typename TempAlloc,typename CharT>
275-
static result_type try_deserialize(const allocator_set<Alloc,TempAlloc>& aset,
275+
static result_type deserialize(const allocator_set<Alloc,TempAlloc>& aset,
276276
basic_staj_cursor<CharT>& cursor)
277277
{
278278
std::error_code ec;
@@ -322,7 +322,7 @@ struct deserializer<T,
322322
cursor.next(ec);
323323
while (cursor.current().event_type() != staj_events::end_array && !ec)
324324
{
325-
auto r = deserializer<element_type>::try_deserialize(aset, cursor);
325+
auto r = deserializer<element_type>::deserialize(aset, cursor);
326326
if (!r)
327327
{
328328
return result_type(jsoncons::unexpect, r.error());
@@ -370,7 +370,7 @@ struct deserializer<T,
370370
using result_type = read_result<value_type>;
371371

372372
template <typename Alloc,typename TempAlloc,typename CharT>
373-
static result_type try_deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
373+
static result_type deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
374374
{
375375
std::error_code ec;
376376

@@ -390,7 +390,7 @@ struct deserializer<T,
390390
cursor.next(ec);
391391
while (cursor.current().event_type() != staj_events::end_array && !ec)
392392
{
393-
auto r = deserializer<element_type>::try_deserialize(aset, cursor);
393+
auto r = deserializer<element_type>::deserialize(aset, cursor);
394394
if (!r)
395395
{
396396
return result_type(jsoncons::unexpect, r.error());
@@ -435,7 +435,7 @@ struct deserializer<T,
435435
using result_type = read_result<value_type>;
436436

437437
template <typename Alloc,typename TempAlloc,typename CharT>
438-
static result_type try_deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
438+
static result_type deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
439439
{
440440
std::error_code ec;
441441
T v{jsoncons::make_obj_using_allocator<T>(aset.get_allocator())};
@@ -456,7 +456,7 @@ struct deserializer<T,
456456
cursor.next(ec);
457457
while (cursor.current().event_type() != staj_events::end_array && !ec)
458458
{
459-
auto r = deserializer<element_type>::try_deserialize(aset, cursor);
459+
auto r = deserializer<element_type>::deserialize(aset, cursor);
460460
if (!r)
461461
{
462462
return result_type(jsoncons::unexpect, r.error());
@@ -494,7 +494,7 @@ struct deserializer<T,
494494
using result_type = read_result<value_type>;
495495

496496
template <typename Alloc,typename TempAlloc,typename CharT>
497-
static result_type try_deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
497+
static result_type deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
498498
{
499499
std::error_code ec;
500500

@@ -518,7 +518,7 @@ struct deserializer<T,
518518
auto it = v.begin();
519519
while (cursor.current().event_type() != staj_events::end_array)
520520
{
521-
auto r = deserializer<element_type>::try_deserialize(aset, cursor);
521+
auto r = deserializer<element_type>::deserialize(aset, cursor);
522522
if (!r)
523523
{
524524
return result_type(jsoncons::unexpect, r.error());
@@ -558,7 +558,7 @@ struct deserializer<std::array<T,N>>
558558
using result_type = read_result<value_type>;
559559

560560
template <typename Alloc,typename TempAlloc,typename CharT>
561-
static result_type try_deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
561+
static result_type deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
562562
{
563563
std::error_code ec;
564564

@@ -575,7 +575,7 @@ struct deserializer<std::array<T,N>>
575575
cursor.next(ec);
576576
for (std::size_t i = 0; i < N && cursor.current().event_type() != staj_events::end_array && !ec; ++i)
577577
{
578-
auto r = deserializer<element_type>::try_deserialize(aset, cursor);
578+
auto r = deserializer<element_type>::deserialize(aset, cursor);
579579
if (!r)
580580
{
581581
return result_type(jsoncons::unexpect, r.error());
@@ -605,7 +605,7 @@ struct deserializer<T,
605605
using result_type = read_result<value_type>;
606606

607607
template <typename Alloc,typename TempAlloc,typename CharT>
608-
static result_type try_deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
608+
static result_type deserialize(const allocator_set<Alloc,TempAlloc>& aset, basic_staj_cursor<CharT>& cursor)
609609
{
610610
std::error_code ec;
611611

@@ -626,7 +626,7 @@ struct deserializer<T,
626626
{
627627
return result_type{jsoncons::unexpect, json_errc::expected_key, cursor.line(), cursor.column()};
628628
}
629-
auto r0 = deserializer<key_type>::try_deserialize(aset, cursor);
629+
auto r0 = deserializer<key_type>::deserialize(aset, cursor);
630630
if (!r0)
631631
{
632632
return result_type(jsoncons::unexpect, r0.error());
@@ -637,7 +637,7 @@ struct deserializer<T,
637637
{
638638
return result_type{jsoncons::unexpect, ec, cursor.line(), cursor.column()};
639639
}
640-
auto r1 = deserializer<mapped_type>::try_deserialize(aset, cursor);
640+
auto r1 = deserializer<mapped_type>::deserialize(aset, cursor);
641641
if (!r1)
642642
{
643643
return result_type(jsoncons::unexpect, r1.error());

0 commit comments

Comments
 (0)