-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotey.cpp
More file actions
50 lines (41 loc) · 1.3 KB
/
Copy pathnotey.cpp
File metadata and controls
50 lines (41 loc) · 1.3 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
#include <stdio.h>
#include <iostream>
#include "Header/Core.h"
#include "Header/Console.h"
#include "Header/Sqlite.h"
using namespace std;
using namespace Core;
int main( int argc, const char* argv[] )
{
// Prints each argument on the command line.
for( int i = 0; i < argc; i++ )
{
printf( "arg %d: %s\n", i, argv[i] );
}
// initialize database
const char* file = "/home/meymard/Dropbox/cpp/notes/bin/notey.db";
Sqlite::Controller::DataSave *db = new Sqlite::Controller::DataSave(file);
Controller::Note::db = db;
// Initialize View mode
Console::View::Menu *view = new Console::View::Menu();
Controller::Note::view = view;
// initialize last Note id
Model::Note::lastId = 0;
Controller::Note::loadAll();
string choice = "";
do {
choice = view->showMenu();
if (choice == "list") {
Controller::Note::list();
} else if (choice == "add") {
Controller::Note::add();
} else if (choice == "edit") {
Controller::Note::edit();
} else if (choice == "show") {
Controller::Note::show();
} else if (choice == "remove") {
Controller::Note::remove();
}
} while (choice != "quit");
view->end();
}