📄 login.h.bak
字号:
/*
* File: login.h
* ----------------
* This file contains some declarations about the login info.
*/
#ifndef LOGIN_H
#define LOGIN_H
#include "base.h"
/* Constants */
#define USERINFOFILENAME "data\\user.dat"
#define CRYPTCODE 2
/*
* Struct: UserInfo
* -----------------------------
* This struct list contains all the
* users login info.
*/
struct UserInfo{
string user;
string pass;
int level;
struct UserInfo *next;
};
/*
* Class: Login
* -----------------------
* This Class contains a list of
* users info and operation functions.
*/
class Login
{
public:
Login(); // constructor.
int LoginSuccess( string , string ); // check the correct user and pass.
struct UserInfo *FindUser( string ); // find a user by its username.
bool AddUser( string, string, int ); // add a user .
bool DeleteUser( string ); // delete a user.
void Clean(); // free the users info in memory.
void ReadFromFile( const char * ); // read the users info from the data file.
void WriteToFile( const char * ); // write the users info to the data file.
~Login(); // destructor.
private:
int numOfUsers;
struct UserInfo *allUserList;
string Encrypt( string ); // encrypt the string.
string Decrypt( string ); // decrypt the string.
};
/*
* Function: AddUser()
* Usage: AddUser(login);
* -----------------------------------------
* This function provides an interface to allow
* user to create a new user.
*/
void AddUser( Login * );
/*
* Function: DeleteUser()
* Usage: DeleteUser(login);
* ------------------------------------------
* This function provides an interface to allow
* user to delete a user.
*/
void DeleteUser( Login *s );
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -