Blender V4.3
blender::io::serialize::DictionaryValue Class Reference

#include <BLI_serialize.hh>

Inherits blender::io::serialize::Value.

Public Types

using Item = std::pair<std::string, std::shared_ptr<Value>>
 
using Lookup = Map<std::string, std::shared_ptr<Value>>
 

Public Member Functions

 DictionaryValue ()
 
Lookup create_lookup () const
 
const std::shared_ptr< Value > * lookup (const StringRef key) const
 
std::optional< StringRefNulllookup_str (const StringRef key) const
 
std::optional< int64_tlookup_int (const StringRef key) const
 
std::optional< doublelookup_double (const StringRef key) const
 
const DictionaryValuelookup_dict (const StringRef key) const
 
const ArrayValuelookup_array (const StringRef key) const
 
Span< Itemelements () const
 
void append (std::string key, std::shared_ptr< Value > value)
 
void append_int (std::string key, int64_t value)
 
void append_double (std::string key, double value)
 
void append_str (std::string key, std::string value)
 
std::shared_ptr< DictionaryValueappend_dict (std::string key)
 
std::shared_ptr< ArrayValueappend_array (std::string key)
 
- Public Member Functions inherited from blender::io::serialize::Value
virtual ~Value ()=default
 
eValueType type () const
 
const StringValueas_string_value () const
 
const IntValueas_int_value () const
 
const DoubleValueas_double_value () const
 
const BooleanValueas_boolean_value () const
 
const EnumValueas_enum_value () const
 
const ArrayValueas_array_value () const
 
const DictionaryValueas_dictionary_value () const
 

Additional Inherited Members

- Protected Member Functions inherited from blender::io::serialize::Value
 Value ()=delete
 
 Value (eValueType type)
 

Detailed Description

Object is a key-value container where the key must be a std::string. Internally it is stored in a blender::Vector to ensure the order of keys.

Definition at line 234 of file BLI_serialize.hh.

Member Typedef Documentation

◆ Item

using blender::io::serialize::DictionaryValue::Item = std::pair<std::string, std::shared_ptr<Value>>

Elements are stored as an key value pair. The value is a shared pointer so it can be shared when using DictionaryValue::create_lookup.

Definition at line 240 of file BLI_serialize.hh.

◆ Lookup

using blender::io::serialize::DictionaryValue::Lookup = Map<std::string, std::shared_ptr<Value>>

Definition at line 241 of file BLI_serialize.hh.

Constructor & Destructor Documentation

◆ DictionaryValue()

blender::io::serialize::DictionaryValue::DictionaryValue ( )
inline

Definition at line 247 of file BLI_serialize.hh.

Member Function Documentation

◆ append()

void blender::io::serialize::DictionaryValue::append ( std::string key,
std::shared_ptr< Value > value )

◆ append_array()

std::shared_ptr< ArrayValue > blender::io::serialize::DictionaryValue::append_array ( std::string key)

Definition at line 344 of file serialize.cc.

References append.

◆ append_dict()

std::shared_ptr< DictionaryValue > blender::io::serialize::DictionaryValue::append_dict ( std::string key)

Definition at line 337 of file serialize.cc.

References append.

Referenced by blender::bke::bake::serialize_bake().

◆ append_double()

void blender::io::serialize::DictionaryValue::append_double ( std::string key,
double value )

Definition at line 327 of file serialize.cc.

References append.

◆ append_int()

void blender::io::serialize::DictionaryValue::append_int ( std::string key,
int64_t value )

◆ append_str()

void blender::io::serialize::DictionaryValue::append_str ( std::string key,
std::string value )

◆ create_lookup()

DictionaryValue::Lookup blender::io::serialize::DictionaryValue::create_lookup ( ) const

Return a lookup map to quickly lookup by key.

The lookup is owned by the caller.

Definition at line 252 of file serialize.cc.

References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_as(), and result.

◆ elements()

Span< Item > blender::io::serialize::DictionaryValue::elements ( ) const
inline

Definition at line 262 of file BLI_serialize.hh.

Referenced by blender::bke::bake::deserialize_bake().

◆ lookup()

const std::shared_ptr< Value > * blender::io::serialize::DictionaryValue::lookup ( const StringRef key) const

◆ lookup_array()

◆ lookup_dict()

◆ lookup_double()

std::optional< double > blender::io::serialize::DictionaryValue::lookup_double ( const StringRef key) const

Definition at line 291 of file serialize.cc.

References blender::io::serialize::Value::as_double_value(), and lookup().

◆ lookup_int()

◆ lookup_str()


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