Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
NSDictionary(OldSchoolPropertyListWriting) Category Reference

#include <OldSchoolPropertyListWriting.h>

+ Inheritance diagram for NSDictionary(OldSchoolPropertyListWriting):
+ Collaboration diagram for NSDictionary(OldSchoolPropertyListWriting):

Instance Methods

(NSString *) - oldSchoolPListFormatWithIndentation:errorDescription: [implementation]
 
- Instance Methods inherited from <OldSchoolPropertyListWriting>

Detailed Description

Definition at line 55 of file OldSchoolPropertyListWriting.h.

Method Documentation

◆ oldSchoolPListFormatWithIndentation:errorDescription:

- (NSString *) oldSchoolPListFormatWithIndentation: (unsigned) inIndentation
errorDescription: (NSString **) outErrorDescription 
implementation

Reimplemented from <OldSchoolPropertyListWriting>.

Definition at line 325 of file OldSchoolPropertyListWriting.m.

230 :(unsigned)inIndentation errorDescription:(NSString **)outErrorDescription
231{
232 NSMutableString *result;
233 NSUInteger i, count;
234 NSArray *allKeys;
235 id key, value;
236 NSString *valueDesc;
237
238 result = [NSMutableString string];
239 allKeys = [[self allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
240 count = [allKeys count];
241
242 [result appendString:@"{"];
243
244 AppendNewLineAndIndent(result, inIndentation + 1);
245
246 for (i = 0; i != count; ++i)
247 {
248 if (0 != i)
249 {
250 AppendNewLineAndIndent(result, inIndentation + 1);
251 }
252
253 key = [allKeys objectAtIndex:i];
254 if (![key isKindOfClass:[NSString class]])
255 {
256 if (NULL != outErrorDescription) *outErrorDescription = [NSString stringWithFormat:@"non-string key in dictionary"];
257 return nil;
258 }
259 value = [self objectForKey:key];
260 if (![value conformsToProtocol:@protocol(OldSchoolPropertyListWriting)])
261 {
262 if (nil != value && NULL != outErrorDescription)
263 {
264 *outErrorDescription = [NSString stringWithFormat:@"non-plist object in dictionary"];
265 }
266 return nil;
267 }
268
269 key = [key oldSchoolPListFormatWithIndentation:inIndentation + 1 errorDescription:outErrorDescription];
270 if (nil == key) return nil;
271 valueDesc = [value oldSchoolPListFormatWithIndentation:inIndentation + 1 errorDescription:outErrorDescription];
272 if (nil == valueDesc) return nil;
273
274 [result appendFormat:@"%@ =", key];
275 if ([value isKindOfClass:[NSArray class]] || [value isKindOfClass:[NSDictionary class]])
276 {
277 AppendNewLineAndIndent(result, inIndentation + 1);
278 }
279 else
280 {
281 [result appendString:@" "];
282 }
283 [result appendFormat:@"%@;", valueDesc];
284 }
285
286 AppendNewLineAndIndent(result, inIndentation);
287 [result appendString:@"}"];
288
289 return result;
290}
unsigned count
return nil
static void AppendNewLineAndIndent(NSMutableString *ioString, unsigned indentDepth)

The documentation for this category was generated from the following files: