diff --git a/user.cpp b/user.cpp index 19fcde1..9cb4cd2 100755 --- a/user.cpp +++ b/user.cpp @@ -1,37 +1,170 @@ #include #include -#include "user.h" +#include "User.h" -// User::User(){ - // name = ""; - // password = ""; - // phone_number = ""; - // fax_number = ""; - // postal_address = ""; - // is_admin = false; -// } +/* +------------------------User------------------------ +*/ + User::User(){ + name = ""; + password = ""; + phone_number = ""; + fax_number = ""; + postal_address = ""; + is_admin = false; + } -// User::User(string n, string pass, string phone, string fax, string postal, bool admin){ - // name = n; - // password = pass; - // phone_number = phone; - // fax_number = fax; - // postal_address = postal; - // is_admin = admin; -// } + User::User(string n, string pass, string phone, string fax, string postal, bool admin){ + name = n; + password = pass; + phone_number = phone; + fax_number = fax; + postal_address = postal; + is_admin = admin; + } -// string User::getName() {return name;} -// string User::getPassword() {return password;} -// string User::getPhoneNumber() {return phone_number;} -// string User::getFaxNumber() {return fax_number;} -// string User::getPostalAddress() {return postal_address;} -// bool User::confirmAdmin() {return is_admin;} -// bool User::checkLogin() {return is_logged_in;} -// vector User::getGroups(){return groups;} -// vector User::getMessages(){return messages;} + string User::getName() {return name;} + string User::getPassword() {return password;} + string User::getPhoneNumber() {return phone_number;} + string User::getFaxNumber() {return fax_number;} + string User::getPostalAddress() {return postal_address;} + bool User::confirmAdmin() {return is_admin;} + bool User::checkLogin() {return is_logged_in;} + vector User::getGroups(){return groups;} + vector User::getMessages(){return messages;} + vector User::getInfo() + { + vector output; + output.push_back(name); + output.push_back(phone_number); + output.push_back(fax_number); + output.push_back(postal_address); + + return output; + } -// void User::setName(string new_name) {name = new_name;} -// void User::setPassword(string new_password) {password = new_password;} -// void User::setPhone(string new_phone) {phone_number = new_phone;} -// void User::setFax(string new_fax) {fax_number = new_fax;} -// void User::setPostal(string new_postal) {postal_address = new_postal;} + void User::setName(string new_name) {name = new_name;} + void User::setPassword(string new_password) {password = new_password;} + void User::setPhone(string new_phone) {phone_number = new_phone;} + void User::setFax(string new_fax) {fax_number = new_fax;} + void User::setPostal(string new_postal) {postal_address = new_postal;} + +/* +------------------------Message------------------------ +*/ +Message::Message(){ + sender = ""; + receiver = ""; + timestamp = ""; + text = ""; +} + +Message::Message(string time, string t, string s, string r){ + sender = s; + receiver = r; + timestamp = time; + text = t; +} + +string Message::getSender() {return sender;} +string Message::getReceiver() {return receiver;} +string Message::getTimestamp() {return timestamp;} +string Message::getText() {return text;} +void Message::changeText(string input) {text = input;} +vector Message::getInfo() + { + vector output; + output.push_back(sender); + output.push_back(receiver); + output.push_back(timestamp); + output.push_back(text); + return output; + } +/* +------------------------Board------------------------ +*/ +Board::Board() { + name = ""; + description = ""; + lockedForGroup = false; + group = ""; +} + +Board::Board(string n, string d) { + name = n; + description = d; + lockedForGroup = false; + group = ""; +} + +Board::Board(string n, string d, bool l, string g) { + name = n; + description = d; + lockedForGroup = true; + group = g; +} + +string Board::getName() {return name;} +string Board::getDescription() {return description;} +bool Board::checkIfLocked(){return lockedForGroup;} +string Board::getGroup(){return group;} +vector Board::getInfo() + { + vector output; + output.push_back(name); + output.push_back(description); + output.push_back(group); + return output; + } + +/* +------------------------Group------------------------ +*/ +Group::Group() { + name = ""; + description = ""; +} + +Group::Group(string n, string d) { + name = n; + description = d; +} + +string Group::getName() {return name;} +string Group::getDescription() {return description;} +vector Group::getBoards() {return boards;} +void Group::addBoard(Board input) {boards.push_back(input);} +vector Group::getInfo() + { + vector output; + output.push_back(name); + output.push_back(description); + return output; + } + +/* +------------------------Article------------------------ +*/ +Article::Article() { + author = ""; + timestamp = ""; + length = 0; +} + +Article::Article(string a, string t, int l) { + author = a; + timestamp = t; + length = l; +} + +string Article::getAuthor() {return author;} +string Article::getTimestamp() {return timestamp;} +string Article::getLength() {return to_string(length);} +vector Article::getInfo() + { + vector output; + output.push_back(author); + output.push_back(timestamp); + output.push_back(to_string(length)); + return output; + }