From 5d5c20e7e6321f7d99300023bd3582b8e570831d Mon Sep 17 00:00:00 2001 From: Manuel Guesdon Date: Thu, 29 May 2014 12:05:16 +0000 Subject: [PATCH] * GSWeb/GSWConstants.[hm] add GSWClassName_Component * GSWeb/GSWComponentDefinition.m fix -componentClass to use GSWClassName_Component git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@37919 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 ++++ GSWeb/GSWComponentDefinition.m | 51 +++++++++++++--------------------- GSWeb/GSWConstants.h | 1 + GSWeb/GSWConstants.m | 1 + 4 files changed, 27 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9479074..354c17a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-05-29 Manuel Guesdon + * GSWeb/GSWConstants.[hm] + add GSWClassName_Component + * GSWeb/GSWComponentDefinition.m + fix -componentClass to use GSWClassName_Component 2014-05-29 Manuel Guesdon * GSWDatabase/WODisplayGroup.m respect GNUstep coding standard (curly brackets placement, indentation) diff --git a/GSWeb/GSWComponentDefinition.m b/GSWeb/GSWComponentDefinition.m index f0df11f..89b0410 100644 --- a/GSWeb/GSWComponentDefinition.m +++ b/GSWeb/GSWComponentDefinition.m @@ -76,7 +76,7 @@ static GSWContext * TheTemporaryContext; [super init]; ASSIGN(_name, [aName stringByDeletingPathExtension]); // does it ever happen that ASSIGN(_className, aName); // those are different? dw. - _componentClass = NSClassFromString(_className); + ASSIGN(_componentClass,NSClassFromString(_className)); ASSIGN(_path, aPath); ASSIGN(_url, baseURL); ASSIGN(_frameworkName, aFrameworkName); @@ -90,9 +90,11 @@ static GSWContext * TheTemporaryContext; _instancePool = [NSMutableArray new]; _lockInstancePool = [GSWApp isConcurrentRequestHandlingEnabled]; - if ((_name != nil) && (_frameworkName != nil)) { - _componentClass = NSClassFromString(_className); - } + if (_name != nil + && _frameworkName != nil) + { + ASSIGN(_componentClass,NSClassFromString(_className)); + } myBasePath = [aPath stringByAppendingPathComponent: aName]; ASSIGN(_htmlPath,[myBasePath stringByAppendingPathExtension:@"html"]); ASSIGN(_wodPath,[myBasePath stringByAppendingPathExtension:GSWComponentDeclarationsSuffix[GSWebNamingConv]]); @@ -135,7 +137,7 @@ static GSWContext * TheTemporaryContext; DESTROY(_frameworkName); DESTROY(_language); DESTROY(_className); - _componentClass = Nil; + DESTROY(_componentClass); DESTROY(_template); DESTROY(_htmlPath); DESTROY(_wodPath); @@ -419,34 +421,21 @@ static GSWContext * TheTemporaryContext; /** Find the class of the component **/ -(Class) componentClass { - Class componentClass = Nil; - - if (_componentClass) { - return _componentClass; - } - - componentClass = _componentClass; - if (!componentClass) { - componentClass=NSClassFromString(_name);//??? - } - if (!componentClass) // There's no class with that name - { - BOOL createClassesOk=NO; - NSString* superClassName=nil; - // If we haven't found a superclass, use GSWComponent as the superclass - if (!superClassName) - superClassName=@"WOComponent"; - // Create class - createClassesOk=[GSWApplication createUnknownComponentClasses:[NSArray arrayWithObject:_name] - superClassName:superClassName]; + if (_componentClass==Nil) + { + ASSIGN(_componentClass,NSClassFromString(_name)); + if (_componentClass==Nil) // There's no class with that name + { + BOOL createClassesOk=NO; + // Create class with GSWComponent as the superclass + createClassesOk=[GSWApplication createUnknownComponentClasses:[NSArray arrayWithObject:_name] + superClassName:GSWClassName_Component[GSWebNamingConv]]; - // Use it - componentClass=NSClassFromString(_name); - }; - //call GSWApp isCaching - _componentClass=componentClass; + ASSIGN(_componentClass,NSClassFromString(_name)); + }; + } - return componentClass; + return _componentClass; }; //-------------------------------------------------------------------- diff --git a/GSWeb/GSWConstants.h b/GSWeb/GSWConstants.h index 14e4fbd..04e4e3d 100644 --- a/GSWeb/GSWConstants.h +++ b/GSWeb/GSWConstants.h @@ -94,6 +94,7 @@ GSWEB_EXPORT NSString* GSWClassName_Application; GSWEB_EXPORT NSString* GSWClassName_ResourceManager[2]; GSWEB_EXPORT NSString* GSWClassName_StatisticsStore[2]; GSWEB_EXPORT NSString* GSWClassName_ServerSessionStore[2]; +GSWEB_EXPORT NSString* GSWClassName_Component[2]; GSWEB_EXPORT NSString* GSWClassName_DefaultAdaptor[2]; GSWEB_EXPORT NSString* GSWClassName_DefaultContext[2]; GSWEB_EXPORT NSString* GSWClassName_DefaultResponse[2]; diff --git a/GSWeb/GSWConstants.m b/GSWeb/GSWConstants.m index 9684cc7..7d5f44e 100644 --- a/GSWeb/GSWConstants.m +++ b/GSWeb/GSWConstants.m @@ -90,6 +90,7 @@ NSString* GSWClassName_Application=@"Application"; NSString* GSWClassName_ResourceManager[2]={ @"GSWResourceManager", @"WOResourceManager" }; NSString* GSWClassName_StatisticsStore[2]={ @"GSWStatisticsStore", @"WOStatisticsStore" }; NSString* GSWClassName_ServerSessionStore[2]={ @"GSWServerSessionStore", @"WOServerSessionStore" }; +NSString* GSWClassName_Component[2]={ @"GSWComponent", @"WOComponent" }; NSString* GSWClassName_DefaultAdaptor[2]={ @"GSWDefaultAdaptor", @"WODefaultAdaptor" }; NSString* GSWClassName_DefaultContext[2]={ @"GSWContext", @"WOContext" }; NSString* GSWClassName_DefaultResponse[2]={ @"GSWResponse", @"WOResponse" };