BitShares-Core  4.0.0
BitShares blockchain implementation and command-line interface 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

Definition at line 115 of file variant_object.hpp.

a key/value pair

Definition at line 112 of file variant_object.hpp.

Definition at line 114 of file variant_object.hpp.

Constructor & Destructor Documentation

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

Definition at line 191 of file variant_object.hpp.

fc::mutable_variant_object::mutable_variant_object ( )

Definition at line 261 of file variant_object.cpp.

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.

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

Definition at line 202 of file variant_object.hpp.

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

Definition at line 282 of file variant_object.cpp.

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

Definition at line 277 of file variant_object.cpp.

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

Definition at line 272 of file variant_object.cpp.

Member Function Documentation

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

Definition at line 188 of file variant_object.cpp.

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

Definition at line 178 of file variant_object.cpp.

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

Definition at line 193 of file variant_object.cpp.

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

Definition at line 183 of file variant_object.cpp.

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

Definition at line 316 of file variant_object.cpp.

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

Definition at line 198 of file variant_object.cpp.

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

Definition at line 203 of file variant_object.cpp.

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.

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

Definition at line 220 of file variant_object.cpp.

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.

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.

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.

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.

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

Definition at line 293 of file variant_object.cpp.

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

Definition at line 302 of file variant_object.cpp.

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

Definition at line 287 of file variant_object.cpp.

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

Definition at line 232 of file variant_object.cpp.

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

Definition at line 237 of file variant_object.cpp.

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

Definition at line 243 of file variant_object.cpp.

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

Definition at line 248 of file variant_object.cpp.

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

Definition at line 311 of file variant_object.cpp.

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_t fc::mutable_variant_object::size ( ) const

Definition at line 256 of file variant_object.cpp.

Friends And Related Function Documentation

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: