-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext.cpp
More file actions
256 lines (241 loc) · 5.96 KB
/
text.cpp
File metadata and controls
256 lines (241 loc) · 5.96 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
// User.cpp
#include "headers/User.h"
#include <iostream>
User::User(int id, std::string uname, std::string mail, std::string pass)
: userId(id), username(uname), email(mail), password(pass) {}
void User::login()
{
std::cout << username << " logged in.\n";
}
void User::logout()
{
std::cout << username << " logged out.\n";
}
// Admin.cpp
#include "headers/Admin.h"
#include <iostream>
Admin::Admin(int id, std::string uname, std::string mail, std::string pass, int level)
: User(id, uname, mail, pass), adminLevel(level) {}
void Admin::createGroup(Group &group)
{
std::cout << "Admin created group: " << group.viewGroupMembers().size() << " members.\n";
}
void Admin::assignTaskToGroup(Task &task, Group &group)
{
std::cout << "Task assigned to group.\n";
}
std::vector<Group> Admin::viewAllGroups()
{
return {};
}
void Admin::setTaskPriority(Task &task, PriorityLevel priority)
{
std::cout << "Priority updated.\n";
}
// NormalUser.cpp
#include "headers/NormalUser.h"
#include <iostream>
NormalUser::NormalUser(int id, std::string uname, std::string mail, std::string pass)
: User(id, uname, mail, pass) {}
std::vector<Task> NormalUser::viewGroupTasks(Group &group)
{
return {};
}
void NormalUser::startTaskTimer(Task &task)
{
std::cout << "Started timer for task.\n";
}
void NormalUser::stopTaskTimer(Task &task)
{
std::cout << "Stopped timer for task.\n";
}
// Group.cpp
#include "headers/Group.h"
#include <iostream>
Group::Group(int id, std::string name) : groupId(id), groupName(name) {}
void Group::addUser(User *user)
{
members.push_back(user);
}
void Group::removeUser(User *user)
{
members.erase(std::remove(members.begin(), members.end(), user), members.end());
}
#include <string>
#include <vector>
#include "User.h"
#include "Task.h"
class Group
{
private:
int groupId;
std::string groupName;
std::vector<User *> members;
public:
Group(int id, std::string name);
void addUser(User *user);
void removeUser(User *user);
std::vector<User *> viewGroupMembers();
std::vector<Task> viewGroupTasks();
};
#endif
// Task.h
#ifndef TASK_H
#define TASK_H
#include <string>
#include "Timer.h"
enum class PriorityLevel
{
LOW,
MEDIUM,
HIGH
};
enum class TaskStatus
{
PENDING,
IN_PROGRESS,
COMPLETED
};
class Task
{
private:
int taskId;
std::string taskName;
std::string description;
std::string dueDate;
PriorityLevel priority;
int groupAssignmentId;
TaskStatus status;
public:
Task(int id, std::string name, std::string desc, std::string due, PriorityLevel p, int groupId);
void markComplete();
void markInProgress();
void markPending();
};
#endif
// Timer.h
#ifndef TIMER_H
#define TIMER_H
#include <string>
#include "Task.h"
class Timer
{
private:
int timerId;
std::string startTime;
std::string endTime;
Task *task;
public:
Timer(int id, std::string start, std::string end, Task *t);
void start();
void stop();
};
#endif
// User.cpp
#include "../headers/User.h"
#include <iostream>
User::User(int id, std::string uname, std::string mail, std::string pass)
: userId(id), username(uname), email(mail), password(pass) {}
void User::login()
{
std::cout << username << " logged in.\n";
}
void User::logout()
{
std::cout << username << " logged out.\n";
}
// Admin.cpp
#include "../headers/Admin.h"
#include <iostream>
Admin::Admin(int id, std::string uname, std::string mail, std::string pass, int level)
: User(id, uname, mail, pass), adminLevel(level) {}
void Admin::createGroup(Group &group)
{
std::cout << "Admin created group: " << group.viewGroupMembers().size() << " members.\n";
}
void Admin::assignTaskToGroup(Task &task, Group &group)
{
std::cout << "Task assigned to group.\n";
}
std::vector<Group> Admin::viewAllGroups()
{
return {};
}
void Admin::setTaskPriority(Task &task, PriorityLevel priority)
{
std::cout << "Priority updated.\n";
}
// NormalUser.cpp
#include "../headers/NormalUser.h"
#include <iostream>
NormalUser::NormalUser(int id, std::string uname, std::string mail, std::string pass)
: User(id, uname, mail, pass) {}
std::vector<Task> NormalUser::viewGroupTasks(Group &group)
{
return {};
}
void NormalUser::startTaskTimer(Task &task)
{
std::cout << "Started timer for task.\n";
}
void NormalUser::stopTaskTimer(Task &task)
{
std::cout << "Stopped timer for task.\n";
}
// Group.cpp
#include "../headers/Group.h"
#include <iostream>
Group::Group(int id, std::string name) : groupId(id), groupName(name) {}
void Group::addUser(User *user)
{
members.push_back(user);
}
void Group::removeUser(User *user)
{
members.erase(std::remove(members.begin(), members.end(), user), members.end());
}
std::vector<User *> Group::viewGroupMembers()
{
return members;
}
std::vector<Task> Group::viewGroupTasks()
{
return {};
}
// Task.cpp
#include "../headers/Task.h"
#include <iostream>
Task::Task(int id, std::string name, std::string desc, std::string due, PriorityLevel p, int groupId)
: taskId(id), taskName(name), description(desc), dueDate(due), priority(p), groupAssignmentId(groupId), status(TaskStatus::PENDING) {}
void Task::markComplete()
{
status = TaskStatus::COMPLETED;
std::cout << "Task marked as completed.\n";
}
void Task::markInProgress()
{
status = TaskStatus::IN_PROGRESS;
std::cout << "Task marked as in progress.\n";
}
void Task::markPending()
{
status = TaskStatus::PENDING;
std::cout << "Task marked as pending.\n";
}
// Timer.cpp
#include "../headers/Timer.h"
#include <iostream>
Timer::Timer(int id, std::string start, std::string end, Task *t)
: timerId(id), startTime(start), endTime(end), task(t) {}
void Timer::start()
{
std::cout << "Timer started for task.\n";
}
void Timer::stop()
{
std::cout << "Timer stopped for task.\n";
}
// To build app
// PS E:\TaskLoop> gcc -c sources/sqlite3.c -o build/sqlite3.o -Iinclude
// PS E:\TaskLoop> g++ -c sources/main.cpp -o build/main.o -Iinclude
// PS E:\TaskLoop> g++ build/main.o build/sqlite3.o -o bin/my_program