~ubuntu-branches/ubuntu/vivid/mygui/vivid

« back to all changes in this revision

Viewing changes to Plugins/Plugin_HikariWidget/FlashValue.h

  • Committer: Package Import Robot
  • Author(s): Scott Howard, Bret Curtis, Scott Howard
  • Date: 2014-09-18 17:57:48 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140918175748-dd8va78mvpw1jbes
Tags: 3.2.1-1
[ Bret Curtis ]
* Updated license for majority of files from LGPL to Expat (MIT)

[ Scott Howard ]
* New upstream release
* Updated patch to add build option for system GLEW libraries
* All patches accepted upstream except shared_libraries.patch
* Bumped SONAME due to dropped symbols, updated *.symbols and package
  names
* Updated license of debian/* to Expat with permission of all authors
* Don't install Doxygen autogenerated md5 and map files (thanks
  lintian)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
        This file is part of Hikari, a library that allows developers
3
 
        to use Flash in their Ogre3D applications.
4
 
 
5
 
        Copyright (C) 2008 Adam J. Simmons
6
 
 
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.
11
 
 
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.
16
 
 
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
20
 
*/
21
 
 
22
 
#ifndef __FlashValue_H__
23
 
#define __FlashValue_H__
24
 
 
25
 
#include <MyGUI.h>
26
 
 
27
 
namespace Hikari
28
 
{
29
 
 
30
 
        /**
31
 
        * Defines the Flash variable types, used by FlashValue.
32
 
        */
33
 
        enum FlashType
34
 
        {
35
 
                FT_NULL,
36
 
                FT_BOOLEAN,
37
 
                FT_NUMBER,
38
 
                FT_STRING
39
 
        };
40
 
 
41
 
        /**
42
 
        * FlashValue represents a Flash ActionScript variable. The currently supported types are: null, boolean, number, and string.
43
 
        */
44
 
        class FlashValue
45
 
        {
46
 
        public:
47
 
                /**
48
 
                * Creates a null FlashValue.
49
 
                */
50
 
                FlashValue();
51
 
 
52
 
                /**
53
 
                * Creates a FlashValue as a boolean type.
54
 
                *
55
 
                * @param        booleanValue    The value to initialize this FlashValue with.
56
 
                */
57
 
                FlashValue(bool booleanValue);
58
 
 
59
 
                /**
60
 
                * Creates a FlashValue as a number type.
61
 
                *
62
 
                * @param        numericValue    The value to initialize this FlashValue with.
63
 
                */
64
 
                FlashValue(int numericValue);
65
 
 
66
 
                /**
67
 
                * Creates a FlashValue as a number type.
68
 
                *
69
 
                * @param        numericValue    The value to initialize this FlashValue with.
70
 
                */
71
 
                FlashValue(float numericValue);
72
 
 
73
 
                /**
74
 
                * Creates a FlashValue as a string type.
75
 
                *
76
 
                * @param        stringValue     The value to initialize this FlashValue with.
77
 
                */
78
 
                FlashValue(const char* stringValue);
79
 
 
80
 
                /**
81
 
                * Creates a FlashValue as a string type.
82
 
                *
83
 
                * @param        stringValue     The value to initialize this FlashValue with.
84
 
                */
85
 
                FlashValue(const wchar_t* stringValue);
86
 
 
87
 
                /**
88
 
                * Creates a FlashValue as a string type.
89
 
                *
90
 
                * @param        stringValue     The value to initialize this FlashValue with.
91
 
                */
92
 
                FlashValue(const std::string& stringValue);
93
 
 
94
 
                /**
95
 
                * Creates a FlashValue as a string type.
96
 
                *
97
 
                * @param        stringValue     The value to initialize this FlashValue with.
98
 
                */
99
 
                FlashValue(const std::wstring& stringValue);
100
 
 
101
 
                /**
102
 
                * Creates a FlashValue as a string type.
103
 
                *
104
 
                * @param        stringValue     The value to initialize this FlashValue with.
105
 
                */
106
 
                FlashValue(const MyGUI::UString& stringValue);
107
 
 
108
 
                /**
109
 
                * Retrieves the FlashType of this FlashValue.
110
 
                */
111
 
                short getType() const;
112
 
 
113
 
                /**
114
 
                * Returns whether or not this FlashValue is of a null type.
115
 
                */
116
 
                bool isNull() const;
117
 
 
118
 
                /**
119
 
                * Sets this FlashValue as a null type.
120
 
                */
121
 
                void setNull();
122
 
 
123
 
                /**
124
 
                * Retrieves the value as a boolean.
125
 
                *
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.
130
 
                */
131
 
                bool getBool() const;
132
 
 
133
 
                /**
134
 
                * Retrieves the value as a number.
135
 
                *
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'.
140
 
                */
141
 
                float getNumber() const;
142
 
 
143
 
                /**
144
 
                * If this FlashValue is a number type, retrieves the number value interpreted as a color.
145
 
                *
146
 
                * @note Color values in ActionScript are generally encoded as a number, hence this function's utility.
147
 
                */
148
 
                MyGUI::Colour getNumberAsColor() const;
149
 
 
150
 
                /**
151
 
                * Retrieves the value as a string.
152
 
                *
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.
157
 
                */
158
 
                MyGUI::UString getString() const;
159
 
 
160
 
        private:
161
 
                MyGUI::UString strValue;
162
 
                float numValue;
163
 
                bool boolValue;
164
 
                short valueType;
165
 
        };
166
 
 
167
 
        /**
168
 
        * Arguments is defined as a vector of FlashValues. Used to communicate with ActionScript functions.
169
 
        */
170
 
        typedef std::vector<FlashValue> Arguments;
171
 
 
172
 
        /**
173
 
        * This helper class can be used to quickly declare variable-length FlashValue arguments inline.
174
 
        *
175
 
        * Syntax is: \code Args(x)(x)(x)(x)... \endcode
176
 
        */
177
 
        class Args : public Arguments
178
 
        {
179
 
        public:
180
 
                Args();
181
 
 
182
 
                Args(Args& v);
183
 
 
184
 
                explicit Args(const FlashValue& firstArg);
185
 
 
186
 
                Args& operator()(const FlashValue& newArg);
187
 
        };
188
 
 
189
 
}
190
 
 
191
 
