177 lines
4.2 KiB
C++
Executable file
177 lines
4.2 KiB
C++
Executable file
#include <iostream>
|
|
#include <vector>
|
|
#include "User.h"
|
|
|
|
/*
|
|
------------------------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;
|
|
}
|
|
|
|
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<string> User::getGroups(){return groups;}
|
|
vector<string> User::getMessages(){return messages;}
|
|
vector<string> User::getInfo()
|
|
{
|
|
vector<string> 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;}
|
|
|
|
/*
|
|
------------------------Message------------------------
|
|
*/
|
|
Message::Message(){
|
|
sender = "";
|
|
receiver = "";
|
|
timestamp = "";
|
|
text = "";
|
|
}
|
|
|
|
Message::Message(string s, string r, string time, string t){
|
|
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<string> Message::getInfo()
|
|
{
|
|
vector<string> output;
|
|
output.push_back(sender);
|
|
output.push_back(receiver);
|
|
output.push_back(timestamp);
|
|
output.push_back(text);
|
|
return output;
|
|
}
|
|
|
|
|
|
/*
|
|
------------------------Article------------------------
|
|
*/
|
|
Article::Article() {
|
|
author = "";
|
|
text = "";
|
|
timestamp = "";
|
|
length = "";
|
|
}
|
|
|
|
Article::Article(string a, string txt, string time) {
|
|
author = a;
|
|
text = txt;
|
|
timestamp = time;
|
|
length = to_string(txt.length());
|
|
}
|
|
|
|
string Article::getAuthor() {return author;}
|
|
string Article::getTimestamp() {return timestamp;}
|
|
string Article::getLength() {return length;}
|
|
vector<string> Article::getInfo()
|
|
{
|
|
vector<string> output;
|
|
output.push_back(author);
|
|
output.push_back(text);
|
|
output.push_back(timestamp);
|
|
output.push_back(length);
|
|
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<Article> Board::getArticles(){return articles;}
|
|
void Board::addArticle(Article article) {articles.push_back(article);}
|
|
vector<string> Board::getInfo()
|
|
{
|
|
vector<string> 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<Board> Group::getBoards() {return boards;}
|
|
void Group::addBoard(Board input) {boards.push_back(input);}
|
|
vector<string> Group::getInfo()
|
|
{
|
|
vector<string> output;
|
|
output.push_back(name);
|
|
output.push_back(description);
|
|
return output;
|
|
}
|