Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
OOPListParsing.h File Reference
import <Foundation/Foundation.h>
+ Include dependency graph for OOPListParsing.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

id OOPropertyListFromData (NSData *data, NSString *whereFrom)
 
id OOPropertyListFromFile (NSString *path)
 
NSDictionary * OODictionaryFromData (NSData *data, NSString *whereFrom)
 
NSDictionary * OODictionaryFromFile (NSString *path)
 
NSArray * OOArrayFromData (NSData *data, NSString *whereFrom)
 
NSArray * OOArrayFromFile (NSString *path)
 

Function Documentation

◆ OOArrayFromData()

NSArray * OOArrayFromData ( NSData * data,
NSString * whereFrom )

Definition at line 215 of file OOPListParsing.m.

216{
217 id result = OOPropertyListFromData(data, whereFrom);
218 return ValueIfClass(result, [NSArray class]);
219}
static id ValueIfClass(id value, Class class)
id OOPropertyListFromData(NSData *data, NSString *whereFrom)

References OOPropertyListFromData(), and ValueIfClass().

+ Here is the call graph for this function:

◆ OOArrayFromFile()

NSArray * OOArrayFromFile ( NSString * path)

Definition at line 222 of file OOPListParsing.m.

223{
224 id result = OOPropertyListFromFile(path);
225 return ValueIfClass(result, [NSArray class]);
226}
id OOPropertyListFromFile(NSString *path)

References OOPropertyListFromFile(), and ValueIfClass().

Referenced by OOScript::descriptionComponents.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OODictionaryFromData()

NSDictionary * OODictionaryFromData ( NSData * data,
NSString * whereFrom )

Definition at line 201 of file OOPListParsing.m.

202{
203 id result = OOPropertyListFromData(data, whereFrom);
204 return ValueIfClass(result, [NSDictionary class]);
205}

References OOPropertyListFromData(), and ValueIfClass().

+ Here is the call graph for this function:

◆ OODictionaryFromFile()

NSDictionary * OODictionaryFromFile ( NSString * path)

Definition at line 208 of file OOPListParsing.m.

209{
210 id result = OOPropertyListFromFile(path);
211 return ValueIfClass(result, [NSDictionary class]);
212}

References OOPropertyListFromFile(), and ValueIfClass().

Referenced by NSFileManager(OOExtensions)::commanderContentsOfPath:, and LoadExplicitSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OOPropertyListFromData()

id OOPropertyListFromData ( NSData * data,
NSString * whereFrom )

Definition at line 51 of file OOPListParsing.m.

52{
53 id result = nil;
54 NSString *error = nil;
55
56 if (data != nil)
57 {
58#ifndef NO_DYNAMIC_PLIST_DTD_CHANGE
59 data = ChangeDTDIfApplicable(data);
60#endif
61
62 result = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:NSPropertyListImmutable format:NULL errorDescription:&error];
63 if (result == nil) // Foundation parser failed
64 {
65#if OOLITE_RELEASE_PLIST_ERROR_STRINGS
66 [error autorelease];
67#endif
68 // Ensure we can say something sensible...
69 if (error == nil) error = @"<no error message>";
70 if (whereFrom == nil) whereFrom = @"<data in memory>";
71
72 OOLog(kOOLogPListFoundationParseError, @"Failed to parse %@ as a property list.\n%@", whereFrom, error);
73 }
74 }
75
76 return result;
77}
#define OOLog(class, format,...)
Definition OOLogging.h:88
static NSString *const kOOLogPListFoundationParseError
return nil

References kOOLogPListFoundationParseError, nil, and OOLog.

Referenced by OOArrayFromData(), OODictionaryFromData(), and OOPropertyListFromFile().

+ Here is the caller graph for this function:

◆ OOPropertyListFromFile()

id OOPropertyListFromFile ( NSString * path)

Definition at line 80 of file OOPListParsing.m.

81{
82 id result = nil;
83 NSData *data = nil;
84
85 if (path != nil)
86 {
87 // Load file, if it exists...
88 data = CopyDataFromFile(path);
89 if (data != nil)
90 {
91 // ...and parse it
92 result = OOPropertyListFromData(data, path);
93 [data release];
94 }
95 // Non-existent file is not an error.
96 }
97
98 return result;
99}
static NSData * CopyDataFromFile(NSString *path)

References CopyDataFromFile(), nil, and OOPropertyListFromData().

Referenced by OOArrayFromFile(), and OODictionaryFromFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: