-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUserInfo.cpp
More file actions
39 lines (33 loc) · 1.19 KB
/
UserInfo.cpp
File metadata and controls
39 lines (33 loc) · 1.19 KB
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
#include "UserInfo.h"
namespace trainsys {
UserInfo::UserInfo(UserID userID, const char *username, const char *password, int privilege) {
this->userID = userID;
this->privilege = privilege;
int len = strlen(username);
if (len > MAX_USERNAME_LEN) len = MAX_USERNAME_LEN;
memcpy(this->username, username, len);
this->username[len] = '\0';
len = strlen(password);
if (len > MAX_PASSWORD_LEN) len = MAX_PASSWORD_LEN;
memcpy(this->password, password, len);
this->password[len] = '\0';
}
UserInfo::UserInfo(const UserInfo &rhs) {
this->userID = rhs.userID;
this->privilege = rhs.privilege;
memcpy(this->username, rhs.username, MAX_USERNAME_LEN + 1);
memcpy(this->password, rhs.password, MAX_PASSWORD_LEN + 1);
}
UserInfo &UserInfo::operator =(const UserInfo &rhs) {
/* Question */
}
bool UserInfo::operator ==(const UserInfo &rhs) const {
/* Question */
}
bool UserInfo::operator !=(const UserInfo &rhs) const {
/* Question */
}
bool UserInfo::operator <(const UserInfo &rhs) const {
/* Question */
}
} // namespace trainsys