BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
Public Types | Public Member Functions | Friends | List of all members
fc::mutable_variant_object Class Reference

An order-perserving dictionary of variant's.
More...

#include <variant_object.hpp>

Inheritance diagram for fc::mutable_variant_object:
fc::limited_mutable_variant_object

Public Types

typedef variant_object::entry entry
 a key/value pair More...
 
typedef std::vector< entry >::iterator iterator
 
typedef std::vector< entry >::const_iterator const_iterator
 

Public Member Functions

variantoperator[] (const string &key)
 
variantoperator[] (const char *key)
 
template<typename T >
 mutable_variant_object (T &&v)
 
 mutable_variant_object ()
 
 mutable_variant_object (string key, variant val)
 
template<typename T >
 mutable_variant_object (string key, T &&val)
 
 mutable_variant_object (mutable_variant_object &&)
 
 mutable_variant_object (const mutable_variant_object &)
 
 mutable_variant_object (const variant_object &)
 
mutable_variant_objectoperator= (mutable_variant_object &&)
 
mutable_variant_objectoperator= (const mutable_variant_object &)
 
mutable_variant_objectoperator= (const variant_object &)
 
Immutable Interface

Calling these methods will not result in copies of the underlying type.

iterator begin () const
 
iterator end () const
 
iterator find (const string &key) const
 
iterator find (const char *key) const
 
const variantoperator[] (const string &key) const
 
const variantoperator[] (const char *key) const
 
size_t size () const
 
mutable Interface

Calling these methods will result in a copy of the underlying type being created if there is more than one reference to this object.

void reserve (size_t s)
 
iterator begin ()
 
iterator end ()
 
void erase (const string &key)
 
iterator find (const string &key)
 
iterator find (const char *key)
 
mutable_variant_objectset (string key, variant var)
 
mutable_variant_objectoperator() (string key, variant var, uint32_t max_depth=1)
 
template<typename T >
mutable_variant_objectoperator() (string key, T &&var, uint32_t max_depth)
 
mutable_variant_objectoperator() (const variant_object &vo)
 
mutable_variant_objectoperator() (const mutable_variant_object &mvo)
 

Friends

class variant_object
 

Detailed Description

An order-perserving dictionary of variant's.

Keys are kept in the order they are inserted. This dictionary implements copy-on-write

Note
This class is not optimized for random-access on large sets of key-value pairs.

Definition at line 108 of file variant_object.hpp.

Member Typedef Documentation

◆ const_iterator

Definition at line 115 of file variant_object.hpp.

◆ entry

a key/value pair

Definition at line 112 of file variant_object.hpp.

◆ iterator

Definition at line 114 of file variant_object.hpp.

Constructor & Destructor Documentation

◆ mutable_variant_object() [1/7]

template<typename T >
fc::mutable_variant_object::mutable_variant_object ( T &&  v)
inlineexplicit

Definition at line 191 of file variant_object.hpp.

◆ mutable_variant_object() [2/7]

fc::mutable_variant_object::mutable_variant_object ( )

Definition at line 261 of file variant_object.cpp.

◆ mutable_variant_object() [3/7]

fc::mutable_variant_object::mutable_variant_object ( string  key,
variant  val 
)

initializes the first key/value pair in the object

Definition at line 266 of file variant_object.cpp.

◆ mutable_variant_object() [4/7]

template<typename T >
fc::mutable_variant_object::mutable_variant_object ( string  key,
T &&  val 
)
inline

Definition at line 202 of file variant_object.hpp.

◆ mutable_variant_object() [5/7]

fc::mutable_variant_object::mutable_variant_object ( mutable_variant_object &&  obj)

Definition at line 282 of file variant_object.cpp.

◆ mutable_variant_object() [6/7]

fc::mutable_variant_object::mutable_variant_object ( const mutable_variant_object obj)

Definition at line 277 of file variant_object.cpp.

◆ mutable_variant_object() [7/7]

fc::mutable_variant_object::mutable_variant_object ( const variant_object obj)

Definition at line 272 of file variant_object.cpp.

Member Function Documentation

◆ begin() [1/2]

iterator fc::mutable_variant_object::begin ( )

◆ begin() [2/2]

mutable_variant_object::iterator fc::mutable_variant_object::begin ( ) const

