![]() |
vkmEngine 1.0.0
A C++ game engine · vkmengine.com
|
Type-erased visitor over a behavior's reflected authoring fields. More...
#include <behavior_field_visitor.h>
Public Member Functions | |
| virtual void | enumField (const char *name, int &index, const char *const *names, std::size_t count)=0 |
| Visit an enum field, type-erased to (name index, name table). | |
| virtual void | assetField (const char *name, std::string &assetName, AssetType type)=0 |
| Visit a field that names an asset, type-erased to (name, kind). | |
| virtual bool | beginStruct (const char *name)=0 |
| Enter a nested reflected-struct field; return true to descend. | |
| virtual void | endStruct ()=0 |
| Leave the struct opened by a beginStruct() that returned true. | |
Type-erased visitor over a behavior's reflected authoring fields.
ReflectedBehavior::visitFields dispatches each field: leaves to a field() overload (the one closed set; add an overload for a new type), VKM_ENUM_NAMES enums to enumField(), AssetRef<Asset> to assetField(), and VKM_REFLECT-ed structs through beginStruct()/endStruct().
|
pure virtual |
Visit an enum field, type-erased to (name index, name table).
Serialize by name (names[index]), never the integer, so reordering values keeps scenes valid.
| name | Field name. |
| index | In: current value. Out: the visitor's chosen value. |
| names | Value-ordered names[count] from the enum's EnumNames. |
| count | Number of names. |
|
pure virtual |
Visit a field that names an asset, type-erased to (name, kind).
The name, not a handle, is the serializable identity; a serializer needs type to save the asset too, or the reference resolves to nothing on load.
| name | Field name. |
| assetName | In: the current reference, empty for none. Out: the visitor's chosen one. |
| type | Asset kind the field may reference. |
|
pure virtual |
Enter a nested reflected-struct field; return true to descend.
False skips the children and no endStruct() follows, so open per-struct scope (a JSON sub-object, a tree node) only on the true path.
| name | Field name of the nested struct. |