This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
dmspine64backup/user.cpp

178 lines
4.2 KiB
C++
Raw Permalink Normal View History

2015-09-30 17:10:16 -05:00
#include <iostream>
#include <vector>
2015-10-06 12:18:08 -05:00
#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 = "";
}
2015-10-06 23:32:31 -05:00
Message::Message(string s, string r, string time, string t){
2015-10-06 12:18:08 -05:00
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;
}
2015-10-06 23:32:31 -05:00
/*
------------------------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;
}
2015-10-06 12:18:08 -05:00
/*
------------------------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;}
2015-10-06 23:32:31 -05:00
vector<Article> Board::getArticles(){return articles;}
void Board::addArticle(Article article) {articles.push_back(article);}
2015-10-06 12:18:08 -05:00
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;
}