]> err.no Git - sope/blob - sope-appserver/NGXmlRpc/EOQualifier+XmlRpcCoding.m
fixed (all?) gcc 4.0 warnings
[sope] / sope-appserver / NGXmlRpc / EOQualifier+XmlRpcCoding.m
1 /*
2   Copyright (C) 2000-2005 SKYRIX Software AG
3
4   This file is part of SOPE.
5
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
9   later version.
10
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.
15
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
19   02111-1307, USA.
20 */
21
22 #include <EOControl/EOQualifier.h>
23 #include "common.h"
24 #include <XmlRpc/XmlRpcCoder.h>
25
26 #if APPLE_FOUNDATION_LIBRARY || NeXT_Foundation_LIBRARY
27 @interface NSObject(Miss)
28 - (void)subclassResponsibility:(SEL)cmd;
29 @end
30 #endif
31
32 @implementation EOQualifier(XmlRpcCoding)
33
34 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
35   // TODO: hh asks: whats that ?
36   return [self init];
37 }
38 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
39   [self subclassResponsibility:_cmd];
40 }
41
42 @end /* EOQualifier */
43
44 @implementation EOAndQualifier(XmlRpcCoding)
45 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
46   NSArray *quals = [_coder decodeArrayForKey:@"qualifiers"];
47   
48   return [self initWithQualifierArray:quals];
49 }
50
51 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
52   [_coder encodeArray:[self qualifiers] forKey:@"qualifiers"];
53 }
54
55 @end /* EOAndQualifier(XmlRpcCoding) */
56
57 @implementation EOOrQualifier(XmlRpcCoding)
58 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
59   NSArray *quals = [_coder decodeArrayForKey:@"qualifiers"];
60   
61   return [self initWithQualifierArray:quals];
62 }
63
64 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
65   [_coder encodeArray:[self qualifiers] forKey:@"qualifiers"];
66 }
67
68 @end /* EOOrQualifier(XmlRpcCoding) */
69
70 @implementation EONotQualifier(XmlRpcCoding)
71 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
72   return [self initWithQualifier:[_coder decodeObject]];
73 }
74
75 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
76   [_coder encodeObject:[self qualifier]];
77 }
78
79 @end /* EONotQualifier(XmlRpcCoding) */
80
81 @implementation EOKeyValueQualifier(XmlRpcCoding)
82 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
83   NSString *k  = nil;
84   id       val = nil;
85   SEL      sel = NULL;
86
87   k = [_coder decodeStringForKey:@"selector"];
88   if (k) sel = NSSelectorFromString(k);
89   val = [_coder decodeObjectForKey:@"value"];
90   k   = [_coder decodeStringForKey:@"key"];
91   
92   return [self initWithKey:k operatorSelector:sel value:val];
93 }
94
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])
99           forKey:@"selector"];
100 }
101
102 @end /* EOKeyValueQualifier(XmlRpcCoding) */
103
104 @implementation EOKeyComparisonQualifier(XmlRpcCoding)
105
106 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
107   NSString *lKey = nil;
108   NSString *rKey = nil;
109   SEL      sel   = NULL;
110
111   lKey = [_coder decodeStringForKey:@"selector"];
112   if (lKey) sel = NSSelectorFromString(lKey);
113   lKey = [_coder decodeObjectForKey:@"leftKey"];
114   rKey = [_coder decodeStringForKey:@"rightKey"];
115   
116   return [self initWithLeftKey:lKey operatorSelector:sel rightKey:rKey];
117 }
118
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])
123           forKey:@"selector"];
124 }
125
126 @end /* EOKeyComparisonQualifier(XmlRpcCoding) */
127
128 @implementation EOQualifierVariable(XmlRpcCoding)
129
130 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
131   return [self initWithKey:[_coder decodeString]];
132 }
133
134 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
135   [_coder encodeString:[self key]];
136 }
137
138 @end /* EOQualifierVariable(XmlRpcCoding) */