2
Copyright (C) 2002-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 "OFSFactoryContext.h"
23
#include "OFSFolder.h"
26
@implementation OFSFactoryContext
28
+ (OFSFactoryContext *)contextForChild:(NSString *)_name
29
storagePath:(NSString *)_sp
30
ofFolder:(OFSFolder *)_folder
32
OFSFactoryContext *ctx;
34
ctx = [[self alloc] init];
35
ctx->fileManager = [[_folder fileManager] retain];
36
ctx->storagePath = [_sp copy];
37
ctx->container = [_folder retain];
38
ctx->name = [_name copy];
39
return [ctx autorelease];
41
+ (OFSFactoryContext *)contextForNewChild:(NSString *)_name
42
storagePath:(NSString *)_sp
43
ofFolder:(OFSFolder *)_folder
45
OFSFactoryContext *ctx;
47
if ((ctx = [self contextForChild:_name storagePath:_sp ofFolder:_folder])) {
48
ctx->isNewObject = YES;
53
+ (OFSFactoryContext *)contextWithFileManager:(id<NSObject,NGFileManager>)_fm
54
storagePath:(NSString *)_sp
56
OFSFactoryContext *ctx;
58
ctx = [[self alloc] init];
59
ctx->fileManager = [_fm retain];
60
ctx->storagePath = [_sp copy];
61
return [ctx autorelease];
65
[self->fileType release];
66
[self->mimeType release];
67
[self->fileManager release];
68
[self->container release];
70
[self->storagePath release];
76
- (id<NSObject,NGFileManager>)fileManager {
77
return self->fileManager;
79
- (NSString *)storagePath {
80
return self->storagePath;
83
return self->container;
85
- (NSString *)nameInContainer {
89
- (NSString *)fileType {
90
return self->fileType;
92
- (NSString *)mimeType {
93
return self->mimeType;
97
return self->isNewObject;
102
- (NSString *)description {
105
ms = [NSMutableString stringWithCapacity:64];
106
[ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])];
108
if (self->isNewObject)
109
[ms appendString:@" NEW"];
110
if (self->name) [ms appendFormat:@" create=%@", self->name];
111
if (self->container) [ms appendFormat:@" in=%@", self->container];
112
if (self->fileType) [ms appendFormat:@" type=%@", self->fileType];
113
if (self->mimeType) [ms appendFormat:@" mime=%@", self->mimeType];
114
if (self->storagePath) [ms appendFormat:@" path=%@", self->storagePath];
116
[ms appendString:@">"];
120
@end /* OFSFactoryContext */