@@ -334,7 +334,8 @@ class basic_cbor_parser : public ser_context
334334 }
335335 else
336336 {
337- produce_end_multi_dim (visitor, ec);
337+ more_ = !cursor_mode_;
338+ state_stack_.pop_back ();
338339 }
339340 break ;
340341 }
@@ -477,7 +478,7 @@ class basic_cbor_parser : public ser_context
477478 {
478479 case jsoncons::cbor::detail::cbor_major_type::unsigned_integer:
479480 {
480- uint64_t val = get_uint64_value (ec);
481+ uint64_t val = read_uint64_value (ec);
481482 if (JSONCONS_UNLIKELY (ec))
482483 {
483484 return ;
@@ -513,7 +514,7 @@ class basic_cbor_parser : public ser_context
513514 case jsoncons::cbor::detail::cbor_major_type::byte_string:
514515 {
515516 read_byte_string_from_buffer read (byte_string_view (str.bytes ));
516- write_byte_string (read, visitor, ec);
517+ read_byte_string (read, visitor, ec);
517518 if (JSONCONS_UNLIKELY (ec))
518519 {
519520 return ;
@@ -543,7 +544,7 @@ class basic_cbor_parser : public ser_context
543544 }
544545 case jsoncons::cbor::detail::cbor_major_type::negative_integer:
545546 {
546- int64_t val = get_int64_value (ec);
547+ int64_t val = read_int64_value (ec);
547548 if (JSONCONS_UNLIKELY (ec))
548549 {
549550 return ;
@@ -564,7 +565,7 @@ class basic_cbor_parser : public ser_context
564565 case jsoncons::cbor::detail::cbor_major_type::byte_string:
565566 {
566567 read_byte_string_from_source read (this );
567- write_byte_string (read, visitor, ec);
568+ read_byte_string (read, visitor, ec);
568569 if (JSONCONS_UNLIKELY (ec))
569570 {
570571 return ;
@@ -625,7 +626,7 @@ class basic_cbor_parser : public ser_context
625626 break ;
626627 case 0x19 : // Half-Precision Float (two-byte IEEE 754)
627628 {
628- uint64_t val = get_uint64_value (ec);
629+ uint64_t val = read_uint64_value (ec);
629630 if (JSONCONS_UNLIKELY (ec))
630631 {
631632 return ;
@@ -637,7 +638,7 @@ class basic_cbor_parser : public ser_context
637638 case 0x1a : // Single-Precision Float (four-byte IEEE 754)
638639 case 0x1b : // Double-Precision Float (eight-byte IEEE 754)
639640 {
640- double val = get_double (ec);
641+ double val = read_double_value (ec);
641642 if (JSONCONS_UNLIKELY (ec))
642643 {
643644 return ;
@@ -693,12 +694,12 @@ class basic_cbor_parser : public ser_context
693694 case 40 : // row major storage
694695 is_multi_dim_ = true ;
695696 order_ = mdarray_order::row_major;
696- produce_begin_multi_dim (visitor, semantic_tag::multi_dim_row_major, ec);
697+ produce_begin_multi_dim (ec);
697698 break ;
698699 case 1040 : // column major storage
699700 is_multi_dim_ = true ;
700701 order_ = mdarray_order::column_major;
701- produce_begin_multi_dim (visitor, semantic_tag::multi_dim_column_major, ec);
702+ produce_begin_multi_dim (ec);
702703 break ;
703704 default :
704705 begin_array (visitor, info, ec);
@@ -751,7 +752,7 @@ class basic_cbor_parser : public ser_context
751752 }
752753 default : // definite length
753754 {
754- std::size_t len = get_size (ec);
755+ std::size_t len = read_size (ec);
755756 if (JSONCONS_UNLIKELY (ec))
756757 {
757758 return ;
@@ -808,7 +809,7 @@ class basic_cbor_parser : public ser_context
808809 }
809810 default : // definite_length
810811 {
811- std::size_t len = get_size (ec);
812+ std::size_t len = read_size (ec);
812813 if (JSONCONS_UNLIKELY (ec))
813814 {
814815 return ;
@@ -870,9 +871,9 @@ class basic_cbor_parser : public ser_context
870871
871872 }
872873
873- std::size_t get_size (std::error_code& ec)
874+ std::size_t read_size (std::error_code& ec)
874875 {
875- uint64_t u = get_uint64_value (ec);
876+ uint64_t u = read_uint64_value (ec);
876877 if (JSONCONS_UNLIKELY (ec))
877878 {
878879 return 0 ;
@@ -918,7 +919,7 @@ class basic_cbor_parser : public ser_context
918919 }
919920 default :
920921 {
921- std::size_t length = get_size (ec);
922+ std::size_t length = read_size (ec);
922923 if (JSONCONS_UNLIKELY (ec))
923924 {
924925 return ;
@@ -984,7 +985,7 @@ class basic_cbor_parser : public ser_context
984985 }
985986 default : // definite length
986987 {
987- std::size_t length = get_size (ec);
988+ std::size_t length = read_size (ec);
988989 if (JSONCONS_UNLIKELY (ec))
989990 {
990991 return ;
@@ -1004,7 +1005,7 @@ class basic_cbor_parser : public ser_context
10041005 }
10051006 }
10061007
1007- uint64_t get_uint64_value (std::error_code& ec)
1008+ uint64_t read_uint64_value (std::error_code& ec)
10081009 {
10091010 uint64_t val = 0 ;
10101011
@@ -1066,7 +1067,7 @@ class basic_cbor_parser : public ser_context
10661067 return val;
10671068 }
10681069
1069- int64_t get_int64_value (std::error_code& ec)
1070+ int64_t read_int64_value (std::error_code& ec)
10701071 {
10711072 int64_t val = 0 ;
10721073
@@ -1150,7 +1151,7 @@ class basic_cbor_parser : public ser_context
11501151
11511152 case jsoncons::cbor::detail::cbor_major_type::unsigned_integer:
11521153 {
1153- uint64_t x = get_uint64_value (ec);
1154+ uint64_t x = read_uint64_value (ec);
11541155 if (JSONCONS_UNLIKELY (ec))
11551156 {
11561157 return 0 ;
@@ -1174,7 +1175,7 @@ class basic_cbor_parser : public ser_context
11741175 return val;
11751176 }
11761177
1177- double get_double (std::error_code& ec)
1178+ double read_double_value (std::error_code& ec)
11781179 {
11791180 double val = 0 ;
11801181
@@ -1222,7 +1223,7 @@ class basic_cbor_parser : public ser_context
12221223
12231224 void read_decimal_fraction (string_type& result, std::error_code& ec)
12241225 {
1225- std::size_t size = get_size (ec);
1226+ std::size_t size = read_size (ec);
12261227 if (JSONCONS_UNLIKELY (ec))
12271228 {
12281229 return ;
@@ -1246,7 +1247,7 @@ class basic_cbor_parser : public ser_context
12461247 {
12471248 case jsoncons::cbor::detail::cbor_major_type::unsigned_integer:
12481249 {
1249- exponent = get_uint64_value (ec);
1250+ exponent = read_uint64_value (ec);
12501251 if (JSONCONS_UNLIKELY (ec))
12511252 {
12521253 return ;
@@ -1255,7 +1256,7 @@ class basic_cbor_parser : public ser_context
12551256 }
12561257 case jsoncons::cbor::detail::cbor_major_type::negative_integer:
12571258 {
1258- exponent = get_int64_value (ec);
1259+ exponent = read_int64_value (ec);
12591260 if (JSONCONS_UNLIKELY (ec))
12601261 {
12611262 return ;
@@ -1284,7 +1285,7 @@ class basic_cbor_parser : public ser_context
12841285 {
12851286 case jsoncons::cbor::detail::cbor_major_type::unsigned_integer:
12861287 {
1287- uint64_t val = get_uint64_value (ec);
1288+ uint64_t val = read_uint64_value (ec);
12881289 if (JSONCONS_UNLIKELY (ec))
12891290 {
12901291 return ;
@@ -1294,7 +1295,7 @@ class basic_cbor_parser : public ser_context
12941295 }
12951296 case jsoncons::cbor::detail::cbor_major_type::negative_integer:
12961297 {
1297- int64_t val = get_int64_value (ec);
1298+ int64_t val = read_int64_value (ec);
12981299 if (JSONCONS_UNLIKELY (ec))
12991300 {
13001301 return ;
@@ -1381,7 +1382,7 @@ class basic_cbor_parser : public ser_context
13811382
13821383 void read_bigfloat (string_type& str, std::error_code& ec)
13831384 {
1384- std::size_t size = get_size (ec);
1385+ std::size_t size = read_size (ec);
13851386 if (JSONCONS_UNLIKELY (ec))
13861387 {
13871388 return ;
@@ -1405,7 +1406,7 @@ class basic_cbor_parser : public ser_context
14051406 {
14061407 case jsoncons::cbor::detail::cbor_major_type::unsigned_integer:
14071408 {
1408- exponent = get_uint64_value (ec);
1409+ exponent = read_uint64_value (ec);
14091410 if (JSONCONS_UNLIKELY (ec))
14101411 {
14111412 return ;
@@ -1414,7 +1415,7 @@ class basic_cbor_parser : public ser_context
14141415 }
14151416 case jsoncons::cbor::detail::cbor_major_type::negative_integer:
14161417 {
1417- exponent = get_int64_value (ec);
1418+ exponent = read_int64_value (ec);
14181419 if (JSONCONS_UNLIKELY (ec))
14191420 {
14201421 return ;
@@ -1440,7 +1441,7 @@ class basic_cbor_parser : public ser_context
14401441 {
14411442 case jsoncons::cbor::detail::cbor_major_type::unsigned_integer:
14421443 {
1443- uint64_t val = get_uint64_value (ec);
1444+ uint64_t val = read_uint64_value (ec);
14441445 if (JSONCONS_UNLIKELY (ec))
14451446 {
14461447 return ;
@@ -1452,7 +1453,7 @@ class basic_cbor_parser : public ser_context
14521453 }
14531454 case jsoncons::cbor::detail::cbor_major_type::negative_integer:
14541455 {
1455- int64_t val = get_int64_value (ec);
1456+ int64_t val = read_int64_value (ec);
14561457 if (JSONCONS_UNLIKELY (ec))
14571458 {
14581459 return ;
@@ -1557,7 +1558,7 @@ class basic_cbor_parser : public ser_context
15571558
15581559 while (major_type == jsoncons::cbor::detail::cbor_major_type::semantic_tag)
15591560 {
1560- uint64_t val = get_uint64_value (ec);
1561+ uint64_t val = read_uint64_value (ec);
15611562 if (JSONCONS_UNLIKELY (ec))
15621563 {
15631564 return ;
@@ -1628,7 +1629,7 @@ class basic_cbor_parser : public ser_context
16281629 }
16291630
16301631 template <typename Read>
1631- void write_byte_string (Read read, item_event_visitor& visitor, std::error_code& ec)
1632+ void read_byte_string (Read read, item_event_visitor& visitor, std::error_code& ec)
16321633 {
16331634 if (other_tags_[item_tag])
16341635 {
@@ -2121,9 +2122,7 @@ class basic_cbor_parser : public ser_context
21212122 }
21222123 }
21232124
2124- void produce_begin_multi_dim (item_event_visitor& visitor,
2125- semantic_tag tag,
2126- std::error_code& ec)
2125+ void produce_begin_multi_dim (std::error_code& ec)
21272126 {
21282127 uint8_t b;
21292128 if (source_.read (&b, 1 ) == 0 )
@@ -2143,15 +2142,7 @@ class basic_cbor_parser : public ser_context
21432142 }
21442143
21452144 state_stack_.emplace_back (parse_mode::multi_dim, 0 );
2146- // visitor.begin_multi_dim(extents_, tag, *this, ec);
2147- more_ = !cursor_mode_;
2148- }
2149-
2150- void produce_end_multi_dim (item_event_visitor& visitor, std::error_code&)
2151- {
2152- // visitor.end_multi_dim(*this, ec);
21532145 more_ = !cursor_mode_;
2154- state_stack_.pop_back ();
21552146 }
21562147
21572148 void read_extents (uint8_t info, std::error_code& ec)
@@ -2176,7 +2167,7 @@ class basic_cbor_parser : public ser_context
21762167 }
21772168 else
21782169 {
2179- std::size_t extent_size = get_size (ec);
2170+ std::size_t extent_size = read_size (ec);
21802171 if (JSONCONS_UNLIKELY (ec))
21812172 {
21822173 return ;
@@ -2188,14 +2179,14 @@ class basic_cbor_parser : public ser_context
21882179 }
21892180 default :
21902181 {
2191- std::size_t size = get_size (ec);
2182+ std::size_t size = read_size (ec);
21922183 if (JSONCONS_UNLIKELY (ec))
21932184 {
21942185 return ;
21952186 }
21962187 for (std::size_t i = 0 ; more_ && i < size; ++i)
21972188 {
2198- std::size_t extent_size = get_size (ec);
2189+ std::size_t extent_size = read_size (ec);
21992190 if (JSONCONS_UNLIKELY (ec))
22002191 {
22012192 return ;
0 commit comments