]> err.no Git - sope/blob - sope-core/NGExtensions/NGExtensions/NGPropertyListParser.h
07fbdba0db7bb319be4e5f830f820da3f72942d9
[sope] / sope-core / NGExtensions / NGExtensions / NGPropertyListParser.h
1 /*
2   Copyright (C) 2000-2004 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
6   OGo 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   OGo 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 OGo; 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 // $Id$
22
23 #ifndef __NGExtensions_NGPropertyListParser_H__
24 #define __NGExtensions_NGPropertyListParser_H__
25
26 #import <Foundation/NSObject.h>
27
28 @class NSString, NSArray, NSDictionary, NSData;
29
30 /*
31   The property list format is:
32
33     Strings: char's without specials:  'hello', but not 'hel  lo'
34              or quoted string:         '"hello world !"
35
36     Arrays:  '(' ')'
37              or '(' element ( ',' element )* ')'
38
39     Dicts:   '{' ( dictEntry )* '}'
40              dictEntry = property '=' property ';' ;
41
42     Data:    '<' data '>', eg: '< AABB 88CC 77a7 11 >'
43  */
44
45 NSString     *NGParseStringFromBuffer(const unsigned char *_buffer, unsigned _len);
46 NSArray      *NGParseArrayFromBuffer(const unsigned char *_buffer, unsigned _len);
47 NSDictionary *NGParseDictionaryFromBuffer(const unsigned char *_buffer, unsigned _len);
48
49 NSString     *NGParseStringFromData(NSData *_data);
50 NSArray      *NGParseArrayFromData(NSData *_data);
51 NSDictionary *NGParseDictionaryFromData(NSData *_data);
52 NSString     *NGParseStringFromString(NSString *_str);
53 NSArray      *NGParseArrayFromString(NSString *_str);
54 NSDictionary *NGParseDictionaryFromString(NSString *_str);
55
56 id NGParsePropertyListFromBuffer(const unsigned char *_buffer, unsigned _len);
57 id NGParsePropertyListFromData(NSData *_data);
58 id NGParsePropertyListFromString(NSString *_string);
59 id NGParsePropertyListFromFile(NSString *_path);
60
61 NSDictionary *NGParseStringsFromBuffer(const char *_buffer, unsigned _len);
62 NSDictionary *NGParseStringsFromData(NSData *_data);
63 NSDictionary *NGParseStringsFromString(NSString *_string);
64 NSDictionary *NGParseStringsFromFile(NSString *_path);
65
66 #import <Foundation/NSArray.h>
67 #import <Foundation/NSDictionary.h>
68
69 @interface NSArray(NGPropertyListParser)
70
71 + (id)skyArrayWithContentsOfFile:(NSString *)_path;
72 - (id)skyInitWithContentsOfFile:(NSString *)_path;
73
74 @end
75
76 @interface NSDictionary(NGPropertyListParser)
77
78 + (id)skyDictionaryWithContentsOfFile:(NSString *)_path;
79 - (id)skyInitWithContentsOfFile:(NSString *)_path;
80
81 @end
82
83 #endif /* __NGExtensions_NGPropertyListParser_H__ */