2
This file is part of Hikari, a library that allows developers
3
to use Flash in their Ogre3D applications.
5
Copyright (C) 2008 Adam J. Simmons
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public
9
License as published by the Free Software Foundation; either
10
version 2.1 of the License, or (at your option) any later version.
12
This library is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Lesser General Public License for more details.
17
You should have received a copy of the GNU Lesser General Public
18
License along with this library; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
#ifndef __FlashValue_H__
23
#define __FlashValue_H__
31
* Defines the Flash variable types, used by FlashValue.
42
* FlashValue represents a Flash ActionScript variable. The currently supported types are: null, boolean, number, and string.
48
* Creates a null FlashValue.
53
* Creates a FlashValue as a boolean type.
55
* @param booleanValue The value to initialize this FlashValue with.
57
FlashValue(bool booleanValue);
60
* Creates a FlashValue as a number type.
62
* @param numericValue The value to initialize this FlashValue with.
64
FlashValue(int numericValue);
67
* Creates a FlashValue as a number type.
69
* @param numericValue The value to initialize this FlashValue with.
71
FlashValue(float numericValue);
74
* Creates a FlashValue as a string type.
76
* @param stringValue The value to initialize this FlashValue with.
78
FlashValue(const char* stringValue);
81
* Creates a FlashValue as a string type.
83
* @param stringValue The value to initialize this FlashValue with.
85
FlashValue(const wchar_t* stringValue);
88
* Creates a FlashValue as a string type.
90
* @param stringValue The value to initialize this FlashValue with.
92
FlashValue(const std::string& stringValue);
95
* Creates a FlashValue as a string type.
97
* @param stringValue The value to initialize this FlashValue with.
99
FlashValue(const std::wstring& stringValue);
102
* Creates a FlashValue as a string type.
104
* @param stringValue The value to initialize this FlashValue with.
106
FlashValue(const MyGUI::UString& stringValue);
109
* Retrieves the FlashType of this FlashValue.
111
short getType() const;
114
* Returns whether or not this FlashValue is of a null type.
119
* Sets this FlashValue as a null type.
124
* Retrieves the value as a boolean.
126
* @note If the actual value type is FT_BOOLEAN, this directly retrieves the actual value. Otherwise
127
* this function will make an interpretation of the value as that of a boolean. Number values
128
* will be cast to boolean and string values will be parsed lexically ("true" and "false" are valid).
129
* A value type of null will always return false.
131
bool getBool() const;
134
* Retrieves the value as a number.
136
* @note If the actual value type is FT_NUMBER, this directly retrieves the actual value. Otherwise
137
* this function will make an interpretation of the value as that of a number type. Boolean
138
* values will be cast to a number and string values will be parsed lexically. A value type of
139
* null will always return '0'.
141
float getNumber() const;
144
* If this FlashValue is a number type, retrieves the number value interpreted as a color.
146
* @note Color values in ActionScript are generally encoded as a number, hence this function's utility.
148
MyGUI::Colour getNumberAsColor() const;
151
* Retrieves the value as a string.
153
* @note If the actual value type is FT_STRING, this directly retrieves the actual value. Otherwise
154
* this function will make an interpretation of the value as that of a string type. Boolean
155
* values will either be "true" or "false", number values will be output in standard form,
156
* and null value types will always return an empty string.
158
MyGUI::UString getString() const;
161
MyGUI::UString strValue;
168
* Arguments is defined as a vector of FlashValues. Used to communicate with ActionScript functions.
170
typedef std::vector<FlashValue> Arguments;
173
* This helper class can be used to quickly declare variable-length FlashValue arguments inline.
175
* Syntax is: \code Args(x)(x)(x)(x)... \endcode
177
class Args : public Arguments
184
explicit Args(const FlashValue& firstArg);
186
Args& operator()(const FlashValue& newArg);
2
This file is part of Hikari, a library that allows developers
3
to use Flash in their Ogre3D applications.
5
Copyright (C) 2008 Adam J. Simmons
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public
9
License as published by the Free Software Foundation; either
10
version 2.1 of the License, or (at your option) any later version.
12
This library is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Lesser General Public License for more details.
17
You should have received a copy of the GNU Lesser General Public
18
License along with this library; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
#ifndef __FlashValue_H__
23
#define __FlashValue_H__
31
* Defines the Flash variable types, used by FlashValue.
42
* FlashValue represents a Flash ActionScript variable. The currently supported types are: null, boolean, number, and string.
48
* Creates a null FlashValue.
53
* Creates a FlashValue as a boolean type.
55
* @param booleanValue The value to initialize this FlashValue with.
57
FlashValue(bool booleanValue);
60
* Creates a FlashValue as a number type.
62
* @param numericValue The value to initialize this FlashValue with.
64
FlashValue(int numericValue);
67
* Creates a FlashValue as a number type.
69
* @param numericValue The value to initialize this FlashValue with.
71
FlashValue(float numericValue);
74
* Creates a FlashValue as a string type.
76
* @param stringValue The value to initialize this FlashValue with.
78
FlashValue(const char* stringValue);
81
* Creates a FlashValue as a string type.
83
* @param stringValue The value to initialize this FlashValue with.
85
FlashValue(const wchar_t* stringValue);
88
* Creates a FlashValue as a string type.
90
* @param stringValue The value to initialize this FlashValue with.
92
FlashValue(const std::string& stringValue);
95
* Creates a FlashValue as a string type.
97
* @param stringValue The value to initialize this FlashValue with.
99
FlashValue(const std::wstring& stringValue);
102
* Creates a FlashValue as a string type.
104
* @param stringValue The value to initialize this FlashValue with.
106
FlashValue(const MyGUI::UString& stringValue);
109
* Retrieves the FlashType of this FlashValue.
111
short getType() const;
114
* Returns whether or not this FlashValue is of a null type.
119
* Sets this FlashValue as a null type.
124
* Retrieves the value as a boolean.
126
* @note If the actual value type is FT_BOOLEAN, this directly retrieves the actual value. Otherwise
127
* this function will make an interpretation of the value as that of a boolean. Number values
128
* will be cast to boolean and string values will be parsed lexically ("true" and "false" are valid).
129
* A value type of null will always return false.
131
bool getBool() const;
134
* Retrieves the value as a number.
136
* @note If the actual value type is FT_NUMBER, this directly retrieves the actual value. Otherwise
137
* this function will make an interpretation of the value as that of a number type. Boolean
138
* values will be cast to a number and string values will be parsed lexically. A value type of
139
* null will always return '0'.
141
float getNumber() const;
144
* If this FlashValue is a number type, retrieves the number value interpreted as a color.
146
* @note Color values in ActionScript are generally encoded as a number, hence this function's utility.
148
MyGUI::Colour getNumberAsColor() const;
151
* Retrieves the value as a string.
153
* @note If the actual value type is FT_STRING, this directly retrieves the actual value. Otherwise
154
* this function will make an interpretation of the value as that of a string type. Boolean
155
* values will either be "true" or "false", number values will be output in standard form,
156
* and null value types will always return an empty string.
158
MyGUI::UString getString() const;
161
MyGUI::UString strValue;
168
* Arguments is defined as a vector of FlashValues. Used to communicate with ActionScript functions.
170
typedef std::vector<FlashValue> Arguments;
173
* This helper class can be used to quickly declare variable-length FlashValue arguments inline.
175
* Syntax is: \code Args(x)(x)(x)(x)... \endcode
177
class Args : public Arguments
184
explicit Args(const FlashValue& firstArg);
186
Args& operator()(const FlashValue& newArg);