🎨 use Clang-Format
This commit is contained in:
77 files changed
+4290
-4393
No files matched your search
@@ -340,12 +340,12 @@ class binary_reader
|
||||
|
||||
default: // anything else not supported (yet)
|
||||
{
|
||||
std::array<char, 3> cr{{}};
|
||||
static_cast<void>((std::snprintf)(cr.data(),
|
||||
std::array<char, 3> cr{ {} };
|
||||
static_cast<void>((std::snprintf)(cr.data(), // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
cr.size(),
|
||||
"%.2hhX",
|
||||
static_cast<unsigned char>(element_type))); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
const std::string cr_str{cr.data()};
|
||||
static_cast<unsigned char>(element_type)));
|
||||
const std::string cr_str{ cr.data() };
|
||||
return sax->parse_error(element_type_parse_position,
|
||||
cr_str,
|
||||
parse_error::create(114, element_type_parse_position, concat("Unsupported BSON record type 0x", cr_str), nullptr));
|
||||
@@ -2970,10 +2970,10 @@ class binary_reader
|
||||
*/
|
||||
std::string get_token_string() const
|
||||
{
|
||||
std::array<char, 3> cr{{}};
|
||||
std::array<char, 3> cr{ {} };
|
||||
static_cast<void>(
|
||||
(std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(current))); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
return std::string{cr.data()};
|
||||
return std::string{ cr.data() };
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -3041,22 +3041,22 @@ class binary_reader
|
||||
#define JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_ make_array<char_int_type>('F', 'H', 'N', 'S', 'T', 'Z', '[', '{')
|
||||
|
||||
#define JSON_BINARY_READER_MAKE_BJD_TYPES_MAP_ \
|
||||
make_array<bjd_type>(bjd_type{'C', "char"}, \
|
||||
bjd_type{'D', "double"}, \
|
||||
bjd_type{'I', "int16"}, \
|
||||
bjd_type{'L', "int64"}, \
|
||||
bjd_type{'M', "uint64"}, \
|
||||
bjd_type{'U', "uint8"}, \
|
||||
bjd_type{'d', "single"}, \
|
||||
bjd_type{'i', "int8"}, \
|
||||
bjd_type{'l', "int32"}, \
|
||||
bjd_type{'m', "uint32"}, \
|
||||
bjd_type{'u', "uint16"})
|
||||
make_array<bjd_type>(bjd_type{ 'C', "char" }, \
|
||||
bjd_type{ 'D', "double" }, \
|
||||
bjd_type{ 'I', "int16" }, \
|
||||
bjd_type{ 'L', "int64" }, \
|
||||
bjd_type{ 'M', "uint64" }, \
|
||||
bjd_type{ 'U', "uint8" }, \
|
||||
bjd_type{ 'd', "single" }, \
|
||||
bjd_type{ 'i', "int8" }, \
|
||||
bjd_type{ 'l', "int32" }, \
|
||||
bjd_type{ 'm', "uint32" }, \
|
||||
bjd_type{ 'u', "uint16" })
|
||||
|
||||
JSON_PRIVATE_UNLESS_TESTED :
|
||||
// lookup tables
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
const decltype(JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_) bjd_optimized_type_markers = JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_;
|
||||
// lookup tables
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
const decltype(JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_) bjd_optimized_type_markers = JSON_BINARY_READER_MAKE_BJD_OPTIMIZED_TYPE_MARKERS_;
|
||||
|
||||
using bjd_type = std::pair<char_int_type, string_t>;
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-non-private-member-variables-in-classes)
|
||||
|
||||
@@ -338,7 +338,7 @@ class wide_string_input_adapter
|
||||
}
|
||||
|
||||
/// a buffer for UTF-8 bytes
|
||||
std::array<std::char_traits<char>::int_type, 4> utf8_bytes = {{0, 0, 0, 0}};
|
||||
std::array<std::char_traits<char>::int_type, 4> utf8_bytes = { { 0, 0, 0, 0 } };
|
||||
|
||||
/// index to the utf8_codes array for the next valid byte
|
||||
std::size_t utf8_bytes_index = 0;
|
||||
|
||||
@@ -568,7 +568,7 @@ class json_sax_dom_callback_parser
|
||||
// container
|
||||
if (!keep_stack.back())
|
||||
{
|
||||
return {false, nullptr};
|
||||
return { false, nullptr };
|
||||
}
|
||||
|
||||
// create value
|
||||
@@ -580,20 +580,20 @@ class json_sax_dom_callback_parser
|
||||
// do not handle this value if we just learnt it shall be discarded
|
||||
if (!keep)
|
||||
{
|
||||
return {false, nullptr};
|
||||
return { false, nullptr };
|
||||
}
|
||||
|
||||
if (ref_stack.empty())
|
||||
{
|
||||
root = std::move(value);
|
||||
return {true, &root};
|
||||
return { true, &root };
|
||||
}
|
||||
|
||||
// skip this value if we already decided to skip the parent
|
||||
// (https://github.com/nlohmann/json/issues/971#issuecomment-413678360)
|
||||
if (!ref_stack.back())
|
||||
{
|
||||
return {false, nullptr};
|
||||
return { false, nullptr };
|
||||
}
|
||||
|
||||
// we now only expect arrays and objects
|
||||
@@ -603,7 +603,7 @@ class json_sax_dom_callback_parser
|
||||
if (ref_stack.back()->is_array())
|
||||
{
|
||||
ref_stack.back()->m_data.m_value.array->emplace_back(std::move(value));
|
||||
return {true, &(ref_stack.back()->m_data.m_value.array->back())};
|
||||
return { true, &(ref_stack.back()->m_data.m_value.array->back()) };
|
||||
}
|
||||
|
||||
// object
|
||||
@@ -615,12 +615,12 @@ class json_sax_dom_callback_parser
|
||||
|
||||
if (!store_element)
|
||||
{
|
||||
return {false, nullptr};
|
||||
return { false, nullptr };
|
||||
}
|
||||
|
||||
JSON_ASSERT(object_element);
|
||||
*object_element = std::move(value);
|
||||
return {true, object_element};
|
||||
return { true, object_element };
|
||||
}
|
||||
|
||||
/// the parsed JSON value
|
||||
|
||||
@@ -173,7 +173,7 @@ class lexer : public lexer_base<BasicJsonType>
|
||||
JSON_ASSERT(current == 'u');
|
||||
int codepoint = 0;
|
||||
|
||||
const auto factors = {12u, 8u, 4u, 0u};
|
||||
const auto factors = { 12u, 8u, 4u, 0u };
|
||||
for (const auto factor : factors)
|
||||
{
|
||||
get();
|
||||
@@ -745,7 +745,7 @@ class lexer : public lexer_base<BasicJsonType>
|
||||
case 0xDE:
|
||||
case 0xDF:
|
||||
{
|
||||
if (JSON_HEDLEY_UNLIKELY(!next_byte_in_range({0x80, 0xBF})))
|
||||
if (JSON_HEDLEY_UNLIKELY(!next_byte_in_range({ 0x80, 0xBF })))
|
||||
{
|
||||
return token_type::parse_error;
|
||||
}
|
||||
@@ -755,7 +755,7 @@ class lexer : public lexer_base<BasicJsonType>
|
||||
// U+0800..U+0FFF: bytes E0 A0..BF 80..BF
|
||||
case 0xE0:
|
||||
{
|
||||
if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0xA0, 0xBF, 0x80, 0xBF}))))
|
||||
if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({ 0xA0, 0xBF, 0x80, 0xBF }))))
|
||||
{
|
||||
return token_type::parse_error;
|
||||
}
|
||||
@@ -779,7 +779,7 @@ class lexer : public lexer_base<BasicJsonType>
|
||||
case 0xEE:
|
||||
case 0xEF:
|
||||
{
|
||||
if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x80, 0xBF, 0x80, 0xBF}))))
|
||||
if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({ 0x80, 0xBF, 0x80, 0xBF }))))
|
||||
{
|
||||
return token_type::parse_error;
|
||||
}
|
||||
@@ -789,7 +789,7 @@ class lexer : public lexer_base<BasicJsonType>
|
||||
// U+D000..U+D7FF: bytes ED 80..9F 80..BF
|
||||
case 0xED:
|
||||
{
|
||||
if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x80, 0x9F, 0x80, 0xBF}))))
|
||||
if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({ 0x80, 0x9F, 0x80, 0xBF }))))
|
||||
{
|
||||
return token_type::parse_error;
|
||||
}
|
||||
@@ -799,7 +799,7 @@ class lexer : public lexer_base<BasicJsonType>
|
||||
// U+10000..U+3FFFF F0 90..BF 80..BF 80..BF
|
||||
case 0xF0:
|
||||
{
|
||||
if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x90, 0xBF, 0x80, 0xBF, 0x80, 0xBF}))))
|
||||
if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({ 0x90, 0xBF, 0x80, 0xBF, 0x80, 0xBF }))))
|
||||
{
|
||||
return token_type::parse_error;
|
||||
}
|
||||
@@ -811,7 +811,7 @@ class lexer : public lexer_base<BasicJsonType>
|
||||
case 0xF2:
|
||||
case 0xF3:
|
||||
{
|
||||
if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF}))))
|
||||
if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({ 0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF }))))
|
||||
{
|
||||
return token_type::parse_error;
|
||||
}
|
||||
@@ -821,7 +821,7 @@ class lexer : public lexer_base<BasicJsonType>
|
||||
// U+100000..U+10FFFF F4 80..8F 80..BF 80..BF
|
||||
case 0xF4:
|
||||
{
|
||||
if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({0x80, 0x8F, 0x80, 0xBF, 0x80, 0xBF}))))
|
||||
if (JSON_HEDLEY_UNLIKELY(!(next_byte_in_range({ 0x80, 0x8F, 0x80, 0xBF, 0x80, 0xBF }))))
|
||||
{
|
||||
return token_type::parse_error;
|
||||
}
|
||||
@@ -1453,9 +1453,9 @@ scan_number_done:
|
||||
if (static_cast<unsigned char>(c) <= '\x1F')
|
||||
{
|
||||
// escape control characters
|
||||
std::array<char, 9> cs{{}};
|
||||
static_cast<void>((
|
||||
std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c))); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
std::array<char, 9> cs{ {} };
|
||||
static_cast<void>(( // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c)));
|
||||
result += cs.data();
|
||||
}
|
||||
else
|
||||
@@ -1549,22 +1549,24 @@ scan_number_done:
|
||||
case 't':
|
||||
{
|
||||
std::array<char_type, 4> true_literal = {
|
||||
{static_cast<char_type>('t'), static_cast<char_type>('r'), static_cast<char_type>('u'), static_cast<char_type>('e')}};
|
||||
{ static_cast<char_type>('t'), static_cast<char_type>('r'), static_cast<char_type>('u'), static_cast<char_type>('e') }
|
||||
};
|
||||
return scan_literal(true_literal.data(), true_literal.size(), token_type::literal_true);
|
||||
}
|
||||
case 'f':
|
||||
{
|
||||
std::array<char_type, 5> false_literal = {{static_cast<char_type>('f'),
|
||||
static_cast<char_type>('a'),
|
||||
static_cast<char_type>('l'),
|
||||
static_cast<char_type>('s'),
|
||||
static_cast<char_type>('e')}};
|
||||
std::array<char_type, 5> false_literal = { { static_cast<char_type>('f'),
|
||||
static_cast<char_type>('a'),
|
||||
static_cast<char_type>('l'),
|
||||
static_cast<char_type>('s'),
|
||||
static_cast<char_type>('e') } };
|
||||
return scan_literal(false_literal.data(), false_literal.size(), token_type::literal_false);
|
||||
}
|
||||
case 'n':
|
||||
{
|
||||
std::array<char_type, 4> null_literal = {
|
||||
{static_cast<char_type>('n'), static_cast<char_type>('u'), static_cast<char_type>('l'), static_cast<char_type>('l')}};
|
||||
{ static_cast<char_type>('n'), static_cast<char_type>('u'), static_cast<char_type>('l'), static_cast<char_type>('l') }
|
||||
};
|
||||
return scan_literal(null_literal.data(), null_literal.size(), token_type::literal_null);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user