LLVM  8.0.1
Classes | Public Types | Public Member Functions | List of all members
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)
 
iterator find (StringRef K)
 
const_iterator find (StringRef K) const
 
Valueoperator[] (const ObjectKey &K)
 
Valueoperator[] (ObjectKey &&K)
 
Valueget (StringRef K)
 
const Valueget (StringRef K) const
 
llvm::Optional< std::nullptr_t > getNull (StringRef K) const
 
llvm::Optional< boolgetBoolean (StringRef K) const
 
llvm::Optional< double > getNumber (StringRef K) const
 
llvm::Optional< int64_t > getInteger (StringRef K) const
 
llvm::Optional< llvm::StringRefgetString (StringRef K) const
 
const json::ObjectgetObject (StringRef K) const
 
json::ObjectgetObject (StringRef K)
 
const json::ArraygetArray (StringRef K) const
 
json::ArraygetArray (StringRef K)
 

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 88 of file JSON.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 97 of file JSON.h.

◆ iterator

Definition at line 96 of file JSON.h.

◆ key_type

Definition at line 93 of file JSON.h.

◆ mapped_type

Definition at line 94 of file JSON.h.

◆ value_type

Definition at line 95 of file JSON.h.

Constructor & Destructor Documentation

◆ Object() [1/2]

llvm::json::Object::Object ( )
explicitdefault

Referenced by llvm::json::Value::kind().

◆ Object() [2/2]

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

Definition at line 553 of file JSON.h.

References P, and try_emplace().

Member Function Documentation

◆ begin() [1/2]

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

◆ begin() [2/2]

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

◆ clear()

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

◆ empty()

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

◆ end() [1/2]

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

◆ end() [2/2]

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

◆ find() [1/2]

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

◆ find() [2/2]

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

◆ get() [1/2]

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

Definition at line 24 of file JSON.cpp.

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

◆ get() [2/2]

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

Definition at line 30 of file JSON.cpp.

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

◆ getArray() [1/2]

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

Definition at line 71 of file JSON.cpp.

Referenced by find().

◆ getArray() [2/2]

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

Definition at line 76 of file JSON.cpp.

◆ getBoolean()

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

Definition at line 41 of file JSON.cpp.

References llvm::None.

Referenced by find().

◆ getInteger()

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

Definition at line 51 of file JSON.cpp.

References llvm::None.

Referenced by find().

◆ getNull()

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

Definition at line 36 of file JSON.cpp.

References llvm::None.

Referenced by find().

◆ getNumber()

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

Definition at line 46 of file JSON.cpp.

References llvm::None.

Referenced by find().

◆ getObject() [1/2]

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

Definition at line 61 of file JSON.cpp.

Referenced by find().

◆ getObject() [2/2]

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

Definition at line 66 of file JSON.cpp.

◆ getString()

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

Definition at line 56 of file JSON.cpp.

References llvm::None.

Referenced by find().

◆ insert()

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

Definition at line 560 of file JSON.h.

References llvm::json::Object::KV::K, try_emplace(), and llvm::json::Object::KV::V.

Referenced by clear().

◆ operator[]() [1/2]

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

Definition at line 18 of file JSON.cpp.

References try_emplace().

Referenced by find().

◆ operator[]() [2/2]

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

Definition at line 21 of file JSON.cpp.

References try_emplace().

◆ size()

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

◆ try_emplace() [1/2]

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

◆ try_emplace() [2/2]

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

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