-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtaskview.cpp
More file actions
94 lines (79 loc) · 1.93 KB
/
taskview.cpp
File metadata and controls
94 lines (79 loc) · 1.93 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
#include "taskview.h"
void TaskView::printMenu() const
{
std::cout << "------------------\n"
"1. Add task\n"
"2. Remove task\n"
"3. Show all tasks\n"
"4. Exit\n"
"------------------\n";
}
void TaskView::printTasks(const std::vector<std::string> &tasks) const
{
if (tasks.empty())
{
std::cout << "No tasks found.\n";
return;
}
std::cout << "------------------\n"
"Your tasks:\n"
"------------------\n";
for (size_t i = 0; i < tasks.size(); ++i)
{
std::cout << "[" << i << "] " << tasks[i] << '\n';
}
std::cout << "------------------\n";
}
void TaskView::printAddSuccess() const
{
std::cout << "Task successfully added!\n";
}
void TaskView::printRemoveSuccess() const
{
std::cout << "Task successfully removed!\n";
}
void TaskView::printError(const std::string &message) const
{
std::cout << "Error: " << message << '\n';
}
void TaskView::printEnterTaskPrompt() const
{
std::cout << "Enter your task...\n";
}
void TaskView::printRemovePrompt() const
{
std::cout << "Choose task for remove (id):\n";
}
void TaskView::printEnterIdPrompt() const
{
std::cout << "Enter task ID: ";
}
void TaskView::printInvalidId() const
{
std::cout << "Invalid ID!\n";
}
void TaskView::printEmptyList() const
{
std::cout << "Tasks list is empty!\n";
}
void TaskView::printGoodbye() const
{
std::cout << "Goodbye!\n";
}
void TaskView::printPressAnyKey() const
{
std::cout << "Press Enter to continue...\n";
}
std::string TaskView::formatMenu() const
{
return "------------------\n"
"1. Add task\n"
"2. Remove task\n"
"3. Show all tasks\n"
"4. Exit\n"
"------------------\n";
}
std::string TaskView::formatTask(int id, const std::string &task) const
{
return "[" + std::to_string(id) + "] " + task;
}