2 Copyright (C) 2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
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 "SOGoObject.h"
26 @implementation SOGoObject
28 - (BOOL)doesRetainContainer {
32 - (id)initWithName:(NSString *)_name inContainer:(id)_container {
33 if ((self = [super init])) {
34 self->nameInContainer = [_name copy];
36 [self doesRetainContainer] ? [_container retain] : _container;
41 return [self initWithName:nil inContainer:nil];
45 if ([self doesRetainContainer])
46 [self->container release];
47 [self->nameInContainer release];
53 - (NSString *)nameInContainer {
54 return self->nameInContainer;
57 return self->container;
60 /* looking up shared objects */
62 - (SOGoUserFolder *)lookupUserFolder {
63 if (![self->container respondsToSelector:_cmd])
66 return [self->container lookupUserFolder];
71 - (id)valueForUndefinedKey:(NSString *)_key {
77 - (NSString *)davDisplayName {
78 return [self nameInContainer];
83 - (void)appendAttributesToDescription:(NSMutableString *)_ms {
84 if (self->nameInContainer)
85 [_ms appendFormat:@" name=%@", self->nameInContainer];
87 [_ms appendFormat:@" container=0x%08X", self->container];
90 - (NSString *)description {
93 ms = [NSMutableString stringWithCapacity:64];
94 [ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])];
95 [self appendAttributesToDescription:ms];
96 [ms appendString:@">"];
100 @end /* SOGoObject */