1
0
mirror of https://github.com/nlohmann/json synced 2024-12-03 16:51:04 +00:00

🔨 fixed compilation error

This commit is contained in:
Niels Lohmann 2018-03-14 07:18:42 +01:00
parent abac6a0e84
commit 282bafae4f
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
2 changed files with 26 additions and 18 deletions

View File

@ -21,6 +21,8 @@ struct json_sax
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
/// type for floating-point numbers
using number_float_t = typename BasicJsonType::number_float_t;
/// type for strings
using string_t = typename BasicJsonType::string_t;
/// constant to indicate that no size limit is given for array or object
static constexpr auto no_limit = std::size_t(-1);
@ -58,14 +60,14 @@ struct json_sax
@param[in] s raw token value
@return whether parsing should proceed
*/
virtual bool number_float(number_float_t val, const std::string& s) = 0;
virtual bool number_float(number_float_t val, const string_t& s) = 0;
/*!
@brief a string was read
@param[in] val string value
@return whether parsing should proceed
*/
virtual bool string(std::string&& val) = 0;
virtual bool string(string_t&& val) = 0;
/*!
@brief the beginning of an object was read
@ -80,7 +82,7 @@ struct json_sax
@param[in] val object key
@return whether parsing should proceed
*/
virtual bool key(std::string&& val) = 0;
virtual bool key(string_t&& val) = 0;
/*!
@brief the end of an object was read
@ -135,6 +137,7 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
using number_integer_t = typename BasicJsonType::number_integer_t;
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
using number_float_t = typename BasicJsonType::number_float_t;
using string_t = typename BasicJsonType::string_t;
json_sax_dom_parser(BasicJsonType& r, const bool allow_exceptions_ = true)
: root(r), allow_exceptions(allow_exceptions_)
@ -164,13 +167,13 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
return true;
}
bool number_float(number_float_t val, const std::string&) override
bool number_float(number_float_t val, const string_t&) override
{
handle_value(val);
return true;
}
bool string(std::string&& val) override
bool string(string_t&& val) override
{
handle_value(val);
return true;
@ -189,7 +192,7 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
return true;
}
bool key(std::string&& val) override
bool key(string_t&& val) override
{
// add null at given key and store the reference for later
object_element = &(ref_stack.back()->m_value.object->operator[](val));
@ -308,6 +311,7 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
using number_integer_t = typename BasicJsonType::number_integer_t;
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
using number_float_t = typename BasicJsonType::number_float_t;
using string_t = typename BasicJsonType::string_t;
bool null() override
{
@ -329,12 +333,12 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
return true;
}
bool number_float(number_float_t, const std::string&) override
bool number_float(number_float_t, const string_t&) override
{
return true;
}
bool string(std::string&&) override
bool string(string_t&&) override
{
return true;
}
@ -344,7 +348,7 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
return true;
}
bool key(std::string&&) override
bool key(string_t&&) override
{
return true;
}

View File

@ -3157,6 +3157,8 @@ struct json_sax
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
/// type for floating-point numbers
using number_float_t = typename BasicJsonType::number_float_t;
/// type for strings
using string_t = typename BasicJsonType::string_t;
/// constant to indicate that no size limit is given for array or object
static constexpr auto no_limit = std::size_t(-1);
@ -3194,14 +3196,14 @@ struct json_sax
@param[in] s raw token value
@return whether parsing should proceed
*/
virtual bool number_float(number_float_t val, const std::string& s) = 0;
virtual bool number_float(number_float_t val, const string_t& s) = 0;
/*!
@brief a string was read
@param[in] val string value
@return whether parsing should proceed
*/
virtual bool string(std::string&& val) = 0;
virtual bool string(string_t&& val) = 0;
/*!
@brief the beginning of an object was read
@ -3216,7 +3218,7 @@ struct json_sax
@param[in] val object key
@return whether parsing should proceed
*/
virtual bool key(std::string&& val) = 0;
virtual bool key(string_t&& val) = 0;
/*!
@brief the end of an object was read
@ -3271,6 +3273,7 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
using number_integer_t = typename BasicJsonType::number_integer_t;
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
using number_float_t = typename BasicJsonType::number_float_t;
using string_t = typename BasicJsonType::string_t;
json_sax_dom_parser(BasicJsonType& r, const bool allow_exceptions_ = true)
: root(r), allow_exceptions(allow_exceptions_)
@ -3300,13 +3303,13 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
return true;
}
bool number_float(number_float_t val, const std::string&) override
bool number_float(number_float_t val, const string_t&) override
{
handle_value(val);
return true;
}
bool string(std::string&& val) override
bool string(string_t&& val) override
{
handle_value(val);
return true;
@ -3325,7 +3328,7 @@ class json_sax_dom_parser : public json_sax<BasicJsonType>
return true;
}
bool key(std::string&& val) override
bool key(string_t&& val) override
{
// add null at given key and store the reference for later
object_element = &(ref_stack.back()->m_value.object->operator[](val));
@ -3444,6 +3447,7 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
using number_integer_t = typename BasicJsonType::number_integer_t;
using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
using number_float_t = typename BasicJsonType::number_float_t;
using string_t = typename BasicJsonType::string_t;
bool null() override
{
@ -3465,12 +3469,12 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
return true;
}
bool number_float(number_float_t, const std::string&) override
bool number_float(number_float_t, const string_t&) override
{
return true;
}
bool string(std::string&&) override
bool string(string_t&&) override
{
return true;
}
@ -3480,7 +3484,7 @@ class json_sax_acceptor : public json_sax<BasicJsonType>
return true;
}
bool key(std::string&&) override
bool key(string_t&&) override
{
return true;
}