-
Notifications
You must be signed in to change notification settings - Fork 0
/
User.h
78 lines (55 loc) · 1.88 KB
/
User.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//
// Created by Christo on 3/5/2019.
//
#ifndef MONRAZD_USER_H
#define MONRAZD_USER_H
#pragma once
#include <map>
#include <string>
#include <fstream>
#include <vector>
#include "FileManager.h"
/*-------------------------HOW IT WORKS------------------------
*Each user owns a text file that saves the name of the user and the databases owned.
* The Text file is named this way: "name_user" being "name" the name of the user
* The text file is created when an object User is instantiated and there's no
* name_user textfile in the directory.
*
*
*
*
*
*
*
* */
class User {
std::string userName;
std::string userFilePath;
std::fstream userFile;
std::string password;
std::vector<std::string> userInfoVector;
public:
//------------------Constructors---------------------------
/* CONSTRUCTOR WITH NAME OF USER AS PARAMETER
* This constructor will be the most extensively used. It takes a name as a
* string and then it tries to open the userFile using the name provided and the
* */
User(std::string name);
User();
User(std::string name, bool isregistered);
//---------------Public class members----------------------
//---------------Getters and setters-----------------------
const std::string &getUserFilePath() const;
void setUserFilePath(const std::string &userFilePath);
const std::string &getUserName() const;
void setUserName(std::string &userName);
//-----------------Methods------------------------------
void refreshUserInfo();
std::vector<std::string> getDatabases();
std::string getPassword(bool withoutSignature);
bool validatePassword(std::string answer);
void deleteDatabase(std::shared_ptr<Database>database);
void openDatabase();
void saveDatabase();
};
#endif //MONRAZD_USER_H