]> err.no Git - sope/blob - sope-xml/SaxObjC/SaxAttributes.h
lF fixes
[sope] / sope-xml / SaxObjC / SaxAttributes.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 __SaxAttributes_H__
23 #define __SaxAttributes_H__
24
25 #import <Foundation/NSObject.h>
26
27 @class NSString, NSArray, NSMutableArray, NSDictionary;
28
29 /*
30   new in SAX 2.0beta, replaces the SaxAttributeList
31 */
32
33 @protocol SaxAttributes
34
35 /* lookup indices */
36
37 - (unsigned int)indexOfRawName:(NSString *)_rawName;
38 - (unsigned int)indexOfName:(NSString *)_localPart uri:(NSString *)_uri;
39
40 /* lookup data by index */
41
42 - (NSString *)nameAtIndex:(unsigned int)_idx;
43 - (NSString *)rawNameAtIndex:(unsigned int)_idx;
44 - (NSString *)typeAtIndex:(unsigned int)_idx;
45 - (NSString *)uriAtIndex:(unsigned int)_idx;
46 - (NSString *)valueAtIndex:(unsigned int)_idx;
47
48 /* lookup data by name */
49
50 - (NSString *)typeForRawName:(NSString *)_rawName;
51 - (NSString *)typeForName:(NSString *)_localName uri:(NSString *)_uri;
52 - (NSString *)valueForRawName:(NSString *)_rawName;
53 - (NSString *)valueForName:(NSString *)_localName uri:(NSString *)_uri;
54
55 /* list size */
56
57 - (unsigned int)count;
58
59 @end
60
61 /* simple attributes implementation, should be improved */
62
63 @interface SaxAttributes : NSObject < SaxAttributes, NSCopying >
64 {
65 @private
66   NSMutableArray *names;
67   NSMutableArray *uris;
68   NSMutableArray *rawNames;
69   NSMutableArray *types;
70   NSMutableArray *values;
71 }
72
73 - (id)initWithAttributes:(id<SaxAttributes>)_attrs;
74 - (id)initWithDictionary:(NSDictionary *)_dict;
75
76 - (void)addAttribute:(NSString *)_localName uri:(NSString  *)_uri
77   rawName:(NSString *)_rawName
78   type:(NSString *)_type
79   value:(NSString *)_value;
80
81 - (void)clear;
82
83 @end
84
85 #include <SaxObjC/SaxAttributeList.h>
86
87 @interface SaxAttributes(Compatibility)
88 - (id)initWithAttributeList:(id<SaxAttributeList>)_attrList;
89 @end
90
91 #endif /* __SaxAttributes_H__ */