An object can contain other objects, properties and arrays. More...
#include <Object.h>
Public Types | |
| using | UpdateCallback = Delegate< void(Store &store)> |
| Callback invoked by asynchronous updater. More... | |
Public Member Functions | |
| Object () | |
| Object (const Object &other) | |
| Object (Object &&)=delete | |
| Object & | operator= (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... | |
| Store & | getStore () |
| const Store & | getStore () const |
| Database & | getDatabase () |
| const Database & | getDatabase () 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 |
| Support standard streaming output of this object's content in prettified JSON. More... | |
| bool | exportToStream (const Format &format, Print &output, const ExportOptions &options={}) const |
| Export object to an output stream. More... | |
| bool | exportToFile (const Format &format, const String &filename, const ExportOptions &options={}) const |
| Export object to an output stream. More... | |
| Status | importFromStream (const Format &format, Stream &source) |
| Import content to this object. More... | |
| Status | importFromFile (const Format &format, const String &filename) |
| Import content to this object. More... | |
| const PropertyInfo & | propinfo () const |
| const ObjectInfo & | typeinfo () const |
| PropertyData * | getPropertyData (unsigned index) |
| const PropertyData * | getPropertyData (unsigned index) const |
| void | queueUpdate (UpdateCallback callback) |
Called from OuterObjectTemplate::update to queue an update. More... | |
Public Attributes | |
| uint16_t | streamPos {} |
Protected Member Functions | |
| 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 | |
| const PropertyInfo * | propinfoPtr |
| Object * | parent {} |
| uint16_t | dataRef {} |
Detailed Description
An object can contain other objects, properties and arrays.
- Note
- This class is the base for concrete Object, Array and ObjectArray classes
Member Typedef Documentation
◆ UpdateCallback
| using ConfigDB::Object::UpdateCallback = Delegate<void(Store& store)> |
Callback invoked by asynchronous updater.
- Parameters
-
store Updatable store instance
- Note
- The
OuterObjectTemplate::updatemethod template handles this callback so that the caller receives the appropriate Updater object.
Constructor & Destructor Documentation
◆ Object() [1/8]
|
inline |
◆ Object() [2/8]
|
inline |
◆ Object() [3/8]
|
delete |
◆ Object() [4/8]
|
inlineexplicit |
◆ Object() [5/8]
|
inline |
◆ Object() [6/8]
|
inline |
◆ Object() [7/8]
◆ Object() [8/8]
Member Function Documentation
◆ clear()
| void ConfigDB::Object::clear | ( | ) |
Reset contents to defaults (except arrays, which are cleared)
- Note
- Use caution! All reference objects will be invalidated by this call
◆ clearDirty()
| void ConfigDB::Object::clearDirty | ( | ) |
Clear store dirty flag so changes don't get committed.
- Note
- Store must be reloaded to roll back any changes
◆ commit()
| bool ConfigDB::Object::commit | ( | ) |
Commit changes to the store.
◆ disposeArrays()
|
protected |
◆ exportToFile()
| bool ConfigDB::Object::exportToFile | ( | const Format & | format, |
| const String & | filename, | ||
| const ExportOptions & | options = {} |
||
| ) | const |
Export object to an output stream.
- Parameters
-
format Formatter used to generate output filename Where to write output. Non-existent directories are created automatically. options Options for customising output
◆ exportToStream()
|
inline |
Export object to an output stream.
- Parameters
-
format Formatter used to generate output output Where to write output options Options for customising output
◆ findObject()
| Object ConfigDB::Object::findObject | ( | const char * | name, |
| size_t | length | ||
| ) |
◆ findProperty()
| Property ConfigDB::Object::findProperty | ( | const char * | name, |
| size_t | length | ||
| ) |
Find property by name.
◆ findStringId()
|
protected |
◆ getDatabase() [1/2]
| Database& ConfigDB::Object::getDatabase | ( | ) |
◆ getDatabase() [2/2]
|
inline |
◆ getDataPtr() [1/2]
|
protected |
◆ getDataPtr() [2/2]
|
protected |
◆ getName()
| String ConfigDB::Object::getName | ( | ) | const |
◆ getObject() [1/2]
◆ getObject() [2/2]
◆ getObjectCount()
| unsigned ConfigDB::Object::getObjectCount | ( | ) | const |
Get number of child objects.
- Note
- ObjectArray overrides this to return number of items in the array
◆ getPath()
| String ConfigDB::Object::getPath | ( | ) | const |
◆ getProperty() [1/2]
Get properties.
- Note
- Array types override this to return array elements
◆ getProperty() [2/2]
| PropertyConst ConfigDB::Object::getProperty | ( | unsigned | index | ) | const |
◆ getPropertyCount()
| unsigned ConfigDB::Object::getPropertyCount | ( | ) | const |
Get number of properties.
- Note
- Array types override this to return the number of items in the array.
◆ getPropertyData() [1/2]
|
inline |
◆ getPropertyData() [2/2]
|
inline |
◆ getPropertyString() [1/2]
◆ getPropertyString() [2/2]
◆ getStore() [1/2]
| Store& ConfigDB::Object::getStore | ( | ) |
◆ getStore() [2/2]
|
inline |
◆ getStringId() [1/3]
|
protected |
◆ getStringId() [2/3]
|
inlineprotected |
◆ getStringId() [3/3]
|
inlineprotected |
◆ importFromFile()
Import content to this object.
- Parameters
-
format Formatter used to read the source data filename File containing source data, not including the name of the object itself
◆ importFromStream()
Import content to this object.
- Parameters
-
format Formatter used to read the source data source The source data, not including the name of the object itself
◆ initArrays()
|
protected |
◆ isArray()
|
inline |
◆ isStore()
|
inline |
Determine if this object is a store (not just a reference to it)
◆ isWriteable()
|
protected |
◆ loadArrayDefaults()
| void ConfigDB::Object::loadArrayDefaults | ( | ) |
Clear and load all contained arrays with defaults from schema.
◆ lockStore()
|
protected |
◆ openStore()
◆ openStoreForUpdate()
|
protected |
◆ operator bool()
|
inlineexplicit |
◆ operator=()
◆ printTo()
| size_t ConfigDB::Object::printTo | ( | Print & | p | ) | const |
Support standard streaming output of this object's content in prettified JSON.
◆ propinfo()
|
inline |
◆ queueUpdate()
| void ConfigDB::Object::queueUpdate | ( | UpdateCallback | callback | ) |
Called from OuterObjectTemplate::update to queue an update.
◆ resetToDefaults()
| void ConfigDB::Object::resetToDefaults | ( | ) |
Does a 'clear' followed by 'loadArrayDefaults'.
◆ setPropertyValue() [1/2]
◆ setPropertyValue() [2/2]
|
protected |
◆ typeinfo()
|
inline |
◆ typeIs()
|
inline |
◆ writeCheck()
|
protected |
Member Data Documentation
◆ dataRef
|
protected |
◆ parent
|
protected |
◆ propinfoPtr
|
protected |
◆ streamPos
| uint16_t ConfigDB::Object::streamPos {} |
The documentation for this class was generated from the following file:
1.9.1