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 + (NSString *)libraryDriversSubDir; 38 39 - (id)initWithDictionary:(NSDictionary *)_dict; 40 41 /* queries */ 42 43 - (SaxTagModel *)modelForTag:(NSString *)_localName namespace:(NSString *)_ns; 44 45 @end 46 47 @interface SaxNamespaceModel : NSObject 48 { 49 NSDictionary *tagToModel; 50 } 51 52 /* queries */ 53 54 - (SaxTagModel *)modelForTag:(NSString *)_localName; 55 56 @end 57 58 @interface SaxTagModel : NSObject 59 { 60 NSString *className; 61 NSString *key; 62 NSString *tagKey; /* the key to store the tag name under */ 63 NSString *namespaceKey; /* the key to store the namespace uri under */ 64 NSString *parentKey; /* the key to store the parent object under */ 65 NSString *contentKey; /* the key to store the cdata content under */ 66 NSArray *toManyRelationshipKeys; 67 NSDictionary *defaultValues; 68 NSDictionary *tagToKey; 69 NSDictionary *attrToKey; 70 } 71 72 /* accessors */ 73 74 - (NSString *)className; 75 - (NSString *)key; 76 - (NSString *)tagKey; 77 - (NSString *)namespaceKey; 78 - (NSString *)parentKey; 79 - (NSString *)contentKey; 80 - (NSDictionary *)defaultValues; 81 82 - (NSString *)propertyKeyForChildTag:(NSString *)_tag; 83 84 - (BOOL)isToManyKey:(NSString *)_key; 85 - (NSArray *)toManyRelationshipKeys; 86 87 - (NSArray *)attributeKeys; 88 - (NSString *)propertyKeyForAttribute:(NSString *)_attr; 89 90 /* object operations */ 91 92 - (void)addValue:(id)_val toPropertyWithKey:(NSString *)_key ofObject:(id)_obj; 93 94 @end 95 96 #endif /* __SaxObjC_SaxObjectModel_H__ */ 97