-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathUserData.h
110 lines (84 loc) · 3.07 KB
/
UserData.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#pragma clang diagnostic push
#pragma ide diagnostic ignored "modernize-use-nodiscard"
//#pragma once
#ifndef CTDL_GK_USERDATA_CPP
#define CTDL_GK_USERDATA_CPP
#include <string>
/**
* @class User
* @brief Class representing a User
* @details This class encapsulates the data and operations for a User. It includes attributes such as name, date of birth, age, address, phone number, email, username, password, and role.
* @note This class can be used on any platform that supports C++.
*/
class UserData {
private:
std::string _strName;
std::string _strDateOfBirth;
int _iAge;
std::string _strAddress;
std::string _strPhoneNumber;
std::string _strEmail;
std::string _strUserName;
std::string _strPassword;
std::string _strRole;
/**
* @brief Calculates the age of the user
* @details This function calculates the age of the user based on the date of birth.
* @param dateOfBirth The date of birth of the user (format: DD/MM/YYYY)
* @return The age of the user
*/
int userAge(std::string dateOfBirth) const;
public:
/**
* @brief Constructs a new User object with the provided data.
* @param name The user's name
* @param dateOfBirth The user's date of birth (format: DD/MM/YYYY)
* @param address The user's address
* @param phoneNumber The user's phone number
* @param email The user's email
* @param username The user's username
* @param password The user's password
* @param role The user's role(Admintrator, Employee)
*/
UserData(std::string name, std::string dateOfBirth, std::string address, std::string phoneNumber,
std::string email, std::string username, std::string password, std::string role
);
UserData();
~UserData();
/**
* @brief Getters and setters
* @details Getters and setters for private attributes
* @return Value of private attributes
*/
std::string getName() const;
void setName(std::string name);
std::string getDateOfBirth() const;
void setDateOfBirth(std::string dateOfBirth);
int getAge();
std::string getAddress() const;
void setAddress(std::string address);
std::string getPhoneNumber() const;
void setPhoneNumber(std::string phoneNumber);
std::string getEmail() const;
void setEmail(std::string email);
std::string getUserName() const;
void setUserName(std::string username);
std::string getPassword() const;
void setPassword(std::string password);
std::string getRole() const;
// void setRole(std::string role);
/**
* @brief Overloads the != operator
* @details This function overloads the != operator to compare two users.
* @return True if the two users are not equal, false otherwise
*/
bool operator!=(const UserData& user) const;
/**
* @brief Overloads the = operator
* @details This function overloads the = operator to assign the value of a user to another.
* @return The user with the new value
*/
UserData& operator=(const UserData& user);
};
#endif // CTDL_GK_USERDATA_CPP
#pragma clang diagnostic pop