forked from arqbackup/arq_restore
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Stefan Reitshamer
authored and
Stefan Reitshamer
committed
Aug 19, 2010
1 parent
cbe20c0
commit eb62c99
Showing
5 changed files
with
131 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// UserAndComputer.h | ||
// Arq | ||
// | ||
// Created by Stefan Reitshamer on 7/9/10. | ||
// Copyright 2010 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
|
||
@interface UserAndComputer : NSObject { | ||
NSString *userName; | ||
NSString *computerName; | ||
} | ||
- (id)initWithXMLData:(NSData *)theXMLData error:(NSError **)error; | ||
- (NSString *)userName; | ||
- (NSString *)computerName; | ||
- (NSData *)toXMLData; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// UserAndComputer.m | ||
// Arq | ||
// | ||
// Created by Stefan Reitshamer on 7/9/10. | ||
// Copyright 2010 __MyCompanyName__. All rights reserved. | ||
// | ||
|
||
#import "UserAndComputer.h" | ||
#import "DictNode.h" | ||
|
||
@implementation UserAndComputer | ||
- (id)initWithXMLData:(NSData *)theXMLData error:(NSError **)error { | ||
if (self = [super init]) { | ||
DictNode *plist = [DictNode dictNodeWithXMLData:theXMLData error:error]; | ||
if (plist == nil) { | ||
[self release]; | ||
return nil; | ||
} | ||
userName = [[[plist stringNodeForKey:@"userName"] stringValue] copy]; | ||
computerName = [[[plist stringNodeForKey:@"computerName"] stringValue] copy]; | ||
} | ||
return self; | ||
} | ||
- (void)dealloc { | ||
[userName release]; | ||
[computerName release]; | ||
[super dealloc]; | ||
} | ||
- (NSString *)userName { | ||
return userName; | ||
} | ||
- (NSString *)computerName { | ||
return computerName; | ||
} | ||
- (NSData *)toXMLData { | ||
DictNode *plist = [[[DictNode alloc] init] autorelease]; | ||
[plist putString:userName forKey:@"userName"]; | ||
[plist putString:computerName forKey:@"computerName"]; | ||
return [plist XMLData]; | ||
} | ||
|
||
#pragma mark NSObject | ||
- (NSString *)description { | ||
return [NSString stringWithFormat:@"<UserAndComputer: userName=%@ computerName=%@>", userName, computerName]; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters