Repository navigation
Expand file tree
/
Copy pathTask.m
More file actions
executable file
·129 lines (112 loc) · 3.31 KB
/
Copy pathTask.m
File metadata and controls
executable file
·129 lines (112 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//
// Task.m
// iBeHappy
//
// Created by Jaroslaw Szymczyk on 1/23/13.
// Copyright (c) 2013 __MyCompanyName__. All rights reserved.
//
#import "Task.h"
@implementation Task
- (void)encodeWithCoder: (NSCoder *)encoder
{
[encoder encodeObject:_message forKey: @"message"];
[encoder encodeObject:_timeSpecific forKey: @"tspec"];
[encoder encodeObject:_time forKey: @"time"];
[encoder encodeInteger:_points forKey: @"points"];
[encoder encodeBool:_completed forKey: @"completed"];
[encoder encodeObject:(_reminderMessage) forKey:@"reminderMessage"];
}
- (id)initWithCoder: (NSCoder *)decoder
{
self = [super init];
if (self)
{
self.message = [decoder decodeObjectForKey: @"message"];
self.timeSpecific = [decoder decodeObjectForKey: @"tspec"];
self.time = [decoder decodeObjectForKey: @"time"];
self.points = [decoder decodeIntegerForKey: @"points"];
self.completed = [decoder decodeBoolForKey: @"completed"];
self.reminderMessage = [decoder decodeObjectForKey: @"reminderMessage"];
}
return self;
}
- (id)init
{
self = [super init];
if (self)
{
_message = @"This would be your task";
_time = [[NSString alloc] initWithFormat:@"%d", 0];
_timeSpecific = @"false";
_points = 25;
_completed = false;
_reminderMessage = @"NA";
}
return self;
}
- (id)initWithMessage:(NSString *)msg
{
self = [super init];
if (self)
{
_message = [[NSString alloc] initWithString: msg];
_time = [[NSString alloc] initWithFormat:@"%d", 0];
_timeSpecific = @"false";
_points = 25;
_completed = false;
_reminderMessage = @"NA";
}
return self;
}
- (id)initWithMessageAndPoints:(NSString *)msg
points: (NSInteger) pts
{
self = [super init];
if (self)
{
_message = [[NSString alloc] initWithString: msg];
_time = [[NSString alloc] initWithFormat:@"%d", 0];
_timeSpecific = @"false";
_points = pts;
_completed = false;
}
return self;
}
//- (id)initWithMessage: (NSString *)msg
// time: (NSString *)t
// timeSpecific: (NSString *)ts
// points: (NSInteger *)iPoints
// ageMin: (NSString *)min
// ageMax: (NSString *)max
// femaleExcl: (NSString *)female
// maleExcl: (NSString *)male
// schoolSpecific: (NSString *)ss
// scool: (NSString *)school
// workSpecific: (NSString *)ws
// completed: (bool) bCompleted
//{
// self = [super init];
//
// if (self)
// {
// _message = [[NSString alloc] initWithString: msg];
// _time = [[NSString alloc] initWithString: t];
// _timeSpecific = [[NSString alloc] initWithString: ts];
// _points = *iPoints;
// _completed = &bCompleted;
// }
//
// return self;
//}
- (id)copyWithZone:(NSZone *)zone
{
Task *task = [[Task alloc] init];
task.message = [NSString stringWithString:_message];
task.time = [NSString stringWithString:_time];
task.timeSpecific = [NSString stringWithString:_timeSpecific];
task.points = _points;
task.completed = _completed;
task.reminderMessage =[NSString stringWithString:_reminderMessage];
return task;
}
@end