1 /* SOGoDAVRendererTypes.m - this file is part of SOGo
3 * Copyright (C) 2006 Inverse groupe conseil
5 * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
7 * This file is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This file is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #import <Foundation/NSArray.h>
24 #import <Foundation/NSEnumerator.h>
25 #import <Foundation/NSString.h>
27 #import "SOGoDAVRendererTypes.h"
29 @implementation SOGoDAVSet
31 + (id) davSetWithArray: (NSArray *) newValues
32 ofValuesTaggedAs: (NSString *) newValueTag
37 [davSet setValueTag: newValueTag];
38 [davSet setValues: newValues];
46 if ((self = [super init]))
64 - (void) setValueTag: (NSString *) newValueTag
66 ASSIGN (valueTag, newValueTag);
69 - (void) setValues: (NSArray *) newValues
71 ASSIGN (values, newValues);
74 - (NSString *) stringForTag: (NSString *) _key
75 rawName: (NSString *) setTag
76 inContext: (id) context
77 prefixes: (NSDictionary *) prefixes
79 NSMutableString *resultString;
81 NSString *valueString;
82 NSEnumerator *valueEnum;
84 resultString = [NSMutableString new];
85 [resultString autorelease];
87 [resultString appendFormat: @"<%@>", setTag];
88 valueEnum = [values objectEnumerator];
89 currentValue = [valueEnum nextObject];
92 if ([currentValue isKindOfClass: [SoWebDAVValue class]])
94 = [currentValue stringForTag:
95 [NSString stringWithFormat: @"{DAV:}%@", valueTag]
96 rawName: [NSString stringWithFormat: @"D:%@", valueTag]
100 valueString = currentValue;
102 [resultString appendFormat: @"<%@>%@</%@>",
103 valueTag, valueString, valueTag];
104 currentValue = [valueEnum nextObject];
106 [resultString appendFormat: @"</%@>", setTag];
108 NSLog(@"dav rendering for key '%@' and tag '%@':\n", _key, setTag,