LLVM  14.0.0git
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, bool > insert (KV E)
 
template<typename... Ts>
std::pair< iterator, bool > try_emplace (const ObjectKey &K, Ts &&... Args)
 
template<typename... Ts>
std::pair< iterator, bool > try_emplace (ObjectKey &&K, Ts &&... Args)
 
bool erase (StringRef K)
 
void erase (iterator I)
 
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< bool > getBoolean (StringRef K) const
 
llvm::Optional< doublegetNumber (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 90 of file JSON.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 99 of file JSON.h.

◆ iterator

Definition at line 98 of file JSON.h.

◆ key_type

Definition at line 95 of file JSON.h.

◆ mapped_type

Definition at line 96 of file JSON.h.

◆ value_type

Definition at line 97 of file JSON.h.

Constructor & Destructor Documentation

◆ Object() [1/2]

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

◆ Object() [2/2]

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

Definition at line 579 of file JSON.h.

References move, P, and try_emplace().

Member Function Documentation

◆ begin() [1/2]

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

Definition at line 107 of file JSON.h.

References M.

◆ begin() [2/2]

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

Definition at line 108 of file JSON.h.

References M.

◆ clear()

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

Definition at line 115 of file JSON.h.

References M.

◆ empty()

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

Definition at line 112 of file JSON.h.

References M.

◆ end() [1/2]

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

Definition at line 109 of file JSON.h.

References M.

Referenced by get(), and llvm::json::operator==().

◆ end() [2/2]

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

Definition at line 110 of file JSON.h.

References M.

◆ erase() [1/2]

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

Definition at line 126 of file JSON.h.

References I, and M.

◆ erase() [2/2]

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

◆ find() [1/2]

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

Definition at line 128 of file JSON.h.

References M.

Referenced by get(), and llvm::json::operator==().

◆ find() [2/2]

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

Definition at line 129 of file JSON.h.

References M.

◆ get() [1/2]

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

◆ get() [2/2]

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

Definition at line 32 of file JSON.cpp.

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

◆ getArray() [1/2]

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

Definition at line 78 of file JSON.cpp.

References get().

◆ getArray() [2/2]

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

Definition at line 73 of file JSON.cpp.

References get().

◆ getBoolean()

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

Definition at line 43 of file JSON.cpp.

References get(), and llvm::None.

◆ getInteger()

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

Definition at line 53 of file JSON.cpp.

References get(), and llvm::None.

◆ getNull()

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

Definition at line 38 of file JSON.cpp.

References get(), and llvm::None.

◆ getNumber()

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

Definition at line 48 of file JSON.cpp.

References get(), and llvm::None.

◆ getObject() [1/2]

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

Definition at line 68 of file JSON.cpp.

References get().

◆ getObject() [2/2]

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

Definition at line 63 of file JSON.cpp.

References get().

◆ getString()

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

Definition at line 58 of file JSON.cpp.

References get(), and llvm::None.

◆ insert()

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

Definition at line 586 of file JSON.h.

References E, move, and try_emplace().

◆ operator[]() [1/2]

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

Definition at line 20 of file JSON.cpp.

References try_emplace().

◆ operator[]() [2/2]

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

Definition at line 23 of file JSON.cpp.

References move, and try_emplace().

◆ size()

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

Definition at line 113 of file JSON.h.

References M.

Referenced by llvm::json::operator==().

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

References llvm::AMDGPU::HSAMD::Kernel::Key::Args, and M.

Referenced by insert(), Object(), and operator[]().

◆ try_emplace() [2/2]

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

Definition at line 122 of file JSON.h.

References llvm::AMDGPU::HSAMD::Kernel::Key::Args, M, and move.


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