Definition at line 178 of file variant_object.cpp.

◆ end() [1/2]

iterator fc::mutable_variant_object::end ( )

◆ end() [2/2]

mutable_variant_object::iterator fc::mutable_variant_object::end ( ) const

Definition at line 183 of file variant_object.cpp.

◆ erase()

void fc::mutable_variant_object::erase ( const string &  key)

Definition at line 316 of file variant_object.cpp.

◆ find() [1/4]

mutable_variant_object::iterator fc::mutable_variant_object::find ( const char *  key)

Definition at line 220 of file variant_object.cpp.

◆ find() [2/4]

mutable_variant_object::iterator fc::mutable_variant_object::find ( const char *  key) const

Definition at line 203 of file variant_object.cpp.

◆ find() [3/4]

mutable_variant_object::iterator fc::mutable_variant_object::find ( const string &  key)
Returns
end() if key is not found

Definition at line 215 of file variant_object.cpp.

◆ find() [4/4]

mutable_variant_object::iterator fc::mutable_variant_object::find ( const string &  key) const

Definition at line 198 of file variant_object.cpp.

◆ operator()() [1/4]

mutable_variant_object & fc::mutable_variant_object::operator() ( const mutable_variant_object mvo)

Copy another mutable_variant_object into this mutable_variant_object.

Definition at line 359 of file variant_object.cpp.

◆ operator()() [2/4]

mutable_variant_object & fc::mutable_variant_object::operator() ( const variant_object vo)

Copy a variant_object into this mutable_variant_object.

Definition at line 352 of file variant_object.cpp.

◆ operator()() [3/4]

template<typename T >
mutable_variant_object& fc::mutable_variant_object::operator() ( string  key,
T &&  var,
uint32_t  max_depth 
)
inline

Definition at line 173 of file variant_object.hpp.

◆ operator()() [4/4]

mutable_variant_object & fc::mutable_variant_object::operator() ( string  key,
variant  var,
uint32_t  max_depth = 1 
)

Appends key and var without checking for duplicates, designed to simplify construction of dictionaries using (key,val)(key2,val2) syntax Convenience method to simplify the manual construction of variant_object's

Instead of: mutable_variant_object("c",c).set("a",a).set("b",b);

You can use: mutable_variant_object( "c", c )( "b", b)( "c",c )

Returns
*this;

Appends key and var without checking for duplicates, designed to simplify construction of dictionaries using (key,val)(key2,val2) syntax

Definition at line 346 of file variant_object.cpp.

◆ operator=() [1/3]

mutable_variant_object & fc::mutable_variant_object::operator= ( const mutable_variant_object obj)

Definition at line 302 of file variant_object.cpp.

◆ operator=() [2/3]

mutable_variant_object & fc::mutable_variant_object::operator= ( const variant_object obj)

Definition at line 287 of file variant_object.cpp.

◆ operator=() [3/3]

mutable_variant_object & fc::mutable_variant_object::operator= ( mutable_variant_object &&  obj)

Definition at line 293 of file variant_object.cpp.

◆ operator[]() [1/4]

variant & fc::mutable_variant_object::operator[] ( const char *  key)

Definition at line 248 of file variant_object.cpp.

◆ operator[]() [2/4]

const variant & fc::mutable_variant_object::operator[] ( const char *  key) const

Definition at line 237 of file variant_object.cpp.

◆ operator[]() [3/4]

variant & fc::mutable_variant_object::operator[] ( const string &  key)

Definition at line 243 of file variant_object.cpp.

◆ operator[]() [4/4]

const variant & fc::mutable_variant_object::operator[] ( const string &  key) const

Definition at line 232 of file variant_object.cpp.

◆ reserve()

void fc::mutable_variant_object::reserve ( size_t  s)

Definition at line 311 of file variant_object.cpp.

◆ set()

mutable_variant_object & fc::mutable_variant_object::set ( string  key,
variant  var 
)

replaces the value at key with var or insert's key if not found

Definition at line 329 of file variant_object.cpp.

◆ size()

size_t fc::mutable_variant_object::size ( ) const

Definition at line 256 of file variant_object.cpp.

Friends And Related Function Documentation

◆ variant_object

friend class variant_object
friend

Definition at line 217 of file variant_object.hpp.


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