MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / top

Function top

dependencies/json/json.hpp:11624–11995  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11622{
11623template<typename BasicJsonType>
11624class json_pointer
11625{
11626 // allow basic_json to access private members
11627 NLOHMANN_BASIC_JSON_TPL_DECLARATION
11628 friend class basic_json;
11629
11630 public:
11631 /*!
11632 @brief create JSON pointer
11633
11634 Create a JSON pointer according to the syntax described in
11635 [Section 3 of RFC6901](https://tools.ietf.org/html/rfc6901#section-3).
11636
11637 @param[in] s string representing the JSON pointer; if omitted, the empty
11638 string is assumed which references the whole JSON value
11639
11640 @throw parse_error.107 if the given JSON pointer @a s is nonempty and does
11641 not begin with a slash (`/`); see example below
11642
11643 @throw parse_error.108 if a tilde (`~`) in the given JSON pointer @a s is
11644 not followed by `0` (representing `~`) or `1` (representing `/`); see
11645 example below
11646
11647 @liveexample{The example shows the construction several valid JSON pointers
11648 as well as the exceptional behavior.,json_pointer}
11649
11650 @since version 2.0.0
11651 */
11652 explicit json_pointer(const std::string& s = "")
11653 : reference_tokens(split(s))
11654 {}
11655
11656 /*!
11657 @brief return a string representation of the JSON pointer
11658
11659 @invariant For each JSON pointer `ptr`, it holds:
11660 @code {.cpp}
11661 ptr == json_pointer(ptr.to_string());
11662 @endcode
11663
11664 @return a string representation of the JSON pointer
11665
11666 @liveexample{The example shows the result of `to_string`.,json_pointer__to_string}
11667
11668 @since version 2.0.0
11669 */
11670 std::string to_string() const
11671 {
11672 return std::accumulate(reference_tokens.begin(), reference_tokens.end(),
11673 std::string{},
11674 [](const std::string & a, const std::string & b)
11675 {
11676 return a + "/" + escape(b);
11677 });
11678 }
11679
11680 /// @copydoc to_string()
11681 operator std::string() const

Callers

nothing calls this directly

Calls 2

emptyFunction · 0.70
createFunction · 0.70

Tested by

no test coverage detected