Line data Source code
1 0 : /* 2 : 3 : OOJSEquipmentInfo.h 4 : 5 : JavaScript equipment introspection class, wrapper for OOEquipmentType. 6 : 7 : 8 : Oolite 9 : Copyright (C) 2004-2013 Giles C Williams and contributors 10 : 11 : This program is free software; you can redistribute it and/or 12 : modify it under the terms of the GNU General Public License 13 : as published by the Free Software Foundation; either version 2 14 : of the License, or (at your option) any later version. 15 : 16 : This program is distributed in the hope that it will be useful, 17 : but WITHOUT ANY WARRANTY; without even the implied warranty of 18 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 : GNU General Public License for more details. 20 : 21 : You should have received a copy of the GNU General Public License 22 : along with this program; if not, write to the Free Software 23 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 24 : MA 02110-1301, USA. 25 : 26 : */ 27 : 28 : #include <jsapi.h> 29 : #import "OOCocoa.h" 30 : 31 : @class OOEquipmentType; 32 : 33 : 34 0 : void InitOOJSEquipmentInfo(JSContext *context, JSObject *global); 35 : 36 : /* Given a jsval representing a string (equipment key) or a JS EquipmentInfo, 37 : return the corresponding EquipmentType or key. Note that 38 : JSValueToEquipmentKey() will not return arbitrary strings, only valid 39 : equipment keys. 40 : JSValueToEquipmentKeyRelaxed() will return any string that does not end 41 : with _DAMAGED. 42 : */ 43 0 : OOEquipmentType *JSValueToEquipmentType(JSContext *context, jsval value); 44 0 : NSString *JSValueToEquipmentKey(JSContext *context, jsval value); 45 : 46 0 : NSString *JSValueToEquipmentKeyRelaxed(JSContext *context, jsval value, BOOL *outExists);