Skip to content

Commit 9901b9a

Browse files
committed
try_decode_json
1 parent a585360 commit 9901b9a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

include/jsoncons/reflect/decode_traits.hpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ struct decode_traits<std::pair<T1, T2>, CharT>
155155
cursor.array_expected(ec);
156156
if (JSONCONS_UNLIKELY(ec))
157157
{
158-
return decode_result{decode_error{ec, cursor.line(), cursor.column()}};
158+
return result_type{decode_error{ec, cursor.line(), cursor.column()}};
159159
}
160160
if (cursor.current().event_type() != staj_event_type::begin_array)
161161
{
@@ -164,28 +164,28 @@ struct decode_traits<std::pair<T1, T2>, CharT>
164164
cursor.next(ec); // skip past array
165165
if (JSONCONS_UNLIKELY(ec))
166166
{
167-
return decode_result{decode_error{ec, cursor.line(), cursor.column()}};
167+
return result_type{decode_error{ec, cursor.line(), cursor.column()}};
168168
}
169169

170170
T1 v1 = decode_traits<T1,CharT>::try_decode(cursor, decoder, ec);
171171
if (JSONCONS_UNLIKELY(!v1.has_value())) {v1;}
172172
cursor.next(ec);
173173
if (JSONCONS_UNLIKELY(ec))
174174
{
175-
return decode_result{decode_error{ec, cursor.line(), cursor.column()}};
175+
return result_type{decode_error{ec, cursor.line(), cursor.column()}};
176176
}
177177
T2 v2 = decode_traits<T2, CharT>::try_decode(cursor, decoder, ec);
178178
if (JSONCONS_UNLIKELY(ec))
179179
{
180-
return decode_result{decode_error{ec, cursor.line(), cursor.column()}};
180+
return result_type{decode_error{ec, cursor.line(), cursor.column()}};
181181
}
182182
cursor.next(ec);
183183

184184
if (cursor.current().event_type() != staj_event_type::end_array)
185185
{
186186
return result_type{decode_error{conv_errc::not_pair, cursor.line(), cursor.column()}};
187187
}
188-
return decode_result{std::make_pair(v1, v2)};
188+
return result_type{std::make_pair(v1, v2)};
189189
}
190190
};
191191

@@ -211,7 +211,7 @@ struct decode_traits<T,CharT,
211211
cursor.array_expected(ec);
212212
if (JSONCONS_UNLIKELY(ec))
213213
{
214-
return decode_result{decode_error{ec, cursor.line(), cursor.column()}};
214+
return result_type{decode_error{ec, cursor.line(), cursor.column()}};
215215
}
216216
if (cursor.current().event_type() != staj_event_type::begin_array)
217217
{
@@ -221,7 +221,7 @@ struct decode_traits<T,CharT,
221221
while (cursor.current().event_type() != staj_event_type::end_array && !ec)
222222
{
223223
v.push_back(decode_traits<value_type,CharT>::try_decode(cursor, decoder, ec));
224-
if (JSONCONS_UNLIKELY(ec)) {return decode_result{decode_error{ec, cursor.line(), cursor.column()}};}
224+
if (JSONCONS_UNLIKELY(ec)) {return result_type{decode_error{ec, cursor.line(), cursor.column()}};}
225225
//std::cout << "read next 10\n";
226226
cursor.next(ec);
227227
}
@@ -370,7 +370,7 @@ struct decode_traits<T,CharT,
370370
cursor.array_expected(ec);
371371
if (JSONCONS_UNLIKELY(ec))
372372
{
373-
return decode_result{decode_error{ec, cursor.line(), cursor.column()}};
373+
return result_type{decode_error{ec, cursor.line(), cursor.column()}};
374374
}
375375
switch (cursor.current().event_type())
376376
{
@@ -393,7 +393,7 @@ struct decode_traits<T,CharT,
393393
}
394394
else
395395
{
396-
return decode_result{decode_error{ec, cursor.line(), cursor.column()}};
396+
return result_type{decode_error{ec, cursor.line(), cursor.column()}};
397397
}
398398
}
399399
case staj_event_type::begin_array:
@@ -445,7 +445,7 @@ struct decode_traits<T,CharT,
445445
cursor.array_expected(ec);
446446
if (JSONCONS_UNLIKELY(ec))
447447
{
448-
return decode_result{decode_error{ec, cursor.line(), cursor.column()}};
448+
return result_type{decode_error{ec, cursor.line(), cursor.column()}};
449449
}
450450
switch (cursor.current().event_type())
451451
{
@@ -458,7 +458,7 @@ struct decode_traits<T,CharT,
458458
}
459459
typed_array_visitor<T> visitor(v);
460460
cursor.read_to(visitor, ec);
461-
return decode_result{std::move(v)};
461+
return result_type{std::move(v)};
462462
}
463463
default:
464464
{
@@ -499,7 +499,7 @@ struct decode_traits<T,CharT,
499499
cursor.array_expected(ec);
500500
if (JSONCONS_UNLIKELY(ec))
501501
{
502-
return decode_result{decode_error{ec, cursor.line(), cursor.column()}};
502+
return result_type{decode_error{ec, cursor.line(), cursor.column()}};
503503
}
504504
if (cursor.current().event_type() != staj_event_type::begin_array)
505505
{
@@ -513,10 +513,10 @@ struct decode_traits<T,CharT,
513513
while (cursor.current().event_type() != staj_event_type::end_array && !ec)
514514
{
515515
v.insert(decode_traits<value_type,CharT>::try_decode(cursor, decoder, ec));
516-
if (JSONCONS_UNLIKELY(ec)) {return decode_result{decode_error{ec, cursor.line(), cursor.column()}};}
516+
if (JSONCONS_UNLIKELY(ec)) {return result_type{decode_error{ec, cursor.line(), cursor.column()}};}
517517
//std::cout << "cursor.next 20\n";
518518
cursor.next(ec);
519-
if (JSONCONS_UNLIKELY(ec)) {return decode_result{decode_error{ec, cursor.line(), cursor.column()}};}
519+
if (JSONCONS_UNLIKELY(ec)) {return result_type{decode_error{ec, cursor.line(), cursor.column()}};}
520520
}
521521
return result_type{std::move(v)};
522522
}

0 commit comments

Comments
 (0)