WPILibC++ 2023.4.3
wpi::json_pointer Class Reference

#include </home/runner/work/allwpilib/allwpilib/wpiutil/src/main/native/thirdparty/json/include/wpi/json.h>

Public Member Functions

 json_pointer (std::string_view s={})
 create JSON pointer More...
 
std::string to_string () const noexcept
 return a string representation of the JSON pointer More...
 
 operator std::string () const
 return a string representation of the JSON pointer More...
 

Static Public Member Functions

static int array_index (std::string_view s)
 

Friends

class json
 
class JsonTest
 
bool operator== (json_pointer const &lhs, json_pointer const &rhs) noexcept
 
bool operator!= (json_pointer const &lhs, json_pointer const &rhs) noexcept
 

Constructor & Destructor Documentation

◆ json_pointer()

wpi::json_pointer::json_pointer ( std::string_view  s = {})
inlineexplicit

create JSON pointer

Create a JSON pointer according to the syntax described in Section 3 of RFC6901.

Parameters
[in]sstring representing the JSON pointer; if omitted, the empty string is assumed which references the whole JSON value
Exceptions
parse_error.107if the given JSON pointer s is nonempty and does not begin with a slash (/); see example below
parse_error.108if a tilde (~) in the given JSON pointer s is not followed by 0 (representing ~) or 1 (representing /); see example below

@liveexample{The example shows the construction several valid JSON pointers as well as the exceptional behavior.,json_pointer}

Since
version 2.0.0

Member Function Documentation

◆ array_index()

static int wpi::json_pointer::array_index ( std::string_view  s)
static
Parameters
[in]sreference token to be converted into an array index
Returns
integer representation of s
Exceptions
out_of_range.404if string s could not be converted to an integer

◆ operator std::string()

wpi::json_pointer::operator std::string ( ) const
inline

return a string representation of the JSON pointer

Invariant
For each JSON pointer ptr, it holds:
ptr == json_pointer(ptr.to_string());
json_pointer(std::string_view s={})
create JSON pointer
Definition: json.h:2350
auto ptr(T p) -> const void *
\rst Converts p to const void* for pointer formatting.
Definition: format.h:3808
Returns
a string representation of the JSON pointer

@liveexample{The example shows the result of to_string., json_pointer__to_string}

Since
version 2.0.0

◆ to_string()

std::string wpi::json_pointer::to_string ( ) const
noexcept

return a string representation of the JSON pointer

Invariant
For each JSON pointer ptr, it holds:
ptr == json_pointer(ptr.to_string());
Returns
a string representation of the JSON pointer

@liveexample{The example shows the result of to_string., json_pointer__to_string}

Since
version 2.0.0

Friends And Related Function Documentation

◆ json

friend class json
friend

◆ JsonTest

friend class JsonTest
friend

◆ operator!=

bool operator!= ( json_pointer const &  lhs,
json_pointer const &  rhs 
)
friend

◆ operator==

bool operator== ( json_pointer const &  lhs,
json_pointer const &  rhs 
)
friend

The documentation for this class was generated from the following file: