Bitcoin ABC 0.30.5
P2P Digital Currency
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
UniValue Class Reference

#include <univalue.h>

Classes

class  type_error
 

Public Types

enum  VType {
  VNULL , VOBJ , VARR , VSTR ,
  VNUM , VBOOL
}
 

Public Member Functions

 UniValue ()
 
 UniValue (UniValue::VType type, std::string str={})
 
template<typename Ref , typename T = std::remove_cv_t<std::remove_reference_t<Ref>>, std::enable_if_t< std::is_floating_point_v< T >||std::is_same_v< bool, T >||std::is_signed_v< T >||std::is_unsigned_v< T >||std::is_constructible_v< std::string, T >, bool > = true>
 UniValue (Ref &&val)
 
void clear ()
 
void reserve (size_t n)
 
void setNull ()
 
void setBool (bool val)
 
void setNumStr (std::string str)
 
void setInt (uint64_t val)
 
void setInt (int64_t val)
 
void setInt (int val_)
 
void setFloat (double val)
 
void setStr (std::string str)
 
void setArray ()
 
void setObject ()
 
enum VType getType () const
 
const std::string & getValStr () const
 
bool empty () const
 
size_t size () const
 
void getObjMap (std::map< std::string, UniValue > &kv) const
 
bool checkObject (const std::map< std::string, UniValue::VType > &memberTypes) const
 
const UniValueoperator[] (const std::string &key) const
 
const UniValueoperator[] (size_t index) const
 
bool exists (const std::string &key) const
 
bool isNull () const
 
bool isTrue () const
 
bool isFalse () const
 
bool isBool () const
 
bool isStr () const
 
bool isNum () const
 
bool isArray () const
 
bool isObject () const
 
void push_back (UniValue val)
 
void push_backV (const std::vector< UniValue > &vec)
 
template<class It >
void push_backV (It first, It last)
 
void pushKVEnd (std::string key, UniValue val)
 
void pushKV (std::string key, UniValue val)
 
void pushKVs (UniValue obj)
 
std::string write (unsigned int prettyIndent=0, unsigned int indentLevel=0) const
 
bool read (std::string_view raw)
 
const std::vector< std::string > & getKeys () const
 
const std::vector< UniValue > & getValues () const
 
template<typename Int >
Int getInt () const
 
bool get_bool () const
 
const std::string & get_str () const
 
double get_real () const
 
const UniValueget_obj () const
 
const UniValueget_array () const
 
enum VType type () const
 
const UniValuefind_value (std::string_view key) const
 

Private Member Functions

void checkType (const VType &expected) const
 
bool findKey (const std::string &key, size_t &retIdx) const
 

Private Attributes

UniValue::VType typ
 
std::string val
 
std::vector< std::string > keys
 
std::vector< UniValuevalues
 

Friends

struct ::UniValueStreamWriter
 

Detailed Description

Definition at line 25 of file univalue.h.

Member Enumeration Documentation

◆ VType

Enumerator
VNULL 
VOBJ 
VARR 
VSTR 
VNUM 
VBOOL 

Definition at line 29 of file univalue.h.

Constructor & Destructor Documentation

◆ UniValue() [1/3]

UniValue::UniValue ( )
inline

Definition at line 42 of file univalue.h.

◆ UniValue() [2/3]

UniValue::UniValue ( UniValue::VType  type,
std::string  str = {} 
)
inline

Definition at line 43 of file univalue.h.

◆ UniValue() [3/3]

template<typename Ref , typename T = std::remove_cv_t<std::remove_reference_t<Ref>>, std::enable_if_t< std::is_floating_point_v< T >||std::is_same_v< bool, T >||std::is_signed_v< T >||std::is_unsigned_v< T >||std::is_constructible_v< std::string, T >, bool > = true>
UniValue::UniValue ( Ref &&  val)
inline

Definition at line 53 of file univalue.h.

Here is the call graph for this function:

Member Function Documentation

◆ checkObject()

bool UniValue::checkObject ( const std::map< std::string, UniValue::VType > &  memberTypes) const

Definition at line 157 of file univalue.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkType()

void UniValue::checkType ( const VType expected) const
private

Definition at line 201 of file univalue.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

void UniValue::clear ( )

Definition at line 18 of file univalue.cpp.

Here is the caller graph for this function:

◆ empty()

bool UniValue::empty ( ) const
inline

Definition at line 90 of file univalue.h.

Here is the caller graph for this function:

◆ exists()

bool UniValue::exists ( const std::string &  key) const
inline

Definition at line 99 of file univalue.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_value()

const UniValue & UniValue::find_value ( std::string_view  key) const

Definition at line 229 of file univalue.cpp.

Here is the caller graph for this function:

◆ findKey()

bool UniValue::findKey ( const std::string &  key,
size_t &  retIdx 
) const
private

Definition at line 146 of file univalue.cpp.

Here is the caller graph for this function:

◆ get_array()

const UniValue & UniValue::get_array ( ) const

Definition at line 93 of file univalue_get.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_bool()

bool UniValue::get_bool ( ) const

Definition at line 69 of file univalue_get.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_obj()

const UniValue & UniValue::get_obj ( ) const

Definition at line 88 of file univalue_get.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_real()

double UniValue::get_real ( ) const

Definition at line 79 of file univalue_get.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_str()

const std::string & UniValue::get_str ( ) const

Definition at line 74 of file univalue_get.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInt()

template<typename Int >
Int UniValue::getInt

Definition at line 157 of file univalue.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getKeys()

const std::vector< std::string > & UniValue::getKeys ( ) const

Definition at line 56 of file univalue_get.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getObjMap()

void UniValue::getObjMap ( std::map< std::string, UniValue > &  kv) const

Definition at line 135 of file univalue.cpp.

Here is the caller graph for this function:

◆ getType()

enum VType UniValue::getType ( ) const
inline

Definition at line 88 of file univalue.h.

Here is the caller graph for this function:

◆ getValStr()

const std::string & UniValue::getValStr ( ) const
inline

Definition at line 89 of file univalue.h.

Here is the caller graph for this function:

◆ getValues()

const std::vector< UniValue > & UniValue::getValues ( ) const

Definition at line 61 of file univalue_get.cpp.

Here is the caller graph for this function:

◆ isArray()

bool UniValue::isArray ( ) const
inline

Definition at line 110 of file univalue.h.

Here is the caller graph for this function:

◆ isBool()

bool UniValue::isBool ( ) const
inline

Definition at line 107 of file univalue.h.

Here is the caller graph for this function:

◆ isFalse()

bool UniValue::isFalse ( ) const
inline

Definition at line 106 of file univalue.h.

Here is the caller graph for this function:

◆ isNull()

bool UniValue::isNull ( ) const
inline

Definition at line 104 of file univalue.h.

Here is the caller graph for this function:

◆ isNum()

bool UniValue::isNum ( ) const
inline

Definition at line 109 of file univalue.h.

Here is the caller graph for this function:

◆ isObject()

bool UniValue::isObject ( ) const
inline

Definition at line 111 of file univalue.h.

Here is the caller graph for this function:

◆ isStr()

bool UniValue::isStr ( ) const
inline

Definition at line 108 of file univalue.h.

Here is the caller graph for this function:

◆ isTrue()

bool UniValue::isTrue ( ) const
inline

Definition at line 105 of file univalue.h.

Here is the caller graph for this function:

◆ operator[]() [1/2]

const UniValue & UniValue::operator[] ( const std::string &  key) const

Definition at line 177 of file univalue.cpp.

Here is the call graph for this function:

◆ operator[]() [2/2]

const UniValue & UniValue::operator[] ( size_t  index) const

Definition at line 190 of file univalue.cpp.

◆ push_back()

void UniValue::push_back ( UniValue  val)

Definition at line 96 of file univalue.cpp.

Here is the call graph for this function:

◆ push_backV() [1/2]

void UniValue::push_backV ( const std::vector< UniValue > &  vec)

Definition at line 102 of file univalue.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ push_backV() [2/2]

template<class It >
void UniValue::push_backV ( It  first,
It  last 
)

Definition at line 152 of file univalue.h.

Here is the call graph for this function:

◆ pushKV()

void UniValue::pushKV ( std::string  key,
UniValue  val 
)

Definition at line 115 of file univalue.cpp.

Here is the call graph for this function:

◆ pushKVEnd()

void UniValue::pushKVEnd ( std::string  key,
UniValue  val 
)

Definition at line 108 of file univalue.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pushKVs()

void UniValue::pushKVs ( UniValue  obj)

Definition at line 126 of file univalue.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read()

bool UniValue::read ( std::string_view  raw)

Definition at line 287 of file univalue_read.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reserve()

void UniValue::reserve ( size_t  n)
inline

Definition at line 68 of file univalue.h.

Here is the caller graph for this function:

◆ setArray()

void UniValue::setArray ( )

Definition at line 86 of file univalue.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBool()

void UniValue::setBool ( bool  val)

Definition at line 29 of file univalue.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFloat()

void UniValue::setFloat ( double  val)

Definition at line 72 of file univalue.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setInt() [1/3]

void UniValue::setInt ( int  val_)
inline

Definition at line 82 of file univalue.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setInt() [2/3]

void UniValue::setInt ( int64_t  val)

Definition at line 64 of file univalue.cpp.

Here is the call graph for this function:

◆ setInt() [3/3]

void UniValue::setInt ( uint64_t  val)

Definition at line 56 of file univalue.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNull()

void UniValue::setNull ( )

Definition at line 25 of file univalue.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNumStr()

void UniValue::setNumStr ( std::string  str)

Definition at line 45 of file univalue.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setObject()

void UniValue::setObject ( )

Definition at line 91 of file univalue.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setStr()

void UniValue::setStr ( std::string  str)

Definition at line 80 of file univalue.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

size_t UniValue::size ( ) const
inline

Definition at line 92 of file univalue.h.

Here is the caller graph for this function:

◆ type()

enum VType UniValue::type ( ) const
inline

Definition at line 147 of file univalue.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write()

std::string UniValue::write ( unsigned int  prettyIndent = 0,
unsigned int  indentLevel = 0 
) const

Definition at line 159 of file univalue_write.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ ::UniValueStreamWriter

friend struct ::UniValueStreamWriter
friend

Definition at line 26 of file univalue.h.

Member Data Documentation

◆ keys

std::vector<std::string> UniValue::keys
private

Definition at line 129 of file univalue.h.

◆ typ

UniValue::VType UniValue::typ
private

Definition at line 127 of file univalue.h.

◆ val

std::string UniValue::val
private

Definition at line 128 of file univalue.h.

◆ values

std::vector<UniValue> UniValue::values
private

Definition at line 130 of file univalue.h.


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