mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-05-05 21:00:54 +00:00
2002-10-12 Manuel Guesdon <mguesdon@orange-concept.com>
o added -templateParserTypeForResourcesNamed: o added ivar _templateParserTypeCache o change +templateNamed:... call git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@14736 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
25cec67d33
commit
d11da395ee
2 changed files with 62 additions and 9 deletions
|
@ -42,6 +42,7 @@
|
|||
NSMutableDictionary* _archiveCache;
|
||||
NSMutableDictionary* _apiCache;//NDFN
|
||||
NSMutableDictionary* _encodingCache;
|
||||
NSMutableDictionary* _templateParserTypeCache;//NDFN
|
||||
NSMutableDictionary* _pathCache;
|
||||
NSMutableDictionary* _urlCache;
|
||||
NSMutableDictionary* _stringsTableCache;
|
||||
|
@ -133,6 +134,8 @@
|
|||
|
||||
-(NSStringEncoding)encodingForResourcesNamed:(NSString*)aName;
|
||||
|
||||
-(GSWTemplateParserType)templateParserTypeForResourcesNamed:(NSString*)aName;//NDFN
|
||||
|
||||
-(NSDictionary*)archiveNamed:(NSString*)aName;
|
||||
-(NSDictionary*)apiNamed:(NSString*)aName;//NDFN
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ objectForReference:(NSString*)keyPath
|
|||
_archiveCache=[NSMutableDictionary new];
|
||||
_apiCache=[NSMutableDictionary new];
|
||||
_encodingCache=[NSMutableDictionary new];
|
||||
_templateParserTypeCache=[NSMutableDictionary new];
|
||||
_pathCache=[NSMutableDictionary new];
|
||||
_urlCache=[NSMutableDictionary new];
|
||||
_stringsTableCache=[NSMutableDictionary new];
|
||||
|
@ -127,6 +128,8 @@ objectForReference:(NSString*)keyPath
|
|||
DESTROY(_apiCache);
|
||||
GSWLogC("Dealloc GSWBundle: encodingCache");
|
||||
DESTROY(_encodingCache);
|
||||
GSWLogC("Dealloc GSWBundle: templateParserTypeCache");
|
||||
DESTROY(_templateParserTypeCache);
|
||||
GSWLogC("Dealloc GSWBundle: pathCache");
|
||||
DESTROY(_pathCache);
|
||||
GSWLogC("Dealloc GSWBundle: urlCache");
|
||||
|
@ -579,6 +582,7 @@ objectForReference:(NSString*)keyPath
|
|||
}
|
||||
else
|
||||
{
|
||||
GSWTemplateParserType templateParserType=[self templateParserTypeForResourcesNamed:aName];
|
||||
NSStringEncoding encoding=[self encodingForResourcesNamed:aName];
|
||||
NSString* pageDefString=nil;
|
||||
//TODO use encoding !
|
||||
|
@ -626,15 +630,16 @@ objectForReference:(NSString*)keyPath
|
|||
{
|
||||
NSDebugMLLog(@"bundles",@"GSWTemplateParser on template named %@",
|
||||
aName);
|
||||
template=[GSWTemplateParserXML templateNamed:aName
|
||||
inFrameworkNamed:[self frameworkName]
|
||||
withParserClassName:nil
|
||||
withString:htmlString
|
||||
encoding:encoding
|
||||
fromPath:absoluteTemplatePath
|
||||
definitionsString:pageDefString
|
||||
languages:someLanguages
|
||||
definitionPath:absoluteDefinitionPath];
|
||||
template=[GSWTemplateParser templateNamed:aName
|
||||
inFrameworkNamed:[self frameworkName]
|
||||
withParserType:templateParserType
|
||||
parserClassName:nil
|
||||
withString:htmlString
|
||||
encoding:encoding
|
||||
fromPath:absoluteTemplatePath
|
||||
definitionsString:pageDefString
|
||||
languages:someLanguages
|
||||
definitionPath:absoluteDefinitionPath];
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
NS_HANDLER
|
||||
|
@ -969,6 +974,51 @@ objectForReference:(NSString*)keyPath
|
|||
return encoding;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(GSWTemplateParserType)templateParserTypeForResourcesNamed:(NSString*)aName
|
||||
{
|
||||
NSDictionary* archive=nil;
|
||||
GSWTemplateParserType templateParserType=GSWTemplateParserType_Default;
|
||||
id templateParserTypeObject=nil;
|
||||
LOGObjectFnStart();
|
||||
[self lock];
|
||||
NS_DURING
|
||||
{
|
||||
NSDebugMLLog(@"bundles",@"aName=%@",aName);
|
||||
NSDebugMLLog(@"bundles",@"templateParserTypeCache=%@",_templateParserTypeCache);
|
||||
NSDebugMLLog(@"bundles",@"archiveCache=%@",_archiveCache);
|
||||
templateParserTypeObject=[_templateParserTypeCache objectForKey:aName];
|
||||
if (!templateParserTypeObject)
|
||||
{
|
||||
archive=[self archiveNamed:aName];
|
||||
if (archive)
|
||||
{
|
||||
templateParserTypeObject=[archive objectForKey:@"templateParserType"];
|
||||
if (templateParserTypeObject)
|
||||
{
|
||||
templateParserTypeObject=[NSNumber valueWithInt:[GSWTemplateParser templateParserTypeFromString:templateParserTypeObject]];
|
||||
[_templateParserTypeCache setObject:templateParserTypeObject
|
||||
forKey:aName];
|
||||
};
|
||||
};
|
||||
};
|
||||
if (templateParserTypeObject)
|
||||
templateParserType=[templateParserTypeObject intValue];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]",
|
||||
localException,[localException reason],__FILE__,__LINE__);
|
||||
//TODO
|
||||
[self unlock];
|
||||
[localException raise];
|
||||
};
|
||||
NS_ENDHANDLER;
|
||||
[self unlock];
|
||||
LOGObjectFnStop();
|
||||
return templateParserType;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
-(NSDictionary*)archiveNamed:(NSString*)aName
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue