MCPcopy Create free account
hub / github.com/MergHQ/CRYENGINE / ScriptAnyValue

Class ScriptAnyValue

Code/CryEngine/CryCommon/CryScriptSystem/IScriptSystem.h:101–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99};
100
101struct ScriptAnyValue
102{
103 ScriptAnyType type;
104 union
105 {
106 bool b;
107 float number;
108 const char* str;
109 IScriptTable* table;
110 const void* ptr;
111 HSCRIPTFUNCTION function;
112 struct { float x, y, z; } vec3;
113 struct { void* ptr; int nRef; } ud;
114 };
115
116 ~ScriptAnyValue(); // Implemented at the end of header.
117
118 ScriptAnyValue() : type(ANY_ANY) { table = 0; };
119 ScriptAnyValue(ScriptAnyType _type) : type(_type) { table = 0; };
120 ScriptAnyValue(bool value) : type(ANY_TBOOLEAN) { b = value; };
121 ScriptAnyValue(int value) : type(ANY_TNUMBER) { number = (float)value; };
122 ScriptAnyValue(unsigned int value) : type(ANY_TNUMBER) { number = (float)value; };
123 ScriptAnyValue(float value) : type(ANY_TNUMBER) { number = value; };
124 ScriptAnyValue(const char* value) : type(ANY_TSTRING) { str = value; };
125 ScriptAnyValue(ScriptHandle value) : type(ANY_THANDLE) { ptr = value.ptr; };
126 ScriptAnyValue(HSCRIPTFUNCTION value);
127 ScriptAnyValue(const Vec3& value) : type(ANY_TVECTOR) { vec3.x = value.x; vec3.y = value.y; vec3.z = value.z; };
128 ScriptAnyValue(const Ang3& value) : type(ANY_TVECTOR) { vec3.x = value.x; vec3.y = value.y; vec3.z = value.z; };
129 //ScriptAnyValue( const ScriptUserData &value ) : type(ANY_TUSERDATA) { ud.ptr = value.ptr; ud.nRef = value.nRef; };
130 //ScriptAnyValue( USER_DATA value ) : type(ANY_TUSERDATA) { ud.nRef=(int)value;ud.nCookie=0;ud.nVal=0; }; // To Remove.
131 ScriptAnyValue(IScriptTable* value); // Implemented at the end of header.
132 ScriptAnyValue(const SmartScriptTable& value); // Implemented at the end of header.
133
134 ScriptAnyValue(const ScriptAnyValue& value); // Implemented at the end of header.
135 void Swap(ScriptAnyValue& value); // Implemented at the end of header.
136
137 ScriptAnyValue& operator=(const ScriptAnyValue& rhs)
138 {
139 ScriptAnyValue temp(rhs);
140 Swap(temp);
141 return *this;
142 }
143
144 //! Compares 2 values.
145 bool operator==(const ScriptAnyValue& rhs) const;
146 bool operator!=(const ScriptAnyValue& rhs) const { return !(*this == rhs); };
147
148 bool CopyTo(bool& value) const { if (type == ANY_TBOOLEAN) { value = b; return true; }; return false; };
149 bool CopyTo(int& value) const { if (type == ANY_TNUMBER) { value = (int)number; return true; }; return false; };
150 bool CopyTo(unsigned int& value) const { if (type == ANY_TNUMBER) { value = (unsigned int)number; return true; }; return false; };
151 bool CopyTo(float& value) const { if (type == ANY_TNUMBER) { value = number; return true; }; return false; };
152 bool CopyTo(const char*& value) const { if (type == ANY_TSTRING) { value = str; return true; }; return false; };
153 bool CopyTo(char*& value) const { if (type == ANY_TSTRING) { value = (char*)str; return true; }; return false; };
154 bool CopyTo(string& value) const { if (type == ANY_TSTRING) { value = str; return true; }; return false; };
155 bool CopyTo(ScriptHandle& value) const { if (type == ANY_THANDLE) { value.ptr = const_cast<void*>(ptr); return true; }; return false; };
156 bool CopyTo(HSCRIPTFUNCTION& value) const;
157 bool CopyTo(Vec3& value) const { if (type == ANY_TVECTOR) { value.x = vec3.x; value.y = vec3.y; value.z = vec3.z; return true; }; return false; };
158 bool CopyTo(Ang3& value) const { if (type == ANY_TVECTOR) { value.x = vec3.x; value.y = vec3.y; value.z = vec3.z; return true; }; return false; };

Callers 13

EntityIdToScriptMethod · 0.85
GetValueRawFunction · 0.85
UIValueToLuaValueMethod · 0.85
ReadScriptMethod · 0.85
SetGlobalToNullMethod · 0.85
SetGlobalValueMethod · 0.85
SetToNullMethod · 0.85
SetToNullChainMethod · 0.85
SetNullAtMethod · 0.85
SmartScriptFunctionMethod · 0.85
ReadScriptMethod · 0.85

Calls 1

SwapFunction · 0.50

Tested by

no test coverage detected