|
LLVM
10.0.0
|
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 | Value |
| A Value is an JSON value of unknown type. More... | |
Functions | |
| bool | isUTF8 (llvm::StringRef S, size_t *ErrOffset=nullptr) |
Returns true if S is valid UTF-8, which is required for use as JSON. More... | |
| std::string | fixUTF8 (llvm::StringRef S) |
Replaces invalid UTF-8 sequences in S with the replacement character (U+FFFD). More... | |
| template<typename T > | |
| Value | toJSON (const llvm::Optional< T > &Opt) |
| bool | operator== (const Object &LHS, const Object &RHS) |
| bool | operator!= (const Object &LHS, const Object &RHS) |
| bool | operator!= (const Array &L, const Array &R) |
| bool | operator== (const Value &, const Value &) |
| bool | operator!= (const Value &L, const Value &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) |
| bool | fromJSON (const Value &E, std::string &Out) |
| bool | fromJSON (const Value &E, int &Out) |
| bool | fromJSON (const Value &E, int64_t &Out) |
| bool | fromJSON (const Value &E, double &Out) |
| bool | fromJSON (const Value &E, bool &Out) |
| template<typename T > | |
| bool | fromJSON (const Value &E, llvm::Optional< T > &Out) |
| template<typename T > | |
| bool | fromJSON (const Value &E, std::vector< T > &Out) |
| template<typename T > | |
| bool | fromJSON (const Value &E, std::map< std::string, T > &Out) |
| llvm::Expected< Value > | parse (llvm::StringRef JSON) |
| Parses the provided JSON source, or returns a ParseError. More... | |
| llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const Value &V) |
| Serializes this Value to JSON, writing it to the provided stream. More... | |
| static std::vector< const Object::value_type * > | sortedElements (const Object &O) |
| static void | quote (llvm::raw_ostream &OS, llvm::StringRef S) |
| std::string llvm::json::fixUTF8 | ( | llvm::StringRef | S | ) |
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 546 of file JSON.cpp.
References llvm::ConvertUTF32toUTF8(), llvm::ConvertUTF8toUTF32(), llvm::StringRef::data(), llvm::lenientConversion, llvm::StringRef::size(), and llvm::strictConversion.
Referenced by llvm::json::OStream::attributeBegin(), llvm::json::ObjectKey::ObjectKey(), and llvm::json::Value::Value().
Definition at line 566 of file JSON.h.
References llvm::json::Value::getAsString().
Referenced by fromJSON(), and llvm::json::ObjectMapper::map().
Definition at line 573 of file JSON.h.
References llvm::json::Value::getAsInteger().
Definition at line 580 of file JSON.h.
References llvm::json::Value::getAsInteger().
Definition at line 587 of file JSON.h.
References llvm::json::Value::getAsNumber().
Definition at line 594 of file JSON.h.
References llvm::json::Value::getAsBoolean().
| bool llvm::json::fromJSON | ( | const Value & | E, |
| llvm::Optional< T > & | Out | ||
| ) |
Definition at line 601 of file JSON.h.
References fromJSON(), llvm::json::Value::getAsNull(), and llvm::None.
Definition at line 612 of file JSON.h.
References fromJSON(), llvm::json::Value::getAsArray(), and I.
| bool llvm::json::fromJSON | ( | const Value & | E, |
| std::map< std::string, T > & | Out | ||
| ) |
Definition at line 624 of file JSON.h.
References fromJSON(), llvm::json::Value::getAsObject(), and llvm::RISCVFenceField::O.
| bool llvm::json::isUTF8 | ( | llvm::StringRef | S, |
| size_t * | ErrOffset = nullptr |
||
| ) |
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 532 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(), and llvm::json::Value::Value().
Definition at line 486 of file JSON.h.
References llvm::RISCVFenceField::R.
|
inline |
Serializes this Value to JSON, writing it to the provided stream.
The formatting is compact (no extra whitespace) and deterministic. For pretty-printing, use the formatv() format_provider below.
Definition at line 846 of file JSON.h.
References llvm::json::OStream::value().
Definition at line 80 of file JSON.cpp.
References llvm::json::Object::end(), llvm::json::Object::find(), and llvm::json::Object::size().
Referenced by llvm::json::Object::find().
Definition at line 175 of file JSON.cpp.
References llvm::json::Value::Array, llvm::json::Value::Boolean, llvm::json::Value::getAsArray(), llvm::json::Value::getAsBoolean(), llvm::json::Value::getAsInteger(), llvm::json::Value::getAsNull(), llvm::json::Value::getAsNumber(), llvm::json::Value::getAsObject(), llvm::json::Value::getAsString(), llvm::json::Value::kind(), llvm_unreachable, llvm::json::Value::Null, llvm::json::Value::Number, llvm::json::Value::Object, and llvm::json::Value::String.
| Expected< Value > llvm::json::parse | ( | llvm::StringRef | JSON | ) |
Parses the provided JSON source, or returns a ParseError.
The returned Value is self-contained and owns its strings (they do not refer to the original source).
Definition at line 510 of file JSON.cpp.
Referenced by llvm::json::ObjectMapper::map().
|
static |
Definition at line 563 of file JSON.cpp.
References C, llvm::Lower, and llvm::write_hex().
Referenced by llvm::json::OStream::attributeBegin(), and llvm::json::OStream::value().
|
static |
Definition at line 521 of file JSON.cpp.
References E, and llvm::sort().
Referenced by llvm::json::OStream::value().
| Value llvm::json::toJSON | ( | const llvm::Optional< T > & | Opt | ) |
Definition at line 636 of file JSON.h.
Referenced by llvm::json::Value::Value().
1.8.13