Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
llvm::json::Object Class Reference

An Object is a JSON object, which maps strings to heterogenous JSON values. More...

#include "llvm/Support/JSON.h"

Classes

struct  KV

Public Types

using key_type = ObjectKey
using mapped_type = Value
using value_type = Storage::value_type
using iterator = Storage::iterator
using const_iterator = Storage::const_iterator

Public Member Functions

 Object ()=default
 Object (std::initializer_list< KV > Properties)
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
bool empty () const
size_t size () const
void clear ()
std::pair< iterator, boolinsert (KV E)
template<typename... Ts>
std::pair< iterator, booltry_emplace (const ObjectKey &K, Ts &&... Args)
template<typename... Ts>
std::pair< iterator, booltry_emplace (ObjectKey &&K, Ts &&... Args)
bool erase (StringRef K)
void erase (iterator I)
iterator find (StringRef K)
const_iterator find (StringRef K) const
LLVM_ABI Valueoperator[] (const ObjectKey &K)
LLVM_ABI Valueoperator[] (ObjectKey &&K)
LLVM_ABI Valueget (StringRef K)
LLVM_ABI const Valueget (StringRef K) const
LLVM_ABI std::optional< std::nullptr_t > getNull (StringRef K) const
LLVM_ABI std::optional< boolgetBoolean (StringRef K) const
LLVM_ABI std::optional< double > getNumber (StringRef K) const
LLVM_ABI std::optional< int64_t > getInteger (StringRef K) const
LLVM_ABI std::optional< llvm::StringRefgetString (StringRef K) const
LLVM_ABI const json::ObjectgetObject (StringRef K) const
LLVM_ABI json::ObjectgetObject (StringRef K)
LLVM_ABI const json::ArraygetArray (StringRef K) const
LLVM_ABI json::ArraygetArray (StringRef K)

Friends

bool operator== (const Object &LHS, const Object &RHS)

Detailed Description

An Object is a JSON object, which maps strings to heterogenous JSON values.

It simulates DenseMap<ObjectKey, Value>. ObjectKey is a maybe-owned string.

Definition at line 98 of file JSON.h.

Member Typedef Documentation

◆ const_iterator

◆ iterator

Definition at line 106 of file JSON.h.

◆ key_type

Definition at line 103 of file JSON.h.

◆ mapped_type

Definition at line 104 of file JSON.h.

◆ value_type

Definition at line 105 of file JSON.h.

Constructor & Destructor Documentation

◆ Object() [1/2]

llvm::json::Object::Object ( )
default

Referenced by operator==.

◆ Object() [2/2]

llvm::json::Object::Object ( std::initializer_list< KV > Properties)
inlineexplicit

Definition at line 646 of file JSON.h.

References P, and try_emplace().

Member Function Documentation

◆ begin() [1/2]

iterator llvm::json::Object::begin ( )
inline

Definition at line 115 of file JSON.h.

◆ begin() [2/2]

const_iterator llvm::json::Object::begin ( ) const
inline

Definition at line 116 of file JSON.h.

◆ clear()

void llvm::json::Object::clear ( )
inline

Definition at line 123 of file JSON.h.

◆ empty()

bool llvm::json::Object::empty ( ) const
inline

Definition at line 120 of file JSON.h.

◆ end() [1/2]

iterator llvm::json::Object::end ( )
inline

Definition at line 117 of file JSON.h.

Referenced by get(), and get().

◆ end() [2/2]

const_iterator llvm::json::Object::end ( ) const
inline

Definition at line 118 of file JSON.h.

◆ erase() [1/2]

void llvm::json::Object::erase ( iterator I)
inline

Definition at line 134 of file JSON.h.

References I.

◆ erase() [2/2]

bool llvm::json::Object::erase ( StringRef K)
inline

Definition at line 656 of file JSON.h.

◆ find() [1/2]

iterator llvm::json::Object::find ( StringRef K)
inline

Definition at line 136 of file JSON.h.

Referenced by get(), and get().

◆ find() [2/2]

const_iterator llvm::json::Object::find ( StringRef K) const
inline

Definition at line 137 of file JSON.h.

◆ get() [1/2]

Value * llvm::json::Object::get ( StringRef K)

Definition at line 30 of file JSON.cpp.

References end(), find(), and I.

Referenced by getArray(), getArray(), getBoolean(), getInteger(), getNull(), getNumber(), getObject(), getObject(), and getString().

◆ get() [2/2]

const Value * llvm::json::Object::get ( StringRef K) const

Definition at line 36 of file JSON.cpp.

References end(), find(), and I.

◆ getArray() [1/2]

json::Array * llvm::json::Object::getArray ( StringRef K)

Definition at line 82 of file JSON.cpp.

References get().

◆ getArray() [2/2]

const json::Array * llvm::json::Object::getArray ( StringRef K) const

Definition at line 77 of file JSON.cpp.

References get().

◆ getBoolean()

std::optional< bool > llvm::json::Object::getBoolean ( StringRef K) const

Definition at line 47 of file JSON.cpp.

References get().

◆ getInteger()

std::optional< int64_t > llvm::json::Object::getInteger ( StringRef K) const

Definition at line 57 of file JSON.cpp.

References get().

◆ getNull()

std::optional< std::nullptr_t > llvm::json::Object::getNull ( StringRef K) const

Definition at line 42 of file JSON.cpp.

References get().

◆ getNumber()

std::optional< double > llvm::json::Object::getNumber ( StringRef K) const

Definition at line 52 of file JSON.cpp.

References get().

◆ getObject() [1/2]

json::Object * llvm::json::Object::getObject ( StringRef K)

Definition at line 72 of file JSON.cpp.

References get().

◆ getObject() [2/2]

const json::Object * llvm::json::Object::getObject ( StringRef K) const

Definition at line 67 of file JSON.cpp.

References get().

Referenced by llvm::MachO::getInterfaceFileFromJSON().

◆ getString()

std::optional< llvm::StringRef > llvm::json::Object::getString ( StringRef K) const

Definition at line 62 of file JSON.cpp.

References get().

◆ insert()

std::pair< Object::iterator, bool > llvm::json::Object::insert ( KV E)
inline

Definition at line 653 of file JSON.h.

References E(), and try_emplace().

Referenced by llvm::symbolize::toJSON().

◆ operator[]() [1/2]

Value & llvm::json::Object::operator[] ( const ObjectKey & K)

Definition at line 24 of file JSON.cpp.

References try_emplace().

◆ operator[]() [2/2]

Value & llvm::json::Object::operator[] ( ObjectKey && K)

Definition at line 27 of file JSON.cpp.

References try_emplace().

◆ size()

size_t llvm::json::Object::size ( ) const
inline

Definition at line 121 of file JSON.h.

◆ try_emplace() [1/2]

template<typename... Ts>
std::pair< iterator, bool > llvm::json::Object::try_emplace ( const ObjectKey & K,
Ts &&... Args )
inline

Definition at line 126 of file JSON.h.

Referenced by insert(), Object(), operator[](), operator[](), and llvm::DWARFVerifier::summarize().

◆ try_emplace() [2/2]

template<typename... Ts>
std::pair< iterator, bool > llvm::json::Object::try_emplace ( ObjectKey && K,
Ts &&... Args )
inline

Definition at line 130 of file JSON.h.

◆ operator==

bool operator== ( const Object & LHS,
const Object & RHS )
friend

Definition at line 87 of file JSON.cpp.

References LHS, Object(), and RHS.


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