diff --git a/.gitignore b/.gitignore index df2113c..41d1703 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ bin obj +database.txt +vehiclesData.json + # Compiled Object files *.slo *.lo diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..90d69b1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +language: cpp +install: ./install.sh +script: ant test diff --git a/README.md b/README.md index 18ae4da..8ba1543 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,13 @@ For detailed code documentations, please visit [https://binhonglee.github.io/Tic ##### Disclaimer: -This program is still in progress and is currently in a **NOT WORKING** condition. This is due to the fact that ant does not support taking in inputs in command line thus a GUI implementation is needed for this program to function as intended. +This program is still in progress and is currently in a **NOT WORKING** condition. ## Setting up and running it ```sh $ git clone https://github.com/binhonglee/TicketingSystem.git $ cd TicketingSystem -$ ant execute +$ ant build +$ ./bin/main ``` diff --git a/build.xml b/build.xml index fc8853c..abf3348 100644 --- a/build.xml +++ b/build.xml @@ -21,7 +21,7 @@ - + @@ -88,10 +88,11 @@ + + - - + diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..f5e00cd --- /dev/null +++ b/circle.yml @@ -0,0 +1,6 @@ +dependencies: + pre: + - ./install.sh +test: + override: + - ant test diff --git a/database.txt b/database.txt index a10b596..adca3d9 100644 --- a/database.txt +++ b/database.txt @@ -1,4 +1,4 @@ -binhonglee bhlee03655 binhonglee@hotmail.com +13479618886 1 -binhong binhong binhong@binhong.me +14802527013 2 -who whut wtf_is_happening@binhong.me +999999999 3 -testing password testing@binhong.me +601111111111 4 +binhonglee bhlee03655 binhonglee@hotmail.com +13479618886 1 +binhong binhong binhong@binhong.me +14802527013 2 +who whut wtf_is_happening@binhong.me +999999999 3 +testing password testing@binhong.me +601111111111 4 diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..3703909 --- /dev/null +++ b/install.sh @@ -0,0 +1,4 @@ +cp lib/anttasks.jar ~ +pushd ~ +jar xf anttasks.jar +pushd -0 diff --git a/src/main.cpp b/src/main.cpp index 7f127b4..03e0d0c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,15 +1,41 @@ #include #include #include +#include #include +#include #include "VehicleManager.hpp" #include "LogInSystem.hpp" using namespace std; int main() { - LogInSystem users("database.txt"); - VehicleManager vehicles("vehiclesData.json"); + string userFile = "database.txt"; + string vehicleFile = "vehiclesData.json"; + + LogInSystem users; + VehicleManager vehicles; + + ifstream userfile(userFile); + if (userfile) + { + users = LogInSystem(userFile); + } + else + { + users = LogInSystem(); + } + + ifstream vehiclefile(vehicleFile); + if (vehiclefile) + { + vehicles = VehicleManager(vehicleFile); + } + else + { + vehicles = VehicleManager(); + } + int currentUser = -1; @@ -27,9 +53,14 @@ int main() switch (userOption) { case 1: - while (users.getWrongPass() < 3 && currentUser != -1) + if (users.getWrongPass() < 3) { currentUser = users.login(); + + if (currentUser != -1) + { + users.loggedIn(users.getUser(currentUser)); + } } break; case 2: users.loggedIn(users.registration()); break; @@ -39,11 +70,8 @@ int main() } } - Vehicle test = Vehicle(10, 5, 0); + users.toTxtFile(userFile); + vehicles.toJson(vehicleFile); - if (test.bookSeat(3, 4, 10)) - { - cout << "Booking success" << endl; - } - test.printMap(10); + return 0; } diff --git a/vehiclesData.json b/vehiclesData.json index e69de29..19765bd 100644 --- a/vehiclesData.json +++ b/vehiclesData.json @@ -0,0 +1 @@ +null