Plasma Engine  2.0
Loading...
Searching...
No Matches
plPropertyPath Class Reference

Stores a path from an object of a given type to a property inside of it. Once initialized to a specific path, the target property/object of the path can be read or written on multiple root objects. An empty path is allowed in which case WriteToLeafObject/ReadFromLeafObject will return pRootObject directly. More...

#include <PropertyPath.h>

Public Member Functions

bool IsValid () const
 Returns true if InitializeFromPath() has been successfully called and it is therefore possible to use the other functions.
 
plResult InitializeFromPath (const plRTTI &rootObjectRtti, const char *szPath)
 Resolves a path in the syntax 'propertyName[index]/propertyName[index]/...' into steps. The '[index]' part is only added for properties that require indices (arrays and maps).
 
plResult InitializeFromPath (const plRTTI *pRootObjectRtti, const plArrayPtr< const plPropertyPathStep > path)
 Resolves a path provided as an array of plPropertyPathStep.
 
plResult WriteToLeafObject (void *pRootObject, const plRTTI &type, plDelegate< void(void *pLeaf, const plRTTI &pType)> func) const
 Applies the entire path and allows writing to the target object.
 
plResult ReadFromLeafObject (void *pRootObject, const plRTTI &type, plDelegate< void(void *pLeaf, const plRTTI &pType)> func) const
 Applies the entire path and allows reading from the target object.
 
plResult WriteProperty (void *pRootObject, const plRTTI &type, plDelegate< void(void *pLeafObject, const plRTTI &pLeafType, const plAbstractProperty *pProp, const plVariant &index)> func) const
 Applies the path up to the last step and allows a functor to write to the final property.
 
plResult ReadProperty (void *pRootObject, const plRTTI &type, plDelegate< void(void *pLeafObject, const plRTTI &pLeafType, const plAbstractProperty *pProp, const plVariant &index)> func) const
 Applies the path up to the last step and allows a functor to read from the final property.
 
void SetValue (void *pRootObject, const plRTTI &type, const plVariant &value) const
 Convenience function that writes 'value' to the 'pRootObject' at the current path.
 
template<typename T >
PL_ALWAYS_INLINE void SetValue (T *pRootObject, const plVariant &value) const
 Convenience function that writes 'value' to the 'pRootObject' at the current path.
 
void GetValue (void *pRootObject, const plRTTI &type, plVariant &out_value) const
 Convenience function that reads the value from 'pRootObject' at the current path and stores it in 'out_value'.
 
template<typename T >
PL_ALWAYS_INLINE void GetValue (T *pRootObject, plVariant &out_value) const
 Convenience function that reads the value from 'pRootObject' at the current path and stores it in 'out_value'.
 

Detailed Description

Stores a path from an object of a given type to a property inside of it. Once initialized to a specific path, the target property/object of the path can be read or written on multiple root objects. An empty path is allowed in which case WriteToLeafObject/ReadFromLeafObject will return pRootObject directly.

TODO: read/write methods and ResolvePath should return a failure state.


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