uni

University stuff
git clone git://git.christosmarg.xyz/uni-assignments.git
Log | Files | Refs | README | LICENSE

commit def4c1d9cf1721318fe9a0eef75eccca596e508f
parent 029e0c858922b44fc76a1ca875dfbb0366edc734
Author: Christos Margiolis <christos@margiolis.net>
Date:   Tue, 19 May 2020 23:24:01 +0300

added some constexpr ifs

Diffstat:
Massignment-2.3-operoverloading/Makefile | 2+-
Massignment-2.3-operoverloading/bin/operoverloading | 0
Massignment-2.3-operoverloading/obj/course.o | 0
Massignment-2.3-operoverloading/obj/main.o | 0
Massignment-2.3-operoverloading/obj/student.o | 0
Massignment-2.4-inheritance/Makefile | 2+-
Massignment-2.4-inheritance/bin/inheritance | 0
Massignment-2.4-inheritance/obj/app.o | 0
Massignment-2.4-inheritance/obj/appsystem.o | 0
Massignment-2.4-inheritance/obj/game.o | 0
Massignment-2.4-inheritance/obj/main.o | 0
Massignment-2.4-inheritance/obj/manufacturer.o | 0
Massignment-2.4-inheritance/obj/office.o | 0
Massignment-2.4-inheritance/obj/review.o | 0
Massignment-2.4-inheritance/src/appsystem.h | 18+++++++++---------
Massignment-2.5-spreadsheets/Makefile | 2+-
Massignment-2.5-spreadsheets/bin/spreadsheets | 0
Massignment-2.5-spreadsheets/obj/course.o | 0
Massignment-2.5-spreadsheets/obj/datahandler.o | 0
Massignment-2.5-spreadsheets/obj/errlog.o | 0
Massignment-2.5-spreadsheets/obj/main.o | 0
Massignment-2.5-spreadsheets/obj/student.o | 0
Massignment-2.5-spreadsheets/obj/xstring.o | 0
Massignment-2.5-spreadsheets/src/datahandler.h | 6+++---
24 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/assignment-2.3-operoverloading/Makefile b/assignment-2.3-operoverloading/Makefile @@ -13,7 +13,7 @@ MKDIR_P = mkdir -p CC = g++ CPPFLAGS += -Iinclude -CFLAGS += -Wall +CFLAGS += -std=c++17 -Wall LDFLAGS += -Llib #LDLIBS += -lm diff --git a/assignment-2.3-operoverloading/bin/operoverloading b/assignment-2.3-operoverloading/bin/operoverloading Binary files differ. diff --git a/assignment-2.3-operoverloading/obj/course.o b/assignment-2.3-operoverloading/obj/course.o Binary files differ. diff --git a/assignment-2.3-operoverloading/obj/main.o b/assignment-2.3-operoverloading/obj/main.o Binary files differ. diff --git a/assignment-2.3-operoverloading/obj/student.o b/assignment-2.3-operoverloading/obj/student.o Binary files differ. diff --git a/assignment-2.4-inheritance/Makefile b/assignment-2.4-inheritance/Makefile @@ -13,7 +13,7 @@ MKDIR_P = mkdir -p CC = g++ CPPFLAGS += -Iinclude -CFLAGS += -Wall +CFLAGS += -std=c++17 -Wall LDFLAGS += -Llib #LDLIBS += -lm diff --git a/assignment-2.4-inheritance/bin/inheritance b/assignment-2.4-inheritance/bin/inheritance Binary files differ. diff --git a/assignment-2.4-inheritance/obj/app.o b/assignment-2.4-inheritance/obj/app.o Binary files differ. diff --git a/assignment-2.4-inheritance/obj/appsystem.o b/assignment-2.4-inheritance/obj/appsystem.o Binary files differ. diff --git a/assignment-2.4-inheritance/obj/game.o b/assignment-2.4-inheritance/obj/game.o Binary files differ. diff --git a/assignment-2.4-inheritance/obj/main.o b/assignment-2.4-inheritance/obj/main.o Binary files differ. diff --git a/assignment-2.4-inheritance/obj/manufacturer.o b/assignment-2.4-inheritance/obj/manufacturer.o Binary files differ. diff --git a/assignment-2.4-inheritance/obj/office.o b/assignment-2.4-inheritance/obj/office.o Binary files differ. diff --git a/assignment-2.4-inheritance/obj/review.o b/assignment-2.4-inheritance/obj/review.o Binary files differ. diff --git a/assignment-2.4-inheritance/src/appsystem.h b/assignment-2.4-inheritance/src/appsystem.h @@ -60,7 +60,7 @@ AppSystem::parse(std::ifstream& f) { try { - if (std::is_same<T, Manufacturer>::value) + if constexpr (std::is_same<T, Manufacturer>::value) { std::string sn, name, email; std::getline(f, sn, ','); @@ -69,7 +69,7 @@ AppSystem::parse(std::ifstream& f) if (f.eof()) return true; manfs.push_back(new Manufacturer(sn.c_str(), name.c_str(), email)); } - else if (std::is_same<T, Office>::value) + else if constexpr (std::is_same<T, Office>::value) { std::string sn, name, os, manf, price, skip1, skip2; std::getline(f, sn, ','); @@ -95,7 +95,7 @@ AppSystem::parse(std::ifstream& f) } } } - else if (std::is_same<T, Game>::value) + else if constexpr (std::is_same<T, Game>::value) { std::string sn, name, os, manf, price, genre, online; std::string skip; @@ -151,11 +151,11 @@ AppSystem::import_data(const char *fpath) std::getline(f, skip); while (f.good()) { - if (std::is_same<T, Manufacturer>::value) + if constexpr (std::is_same<T, Manufacturer>::value) { if (!parse<Manufacturer>(f)) break; } - else if (std::is_same<T, App>::value) + else if constexpr (std::is_same<T, App>::value) { std::string type; std::getline(f, type, ','); @@ -164,7 +164,7 @@ AppSystem::import_data(const char *fpath) if (type == "Office") if (!parse<Office>(f)) break; } - else if (std::is_same<T, Review>::value) + else if constexpr (std::is_same<T, Review>::value) { std::string appname, stars, username, comment; std::getline(f, appname, ','); @@ -201,7 +201,7 @@ AppSystem::export_data(const char *fpath) f.open(fpath); std::cout << "Exporting data to \'" << fpath << "\'." << std::endl; - if (std::is_same<T, Manufacturer>::value) + if constexpr (std::is_same<T, Manufacturer>::value) { f << "SN,Name,Email\n"; for (const auto& manf : manfs) @@ -209,7 +209,7 @@ AppSystem::export_data(const char *fpath) manf->get_name() << ',' << manf->get_email() << std::endl; } - else if (std::is_same<T, App>::value) + else if constexpr (std::is_same<T, App>::value) { f << "Type,SN,Name,OS,Manf,Price,Genre,Online,Extensions\n"; for (const auto& app : apps) @@ -233,7 +233,7 @@ AppSystem::export_data(const char *fpath) } } } - else if (std::is_same<T, Review>::value) + else if constexpr (std::is_same<T, Review>::value) { f << "AppName,Stars,Username,Comment\n"; for (const auto& app : apps) diff --git a/assignment-2.5-spreadsheets/Makefile b/assignment-2.5-spreadsheets/Makefile @@ -13,7 +13,7 @@ MKDIR_P = mkdir -p CC = g++ CPPFLAGS += -Iinclude -CFLAGS += -Wall +CFLAGS += -std=c++17 -Wall LDFLAGS += -Llib #LDLIBS += -lm diff --git a/assignment-2.5-spreadsheets/bin/spreadsheets b/assignment-2.5-spreadsheets/bin/spreadsheets Binary files differ. diff --git a/assignment-2.5-spreadsheets/obj/course.o b/assignment-2.5-spreadsheets/obj/course.o Binary files differ. diff --git a/assignment-2.5-spreadsheets/obj/datahandler.o b/assignment-2.5-spreadsheets/obj/datahandler.o Binary files differ. diff --git a/assignment-2.5-spreadsheets/obj/errlog.o b/assignment-2.5-spreadsheets/obj/errlog.o Binary files differ. diff --git a/assignment-2.5-spreadsheets/obj/main.o b/assignment-2.5-spreadsheets/obj/main.o Binary files differ. diff --git a/assignment-2.5-spreadsheets/obj/student.o b/assignment-2.5-spreadsheets/obj/student.o Binary files differ. diff --git a/assignment-2.5-spreadsheets/obj/xstring.o b/assignment-2.5-spreadsheets/obj/xstring.o Binary files differ. diff --git a/assignment-2.5-spreadsheets/src/datahandler.h b/assignment-2.5-spreadsheets/src/datahandler.h @@ -68,7 +68,7 @@ DataHandler::import_data(const char *fpath) lab::getline(f, skip); while (f.good()) { - if (std::is_same<T, Course>::value) + if constexpr (std::is_same<T, Course>::value) { lab::xstring code, name; lab::getline(f, code, ';'); @@ -76,7 +76,7 @@ DataHandler::import_data(const char *fpath) if (f.eof()) break; courses.insert(std::make_pair(code, new Course(code, name))); } - else if (std::is_same<T, Student>::value) + else if constexpr (std::is_same<T, Student>::value) { lab::xstring AM, lname, fname; lab::getline(f, AM, ';'); @@ -85,7 +85,7 @@ DataHandler::import_data(const char *fpath) if (f.eof()) break; studs.insert(std::make_pair(AM, new Student(AM, lname, fname))); } - else if (std::is_same<T, equivalencies>::value) + else if constexpr (std::is_same<T, equivalencies>::value) { lab::xstring oldcurr, newcurr; lab::getline(f, oldcurr, ';');