From b50937ebcb4bea776c615d9575af3b703073c67a Mon Sep 17 00:00:00 2001 From: mguesdon Date: Tue, 25 Nov 2003 13:11:38 +0000 Subject: [PATCH] o added (come from Dave Lopper) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@18196 72102866-910b-0410-8b05-ffd578937521 --- .../GSWKeyValueConditional.api | 12 ++++ .../GSWKeyValueConditional.gswd | 8 +++ .../GSWKeyValueConditional.gswi | 4 ++ .../GSWKeyValueConditional.html | 1 + .../GSWKeyValueConditional.h | 44 ++++++++++++++ .../GSWKeyValueConditional.m | 59 +++++++++++++++++++ 6 files changed, 128 insertions(+) create mode 100644 GSWExtensions.framework/GSWKeyValueConditional.api create mode 100644 GSWExtensions.framework/GSWKeyValueConditional.gswc/GSWKeyValueConditional.gswd create mode 100644 GSWExtensions.framework/GSWKeyValueConditional.gswc/GSWKeyValueConditional.gswi create mode 100644 GSWExtensions.framework/GSWKeyValueConditional.gswc/GSWKeyValueConditional.html create mode 100644 GSWExtensions.framework/GSWKeyValueConditional.h create mode 100644 GSWExtensions.framework/GSWKeyValueConditional.m diff --git a/GSWExtensions.framework/GSWKeyValueConditional.api b/GSWExtensions.framework/GSWKeyValueConditional.api new file mode 100644 index 0000000..ba3c4c5 --- /dev/null +++ b/GSWExtensions.framework/GSWKeyValueConditional.api @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/GSWExtensions.framework/GSWKeyValueConditional.gswc/GSWKeyValueConditional.gswd b/GSWExtensions.framework/GSWKeyValueConditional.gswc/GSWKeyValueConditional.gswd new file mode 100644 index 0000000..288b2eb --- /dev/null +++ b/GSWExtensions.framework/GSWKeyValueConditional.gswc/GSWKeyValueConditional.gswd @@ -0,0 +1,8 @@ + +Conditional: GSWConditional { + condition = condition; + negate = ^negate; +} + +Content: GSWComponentContent { +} diff --git a/GSWExtensions.framework/GSWKeyValueConditional.gswc/GSWKeyValueConditional.gswi b/GSWExtensions.framework/GSWKeyValueConditional.gswc/GSWKeyValueConditional.gswi new file mode 100644 index 0000000..55bf4be --- /dev/null +++ b/GSWExtensions.framework/GSWKeyValueConditional.gswc/GSWKeyValueConditional.gswi @@ -0,0 +1,4 @@ +{ + encoding = NSISOLatin1StringEncoding; + variables = {}; +} diff --git a/GSWExtensions.framework/GSWKeyValueConditional.gswc/GSWKeyValueConditional.html b/GSWExtensions.framework/GSWKeyValueConditional.gswc/GSWKeyValueConditional.html new file mode 100644 index 0000000..0e65e75 --- /dev/null +++ b/GSWExtensions.framework/GSWKeyValueConditional.gswc/GSWKeyValueConditional.html @@ -0,0 +1 @@ + diff --git a/GSWExtensions.framework/GSWKeyValueConditional.h b/GSWExtensions.framework/GSWKeyValueConditional.h new file mode 100644 index 0000000..d9288bc --- /dev/null +++ b/GSWExtensions.framework/GSWKeyValueConditional.h @@ -0,0 +1,44 @@ +/** GSWKeyValueConditional.h - GSWeb: Class GSWKeyValueConditional + + Copyright (C) 2003 Free Software Foundation, Inc. + + Written by: Dave Lopper + Date: Mar 2003 + + $Revision$ + $Date$ + + + + This file is part of the GNUstep Web Library. + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +**/ + +#ifndef _GSWKeyValueConditional_h__ +#define _GSWKeyValueConditional_h__ + +#include + +//============================================================================== +@interface GSWKeyValueConditional : GSWComponent +{ +} + +@end + +#endif //_GSWKeyValueConditional_h__ diff --git a/GSWExtensions.framework/GSWKeyValueConditional.m b/GSWExtensions.framework/GSWKeyValueConditional.m new file mode 100644 index 0000000..cd7e117 --- /dev/null +++ b/GSWExtensions.framework/GSWKeyValueConditional.m @@ -0,0 +1,59 @@ +/** GSWKeyValueConditional.m - GSWeb: Class GSWKeyValueConditional + + Copyright (C) 2003 Free Software Foundation, Inc. + + Written by: Dave Lopper + Date: Mar 2003 + + $Revision$ + $Date$ + + + + This file is part of the GNUstep Web Library. + + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +**/ + +#include "config.h" + +RCS_ID("$Id$") + +#include "GSWExtWOCompatibility.h" +#include "GSWKeyValueConditional.h" + +//=================================================================================== +@implementation GSWKeyValueConditional + +- (BOOL) synchronizesVariablesWithBindings +{ + return NO; +} + +- (BOOL) condition +{ + id key = [self valueForBinding:@"key"]; + id parentValue = (key ? [[self parent] valueForKeyPath:key]:nil); + id value = [self valueForBinding:@"value"]; + + if(parentValue == nil) + return value == nil; + else + return [parentValue isEqual:value]; +} + +@end