-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
58 lines (51 loc) · 1.31 KB
/
Copy pathmain.cpp
File metadata and controls
58 lines (51 loc) · 1.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
#include "src/note-manager/NoteManager.hpp"
#include "src/cache/RecentNotesCache.hpp"
#include <iostream>
int main(int argc, char const *argv[])
{
NoteManager nm("notes.json");
RecentNotesCache cache;
std::cout << "Welcome to NoteKeeper\n\n";
while (1)
{
std::cout
<< "\n\n1. List all notes\n"
"2. View a note\n"
"3. Create a note\n"
"4. Delete a note\n"
"5. Recent Viewed Notes\n"
"6. Exit\n"
"\n";
std::cout << "Enter your choice: ";
int choice = 1;
std::cin >> choice;
int noteId = 0;
switch (choice)
{
case 1:
nm.listAllNotes();
break;
case 2:
noteId = inputNoteId();
cache.addCacheNote(nm.getNotePointer(noteId));
nm.viewNote(noteId);
break;
case 3:
nm.createNote();
break;
case 4:
noteId = inputNoteId();
nm.deleteNote(noteId);
break;
case 5:
cache.showCachedNotes();
break;
case 6:
nm.exitWithSavingNotes();
break;
default:
std::cerr << "Invalid choice!" << std::endl;
}
}
return 0;
}