mirror of
https://github.com/nlohmann/json.git
synced 2025-07-31 10:24:23 +03:00
📝 added documentation
This commit is contained in:
@ -56,8 +56,7 @@ class json_pointer
|
||||
|
||||
@return a string representation of the JSON pointer
|
||||
|
||||
@liveexample{The example shows the result of `to_string`.,
|
||||
json_pointer__to_string}
|
||||
@liveexample{The example shows the result of `to_string`.,json_pointer__to_string}
|
||||
|
||||
@since version 2.0.0
|
||||
*/
|
||||
@ -79,6 +78,19 @@ class json_pointer
|
||||
|
||||
/*!
|
||||
@brief append another JSON pointer at the end of this JSON pointer
|
||||
|
||||
@param[in] ptr JSON pointer to append
|
||||
@return JSON pointer with @a ptr appended
|
||||
|
||||
@liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add}
|
||||
|
||||
@complexity Linear in the length of @a ptr.
|
||||
|
||||
@sa @ref operator/=(std::string) to append a reference token
|
||||
@sa @ref operator/=(std::size_t) to append an array index
|
||||
@sa @ref operator/(const json_pointer&, const json_pointer&) for a binary operator
|
||||
|
||||
@since version 3.6.0
|
||||
*/
|
||||
json_pointer& operator/=(const json_pointer& ptr)
|
||||
{
|
||||
@ -88,14 +100,44 @@ class json_pointer
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// @copydoc push_back(std::string&&)
|
||||
/*!
|
||||
@brief append an unescaped reference token at the end of this JSON pointer
|
||||
|
||||
@param[in] token reference token to append
|
||||
@return JSON pointer with @a token appended without escaping @a token
|
||||
|
||||
@liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add}
|
||||
|
||||
@complexity Amortized constant.
|
||||
|
||||
@sa @ref operator/=(const json_pointer&) to append a JSON pointer
|
||||
@sa @ref operator/=(std::size_t) to append an array index
|
||||
@sa @ref operator/(const json_pointer&, std::size_t) for a binary operator
|
||||
|
||||
@since version 3.6.0
|
||||
*/
|
||||
json_pointer& operator/=(std::string token)
|
||||
{
|
||||
push_back(std::move(token));
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// @copydoc operator/=(std::string)
|
||||
/*!
|
||||
@brief append an array index at the end of this JSON pointer
|
||||
|
||||
@param[in] array_index array index ot append
|
||||
@return JSON pointer with @a array_index appended
|
||||
|
||||
@liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add}
|
||||
|
||||
@complexity Amortized constant.
|
||||
|
||||
@sa @ref operator/=(const json_pointer&) to append a JSON pointer
|
||||
@sa @ref operator/=(std::string) to append a reference token
|
||||
@sa @ref operator/(const json_pointer&, std::string) for a binary operator
|
||||
|
||||
@since version 3.6.0
|
||||
*/
|
||||
json_pointer& operator/=(std::size_t array_index)
|
||||
{
|
||||
return *this /= std::to_string(array_index);
|
||||
@ -103,15 +145,39 @@ class json_pointer
|
||||
|
||||
/*!
|
||||
@brief create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer
|
||||
|
||||
@param[in] lhs JSON pointer
|
||||
@param[in] rhs JSON pointer
|
||||
@return a new JSON pointer with @a rhs appended to @a lhs
|
||||
|
||||
@liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary}
|
||||
|
||||
@complexity Linear in the length of @a lhs and @a rhs.
|
||||
|
||||
@sa @ref operator/=(const json_pointer&) to append a JSON pointer
|
||||
|
||||
@since version 3.6.0
|
||||
*/
|
||||
friend json_pointer operator/(const json_pointer& left_ptr,
|
||||
const json_pointer& right_ptr)
|
||||
friend json_pointer operator/(const json_pointer& lhs,
|
||||
const json_pointer& rhs)
|
||||
{
|
||||
return json_pointer(left_ptr) /= right_ptr;
|
||||
return json_pointer(lhs) /= rhs;
|
||||
}
|
||||
|
||||
/*!
|
||||
@brief create a new JSON pointer by appending the unescaped token at the end of the JSON pointer
|
||||
|
||||
@param[in] ptr JSON pointer
|
||||
@param[in] token reference token
|
||||
@return a new JSON pointer with unescaped @a token appended to @a ptr
|
||||
|
||||
@liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary}
|
||||
|
||||
@complexity Linear in the length of @a ptr.
|
||||
|
||||
@sa @ref operator/=(std::string) to append a reference token
|
||||
|
||||
@since version 3.6.0
|
||||
*/
|
||||
friend json_pointer operator/(const json_pointer& ptr, std::string token)
|
||||
{
|
||||
@ -120,10 +186,22 @@ class json_pointer
|
||||
|
||||
/*!
|
||||
@brief create a new JSON pointer by appending the array-index-token at the end of the JSON pointer
|
||||
|
||||
@param[in] ptr JSON pointer
|
||||
@param[in] array_index array index
|
||||
@return a new JSON pointer with @a array_index appended to @a ptr
|
||||
|
||||
@liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary}
|
||||
|
||||
@complexity Linear in the length of @a ptr.
|
||||
|
||||
@sa @ref operator/=(std::size_t) to append an array index
|
||||
|
||||
@since version 3.6.0
|
||||
*/
|
||||
friend json_pointer operator/(const json_pointer& lhs, std::size_t array_index)
|
||||
friend json_pointer operator/(const json_pointer& ptr, std::size_t array_index)
|
||||
{
|
||||
return json_pointer(lhs) /= array_index;
|
||||
return json_pointer(ptr) /= array_index;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -790,12 +868,34 @@ class json_pointer
|
||||
return result;
|
||||
}
|
||||
|
||||
/*!
|
||||
@brief compares two JSON pointers for equality
|
||||
|
||||
@param[in] lhs JSON pointer to compare
|
||||
@param[in] rhs JSON pointer to compare
|
||||
@return whether @a lhs is equal to @a rhs
|
||||
|
||||
@complexity Linear in the length of the JSON pointer
|
||||
|
||||
@exceptionsafety No-throw guarantee: this function never throws exceptions.
|
||||
*/
|
||||
friend bool operator==(json_pointer const& lhs,
|
||||
json_pointer const& rhs) noexcept
|
||||
{
|
||||
return lhs.reference_tokens == rhs.reference_tokens;
|
||||
}
|
||||
|
||||
/*!
|
||||
@brief compares two JSON pointers for inequality
|
||||
|
||||
@param[in] lhs JSON pointer to compare
|
||||
@param[in] rhs JSON pointer to compare
|
||||
@return whether @a lhs is not equal @a rhs
|
||||
|
||||
@complexity Linear in the length of the JSON pointer
|
||||
|
||||
@exceptionsafety No-throw guarantee: this function never throws exceptions.
|
||||
*/
|
||||
friend bool operator!=(json_pointer const& lhs,
|
||||
json_pointer const& rhs) noexcept
|
||||
{
|
||||
|
Reference in New Issue
Block a user