Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/system/ParamNode.h
Show All 21 Lines | |||||
#include "maths/Fixed.h" | #include "maths/Fixed.h" | ||||
#include "ps/CStrIntern.h" | #include "ps/CStrIntern.h" | ||||
#include "ps/Errors.h" | #include "ps/Errors.h" | ||||
#include "scriptinterface/ScriptTypes.h" | #include "scriptinterface/ScriptTypes.h" | ||||
#include <map> | #include <map> | ||||
#include <string> | #include <string> | ||||
class XMBFile; | class XMBData; | ||||
class XMBElement; | class XMBElement; | ||||
class ScriptRequest; | class ScriptRequest; | ||||
/** | /** | ||||
* An entity initialisation parameter node. | * An entity initialisation parameter node. | ||||
* Each node has a text value, plus a number of named child nodes (in a tree structure). | * Each node has a text value, plus a number of named child nodes (in a tree structure). | ||||
* Child nodes are unordered, and there cannot be more than one with the same name. | * Child nodes are unordered, and there cannot be more than one with the same name. | ||||
▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | public: | ||||
/** | /** | ||||
* Loads the XML data specified by @a file into the node @a ret. | * Loads the XML data specified by @a file into the node @a ret. | ||||
* Any existing data in @a ret will be overwritten or else kept, so this | * Any existing data in @a ret will be overwritten or else kept, so this | ||||
* can be called multiple times to build up a node from multiple inputs. | * can be called multiple times to build up a node from multiple inputs. | ||||
* | * | ||||
* @param sourceIdentifier Optional; string you can pass along to indicate the source of | * @param sourceIdentifier Optional; string you can pass along to indicate the source of | ||||
* the data getting loaded. Used for output to log messages if an error occurs. | * the data getting loaded. Used for output to log messages if an error occurs. | ||||
*/ | */ | ||||
static void LoadXML(CParamNode& ret, const XMBFile& file, const wchar_t* sourceIdentifier = NULL); | static void LoadXML(CParamNode& ret, const XMBData& xmb, const wchar_t* sourceIdentifier = NULL); | ||||
/** | /** | ||||
* Loads the XML data specified by @a path into the node @a ret. | * Loads the XML data specified by @a path into the node @a ret. | ||||
* Any existing data in @a ret will be overwritten or else kept, so this | * Any existing data in @a ret will be overwritten or else kept, so this | ||||
* can be called multiple times to build up a node from multiple inputs. | * can be called multiple times to build up a node from multiple inputs. | ||||
*/ | */ | ||||
static void LoadXML(CParamNode& ret, const VfsPath& path, const std::string& validatorName); | static void LoadXML(CParamNode& ret, const VfsPath& path, const std::string& validatorName); | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | private: | ||||
/** | /** | ||||
* Overlays the specified data onto this node. See class documentation for the concept and examples. | * Overlays the specified data onto this node. See class documentation for the concept and examples. | ||||
* | * | ||||
* @param xmb Representation of the XMB file containing an element with the data to apply. | * @param xmb Representation of the XMB file containing an element with the data to apply. | ||||
* @param element Element inside the specified @p xmb file containing the data to apply. | * @param element Element inside the specified @p xmb file containing the data to apply. | ||||
* @param sourceIdentifier Optional; string you can pass along to indicate the source of | * @param sourceIdentifier Optional; string you can pass along to indicate the source of | ||||
* the data getting applied. Used for output to log messages if an error occurs. | * the data getting applied. Used for output to log messages if an error occurs. | ||||
*/ | */ | ||||
void ApplyLayer(const XMBFile& xmb, const XMBElement& element, const wchar_t* sourceIdentifier = NULL); | void ApplyLayer(const XMBData& xmb, const XMBElement& element, const wchar_t* sourceIdentifier = NULL); | ||||
void ResetScriptVal(); | void ResetScriptVal(); | ||||
void ConstructJSVal(const ScriptRequest& rq, JS::MutableHandleValue ret) const; | void ConstructJSVal(const ScriptRequest& rq, JS::MutableHandleValue ret) const; | ||||
std::string m_Value; | std::string m_Value; | ||||
ChildrenMap m_Childs; | ChildrenMap m_Childs; | ||||
bool m_IsOk; | bool m_IsOk; | ||||
/** | /** | ||||
* Caches the ToJSVal script representation of this node. | * Caches the ToJSVal script representation of this node. | ||||
*/ | */ | ||||
mutable std::shared_ptr<JS::PersistentRootedValue> m_ScriptVal; | mutable std::shared_ptr<JS::PersistentRootedValue> m_ScriptVal; | ||||
}; | }; | ||||
#endif // INCLUDED_PARAMNODE | #endif // INCLUDED_PARAMNODE |
Wildfire Games · Phabricator