Persist¶
ILxPersistenceService¶
-
class
ILxPersistenceService
¶ The service provides methods to define the setup of the configuration.
Public Functions
-
LxResult
ScriptQuery
(LXtObjectID self, void **ppvObj)¶
-
LxResult
Configure
(LXtObjectID self, const char *name, LXtObjectID obj)¶ Clients call this method to define a set of persistent attributes. The name will define a top-level atom in the config file which should be unique. The object can be a visitor which, when evaluated, should add entries and values. It should be noted that this function should only be called once for any top-level name during the lifetime of the application. Attempting to call it again will return an error.
-
LxResult
Start
(LXtObjectID self, const char *name, unsigned int type)¶ During configuration, these calls define the nested hierarchy of entries. Each entry has a name and a type atom, hash or list. Ending the entry definition returns the persistent entry object which can be use to traverse persistent values.
-
LxResult
End
(LXtObjectID self, void **ppvObj)¶
-
LxResult
AddValue
(LXtObjectID self, const char *typeName)¶ While in an entry definition, values can be added. Currently only one value per entry is allowed. The type name is any of the value types.
-
LxResult
LXi_PERSIST_ATOM
LXi_PERSIST_HASH
LXi_PERSIST_LIST
ILxPersistenceClient¶
-
class
ILxPersistenceClient
¶ In most case the client will maintain persistent state in the host app and read it whenever it’s needed. This allows the client to react to changes to the application persistent state (like if the user imports new configs) but it can be slower than desired for very complex resource definitions, for example. If that’s the case the client will want to cache their state internally, but they then need to be able to react to config system events. If this is required the client can pass a PersistenceClient object in the call to Configure() instead of a visitor. In this case the object itself will persist, and methods will be used to manage synchnonization.
Public Functions
-
LxResult
Setup
(LXtObjectID self)¶ Setup Called to configure the entries and values, like Evaluate() from a visitor.
SyncRead Called when the client should read its state from the application. This will be called after a successful initial setup.
SyncRead Called when the client should write its cached state to the application.
-
LxResult
SyncRead
(LXtObjectID self)¶
-
LxResult
SyncWrite
(LXtObjectID self)¶
-
LxResult
ILxPersistentEntry¶
-
class
ILxPersistentEntry
¶ Access to persistent state is through a persistent entry interface. The value for sub-entries depends on the values of their parent entries, so those need to be set in order to get valid results for sub-entries.
Public Functions
-
LxResult
Count
(LXtObjectID self, unsigned int *count)¶ Entry objects also have an ILxAttributes interface for accessing their values, although for now all values are index 0. Count() tells you how many values there are for this entry. For atoms this is 0 or 1, depending on whether it’s defined. For lists and hashes this can be more than one.
-
LxResult
Select
(LXtObjectID self, unsigned int index)¶ These methods pick the specific entry. Select() uses and index and works for lists or hashes, and Lookup() uses a key and is only for hashes. Entries that are atoms don’t need to be explicitly selected.
-
LxResult
Lookup
(LXtObjectID self, const char *key)¶
-
LxResult
Append
(LXtObjectID self)¶ These methods add new values Append() for atoms and lists, and Insert() for hashes.
-
LxResult
Insert
(LXtObjectID self, const char *key)¶
-
LxResult
Delete
(LXtObjectID self)¶ These methods remove values. Delete() removes this specific value, while Clear() removes all values of this type from the current parent.
-
LxResult
Clear
(LXtObjectID self)¶
-
LxResult
Hash
(LXtObjectID self, const char **key)¶ For hash entries, this returns the hash itself.
-
int
Number
()¶ User Class Only: Easier way to get the entry count, with -1 for errors.
-
LxResult