2 Copyright (C) 2000-2003 SKYRIX Software AG
4 This file is part of OGo
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #include <EOControl/EOQualifier.h>
25 #include <XmlRpc/XmlRpcCoder.h>
27 #if APPLE_FOUNDATION_LIBRARY || NeXT_Foundation_LIBRARY
28 @interface NSObject(Miss)
29 - (void)subclassResponsibility:(SEL)cmd;
33 @implementation EOQualifier(XmlRpcCoding)
35 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
36 // TODO: hh asks: whats that ?
39 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
40 [self subclassResponsibility:_cmd];
43 @end /* EOQualifier */
45 @implementation EOAndQualifier(XmlRpcCoding)
46 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
47 NSArray *quals = [_coder decodeArrayForKey:@"qualifiers"];
49 return [self initWithQualifierArray:quals];
52 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
53 [_coder encodeArray:[self qualifiers] forKey:@"qualifiers"];
56 @end /* EOAndQualifier(XmlRpcCoding) */
58 @implementation EOOrQualifier(XmlRpcCoding)
59 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
60 NSArray *quals = [_coder decodeArrayForKey:@"qualifiers"];
62 return [self initWithQualifierArray:quals];
65 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
66 [_coder encodeArray:[self qualifiers] forKey:@"qualifiers"];
69 @end /* EOOrQualifier(XmlRpcCoding) */
71 @implementation EONotQualifier(XmlRpcCoding)
72 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
73 return [self initWithQualifier:[_coder decodeObject]];
76 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
77 [_coder encodeObject:[self qualifier]];
80 @end /* EONotQualifier(XmlRpcCoding) */
82 @implementation EOKeyValueQualifier(XmlRpcCoding)
83 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
88 k = [_coder decodeStringForKey:@"selector"];
89 if (k) sel = NSSelectorFromString(k);
90 val = [_coder decodeObjectForKey:@"value"];
91 k = [_coder decodeStringForKey:@"key"];
93 return [self initWithKey:k operatorSelector:sel value:val];
96 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
97 [_coder encodeString:[self key] forKey:@"key"];
98 [_coder encodeObject:[self value] forKey:@"value"];
99 [_coder encodeString:NSStringFromSelector([self selector])
103 @end /* EOKeyValueQualifier(XmlRpcCoding) */
105 @implementation EOKeyComparisonQualifier(XmlRpcCoding)
107 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
108 NSString *lKey = nil;
109 NSString *rKey = nil;
112 lKey = [_coder decodeStringForKey:@"selector"];
113 if (lKey) sel = NSSelectorFromString(lKey);
114 lKey = [_coder decodeObjectForKey:@"leftKey"];
115 rKey = [_coder decodeStringForKey:@"rightKey"];
117 return [self initWithLeftKey:lKey operatorSelector:sel rightKey:rKey];
120 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
121 [_coder encodeString:[self leftKey] forKey:@"leftKey"];
122 [_coder encodeObject:[self rightKey] forKey:@"rightKey"];
123 [_coder encodeString:NSStringFromSelector([self selector])
127 @end /* EOKeyComparisonQualifier(XmlRpcCoding) */
129 @implementation EOQualifierVariable(XmlRpcCoding)
131 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
132 return [self initWithKey:[_coder decodeString]];
135 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
136 [_coder encodeString:[self key]];
139 @end /* EOQualifierVariable(XmlRpcCoding) */