dao::gui::Value
struct
A value passed between the game and a movie (GFx’s GFxValue): the arguments and return value of an ExternalInterface call, and a Movie’s variables and arguments.
This version of GFx passes only undefined, null, bools, numbers and strings. An object, array or clip read from a movie comes back as its string, and one passed into a movie reaches ActionScript as undefined.
Declared in dao/Gui.h.
Enumerations
Type
enum class Type : std::uint32_t
A value’s type, numbered as in GFx 3.0.
| Value | |
|---|---|
Undefined = 0 |
|
Null = 1 |
|
Boolean = 2 |
|
Number = 3 |
|
String = 4 |
a UTF-8 string |
StringW = 5 |
a wide string |
Object = 6 |
never used by this version of GFx |
Array = 7 |
never used by this version of GFx |
DisplayObject = 8 |
never used by this version of GFx |
Functions
AsBool()
std::optional<bool> AsBool() const
Returns the bool, or nullopt if the value is of another type.
AsNumber()
std::optional<double> AsNumber() const
Returns the number, or nullopt if the value is of another type.
AsString()
std::optional<std::string_view> AsString() const
Returns the UTF-8 string, or nullopt if the value is of another type or a null string.
AsWString()
std::optional<std::wstring_view> AsWString() const
Returns the wide string, or nullopt if the value is of another type or a null string.
Bool()
static Value Bool(bool b)
Makes a bool value.
Kind()
Type Kind() const
Returns the value’s type, without the flag (0x40) that GFx adds to values it manages.
Number()
static Value Number(double n)
Makes a number value.
String()
static Value String(const char *text)
Makes a UTF-8 string value.
The text is not copied, so keep it alive until the call you pass it to returns; GFx copies it there.
WString()
static Value WString(const wchar_t *text)
Makes a wide string value.
The text is not copied, so keep it alive until the call you pass it to returns.
Fields
| Field | Type | |
|---|---|---|
objectInterface |
const void * = nullptr |
unused by this version of GFx; always null |
type |
std::uint32_t = 0 |
a Type plus GFx’s flags; read it through Kind |
value |
union dao::gui::Value::@366143246242321247113034155300221304232245163340 |
[union].value
The value. Which member holds it depends on the type.