Skip to content

Commit f3eb4f2

Browse files
committed
Remove utility namespace
1 parent ee1db74 commit f3eb4f2

35 files changed

+941
-947
lines changed

include/jsoncons/basic_json.hpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ namespace jsoncons {
613613
// long_string_storage
614614
struct long_string_storage
615615
{
616-
using heap_string_factory_type = jsoncons::utility::heap_string_factory<char_type,null_type,Allocator>;
616+
using heap_string_factory_type = jsoncons::heap_string_factory<char_type,null_type,Allocator>;
617617
using pointer = typename heap_string_factory_type::pointer;
618618

619619
uint8_t storage_kind_:4;
@@ -662,7 +662,7 @@ namespace jsoncons {
662662
// byte_string_storage
663663
struct byte_string_storage
664664
{
665-
using heap_string_factory_type = jsoncons::utility::heap_string_factory<uint8_t,uint64_t,Allocator>;
665+
using heap_string_factory_type = jsoncons::heap_string_factory<uint8_t,uint64_t,Allocator>;
666666
using pointer = typename heap_string_factory_type::pointer;
667667

668668
uint8_t storage_kind_:4;
@@ -927,14 +927,14 @@ namespace jsoncons {
927927

928928
typename long_string_storage::pointer create_long_string(const allocator_type& alloc, const char_type* data, std::size_t length)
929929
{
930-
using heap_string_factory_type = jsoncons::utility::heap_string_factory<char_type,null_type,Allocator>;
930+
using heap_string_factory_type = jsoncons::heap_string_factory<char_type,null_type,Allocator>;
931931
return heap_string_factory_type::create(data, length, null_type(), alloc);
932932
}
933933

934934
typename byte_string_storage::pointer create_byte_string(const allocator_type& alloc, const uint8_t* data, std::size_t length,
935935
uint64_t ext_tag)
936936
{
937-
using heap_string_factory_type = jsoncons::utility::heap_string_factory<uint8_t,uint64_t,Allocator>;
937+
using heap_string_factory_type = jsoncons::heap_string_factory<uint8_t,uint64_t,Allocator>;
938938
return heap_string_factory_type::create(data, length, ext_tag, alloc);
939939
}
940940

@@ -2596,7 +2596,7 @@ namespace jsoncons {
25962596
typename std::enable_if<ext_traits::is_unsigned_integer<IntegerType>::value && sizeof(uint64_t) < sizeof(IntegerType), int>::type = 0)
25972597
{
25982598
std::basic_string<CharT> s;
2599-
jsoncons::utility::from_integer(val, s);
2599+
jsoncons::from_integer(val, s);
26002600
if (s.length() <= short_string_storage::max_length)
26012601
{
26022602
construct<short_string_storage>(s.data(), static_cast<uint8_t>(s.length()), semantic_tag::bigint);
@@ -2627,7 +2627,7 @@ namespace jsoncons {
26272627
typename std::enable_if<ext_traits::is_signed_integer<IntegerType>::value && sizeof(int64_t) < sizeof(IntegerType),int>::type = 0)
26282628
{
26292629
std::basic_string<CharT> s;
2630-
jsoncons::utility::from_integer(val, s);
2630+
jsoncons::from_integer(val, s);
26312631
if (s.length() <= short_string_storage::max_length)
26322632
{
26332633
construct<short_string_storage>(s.data(), static_cast<uint8_t>(s.length()), semantic_tag::bigint);
@@ -2644,7 +2644,7 @@ namespace jsoncons {
26442644
typename std::enable_if<ext_traits::is_signed_integer<IntegerType>::value && sizeof(int64_t) < sizeof(IntegerType),int>::type = 0)
26452645
{
26462646
std::basic_string<CharT> s;
2647-
jsoncons::utility::from_integer(val, s);
2647+
jsoncons::from_integer(val, s);
26482648
if (s.length() <= short_string_storage::max_length)
26492649
{
26502650
construct<short_string_storage>(s.data(), static_cast<uint8_t>(s.length()), semantic_tag::bigint);
@@ -3619,7 +3619,7 @@ namespace jsoncons {
36193619
case json_storage_kind::long_str:
36203620
{
36213621
T val;
3622-
auto result = jsoncons::utility::to_integer<T>(as_string_view().data(), as_string_view().length(), val);
3622+
auto result = jsoncons::to_integer<T>(as_string_view().data(), as_string_view().length(), val);
36233623
if (!result)
36243624
{
36253625
return result_type(jsoncons::unexpect, conv_errc::not_integer);
@@ -3685,7 +3685,7 @@ namespace jsoncons {
36853685
case json_storage_kind::long_str:
36863686
{
36873687
T val;
3688-
auto result = jsoncons::utility::to_integer<T>(as_string_view().data(), as_string_view().length(), val);
3688+
auto result = jsoncons::to_integer<T>(as_string_view().data(), as_string_view().length(), val);
36893689
return result ? true : false;
36903690
}
36913691
case json_storage_kind::int64:
@@ -3730,7 +3730,7 @@ namespace jsoncons {
37303730
case json_storage_kind::long_str:
37313731
{
37323732
IntegerType val;
3733-
auto result = jsoncons::utility::to_integer<IntegerType>(as_string_view().data(), as_string_view().length(), val);
3733+
auto result = jsoncons::to_integer<IntegerType>(as_string_view().data(), as_string_view().length(), val);
37343734
return result ? true : false;
37353735
}
37363736
case json_storage_kind::int64:
@@ -3760,23 +3760,23 @@ namespace jsoncons {
37603760
std::size_t len = as_string_view().length();
37613761
if (JSONCONS_UNLIKELY(len > 2 && s[0] == '0' && (s[1] == 'x' || s[1] == 'X')))
37623762
{
3763-
auto result = jsoncons::utility::hexstr_to_double(s, len, x);
3763+
auto result = jsoncons::hexstr_to_double(s, len, x);
37643764
if (result.ec == std::errc::invalid_argument)
37653765
{
37663766
return result_type(jsoncons::unexpect, conv_errc::not_double);
37673767
}
37683768
}
37693769
else if (JSONCONS_UNLIKELY(len > 3 && s[0] == '-' && s[1] == '0' && (s[2] == 'x' || s[2] == 'X')))
37703770
{
3771-
auto result = jsoncons::utility::hexstr_to_double(s, len, x);
3771+
auto result = jsoncons::hexstr_to_double(s, len, x);
37723772
if (result.ec == std::errc::invalid_argument)
37733773
{
37743774
return result_type(jsoncons::unexpect, conv_errc::not_double);
37753775
}
37763776
}
37773777
else
37783778
{
3779-
auto result = jsoncons::utility::decstr_to_double(as_cstring(), as_string_view().length(), x);
3779+
auto result = jsoncons::decstr_to_double(as_cstring(), as_string_view().length(), x);
37803780
if (result.ec == std::errc::invalid_argument)
37813781
{
37823782
return result_type(jsoncons::unexpect, conv_errc::not_double);

include/jsoncons/item_event_visitor.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ namespace jsoncons {
12371237
if (level_stack_.back().is_key() || level_stack_.back().target() == target_t::buffer)
12381238
{
12391239
key_.clear();
1240-
jsoncons::utility::from_integer(value,key_);
1240+
jsoncons::from_integer(value,key_);
12411241
}
12421242

12431243
if (level_stack_.back().is_key())
@@ -1283,7 +1283,7 @@ namespace jsoncons {
12831283
if (level_stack_.back().is_key() || level_stack_.back().target() == target_t::buffer)
12841284
{
12851285
key_.clear();
1286-
jsoncons::utility::from_integer(value,key_);
1286+
jsoncons::from_integer(value,key_);
12871287
}
12881288

12891289
if (level_stack_.back().is_key())
@@ -1330,7 +1330,7 @@ namespace jsoncons {
13301330
{
13311331
key_.clear();
13321332
jsoncons::string_sink<string_type> sink(key_);
1333-
jsoncons::utility::write_double f{float_chars_format::general,0};
1333+
jsoncons::write_double f{float_chars_format::general,0};
13341334
double x = binary::decode_half(value);
13351335
f(x, sink);
13361336
}
@@ -1379,7 +1379,7 @@ namespace jsoncons {
13791379
{
13801380
key_.clear();
13811381
string_sink<string_type> sink(key_);
1382-
jsoncons::utility::write_double f{float_chars_format::general,0};
1382+
jsoncons::write_double f{float_chars_format::general,0};
13831383
f(value, sink);
13841384
}
13851385

include/jsoncons/json_encoder.hpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -122,26 +122,26 @@ namespace detail {
122122

123123
sink.push_back('\\');
124124
sink.push_back('u');
125-
sink.push_back(jsoncons::utility::to_hex_character(first >> 12 & 0x000F));
126-
sink.push_back(jsoncons::utility::to_hex_character(first >> 8 & 0x000F));
127-
sink.push_back(jsoncons::utility::to_hex_character(first >> 4 & 0x000F));
128-
sink.push_back(jsoncons::utility::to_hex_character(first & 0x000F));
125+
sink.push_back(jsoncons::to_hex_character(first >> 12 & 0x000F));
126+
sink.push_back(jsoncons::to_hex_character(first >> 8 & 0x000F));
127+
sink.push_back(jsoncons::to_hex_character(first >> 4 & 0x000F));
128+
sink.push_back(jsoncons::to_hex_character(first & 0x000F));
129129
sink.push_back('\\');
130130
sink.push_back('u');
131-
sink.push_back(jsoncons::utility::to_hex_character(second >> 12 & 0x000F));
132-
sink.push_back(jsoncons::utility::to_hex_character(second >> 8 & 0x000F));
133-
sink.push_back(jsoncons::utility::to_hex_character(second >> 4 & 0x000F));
134-
sink.push_back(jsoncons::utility::to_hex_character(second & 0x000F));
131+
sink.push_back(jsoncons::to_hex_character(second >> 12 & 0x000F));
132+
sink.push_back(jsoncons::to_hex_character(second >> 8 & 0x000F));
133+
sink.push_back(jsoncons::to_hex_character(second >> 4 & 0x000F));
134+
sink.push_back(jsoncons::to_hex_character(second & 0x000F));
135135
count += 12;
136136
}
137137
else
138138
{
139139
sink.push_back('\\');
140140
sink.push_back('u');
141-
sink.push_back(jsoncons::utility::to_hex_character(cp >> 12 & 0x000F));
142-
sink.push_back(jsoncons::utility::to_hex_character(cp >> 8 & 0x000F));
143-
sink.push_back(jsoncons::utility::to_hex_character(cp >> 4 & 0x000F));
144-
sink.push_back(jsoncons::utility::to_hex_character(cp & 0x000F));
141+
sink.push_back(jsoncons::to_hex_character(cp >> 12 & 0x000F));
142+
sink.push_back(jsoncons::to_hex_character(cp >> 8 & 0x000F));
143+
sink.push_back(jsoncons::to_hex_character(cp >> 4 & 0x000F));
144+
sink.push_back(jsoncons::to_hex_character(cp & 0x000F));
145145
count += 6;
146146
}
147147
}
@@ -318,7 +318,7 @@ namespace detail {
318318
Sink sink_;
319319
basic_json_encode_options<CharT> options_;
320320
char_type indent_char_{' '};
321-
jsoncons::utility::write_double fp_;
321+
jsoncons::write_double fp_;
322322

323323
std::vector<encoding_context,encoding_context_allocator_type> stack_;
324324
int indent_amount_{0};
@@ -897,7 +897,7 @@ namespace detail {
897897
break_line();
898898
}
899899
}
900-
std::size_t length = jsoncons::utility::from_integer(value, sink_);
900+
std::size_t length = jsoncons::from_integer(value, sink_);
901901
column_ += length;
902902
end_value();
903903
JSONCONS_VISITOR_RETURN;
@@ -919,7 +919,7 @@ namespace detail {
919919
break_line();
920920
}
921921
}
922-
std::size_t length = jsoncons::utility::from_integer(value, sink_);
922+
std::size_t length = jsoncons::from_integer(value, sink_);
923923
column_ += length;
924924
end_value();
925925
JSONCONS_VISITOR_RETURN;
@@ -1140,7 +1140,7 @@ namespace detail {
11401140

11411141
Sink sink_;
11421142
basic_json_encode_options<CharT> options_;
1143-
jsoncons::utility::write_double fp_;
1143+
jsoncons::write_double fp_;
11441144
std::vector<encoding_context,encoding_context_allocator_type> stack_;
11451145
int nesting_depth_;
11461146
public:
@@ -1546,7 +1546,7 @@ namespace detail {
15461546
{
15471547
sink_.push_back(',');
15481548
}
1549-
jsoncons::utility::from_integer(value, sink_);
1549+
jsoncons::from_integer(value, sink_);
15501550
if (!stack_.empty())
15511551
{
15521552
stack_.back().increment_count();
@@ -1563,7 +1563,7 @@ namespace detail {
15631563
{
15641564
sink_.push_back(',');
15651565
}
1566-
jsoncons::utility::from_integer(value, sink_);
1566+
jsoncons::from_integer(value, sink_);
15671567
if (!stack_.empty())
15681568
{
15691569
stack_.back().increment_count();

include/jsoncons/json_parser.hpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,7 +1751,7 @@ class basic_json_parser : public ser_context
17511751
position_ += (cur - hdr);
17521752
return cur;
17531753
}
1754-
if (jsoncons::utility::is_nonzero_digit(*cur))
1754+
if (jsoncons::is_nonzero_digit(*cur))
17551755
{
17561756
++cur;
17571757
goto integer;
@@ -1779,12 +1779,12 @@ class basic_json_parser : public ser_context
17791779
++cur;
17801780
goto fraction1;
17811781
}
1782-
if (jsoncons::utility::is_exp(*cur))
1782+
if (jsoncons::is_exp(*cur))
17831783
{
17841784
++cur;
17851785
goto exp1;
17861786
}
1787-
if (jsoncons::utility::is_digit(*cur))
1787+
if (jsoncons::is_digit(*cur))
17881788
{
17891789
err_handler_(json_errc::leading_zero, *this);
17901790
ec = json_errc::leading_zero;
@@ -1808,7 +1808,7 @@ class basic_json_parser : public ser_context
18081808
position_ += (cur - hdr);
18091809
return cur;
18101810
}
1811-
if (JSONCONS_UNLIKELY(!jsoncons::utility::is_digit(*cur)))
1811+
if (JSONCONS_UNLIKELY(!jsoncons::is_digit(*cur)))
18121812
{
18131813
break;
18141814
}
@@ -1819,7 +1819,7 @@ class basic_json_parser : public ser_context
18191819
++cur;
18201820
goto fraction1;
18211821
}
1822-
if (jsoncons::utility::is_exp(*cur))
1822+
if (jsoncons::is_exp(*cur))
18231823
{
18241824
++cur;
18251825
goto exp1;
@@ -1836,7 +1836,7 @@ class basic_json_parser : public ser_context
18361836
position_ += (cur - hdr);
18371837
return cur;
18381838
}
1839-
if (jsoncons::utility::is_digit(*cur))
1839+
if (jsoncons::is_digit(*cur))
18401840
{
18411841
++cur;
18421842
goto fraction2;
@@ -1857,13 +1857,13 @@ class basic_json_parser : public ser_context
18571857
position_ += (cur - hdr);
18581858
return cur;
18591859
}
1860-
if (JSONCONS_UNLIKELY(!jsoncons::utility::is_digit(*cur)))
1860+
if (JSONCONS_UNLIKELY(!jsoncons::is_digit(*cur)))
18611861
{
18621862
break;
18631863
}
18641864
++cur;
18651865
}
1866-
if (jsoncons::utility::is_exp(*cur))
1866+
if (jsoncons::is_exp(*cur))
18671867
{
18681868
++cur;
18691869
goto exp1;
@@ -1885,7 +1885,7 @@ class basic_json_parser : public ser_context
18851885
++cur;
18861886
goto exp2;
18871887
}
1888-
if (jsoncons::utility::is_digit(*cur))
1888+
if (jsoncons::is_digit(*cur))
18891889
{
18901890
++cur;
18911891
goto exp3;
@@ -1908,7 +1908,7 @@ class basic_json_parser : public ser_context
19081908
position_ += (cur - hdr);
19091909
return cur;
19101910
}
1911-
if (jsoncons::utility::is_digit(*cur))
1911+
if (jsoncons::is_digit(*cur))
19121912
{
19131913
++cur;
19141914
goto exp3;
@@ -1929,7 +1929,7 @@ class basic_json_parser : public ser_context
19291929
position_ += (cur - hdr);
19301930
return cur;
19311931
}
1932-
if (JSONCONS_UNLIKELY(!jsoncons::utility::is_digit(*cur)))
1932+
if (JSONCONS_UNLIKELY(!jsoncons::is_digit(*cur)))
19331933
{
19341934
break;
19351935
}
@@ -2458,7 +2458,7 @@ class basic_json_parser : public ser_context
24582458
void end_negative_value(basic_json_visitor<char_type>& visitor, std::error_code& ec)
24592459
{
24602460
int64_t val;
2461-
auto result = jsoncons::utility::dec_to_integer(buffer_.data(), buffer_.length(), val);
2461+
auto result = jsoncons::dec_to_integer(buffer_.data(), buffer_.length(), val);
24622462
if (result)
24632463
{
24642464
visitor.int64_value(val, semantic_tag::none, *this, ec);
@@ -2472,7 +2472,7 @@ class basic_json_parser : public ser_context
24722472
else
24732473
{
24742474
double d{0};
2475-
result = jsoncons::utility::decstr_to_double(&buffer_[0], buffer_.length(), d);
2475+
result = jsoncons::decstr_to_double(&buffer_[0], buffer_.length(), d);
24762476
if (JSONCONS_LIKELY(result))
24772477
{
24782478
visitor.double_value(d, semantic_tag::none, *this, ec);
@@ -2497,7 +2497,7 @@ class basic_json_parser : public ser_context
24972497
void end_positive_value(basic_json_visitor<char_type>& visitor, std::error_code& ec)
24982498
{
24992499
uint64_t val;
2500-
auto result = jsoncons::utility::dec_to_integer(buffer_.data(), buffer_.length(), val);
2500+
auto result = jsoncons::dec_to_integer(buffer_.data(), buffer_.length(), val);
25012501
if (result)
25022502
{
25032503
visitor.uint64_value(val, semantic_tag::none, *this, ec);
@@ -2511,7 +2511,7 @@ class basic_json_parser : public ser_context
25112511
else
25122512
{
25132513
double d{0};
2514-
result = jsoncons::utility::decstr_to_double(&buffer_[0], buffer_.length(), d);
2514+
result = jsoncons::decstr_to_double(&buffer_[0], buffer_.length(), d);
25152515
if (JSONCONS_LIKELY(result))
25162516
{
25172517
visitor.double_value(d, semantic_tag::none, *this, ec);
@@ -2541,7 +2541,7 @@ class basic_json_parser : public ser_context
25412541
else
25422542
{
25432543
double d{0};
2544-
auto result = jsoncons::utility::decstr_to_double(&buffer_[0], buffer_.length(), d);
2544+
auto result = jsoncons::decstr_to_double(&buffer_[0], buffer_.length(), d);
25452545
if (JSONCONS_LIKELY(result))
25462546
{
25472547
visitor.double_value(d, semantic_tag::none, *this, ec);

include/jsoncons/reflect/decode_traits.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ struct decode_traits<T,
691691
return result_type{jsoncons::unexpect, ec, cursor.line(), cursor.column()};
692692
}
693693
key_type n{0};
694-
auto r = jsoncons::utility::to_integer(s.data(), s.size(), n);
694+
auto r = jsoncons::to_integer(s.data(), s.size(), n);
695695
if (r.ec != std::errc{})
696696
{
697697
return result_type{jsoncons::unexpect, json_errc::invalid_number, cursor.line(), cursor.column()};

0 commit comments

Comments
 (0)