mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-04-23 15:33:43 +00:00
* GSWeb.framework/GSUtils.m (boolValueWithDefaultFor): Do not
reimplement defaults bool evaluation semantics differently from -base / Foundation. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@19520 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7b69f0d37f
commit
c7b9ac28c3
2 changed files with 13 additions and 16 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,4 +1,11 @@
|
|||
2004-06-14 David Wetzel <dave@turbocat.de>
|
||||
2004-05-18 David Ayers <d.ayers@inode.at>
|
||||
|
||||
* GSWeb.framework/GSUtils.m (boolValueWithDefaultFor): Do not
|
||||
reimplement defaults bool evaluation semantics differently from
|
||||
-base / Foundation.
|
||||
|
||||
2004-06-14 David Wetzel <dave@turbocat.de>
|
||||
|
||||
* GSWeb.framework/GSWElementIDString.m
|
||||
added setString: (original code from Philip Moetteli,
|
||||
debugged with David Ayers)
|
||||
|
@ -7,7 +14,8 @@
|
|||
in appendContentString: append string only if not nil
|
||||
(patch from Philip Moetteli)
|
||||
|
||||
2004-06-01 David Wetzel <dave@turbocat.de>
|
||||
2004-06-01 David Wetzel 2004-05-18 David Ayers <d.ayers@inode.at>
|
||||
<dave@turbocat.de>
|
||||
|
||||
* GSWeb.framework/GSWDeclarationParser.m:
|
||||
supports 'true' and 'false' now. Will be transformed into YES and NO
|
||||
|
|
|
@ -84,30 +84,19 @@ BOOL boolValueFor(id anObject)
|
|||
//--------------------------------------------------------------------
|
||||
BOOL boolValueWithDefaultFor(id anObject,BOOL defaultValue)
|
||||
{
|
||||
int length=0;
|
||||
int length=0;
|
||||
if (anObject)
|
||||
{
|
||||
if (/*anObject==BNYES ||*/ anObject==NSTYES)
|
||||
return YES;
|
||||
else if (/*anObject==BNNO ||*/ anObject==NSTNO)
|
||||
return NO;
|
||||
//@protocol NSString
|
||||
if ([anObject isKindOfClass:[NSString class]]) {
|
||||
length=[anObject length];
|
||||
if (length>0) {
|
||||
if (length<4) { // YES / NO?
|
||||
return ([anObject caseInsensitiveCompare: @"NO"]!=NSOrderedSame);
|
||||
}
|
||||
if (length<6) { // true / false
|
||||
return ([anObject caseInsensitiveCompare: @"false"]!=NSOrderedSame);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ([anObject respondsToSelector:@selector(boolValue)])
|
||||
return ([anObject boolValue]!=NO);
|
||||
else if ([anObject respondsToSelector:@selector(intValue)])
|
||||
return ([anObject intValue]!=0);
|
||||
else if ([anObject respondsToSelector:@selector(unsignedCharValue)]) //BOOL is unsigned char
|
||||
/* BOOL is unsigned char. */
|
||||
else if ([anObject respondsToSelector:@selector(unsignedCharValue)])
|
||||
return ([anObject unsignedCharValue]!=0);
|
||||
else
|
||||
return defaultValue;
|
||||
|
|
Loading…
Reference in a new issue