Adun  0.83
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ULTemplate.h
1 /*
2  Project: ULFramework
3 
4  Copyright (C) 2007 Michael Johnston & Jordi Villą--Freixa
5 
6  Author: Michael Johnston
7 
8  This application is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This application is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU General Public
19  License along with this library; if not, write to the Free
20  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
21 */
22 
23 #ifndef _ULTEMPLATE_
24 #define _ULTEMPLATE_
25 #include <Foundation/Foundation.h>
26 #include <AdunKernel/AdunKernel.h>
27 #include "ULFramework/ULIOManager.h"
28 #include "ULFramework/ULFrameworkDefinitions.h"
29 
58 @interface ULTemplate: AdModelObject <NSCopying, NSMutableCopying>
59 {
60  NSMutableDictionary* objectTemplates;
61  NSMutableDictionary* sections;
62  NSMutableDictionary* classNumberTracker;
63  NSMutableDictionary* externalReferenceTypes;
64  NSMutableArray* externalReferences;
65 }
69 + (NSArray*) systemObjectTemplates;
73 + (NSArray*) forceFieldObjectTemplates;
77 + (NSArray*) configurationGenerationObjectTemplates;
81 + (NSArray*) controllerTemplates;
85 + (NSArray*) allObjectTemplates;
89 + (NSArray*) miscellaneousObjectTemplates;
95 - (id) initWithObjectTemplates: (NSDictionary*) templates;
99 - (id) initWithCoreRepresentation: (NSDictionary*) aDict;
104 - (NSMutableDictionary*) coreRepresentation;
108 - (NSDictionary*) objectTemplates;
112 - (NSDictionary*) objectTemplatesInSection: (NSString*) aString;
116 - (NSDictionary*) objectTemplateWithName: (NSString*) aString;
120 - (NSDictionary*) objectTemplatesOfClass: (NSString*) className;
126 - (NSArray*) externalReferences;
130 - (NSDictionary*) externalReferenceTypes;
134 - (void) setValues: (NSDictionary*) aDictionary forObjectTemplateWithName: (NSString*) name;
138 - (NSDictionary*) valuesForObjectTemplateWithName: (NSString*) name;
142 - (BOOL) validateTemplate: (NSError**) error;
143 @end
144 
145 
151 @interface ULMutableTemplate: ULTemplate
152 {
153 }
159 - (NSString*) addObjectTemplate: (NSDictionary*) aDictionary
160  toSection: (NSString*) stringTwo;
165 - (NSString*) addObjectTemplate: (NSDictionary*) aDictionary;
170 - (void) removeObjectTemplateWithName: (NSString*) aString;
171 @end
172 
184 @interface NSDictionary (ULObjectTemplateExtensions)
189 + (BOOL) isValidTemplate: (NSDictionary*) aDict;
193 + (id) templateForClass: (NSString*) className;
197 + (id) templateForDisplayName: (NSString*) displayName;
202 + (id) templateFromCoreRepresentation: (NSDictionary*) dict;
207 - (BOOL) validate: (NSError**) error;
211 - (NSArray*) typesForKey: (NSString*) aKey;
215 - (BOOL) validateType: (NSString*) type forKey: (NSString*) aKey;
219 - (NSString*) displayName;
223 - (NSString*) templateClass;
227 - (NSArray*) templateKeys;
231 - (NSString*) templateDescription;
235 - (NSString*) descriptionForKey: (NSString*) key;
239 - (id) valueForTemplateKey: (NSString*) aKey;
243 - (NSMutableDictionary*) valuesForTemplateKeys;
248 - (NSMutableDictionary*) coreTemplateRepresentation;
253 - (BOOL) isPropertyListKey: (NSString*) key;
257 - (BOOL) isOptionalKey: (NSString*) aKey;
261 - (NSArray*) propertyListKeys;
265 - (NSArray*) referenceKeys;
270 - (NSArray*) referenceContainerKeys;
275 - (BOOL) isSimpleKey: (NSString*) aKey;
276 @end
277 
278 @interface NSMutableDictionary (ULMutableObjectTemplateExtensions)
282 - (void) setValue: (id) value forTemplateKey: (NSString*) aKey;
283 @end
284 
285 
286 #endif