55 return _key_value->begin();
60 return _key_value->end();
65 return find( key.c_str() );
70 for(
auto itr =
begin(); itr !=
end(); ++itr )
72 if( itr->key() == key )
82 return (*
this)[key.c_str()];
87 auto itr =
find( key );
88 if( itr !=
end() )
return itr->value();
94 return _key_value->size();
106 _key_value->emplace_back(
entry(fc::move(key), fc::move(val)));
110 :_key_value( obj._key_value )
116 : _key_value(
fc::move(obj._key_value) )
118 obj._key_value = std::make_shared<std::vector<entry>>();
128 : _key_value(
fc::move(obj._key_value))
137 fc_swap(_key_value, obj._key_value );
147 _key_value = obj._key_value;
154 _key_value = fc::move(obj._key_value);
155 obj._key_value.reset(
new std::vector<entry>() );
161 *_key_value = *obj._key_value;
167 auto kv_size =
size();
168 size_t sum =
sizeof(*this) +
sizeof(std::vector<entry>);
169 for (
size_t iter = 0; iter < kv_size; ++iter) {
170 const auto& kv = _key_value->at(iter);
171 sum += kv.key().length() +
sizeof(
string);
172 sum += kv.value().estimated_size();
192 return _key_value->begin();
197 return _key_value->end();
202 return _key_value->begin();
207 return _key_value->end();
212 return find( key.c_str() );
217 for(
auto itr =
begin(); itr !=
end(); ++itr )
219 if( itr->key() == key )
229 return find( key.c_str() );
234 for(
auto itr =
begin(); itr !=
end(); ++itr )
236 if( itr->key() == key )
246 return (*
this)[key.c_str()];
251 auto itr =
find( key );
252 if( itr !=
end() )
return itr->value();
257 return (*
this)[key.c_str()];
262 auto itr =
find( key );
263 if( itr !=
end() )
return itr->value();
265 return _key_value->back().value();
270 return _key_value->size();
281 _key_value->push_back(
entry(fc::move(key), fc::move(val)));
295 : _key_value(
fc::move(obj._key_value))
301 *_key_value = *obj._key_value;
309 _key_value = fc::move(obj._key_value);
318 *_key_value = *obj._key_value;
325 _key_value->reserve(
s);
330 for(
auto itr =
begin(); itr !=
end(); ++itr )
332 if( itr->key() == key )
334 _key_value->erase(itr);
343 auto itr = find( key.c_str() );
346 itr->set( fc::move(var) );
350 _key_value->push_back(
entry( fc::move(key), fc::move(var) ) );
357 auto itr = find( key.c_str() );
360 itr->set( fc::move(var) );
364 _key_value->push_back(
entry( fc::move(key), fc::move(var) ) );
366 return std::move(*
this);
374 _key_value->push_back(
entry( fc::move(key), fc::move(var) ) );
380 _key_value->push_back(
entry( fc::move(key), fc::move(var) ) );
381 return std::move(*
this);
387 set( e.key(), e.value() );
394 set( e.key(), e.value() );
395 return std::move(*
this);
403 set( e.key(), e.value() );
410 set( e.key(), e.value() );
411 return std::move(*
this);
An order-preserving dictionary of variants.
std::vector< entry >::iterator iterator
mutable_variant_object & set(string key, variant var) &
mutable_variant_object & operator=(mutable_variant_object &&)
variant_object::entry entry
a key/value pair
mutable_variant_object & operator()(string key, variant var) &
const variant & operator[](const string &key) const
void erase(const string &key)
iterator find(const string &key) const
const string & key() const
const variant & value() const
entry & operator=(const entry &)
An order-preserving dictionary of variants.
const variant & operator[](const string &key) const
size_t estimated_size() const
std::vector< entry >::const_iterator iterator
variant_object & operator=(variant_object &&)
iterator find(const string &key) const
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
variant_object & get_object()
Defines exception's used by fc.
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
void from_variant(const fc::variant &v, sysio::chain::chain_id_type &cid)
void to_variant(const sysio::chain::shared_public_key &var, fc::variant &vo)