2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE 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 SOPE 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 SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #include <EOControl/EOQualifier.h>
24 #include <XmlRpc/XmlRpcCoder.h>
26 #if APPLE_FOUNDATION_LIBRARY || NeXT_Foundation_LIBRARY
27 @interface NSObject(Miss)
28 - (void)subclassResponsibility:(SEL)cmd;
32 @implementation EOQualifier(XmlRpcCoding)
34 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
35 // TODO: hh asks: whats that ?
38 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
39 [self subclassResponsibility:_cmd];
42 @end /* EOQualifier */
44 @implementation EOAndQualifier(XmlRpcCoding)
45 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
46 NSArray *quals = [_coder decodeArrayForKey:@"qualifiers"];
48 return [self initWithQualifierArray:quals];
51 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
52 [_coder encodeArray:[self qualifiers] forKey:@"qualifiers"];
55 @end /* EOAndQualifier(XmlRpcCoding) */
57 @implementation EOOrQualifier(XmlRpcCoding)
58 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
59 NSArray *quals = [_coder decodeArrayForKey:@"qualifiers"];
61 return [self initWithQualifierArray:quals];
64 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
65 [_coder encodeArray:[self qualifiers] forKey:@"qualifiers"];
68 @end /* EOOrQualifier(XmlRpcCoding) */
70 @implementation EONotQualifier(XmlRpcCoding)
71 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
72 return [self initWithQualifier:[_coder decodeObject]];
75 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
76 [_coder encodeObject:[self qualifier]];
79 @end /* EONotQualifier(XmlRpcCoding) */
81 @implementation EOKeyValueQualifier(XmlRpcCoding)
82 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
87 k = [_coder decodeStringForKey:@"selector"];
88 if (k) sel = NSSelectorFromString(k);
89 val = [_coder decodeObjectForKey:@"value"];
90 k = [_coder decodeStringForKey:@"key"];
92 return [self initWithKey:k operatorSelector:sel value:val];
95 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
96 [_coder encodeString:[self key] forKey:@"key"];
97 [_coder encodeObject:[self value] forKey:@"value"];
98 [_coder encodeString:NSStringFromSelector([self selector])
102 @end /* EOKeyValueQualifier(XmlRpcCoding) */
104 @implementation EOKeyComparisonQualifier(XmlRpcCoding)
106 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
107 NSString *lKey = nil;
108 NSString *rKey = nil;
111 lKey = [_coder decodeStringForKey:@"selector"];
112 if (lKey) sel = NSSelectorFromString(lKey);
113 lKey = [_coder decodeObjectForKey:@"leftKey"];
114 rKey = [_coder decodeStringForKey:@"rightKey"];
116 return [self initWithLeftKey:lKey operatorSelector:sel rightKey:rKey];
119 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
120 [_coder encodeString:[self leftKey] forKey:@"leftKey"];
121 [_coder encodeObject:[self rightKey] forKey:@"rightKey"];
122 [_coder encodeString:NSStringFromSelector([self selector])
126 @end /* EOKeyComparisonQualifier(XmlRpcCoding) */
128 @implementation EOQualifierVariable(XmlRpcCoding)
130 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
131 return [self initWithKey:[_coder decodeString]];
134 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
135 [_coder encodeString:[self key]];
138 @end /* EOQualifierVariable(XmlRpcCoding) */