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