Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OOConstToJSString.h
Go to the documentation of this file.
1/*
2
3OOConstToJSString.h
4
5Convert various sets of integer constants to JavaScript strings and back again.
6See also: OOConstToString.h.
7
8
9Oolite
10Copyright (C) 2004-2013 Giles C Williams and contributors
11
12This program is free software; you can redistribute it and/or
13modify it under the terms of the GNU General Public License
14as published by the Free Software Foundation; either version 2
15of the License, or (at your option) any later version.
16
17This program is distributed in the hope that it will be useful,
18but WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License
23along with this program; if not, write to the Free Software
24Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
25MA 02110-1301, USA.
26
27*/
28
30
31
32void OOConstToJSStringInit(JSContext *context);
34
35struct ConstTable;
36
37
38// Private functions, don't use directly.
39JSString *OOJSStringFromConstantPRIVATE(JSContext *context, NSInteger value, struct ConstTable *table);
40NSUInteger OOConstantFromJSStringPRIVATE(JSContext *context, JSString *string, struct ConstTable *table, NSInteger defaultValue);
41NSUInteger OOConstantFromJSValuePRIVATE(JSContext *context, jsval value, struct ConstTable *table, NSInteger defaultValue);
42
43
44/* JSString *OOJSStringFromEntityStatus(JSContext *, OOEntityStatus)
45 jsval OOJSValueFromEntityStatus(JSContext *, OOEntityStatus)
46 OOEntityStatus OOEntityStatusFromJSString(JSContext *, JSString *)
47 OOEntityStatus OOEntityStatusFromJSValue(JSContext *, jsval)
48
49 Convert between JavaScript strings and OOEntityStatus.
50*/
51OOINLINE JSString *OOJSStringFromEntityStatus(JSContext *context, OOEntityStatus value)
52{
55}
56
57
58OOINLINE jsval OOJSValueFromEntityStatus(JSContext *context, OOEntityStatus value)
59{
60 return STRING_TO_JSVAL(OOJSStringFromEntityStatus(context, value));
61}
62
63
69
70
76
77
78/* JSString *OOJSStringFromScanClass(JSContext *, OOScanClass)
79 jsval OOJSValueFromScanClass(JSContext *, OOScanClass)
80 OOScanClass OOScanClassFromJSString(JSContext *, JSString *)
81 OOScanClass OOScanClassFromJSValue(JSContext *, jsval)
82
83 Convert between JavaScript strings and OOScanClass.
84*/
85OOINLINE JSString *OOJSStringFromScanClass(JSContext *context, OOScanClass value)
86{
89}
90
91
92OOINLINE jsval OOJSValueFromScanClass(JSContext *context, OOScanClass value)
93{
94 return STRING_TO_JSVAL(OOJSStringFromScanClass(context, value));
95}
96
97
98OOINLINE OOScanClass OOScanClassFromJSString(JSContext *context, JSString *string)
99{
102}
103
104
110
111
112/* JSString *OOJSStringFromCompassMode(JSContext *, OOCompassMode)
113 jsval OOJSValueFromCompassMode(JSContext *, OOCompassMode)
114 OOCompassMode OOCompassModeFromJSString(JSContext *, JSString *)
115 OOCompassMode OOCompassModeFromJSValue(JSContext *, jsval)
116
117 Convert between JavaScript strings and OOCompassMode.
118*/
119OOINLINE JSString *OOJSStringFromCompassMode(JSContext *context, OOCompassMode value)
120{
123}
124
125
126OOINLINE jsval OOJSValueFromCompassMode(JSContext *context, OOCompassMode value)
127{
128 return STRING_TO_JSVAL(OOJSStringFromCompassMode(context, value));
129}
130
131
137
138
144
145
146/* JSString *OOJSStringFromGUIScreenID(JSContext *, OOGUIScreenID)
147 jsval OOJSValueFromGUIScreenID(JSContext *, OOGUIScreenID)
148 OOGUIScreenID OOGUIScreenIDFromJSString(JSContext *, JSString *)
149 OOGUIScreenID OOGUIScreenIDFromJSValue(JSContext *, jsval)
150
151 Convert between JavaScript strings and OOGUIScreenID.
152*/
153OOINLINE JSString *OOJSStringFromGUIScreenID(JSContext *context, OOGUIScreenID value)
154{
157}
158
159
160OOINLINE jsval OOJSValueFromGUIScreenID(JSContext *context, OOGUIScreenID value)
161{
162 return STRING_TO_JSVAL(OOJSStringFromGUIScreenID(context, value));
163}
164
165
171
172
178
179
180
181/* JSString *OOJSStringFromGalacticHyperspaceBehaviour(JSContext *, OOGalacticHyperspaceBehaviour)
182 jsval OOJSValueFromGalacticHyperspaceBehaviour(JSContext *, OOGalacticHyperspaceBehaviour)
183 OOGalacticHyperspaceBehaviour OOGalacticHyperspaceBehaviourFromJSString(JSContext *, JSString *)
184 OOGalacticHyperspaceBehaviour OOGalacticHyperspaceBehaviourFromJSValue(JSContext *, jsval)
185
186 Convert between JavaScript strings and OOGalacticHyperspaceBehaviour.
187*/
193
194
196{
197 return STRING_TO_JSVAL(OOJSStringFromGalacticHyperspaceBehaviour(context, value));
198}
199
200
206
207
213
214
215
216/* JSString *OOJSStringFromViewID(JSContext *, OOViewID)
217 jsval OOJSValueFromViewID(JSContext *, OOViewID)
218 OOViewID OOViewIDFromJSString(JSContext *, JSString *)
219 OOViewID OOViewIDFromJSValue(JSContext *, jsval)
220
221 Convert between JavaScript strings and OOViewID.
222*/
223OOINLINE JSString *OOJSStringFromViewID(JSContext *context, OOViewID value)
224{
225 extern struct ConstTable gOOViewIDConstTable;
226 return OOJSStringFromConstantPRIVATE(context, value, &gOOViewIDConstTable);
227}
228
229
230OOINLINE jsval OOJSValueFromViewID(JSContext *context, OOViewID value)
231{
232 return STRING_TO_JSVAL(OOJSStringFromViewID(context, value));
233}
234
235
236OOINLINE OOViewID OOViewIDFromJSString(JSContext *context, JSString *string)
237{
238 extern struct ConstTable gOOViewIDConstTable;
240}
241
242
243OOINLINE OOViewID OOViewIDFromJSValue(JSContext *context, jsval value)
244{
245 extern struct ConstTable gOOViewIDConstTable;
247}
248
249
250
251/* JSString *OOJSStringFromShipDamageType(JSContext *, OOShipDamageType)
252 jsval OOJSValueFromShipDamageType(JSContext *, OOShipDamageType)
253
254 Convert OOShipDamageType to JavaScript strings.
255*/
256OOINLINE JSString *OOJSStringFromShipDamageType(JSContext *context, OOShipDamageType value)
257{
260}
261
262
264{
265 return STRING_TO_JSVAL(OOJSStringFromShipDamageType(context, value));
266}
267
268
269
275
276
278{
279 return STRING_TO_JSVAL(OOJSStringFromLegalStatusReason(context, value));
280}
OOEntityStatus
Definition Entity.h:60
@ kOOScanClassDefault
Definition Entity.h:326
@ kOOEntityStatusDefault
Definition Entity.h:325
OOScanClass
Definition Entity.h:71
NSUInteger OOConstantFromJSStringPRIVATE(JSContext *context, JSString *string, struct ConstTable *table, NSInteger defaultValue)
OOINLINE jsval OOJSValueFromGalacticHyperspaceBehaviour(JSContext *context, OOGalacticHyperspaceBehaviour value)
OOINLINE OOViewID OOViewIDFromJSValue(JSContext *context, jsval value)
OOINLINE JSString * OOJSStringFromViewID(JSContext *context, OOViewID value)
OOINLINE JSString * OOJSStringFromEntityStatus(JSContext *context, OOEntityStatus value)
void OOConstToJSStringDestroy(void)
OOINLINE jsval OOJSValueFromViewID(JSContext *context, OOViewID value)
OOINLINE JSString * OOJSStringFromScanClass(JSContext *context, OOScanClass value)
JSString * OOJSStringFromConstantPRIVATE(JSContext *context, NSInteger value, struct ConstTable *table)
OOINLINE jsval OOJSValueFromScanClass(JSContext *context, OOScanClass value)
OOINLINE OOEntityStatus OOEntityStatusFromJSString(JSContext *context, JSString *string)
OOINLINE OOGUIScreenID OOGUIScreenIDFromJSValue(JSContext *context, jsval value)
OOINLINE OOViewID OOViewIDFromJSString(JSContext *context, JSString *string)
OOINLINE OOGalacticHyperspaceBehaviour OOGalacticHyperspaceBehaviourFromJSValue(JSContext *context, jsval value)
void OOConstToJSStringInit(JSContext *context)
OOINLINE JSString * OOJSStringFromGalacticHyperspaceBehaviour(JSContext *context, OOGalacticHyperspaceBehaviour value)
OOINLINE jsval OOJSValueFromEntityStatus(JSContext *context, OOEntityStatus value)
OOINLINE OOCompassMode OOCompassModeFromJSValue(JSContext *context, jsval value)
OOINLINE jsval OOJSValueFromLegalStatusReason(JSContext *context, OOLegalStatusReason value)
OOINLINE OOGalacticHyperspaceBehaviour OOGalacticHyperspaceBehaviourFromJSString(JSContext *context, JSString *string)
OOINLINE OOGUIScreenID OOGUIScreenIDFromJSString(JSContext *context, JSString *string)
OOINLINE OOScanClass OOScanClassFromJSValue(JSContext *context, jsval value)
OOINLINE JSString * OOJSStringFromCompassMode(JSContext *context, OOCompassMode value)
OOINLINE OOEntityStatus OOEntityStatusFromJSValue(JSContext *context, jsval value)
OOINLINE jsval OOJSValueFromShipDamageType(JSContext *context, OOShipDamageType value)
OOINLINE jsval OOJSValueFromCompassMode(JSContext *context, OOCompassMode value)
OOINLINE OOCompassMode OOCompassModeFromJSString(JSContext *context, JSString *string)
OOINLINE OOScanClass OOScanClassFromJSString(JSContext *context, JSString *string)
OOINLINE JSString * OOJSStringFromGUIScreenID(JSContext *context, OOGUIScreenID value)
OOINLINE JSString * OOJSStringFromShipDamageType(JSContext *context, OOShipDamageType value)
OOINLINE jsval OOJSValueFromGUIScreenID(JSContext *context, OOGUIScreenID value)
OOINLINE JSString * OOJSStringFromLegalStatusReason(JSContext *context, OOLegalStatusReason value)
NSUInteger OOConstantFromJSValuePRIVATE(JSContext *context, jsval value, struct ConstTable *table, NSInteger defaultValue)
ConstTable gOOViewIDConstTable
ConstTable gOOEntityStatusConstTable
ConstTable gOOCompassModeConstTable
ConstTable gOOLegalStatusReasonConstTable
ConstTable gOOShipDamageTypeConstTable
ConstTable gOOScanClassConstTable
ConstTable gOOGUIScreenIDConstTable
ConstTable gOOGalacticHyperspaceBehaviourConstTable
#define OOINLINE
OOLegalStatusReason
Definition OOTypes.h:157
OOViewID
Definition OOTypes.h:43
@ kOOViewIDDefault
Definition OOTypes.h:46
OOCompassMode
Definition OOTypes.h:145
@ kOOCompassModeDefault
Definition OOTypes.h:151
OOGalacticHyperspaceBehaviour
OOGUIScreenID
@ kOOGUIScreenIDDefault
@ kOOGalacticHyperspaceBehaviourDefault
OOShipDamageType
Definition ShipEntity.h:183