LLVM: llvm::json Namespace Reference (original) (raw)

Classes
class Array
An Array is a JSON array, which contains heterogeneous JSON values. More...
class Object
An Object is a JSON object, which maps strings to heterogenous JSON values. More...
class ObjectKey
ObjectKey is a used to capture keys in Object. More...
class ObjectMapper
Helper for mapping JSON objects onto protocol structs. More...
class OStream
json::OStream allows writing well-formed JSON without materializing all structures as json::Value ahead of time. More...
class ParseError
class Path
A "cursor" marking a position within a Value. More...
class Value
A Value is an JSON value of unknown type. More...
Functions
LLVM_ABI bool isUTF8 (llvm::StringRef S, size_t *ErrOffset=nullptr)
Returns true if S is valid UTF-8, which is required for use as JSON.
LLVM_ABI std::string fixUTF8 (llvm::StringRef S)
Replaces invalid UTF-8 sequences in S with the replacement character (U+FFFD).
template<typename T>
Value toJSON (const std::optional< T > &Opt)
LLVM_ABI bool operator== (const Object &LHS, const Object &RHS)
bool operator!= (const Object &LHS, const Object &RHS)
bool operator!= (const Array &L, const Array &R)
LLVM_ABI bool operator== (const Value &L, const Value &R)
bool operator!= (const Value &L, const Value &R)
bool operator== (const Array &L, const Array &R)
bool operator== (const ObjectKey &L, const ObjectKey &R)
bool operator!= (const ObjectKey &L, const ObjectKey &R)
bool operator< (const ObjectKey &L, const ObjectKey &R)
LLVM_ABI std::vector< const Object::value_type * > sortedElements (const Object &O)
bool fromJSON (const Value &E, std::string &Out, Path P)
bool fromJSON (const Value &E, int &Out, Path P)
bool fromJSON (const Value &E, int64_t &Out, Path P)
bool fromJSON (const Value &E, double &Out, Path P)
bool fromJSON (const Value &E, bool &Out, Path P)
bool fromJSON (const Value &E, unsigned int &Out, Path P)
bool fromJSON (const Value &E, uint64_t &Out, Path P)
bool fromJSON (const Value &E, std::nullptr_t &Out, Path P)
template<typename T>
bool fromJSON (const Value &E, std::optional< T > &Out, Path P)
template<typename T>
bool fromJSON (const Value &E, std::vector< T > &Out, Path P)
template<typename T>
bool fromJSON (const Value &E, std::map< std::string, T > &Out, Path P)
LLVM_ABI llvm::Expected< Value > parse (llvm::StringRef JSON)
Parses the provided JSON source, or returns a ParseError.
template<typename T>
Expected< T > parse (const llvm::StringRef &JSON, const char *RootName="")
Version of parse() that converts the parsed value to the type T.
llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const Value &V)
Serializes this Value to JSON, writing it to the provided stream.
bool fromJSON (const llvm::json::Value &E, Embedding &Out, llvm::json::Path P)
static void abbreviate (const Value &V, OStream &JOS)
static void abbreviateChildren (const Value &V, OStream &JOS)
static void encodeUtf8 (uint32_t Rune, std::string &Out)
static void quote (llvm::raw_ostream &OS, llvm::StringRef S)
Variables
template<typename T>
constexpr bool is_uint_64_bit_v

abbreviate()

abbreviateChildren()

encodeUtf8()

void llvm::json::encodeUtf8 ( uint32_t Rune, std::string & Out ) static

fixUTF8()

Replaces invalid UTF-8 sequences in S with the replacement character (U+FFFD).

The returned string is valid UTF-8. This is much slower than isUTF8, so test that first.

Definition at line 700 of file JSON.cpp.

References llvm::ConvertUTF32toUTF8(), llvm::ConvertUTF8toUTF32(), llvm::StringRef::data(), llvm::lenientConversion, llvm::StringRef::size(), and llvm::strictConversion.

Referenced by abbreviate(), llvm::json::OStream::attributeBegin(), llvm::json::ObjectKey::ObjectKey(), llvm::json::ObjectKey::ObjectKey(), llvm::json::Value::Value(), and llvm::json::Value::Value().

fromJSON() [1/12]

fromJSON() [2/12]

fromJSON() [3/12]

fromJSON() [4/12]

fromJSON() [5/12]

fromJSON() [6/12]

template<typename T>

bool llvm::json::fromJSON ( const Value & E,
std::map< std::string, T > & Out,
Path P )

fromJSON() [7/12]

fromJSON() [8/12]

template<typename T>

bool llvm::json::fromJSON ( const Value & E,
std::optional< T > & Out,
Path P )

fromJSON() [9/12]

fromJSON() [10/12]

fromJSON() [11/12]

fromJSON() [12/12]

isUTF8()

Returns true if S is valid UTF-8, which is required for use as JSON.

If it returns false, Offset is set to a byte offset near the first error.

Definition at line 686 of file JSON.cpp.

References llvm::Data, llvm::StringRef::data(), llvm::isASCII(), llvm::isLegalUTF8String(), LLVM_LIKELY, and llvm::StringRef::size().

Referenced by llvm::json::OStream::attributeBegin(), llvm::json::ObjectKey::ObjectKey(), llvm::json::ObjectKey::ObjectKey(), llvm::json::Value::Value(), and llvm::json::Value::Value().

operator!=() [1/4]

operator!=() [2/4]

operator!=() [3/4]

operator!=() [4/4]

operator<()

operator<<()

operator==() [1/4]

operator==() [2/4]

operator==() [3/4]

operator==() [4/4]

parse() [1/2]

Version of parse() that converts the parsed value to the type T.

RootName describes the root object and is used in error messages.

Definition at line 935 of file JSON.h.

References fromJSON(), parse(), and T.

parse() [2/2]

quote()

sortedElements()

toJSON()

template<typename T>

Value llvm::json::toJSON ( const std::optional< T > & Opt )

is_uint_64_bit_v

template<typename T>

bool llvm::json::is_uint_64_bit_v constexpr

Initial value:

=

std::is_integral_v && std::is_unsigned_v &&

Definition at line 79 of file JSON.h.