Update user.cpp
This commit is contained in:
parent
70503cd23b
commit
3ead05e585
1 changed files with 164 additions and 31 deletions
195
user.cpp
195
user.cpp
|
@ -1,37 +1,170 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "user.h"
|
#include "User.h"
|
||||||
|
|
||||||
// User::User(){
|
/*
|
||||||
// name = "";
|
------------------------User------------------------
|
||||||
// password = "";
|
*/
|
||||||
// phone_number = "";
|
User::User(){
|
||||||
// fax_number = "";
|
name = "";
|
||||||
// postal_address = "";
|
password = "";
|
||||||
// is_admin = false;
|
phone_number = "";
|
||||||
// }
|
fax_number = "";
|
||||||
|
postal_address = "";
|
||||||
|
is_admin = false;
|
||||||
|
}
|
||||||
|
|
||||||
// User::User(string n, string pass, string phone, string fax, string postal, bool admin){
|
User::User(string n, string pass, string phone, string fax, string postal, bool admin){
|
||||||
// name = n;
|
name = n;
|
||||||
// password = pass;
|
password = pass;
|
||||||
// phone_number = phone;
|
phone_number = phone;
|
||||||
// fax_number = fax;
|
fax_number = fax;
|
||||||
// postal_address = postal;
|
postal_address = postal;
|
||||||
// is_admin = admin;
|
is_admin = admin;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// string User::getName() {return name;}
|
string User::getName() {return name;}
|
||||||
// string User::getPassword() {return password;}
|
string User::getPassword() {return password;}
|
||||||
// string User::getPhoneNumber() {return phone_number;}
|
string User::getPhoneNumber() {return phone_number;}
|
||||||
// string User::getFaxNumber() {return fax_number;}
|
string User::getFaxNumber() {return fax_number;}
|
||||||
// string User::getPostalAddress() {return postal_address;}
|
string User::getPostalAddress() {return postal_address;}
|
||||||
// bool User::confirmAdmin() {return is_admin;}
|
bool User::confirmAdmin() {return is_admin;}
|
||||||
// bool User::checkLogin() {return is_logged_in;}
|
bool User::checkLogin() {return is_logged_in;}
|
||||||
// vector<string> User::getGroups(){return groups;}
|
vector<string> User::getGroups(){return groups;}
|
||||||
// vector<string> User::getMessages(){return messages;}
|
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::setName(string new_name) {name = new_name;}
|
||||||
// void User::setPassword(string new_password) {password = new_password;}
|
void User::setPassword(string new_password) {password = new_password;}
|
||||||
// void User::setPhone(string new_phone) {phone_number = new_phone;}
|
void User::setPhone(string new_phone) {phone_number = new_phone;}
|
||||||
// void User::setFax(string new_fax) {fax_number = new_fax;}
|
void User::setFax(string new_fax) {fax_number = new_fax;}
|
||||||
// void User::setPostal(string new_postal) {postal_address = new_postal;}
|
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<string> Message::getInfo()
|
||||||
|
{
|
||||||
|
vector<string> 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<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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
------------------------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<string> Article::getInfo()
|
||||||
|
{
|
||||||
|
vector<string> output;
|
||||||
|
output.push_back(author);
|
||||||
|
output.push_back(timestamp);
|
||||||
|
output.push_back(to_string(length));
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
Reference in a new issue