/* Copyright (C) 2002-2003, Jeffrey D. Argast. The authors make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy. Permission is hereby granted to use, copy, modify, and distribute this software or portions thereof for any purpose, without fee, subject to these conditions: (1) If any part of the source code is distributed, then this statement must be included, with this copyright and no-warranty notice unaltered. (2) Permission for use of this software is granted only if the user accepts full responsibility for any undesirable consequences; the authors accept NO LIABILITY for damages of any kind. */ #import "PerforceConfiguration.h" @interface PerforceConfiguration (PrivateMethods) @end // // Implementation // @implementation PerforceConfiguration + (void) initialize { [self setVersion:1]; } - (id) initWithName:(NSString*) name perforcePort:(NSString*) perforcePort perforceHost:(NSString*) perforceHost perforceUser:(NSString*) perforceUser perforceClient:(NSString*) perforceClient perforcePasswd:(NSString*) perforcePasswd unicodeServer:(BOOL) unicodeServer { self = [super init]; fConfigurationName = [name copy]; fPerforcePort = perforcePort ? [perforcePort copy] : @""; fPerforceHost = perforceHost ? [perforceHost copy] : @""; fPerforceUser = perforceUser ? [perforceUser copy] : @""; fPerforceClient = perforceClient ? [perforceClient copy] : @""; fPerforcePasswd = perforcePasswd ? [perforcePasswd copy] : @""; fUnicodeServer = unicodeServer; return self; } - (void) dealloc { [fConfigurationName release]; [fPerforcePort release]; [fPerforceHost release]; [fPerforceUser release]; [fPerforceClient release]; [fPerforcePasswd release]; [super dealloc]; } - (id)initWithCoder:(NSCoder*)coder { self = [super init]; int version = [coder versionForClassName:@"PerforceConfiguration"]; if ( version == NSNotFound ) version = 0; if ( [coder allowsKeyedCoding] ) { NSLog (@"Allows keyed coding"); } fConfigurationName = [[coder decodeObject] retain]; fPerforcePort = [[coder decodeObject] retain]; fPerforceHost = [[coder decodeObject] retain]; fPerforceUser = [[coder decodeObject] retain]; fPerforceClient = [[coder decodeObject] retain]; fPerforcePasswd = [[coder decodeObject] retain]; if ( version > 0 ) { [coder decodeValueOfObjCType:@encode(BOOL) at:&fUnicodeServer]; } return self; } - (void) encodeWithCoder:(NSCoder*)coder { [coder encodeObject:fConfigurationName]; [coder encodeObject:fPerforcePort]; [coder encodeObject:fPerforceHost]; [coder encodeObject:fPerforceUser]; [coder encodeObject:fPerforceClient]; [coder encodeObject:fPerforcePasswd]; [coder encodeValueOfObjCType:@encode(BOOL) at:&fUnicodeServer]; } - (id) copyWithZone:(NSZone*)zone { PerforceConfiguration* newConfig = [[PerforceConfiguration alloc] initWithName:fConfigurationName perforcePort:fPerforcePort perforceHost:fPerforceHost perforceUser:fPerforceUser perforceClient:fPerforceClient perforcePasswd:fPerforcePasswd unicodeServer:fUnicodeServer]; return newConfig; } - (NSString*) configurationName { return fConfigurationName; } - (NSString*) perforcePort { return fPerforcePort; } - (NSString*) perforceHost { return fPerforceHost; } - (NSString*) perforceUser { return fPerforceUser; } - (NSString*) perforceClient { return fPerforceClient; } - (NSString*) perforcePasswd { return fPerforcePasswd; } - (BOOL) unicodeServer { return fUnicodeServer; } - (void) setConfigurationName:(NSString*)newName { [fConfigurationName release]; fConfigurationName = [newName copy]; } - (void) setPerforcePort:(NSString*)newPort { [fPerforcePort release]; fPerforcePort = [newPort copy]; } - (void) setPerforceHost:(NSString*)newHost { [fPerforceHost release]; fPerforceHost = [newHost copy]; } - (void) setPerforceUser:(NSString*)newUser { [fPerforceUser release]; fPerforceUser = [newUser copy]; } - (void) setPerforceClient:(NSString*)newClient { [fPerforceClient release]; fPerforceClient = [newClient copy]; } - (void) setPerforcePasswd:(NSString*)newPasswd { [fPerforcePasswd release]; fPerforcePasswd = [newPasswd copy]; } - (void) setUnicodeServer:(BOOL)unicodeServer { fUnicodeServer = unicodeServer; } @end // // // PRIVATE METHODS // // @implementation PerforceConfiguration (PrivateMethods) @end