Line data Source code
1 0 : /* 2 : 3 : OOConvertSystemDescriptions.m 4 : Oolite 5 : 6 : Functions to convert system descriptions between dictionary and array 7 : formats. 8 : 9 : The array format is used in descriptions.plist. Each set of strings is an 10 : array, the sets are stored in a master array, and cross-references are 11 : indices into the master array. 12 : 13 : The dictionary format is more human-friendly, with string sets identified 14 : by name and cross-references using names. 15 : 16 : The indicesToKeys parameter is optional; if it is nil or incomplete, 17 : indices or (index-based) keys will be synthesized. 18 : 19 : 20 : Copyright (C) 2008 Jens Ayton 21 : 22 : Permission is hereby granted, free of charge, to any person obtaining a copy 23 : of this software and associated documentation files (the "Software"), to deal 24 : in the Software without restriction, including without limitation the rights 25 : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 26 : copies of the Software, and to permit persons to whom the Software is 27 : furnished to do so, subject to the following conditions: 28 : 29 : The above copyright notice and this permission notice shall be included in all 30 : copies or substantial portions of the Software. 31 : 32 : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 33 : IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 34 : FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 35 : AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 36 : LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 37 : OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 38 : SOFTWARE. 39 : 40 : */ 41 : 42 : 43 : #import <Foundation/Foundation.h> 44 : 45 : 46 0 : NSArray *OOConvertSystemDescriptionsToArrayFormat(NSDictionary *descriptionsInDictionaryFormat, NSDictionary *indicesToKeys); 47 0 : NSDictionary *OOConvertSystemDescriptionsToDictionaryFormat(NSArray *descriptionsInArrayFormat, NSDictionary *indicesToKeys); 48 : 49 0 : NSString *OOStringifySystemDescriptionLine(NSString *line, NSDictionary *indicesToKeys, BOOL useFallback); 50 : 51 : // Higher-level functions to drive the entire conversion. 52 0 : void CompileSystemDescriptions(BOOL asXML); 53 0 : void ExportSystemDescriptions(BOOL asXML);