![]() |
ezEngine
Release 25.03
|
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. | |
ezResult | InitializeFromPath (const ezRTTI &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). | |
ezResult | InitializeFromPath (const ezRTTI *pRootObjectRtti, const ezArrayPtr< const ezPropertyPathStep > path) |
Resolves a path provided as an array of ezPropertyPathStep. | |
ezResult | WriteToLeafObject (void *pRootObject, const ezRTTI *pType, ezDelegate< void(void *pLeaf, const ezRTTI &pType)> func) const |
Applies the entire path and allows writing to the target object. | |
ezResult | ReadFromLeafObject (void *pRootObject, const ezRTTI *pType, ezDelegate< void(void *pLeaf, const ezRTTI &pType)> func) const |
Applies the entire path and allows reading from the target object. | |
ezResult | WriteProperty (void *pRootObject, const ezRTTI &type, ezDelegate< void(void *pLeafObject, const ezRTTI &pLeafType, const ezAbstractProperty *pProp, const ezVariant &index)> func) const |
Applies the path up to the last step and allows a functor to write to the final property. | |
ezResult | ReadProperty (void *pRootObject, const ezRTTI &type, ezDelegate< void(void *pLeafObject, const ezRTTI &pLeafType, const ezAbstractProperty *pProp, const ezVariant &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 ezRTTI &type, const ezVariant &value) const |
Convenience function that writes 'value' to the 'pRootObject' at the current path. | |
template<typename T > | |
EZ_ALWAYS_INLINE void | SetValue (T *pRootObject, const ezVariant &value) const |
Convenience function that writes 'value' to the 'pRootObject' at the current path. | |
void | GetValue (void *pRootObject, const ezRTTI &type, ezVariant &out_value) const |
Convenience function that reads the value from 'pRootObject' at the current path and stores it in 'out_value'. | |
template<typename T > | |
EZ_ALWAYS_INLINE void | GetValue (T *pRootObject, ezVariant &out_value) const |
Convenience function that reads the value from 'pRootObject' at the current path and stores it in 'out_value'. | |
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.