Rename private json_pointer::is_root as public json_pointer::empty for consistency with std::filesystem::path
This commit is contained in:
parent
5da757bbb3
commit
164e0e54d9
3 changed files with 10 additions and 10 deletions
|
@ -149,7 +149,7 @@ class json_pointer
|
||||||
*/
|
*/
|
||||||
std::string pop_back()
|
std::string pop_back()
|
||||||
{
|
{
|
||||||
if (JSON_UNLIKELY(is_root()))
|
if (JSON_UNLIKELY(empty()))
|
||||||
{
|
{
|
||||||
JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
|
JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
|
||||||
}
|
}
|
||||||
|
@ -173,16 +173,16 @@ class json_pointer
|
||||||
reference_tokens.push_back(std::move(token));
|
reference_tokens.push_back(std::move(token));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
/// return whether pointer points to the root document
|
/// return whether pointer points to the root document
|
||||||
bool is_root() const noexcept
|
bool empty() const noexcept
|
||||||
{
|
{
|
||||||
return reference_tokens.empty();
|
return reference_tokens.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
json_pointer top() const
|
json_pointer top() const
|
||||||
{
|
{
|
||||||
if (JSON_UNLIKELY(is_root()))
|
if (JSON_UNLIKELY(empty()))
|
||||||
{
|
{
|
||||||
JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
|
JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -7466,7 +7466,7 @@ class basic_json
|
||||||
const auto operation_add = [&result](json_pointer & ptr, basic_json val)
|
const auto operation_add = [&result](json_pointer & ptr, basic_json val)
|
||||||
{
|
{
|
||||||
// adding to the root of the target document means replacing it
|
// adding to the root of the target document means replacing it
|
||||||
if (ptr.is_root())
|
if (ptr.empty())
|
||||||
{
|
{
|
||||||
result = val;
|
result = val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11959,7 +11959,7 @@ class json_pointer
|
||||||
*/
|
*/
|
||||||
std::string pop_back()
|
std::string pop_back()
|
||||||
{
|
{
|
||||||
if (JSON_UNLIKELY(is_root()))
|
if (JSON_UNLIKELY(empty()))
|
||||||
{
|
{
|
||||||
JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
|
JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
|
||||||
}
|
}
|
||||||
|
@ -11983,16 +11983,16 @@ class json_pointer
|
||||||
reference_tokens.push_back(std::move(token));
|
reference_tokens.push_back(std::move(token));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
/// return whether pointer points to the root document
|
/// return whether pointer points to the root document
|
||||||
bool is_root() const noexcept
|
bool empty() const noexcept
|
||||||
{
|
{
|
||||||
return reference_tokens.empty();
|
return reference_tokens.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
json_pointer top() const
|
json_pointer top() const
|
||||||
{
|
{
|
||||||
if (JSON_UNLIKELY(is_root()))
|
if (JSON_UNLIKELY(empty()))
|
||||||
{
|
{
|
||||||
JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
|
JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
|
||||||
}
|
}
|
||||||
|
@ -20016,7 +20016,7 @@ class basic_json
|
||||||
const auto operation_add = [&result](json_pointer & ptr, basic_json val)
|
const auto operation_add = [&result](json_pointer & ptr, basic_json val)
|
||||||
{
|
{
|
||||||
// adding to the root of the target document means replacing it
|
// adding to the root of the target document means replacing it
|
||||||
if (ptr.is_root())
|
if (ptr.empty())
|
||||||
{
|
{
|
||||||
result = val;
|
result = val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue