1 //
2 // MyDocument.m
3 // RaiseMan
4 //
5 // Created by b1mobile on 2/14/11.
6 // Copyright 2011 __MyCompanyName__. All rights reserved.
7 //
8
9 #import "MyDocument.h"
10
11 @implementation MyDocument
12
13 - (id)init
14 {
15 self = [super init];
16 employees = [[NSMutableArray alloc] init];
17 return self;
18 }
19
20 - (void)dealloc
21 {
22 [super setEmployees:nil];
23 [super dealloc];
24 }
25
26 - (void)setEmployees:(NSMutableArray *)a
27 {
28 if(a == employees)
29 {
30 return;
31 }
32
33 [a retain];
34 [employees release];
35 employees = a;
36 }
37
38 - (NSString *)windowNibName
39 {
40 // Override returning the nib file name of the document
41 // If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead.
42 return @"MyDocument";
43 }
44
45 - (void)windowControllerDidLoadNib:(NSWindowController *) aController
46 {
47 [super windowControllerDidLoadNib:aController];
48 // Add any code here that needs to be executed once the windowController has loaded the document's window.
49 }
50
51 - (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
52 {
53 // Insert code here to write your document to data of the specified type. If the given outError != NULL, ensure that you set *outError when returning nil.
54
55 // You can also choose to override -fileWrapperOfType:error:, -writeToURL:ofType:error:, or -writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead.
56
57 // For applications targeted for Panther or earlier systems, you should use the deprecated API -dataRepresentationOfType:. In this case you can also choose to override -fileWrapperRepresentationOfType: or -writeToFile:ofType: instead.
58
59 if ( outError != NULL ) {
60 *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL];
61 }
62 return nil;
63 }
64
65 - (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError
66 {
67 // Insert code here to read your document from the given data of the specified type. If the given outError != NULL, ensure that you set *outError when returning NO.
68
69 // You can also choose to override -readFromFileWrapper:ofType:error: or -readFromURL:ofType:error: instead.
70
71 // For applications targeted for Panther or earlier systems, you should use the deprecated API -loadDataRepresentation:ofType. In this case you can also choose to override -readFromFile:ofType: or -loadFileWrapperRepresentation:ofType: instead.
72
73 if ( outError != NULL ) {
74 *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL];
75 }
76 return YES;
77 }
78
79 @end