]> err.no Git - sope/blob - sope-core/NGExtensions/NGExtensions/NGPropertyListParser.h
additions
[sope] / sope-core / NGExtensions / NGExtensions / NGPropertyListParser.h
1 /*
2   Copyright (C) 2000-2005 SKYRIX Software AG
3
4   This file is part of SOPE.
5
6   SOPE is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #ifndef __NGExtensions_NGPropertyListParser_H__
23 #define __NGExtensions_NGPropertyListParser_H__
24
25 #import <Foundation/NSObject.h>
26
27 @class NSString, NSArray, NSDictionary, NSData;
28
29 /*
30   The property list format is:
31
32     Strings: char's without specials:  'hello', but not 'hel  lo'
33              or quoted string:         '"hello world !"
34
35     Arrays:  '(' ')'
36              or '(' element ( ',' element )* ')'
37
38     Dicts:   '{' ( dictEntry )* '}'
39              dictEntry = property '=' property ';' ;
40
41     Data:    '<' data '>', eg: '< AABB 88CC 77a7 11 >'
42  */
43
44 NSString     *NGParseStringFromBuffer(const unsigned char *_buffer, unsigned _len);
45 NSArray      *NGParseArrayFromBuffer(const unsigned char *_buffer, unsigned _len);
46 NSDictionary *NGParseDictionaryFromBuffer(const unsigned char *_buffer, unsigned _len);
47
48 NSString     *NGParseStringFromData(NSData *_data);
49 NSArray      *NGParseArrayFromData(NSData *_data);
50 NSDictionary *NGParseDictionaryFromData(NSData *_data);
51 NSString     *NGParseStringFromString(NSString *_str);
52 NSArray      *NGParseArrayFromString(NSString *_str);
53 NSDictionary *NGParseDictionaryFromString(NSString *_str);
54
55 id NGParsePropertyListFromBuffer(const unsigned char *_buffer, unsigned _len);
56 id NGParsePropertyListFromData(NSData *_data);
57 id NGParsePropertyListFromString(NSString *_string);
58 id NGParsePropertyListFromFile(NSString *_path);
59
60 NSDictionary *NGParseStringsFromBuffer(const char *_buffer, unsigned _len);
61 NSDictionary *NGParseStringsFromData(NSData *_data);
62 NSDictionary *NGParseStringsFromString(NSString *_string);
63 NSDictionary *NGParseStringsFromFile(NSString *_path);
64
65 #import <Foundation/NSArray.h>
66 #import <Foundation/NSDictionary.h>
67
68 @interface NSArray(NGPropertyListParser)
69
70 + (id)skyArrayWithContentsOfFile:(NSString *)_path;
71 - (id)skyInitWithContentsOfFile:(NSString *)_path;
72
73 @end
74
75 @interface NSDictionary(NGPropertyListParser)
76
77 + (id)skyDictionaryWithContentsOfFile:(NSString *)_path;
78 - (id)skyInitWithContentsOfFile:(NSString *)_path;
79
80 @end
81
82 #endif /* __NGExtensions_NGPropertyListParser_H__ */