login.h.bak

来自「命令行模式下的简单宾馆管理系统..各种基本功能齐全..属于新人练习作品..hot」· BAK 代码 · 共 78 行

BAK
78
字号
/*
 * 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 + =
减小字号Ctrl + -
显示快捷键?