]> err.no Git - sope/blob - sope-appserver/NGXmlRpc/EOFetchSpecification+XmlRpcCoding.m
fixed some Cocoa warnings
[sope] / sope-appserver / NGXmlRpc / EOFetchSpecification+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/EOFetchSpecification.h>
23 #include <EOControl/EOSortOrdering.h>
24 #include "common.h"
25 #include <XmlRpc/XmlRpcCoder.h>
26 #include <EOControl/EOQualifier.h>
27
28 @implementation EOFetchSpecification(XmlRpcCoding)
29
30 - (id)initWithXmlRpcCoder:(XmlRpcDecoder *)_coder {
31   if ((self = [super init])) {
32     id q;
33     
34     [self setUsesDistinct:[_coder decodeBooleanForKey:@"usesDistinct"]];
35     [self setLocksObjects:[_coder decodeBooleanForKey:@"locksObjects"]];
36     [self setEntityName:  [_coder decodeStringForKey:@"entityName"]];
37     [self setFetchLimit:  [_coder decodeIntForKey:@"fetchLimit"]];
38     [self setHints:       [_coder decodeStructForKey:@"hints"]];
39     
40     if ((q = [_coder decodeObjectForKey:@"qualifier"])) {
41       if ([q isKindOfClass:[EOQualifier class]])
42         /* already a qualifier :-) [ObjC on the other side ..] */
43         [q retain];
44       else {
45         q = [[EOQualifier alloc] initWithPropertyList:q owner:nil];
46       }
47     }
48     
49     [self setQualifier:q];
50     [self setSortOrderings:[_coder decodeObjectForKey:@"sortOrderings"]];
51     
52     [q release];
53   }
54   return self;
55 }
56
57 - (void)encodeWithXmlRpcCoder:(XmlRpcEncoder *)_coder {
58   [_coder encodeBoolean:[self usesDistinct] forKey:@"usesDistinct"];
59   [_coder encodeBoolean:[self locksObjects] forKey:@"locksObjects"];
60   [_coder encodeString:[self entityName]    forKey:@"entityName"];
61   [_coder encodeInt:[self fetchLimit]       forKey:@"fetchLimit"];
62   [_coder encodeStruct:[self hints]         forKey:@"hints"];
63   [_coder encodeObject:[self qualifier]     forKey:@"qualifier"];
64   [_coder encodeObject:[self sortOrderings] forKey:@"sortOrderings"];
65 }
66
67 @end /* EOFetchSpecification(XmlRpcCoding) */