Line data Source code
1 0 : /* 2 : 3 : OOConstToString.h 4 : 5 : Convert various sets of integer constants to strings. 6 : To consider: replacing the integer constants with string constants. 7 : See also: OOConstToJSString.h. 8 : 9 : This has grown beyond "const-to-string" at this point. 10 : 11 : Oolite 12 : Copyright (C) 2004-2013 Giles C Williams and contributors 13 : 14 : This program is free software; you can redistribute it and/or 15 : modify it under the terms of the GNU General Public License 16 : as published by the Free Software Foundation; either version 2 17 : of the License, or (at your option) any later version. 18 : 19 : This program is distributed in the hope that it will be useful, 20 : but WITHOUT ANY WARRANTY; without even the implied warranty of 21 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 : GNU General Public License for more details. 23 : 24 : You should have received a copy of the GNU General Public License 25 : along with this program; if not, write to the Free Software 26 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 27 : MA 02110-1301, USA. 28 : 29 : */ 30 : 31 : #import <Foundation/Foundation.h> 32 : #import "OOFunctionAttributes.h" 33 : #import "OOTypes.h" 34 : 35 : 36 0 : enum 37 : { 38 : // Values used for unknown strings. 39 : kOOCargoTypeDefault = CARGO_NOT_CARGO, 40 : // kOOCommodityTypeDefault = COMMODITY_UNDEFINED, 41 : kOOEnergyUnitTypeDefault = ENERGY_UNIT_NONE, 42 : kOORouteTypeDefault = OPTIMIZED_BY_JUMPS 43 : }; 44 : 45 : 46 : /* 47 : 48 : To avoid pulling in unnecessary headers, some functions defined in 49 : OOConstToString.m are declared in the header with the appropriate type 50 : declaration, in particular: 51 : 52 : Entity.h: 53 : OOStringFromEntityStatus() 54 : OOEntityStatusFromString() 55 : OOStringFromScanClass() 56 : OOScanClassFromString() 57 : 58 : ShipEntity.h: 59 : OOStringFromBehaviour() 60 : OOEquipmentIdentifierFromWeaponType() 61 : OOWeaponTypeFromEquipmentIdentifierSloppy() 62 : OOWeaponTypeFromEquipmentIdentifierStrict() 63 : OOStringFromWeaponType() 64 : OOWeaponTypeFromString() 65 : OODisplayStringFromAlertCondition() 66 : 67 : PlayerEntity.h: 68 : OODisplayRatingStringFromKillCount() 69 : KillCountToRatingAndKillString() 70 : OODisplayStringFromLegalStatus() 71 : OOStringFromGUIScreenID() 72 : OOGUIScreenIDFromString() 73 : OOGalacticHyperspaceBehaviourFromString() 74 : OOStringFromGalacticHyperspaceBehaviour() 75 : 76 : Universe.h: 77 : OODisplayStringFromGovernmentID() 78 : OODisplayStringFromEconomyID() 79 : 80 : OOOpenGL.h: 81 : OOShaderSettingFromString() 82 : OOStringFromShaderSetting() 83 : OODisplayStringFromShaderSetting() 84 : 85 : */ 86 : 87 0 : NSString *JSTypeToString(int /* JSType */ type) CONST_FUNC; 88 : 89 0 : NSString *CargoTypeToString(OOCargoType cargo) CONST_FUNC; 90 0 : OOCargoType StringToCargoType(NSString *string) PURE_FUNC; 91 : 92 : //NSString *CommodityTypeToString(OOCommodityType commodity) CONST_FUNC; // returns the commodity identifier 93 : //OOCommodityType StringToCommodityType(NSString *string) PURE_FUNC; // needs commodity identifier 94 : 95 0 : NSString *EnergyUnitTypeToString(OOEnergyUnitType unit) CONST_FUNC; 96 0 : OOEnergyUnitType StringToEnergyUnitType(NSString *string) PURE_FUNC; 97 : 98 0 : NSString *CommodityDisplayNameForSymbolicName(NSString *symbolicName); 99 0 : NSString *CommodityDisplayNameForCommodityArray(NSArray *commodityDefinition); 100 : 101 0 : NSString *DisplayStringForMassUnit(OOMassUnit unit); 102 0 : NSString *DisplayStringForMassUnitForCommodity(OOCommodityType commodity); 103 : 104 0 : NSString *OOStringFromCompassMode(OOCompassMode mode); 105 0 : OOCompassMode OOCompassModeFromString(NSString *string); 106 : 107 0 : NSString *OOStringFromLongRangeChartMode(OOLongRangeChartMode chartMode); 108 0 : OOLongRangeChartMode OOLongRangeChartModeFromString(NSString *string); 109 : 110 0 : NSString *OOStringFromLegalStatusReason(OOLegalStatusReason reason); 111 : 112 0 : NSString *RouteTypeToString(OORouteType routeType); 113 0 : OORouteType StringToRouteType(NSString *string); 114 : 115 0 : NSString *DockingClearanceStatusToString(OODockingClearanceStatus dockingClearanceStatus) PURE_FUNC; 116 : 117 0 : NSString *OOStringFromGraphicsDetail(OOGraphicsDetail detail); 118 0 : OOGraphicsDetail OOGraphicsDetailFromString(NSString *string); 119 :