#endif
 
1
/*
 
2
        This file is part of Hikari, a library that allows developers
 
3
        to use Flash in their Ogre3D applications.
 
4
 
 
5
        Copyright (C) 2008 Adam J. Simmons
 
6
 
 
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.
 
11
 
 
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.
 
16
 
 
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
 
20
*/
 
21
 
 
22
#ifndef __FlashValue_H__
 
23
#define __FlashValue_H__
 
24
 
 
25
#include <MyGUI.h>
 
26
 
 
27
namespace Hikari
 
28
{
 
29
 
 
30
        /**
 
31
        * Defines the Flash variable types, used by FlashValue.
 
32
        */
 
33
        enum FlashType
 
34
        {
 
35
                FT_NULL,
 
36
                FT_BOOLEAN,
 
37
                FT_NUMBER,
 
38
                FT_STRING
 
39
        };
 
40
 
 
41
        /**
 
42
        * FlashValue represents a Flash ActionScript variable. The currently supported types are: null, boolean, number, and string.
 
43
        */
 
44
        class FlashValue
 
45
        {
 
46
        public:
 
47
                /**
 
48
                * Creates a null FlashValue.
 
49
                */
 
50
                FlashValue();
 
51
 
 
52
                /**
 
53
                * Creates a FlashValue as a boolean type.
 
54
                *
 
55
                * @param        booleanValue    The value to initialize this FlashValue with.
 
56
                */
 
57
                FlashValue(bool booleanValue);
 
58
 
 
59
                /**
 
60
                * Creates a FlashValue as a number type.
 
61
                *
 
62
                * @param        numericValue    The value to initialize this FlashValue with.
 
63
                */
 
64
                FlashValue(int numericValue);
 
65
 
 
66
                /**
 
67
                * Creates a FlashValue as a number type.
 
68
                *
 
69
                * @param        numericValue    The value to initialize this FlashValue with.
 
70
                */
 
71
                FlashValue(float numericValue);
 
72
 
 
73
                /**
 
74
                * Creates a FlashValue as a string type.
 
75
                *
 
76
                * @param        stringValue     The value to initialize this FlashValue with.
 
77
                */
 
78
                FlashValue(const char* stringValue);
 
79
 
 
80
                /**
 
81
                * Creates a FlashValue as a string type.
 
82
                *
 
83
                * @param        stringValue     The value to initialize this FlashValue with.
 
84
                */
 
85
                FlashValue(const wchar_t* stringValue);
 
86
 
 
87
                /**
 
88
                * Creates a FlashValue as a string type.
 
89
                *
 
90
                * @param        stringValue     The value to initialize this FlashValue with.
 
91
                */
 
92
                FlashValue(const std::string& stringValue);
 
93
 
 
94
                /**
 
95
                * Creates a FlashValue as a string type.
 
96
                *
 
97
                * @param        stringValue     The value to initialize this FlashValue with.
 
98
                */
 
99
                FlashValue(const std::wstring& stringValue);
 
100
 
 
101
                /**
 
102
                * Creates a FlashValue as a string type.
 
103
                *
 
104
                * @param        stringValue     The value to initialize this FlashValue with.
 
105
                */
 
106
                FlashValue(const MyGUI::UString& stringValue);
 
107
 
 
108
                /**
 
109
                * Retrieves the FlashType of this FlashValue.
 
110
                */
 
111
                short getType() const;
 
112
 
 
113
                /**
 
114
                * Returns whether or not this FlashValue is of a null type.
 
115
                */
 
116
                bool isNull() const;
 
117
 
 
118
                /**
 
119
                * Sets this FlashValue as a null type.
 
120
                */
 
121
                void setNull();
 
122
 
 
123
                /**
 
124
                * Retrieves the value as a boolean.
 
125
                *
 
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.
 
130
                */
 
131
                bool getBool() const;
 
132
 
 
133
                /**
 
134
                * Retrieves the value as a number.
 
135
                *
 
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'.
 
140
                */
 
141
                float getNumber() const;
 
142
 
 
143
                /**
 
144
                * If this FlashValue is a number type, retrieves the number value interpreted as a color.
 
145
                *
 
146
                * @note Color values in ActionScript are generally encoded as a number, hence this function's utility.
 
147
                */
 
148
                MyGUI::Colour getNumberAsColor() const;
 
149
 
 
150
                /**
 
151
                * Retrieves the value as a string.
 
152
                *
 
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.
 
157
                */
 
158
                MyGUI::UString getString() const;
 
159
 
 
160
        private:
 
161
                MyGUI::UString strValue;
 
162
                float numValue;
 
163
                bool boolValue;
 
164
                short valueType;
 
165
        };
 
166
 
 
167
        /**
 
168
        * Arguments is defined as a vector of FlashValues. Used to communicate with ActionScript functions.
 
169
        */
 
170
        typedef std::vector<FlashValue> Arguments;
 
171
 
 
172
        /**
 
173
        * This helper class can be used to quickly declare variable-length FlashValue arguments inline.
 
174
        *
 
175
        * Syntax is: \code Args(x)(x)(x)(x)... \endcode
 
176
        */
 
177
        class Args : public Arguments
 
178
        {
 
179
        public:
 
180
                Args();
 
181
 
 
182
                Args(Args& v);
 
183
 
 
184
                explicit Args(const FlashValue& firstArg);
 
185
 
 
186
                Args& operator()(const FlashValue& newArg);
 
187
        };
 
188
 
 
189
}
 
190
 
 
191
#endif