]> err.no Git - sope/blob - sope-xml/SaxObjC/SaxObjectModel.h
bumped trunk versions to 4.7
[sope] / sope-xml / SaxObjC / SaxObjectModel.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 __SaxObjC_SaxObjectModel_H__
23 #define __SaxObjC_SaxObjectModel_H__
24
25 #import <Foundation/NSObject.h>
26
27 @class NSDictionary, NSString, NSArray;
28 @class SaxTagModel;
29
30 @interface SaxObjectModel : NSObject
31 {
32   NSDictionary *nsToModel;
33 }
34
35 + (id)modelWithName:(NSString *)_name;
36 + (id)modelWithContentsOfFile:(NSString *)_path;
37
38 - (id)initWithDictionary:(NSDictionary *)_dict;
39
40 /* queries */
41
42 - (SaxTagModel *)modelForTag:(NSString *)_localName namespace:(NSString *)_ns;
43
44 @end
45
46 @interface SaxNamespaceModel : NSObject
47 {
48   NSDictionary *tagToModel;
49 }
50
51 /* queries */
52
53 - (SaxTagModel *)modelForTag:(NSString *)_localName;
54
55 @end
56
57 @interface SaxTagModel : NSObject
58 {
59   NSString     *className;
60   NSString     *key;
61   NSString     *tagKey;       /* the key to store the tag name under */
62   NSString     *namespaceKey; /* the key to store the namespace uri under */
63   NSString     *parentKey;    /* the key to store the parent object under */
64   NSString     *contentKey;   /* the key to store the cdata content under */
65   NSArray      *toManyRelationshipKeys;
66   NSDictionary *defaultValues;
67   NSDictionary *tagToKey;
68   NSDictionary *attrToKey;
69 }
70
71 /* accessors */
72
73 - (NSString *)className;
74 - (NSString *)key;
75 - (NSString *)tagKey;
76 - (NSString *)namespaceKey;
77 - (NSString *)parentKey;
78 - (NSString *)contentKey;
79 - (NSDictionary *)defaultValues;
80
81 - (NSString *)propertyKeyForChildTag:(NSString *)_tag;
82
83 - (BOOL)isToManyKey:(NSString *)_key;
84 - (NSArray *)toManyRelationshipKeys;
85
86 - (NSArray *)attributeKeys;
87 - (NSString *)propertyKeyForAttribute:(NSString *)_attr;
88
89 /* object operations */
90
91 - (void)addValue:(id)_val toPropertyWithKey:(NSString *)_key ofObject:(id)_obj;
92
93 @end
94
95 #endif /* __SaxObjC_SaxObjectModel_H__ */