ConfigDB::Union Class Reference

Variant object, can contain one of a selection of objects types. More...

#include <Union.h>

Inheritance diagram for ConfigDB::Union:
Collaboration diagram for ConfigDB::Union:

Public Types

using Tag = uint8_t
 
- Public Types inherited from ConfigDB::Object
using UpdateCallback = Delegate< void(Store &store)>
 Callback invoked by asynchronous updater. More...
 

Public Member Functions

Tag getTag () const
 Get the current tag which identifies the stored type. More...
 
void setTag (Tag tag)
 Set the current tag and reset content to object default. More...
 
void clear ()
 Reset tag to default and clear whatever object that corresponds to. More...
 
unsigned getObjectCount () const
 
Object getObject ([[maybe_unused]] unsigned index)
 
unsigned getPropertyCount () const
 
PropertyConst getProperty (unsigned) const
 
Property getProperty (unsigned)
 
template<typename Item >
const Item as (Tag tag) const
 Used by code generator to obtain a read-only reference to the contained object. More...
 
template<typename Item >
Item as (Tag tag)
 Used by code generator to obtain a writeable reference to the contained object. More...
 
template<typename Item >
Item to (Tag tag)
 Used by code generator to set the tag and return a direct reference to the contained object. More...
 
 Object ()
 
 Object (const Object &other)
 
 Object (Object &&)=delete
 
 Object (const PropertyInfo &propinfo)
 
 Object (Object &parent, const PropertyInfo &prop, uint16_t dataRef)
 
 Object (const Object &parent, const PropertyInfo &prop, uint16_t dataRef)
 
 Object (Object &parent, unsigned propIndex, uint16_t dataRef=0)
 
 Object (const Object &parent, unsigned propIndex, uint16_t dataRef=0)
 
- Public Member Functions inherited from ConfigDB::Object
 Object ()
 
 Object (const Object &other)
 
 Object (Object &&)=delete
 
Objectoperator= (const Object &other)
 
 Object (const PropertyInfo &propinfo)
 
 Object (Object &parent, const PropertyInfo &prop, uint16_t dataRef)
 
 Object (const Object &parent, const PropertyInfo &prop, uint16_t dataRef)
 
 Object (Object &parent, unsigned propIndex, uint16_t dataRef=0)
 
 Object (const Object &parent, unsigned propIndex, uint16_t dataRef=0)
 
 operator bool () const
 
bool typeIs (ObjectType type) const
 
bool isArray () const
 
bool isStore () const
 Determine if this object is a store (not just a reference to it) More...
 
StoregetStore ()
 
const StoregetStore () const
 
DatabasegetDatabase ()
 
const DatabasegetDatabase () const
 
unsigned getObjectCount () const
 Get number of child objects. More...
 
Object getObject (unsigned index)
 Get child object by index. More...
 
const Object getObject (unsigned index) const
 
Object findObject (const char *name, size_t length)
 Find child object by name. More...
 
unsigned getPropertyCount () const
 Get number of properties. More...
 
Property getProperty (unsigned index)
 Get properties. More...
 
PropertyConst getProperty (unsigned index) const
 
Property findProperty (const char *name, size_t length)
 Find property by name. More...
 
void clear ()
 Reset contents to defaults (except arrays, which are cleared) More...
 
void loadArrayDefaults ()
 Clear and load all contained arrays with defaults from schema. More...
 
void resetToDefaults ()
 Does a 'clear' followed by 'loadArrayDefaults'. More...
 
bool commit ()
 Commit changes to the store. More...
 
void clearDirty ()
 Clear store dirty flag so changes don't get committed. More...
 
String getName () const
 
String getPath () const
 
size_t printTo (Print &p) const
 
bool exportToStream (const Format &format, Print &output) const
 
bool exportToFile (const Format &format, const String &filename) const
 
Status importFromStream (const Format &format, Stream &source)
 
Status importFromFile (const Format &format, const String &filename)
 
const PropertyInfopropinfo () const
 
const ObjectInfotypeinfo () const
 
PropertyDatagetPropertyData (unsigned index)
 
const PropertyDatagetPropertyData (unsigned index) const
 
void queueUpdate (UpdateCallback callback)
 Called from OuterObjectTemplate::update to queue an update. More...
 

Additional Inherited Members

- Public Attributes inherited from ConfigDB::Object
uint16_t streamPos {}
 
- Protected Member Functions inherited from ConfigDB::Object
StoreRef openStore (Database &db, unsigned storeIndex)
 
StoreUpdateRef openStoreForUpdate (Database &db, unsigned storeIndex)
 
void disposeArrays ()
 
void initArrays ()
 
bool isWriteable () const
 
StoreUpdateRef lockStore (StoreRef &store)
 
bool writeCheck () const
 
void * getDataPtr ()
 
const void * getDataPtr () const
 
String getPropertyString (unsigned index, StringId id) const
 
String getPropertyString (unsigned index) const
 
StringId getStringId (const PropertyInfo &prop, const char *value, uint16_t valueLength)
 
StringId getStringId (const PropertyInfo &prop, const String &value)
 
template<typename T >
StringId getStringId (const PropertyInfo &prop, const T &value)
 
int findStringId (const char *value, uint16_t valueLength) const
 
void setPropertyValue (unsigned index, const void *value)
 
void setPropertyValue (unsigned index, const String &value)
 
- Protected Attributes inherited from ConfigDB::Object
const PropertyInfopropinfoPtr
 
Objectparent {}
 
uint16_t dataRef {}
 

Detailed Description

Variant object, can contain one of a selection of objects types.

Member Typedef Documentation

◆ Tag

using ConfigDB::Union::Tag = uint8_t

Member Function Documentation

◆ as() [1/2]

template<typename Item >
Item ConfigDB::Union::as ( Tag  tag)
inline

Used by code generator to obtain a writeable reference to the contained object.

◆ as() [2/2]

template<typename Item >
const Item ConfigDB::Union::as ( Tag  tag) const
inline

Used by code generator to obtain a read-only reference to the contained object.

◆ clear()

void ConfigDB::Union::clear ( void  )
inline

Reset tag to default and clear whatever object that corresponds to.

◆ getObject()

Object ConfigDB::Union::getObject ( [[maybe_unused] ] unsigned  index)
inline

◆ getObjectCount()

unsigned ConfigDB::Union::getObjectCount ( ) const
inline

◆ getProperty() [1/2]

Property ConfigDB::Union::getProperty ( unsigned  )
inline

◆ getProperty() [2/2]

PropertyConst ConfigDB::Union::getProperty ( unsigned  ) const
inline

◆ getPropertyCount()

unsigned ConfigDB::Union::getPropertyCount ( ) const
inline

◆ getTag()

Tag ConfigDB::Union::getTag ( ) const
inline

Get the current tag which identifies the stored type.

◆ Object() [1/8]

ConfigDB::Object::Object
inline

◆ Object() [2/8]

ConfigDB::Object::Object
inline

◆ Object() [3/8]

ConfigDB::Object::Object
inline

◆ Object() [4/8]

ConfigDB::Object::Object
inline

◆ Object() [5/8]

ConfigDB::Object::Object
inlineexplicit

◆ Object() [6/8]

ConfigDB::Object::Object
delete

◆ Object() [7/8]

ConfigDB::Object::Object
inline

◆ Object() [8/8]

ConfigDB::Object::Object
inline

◆ setTag()

void ConfigDB::Union::setTag ( Tag  tag)
inline

Set the current tag and reset content to object default.

◆ to()

template<typename Item >
Item ConfigDB::Union::to ( Tag  tag)
inline

Used by code generator to set the tag and return a direct reference to the contained object.


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