Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Account Class Reference

#include <accountsxml.h>

Public Types

enum  account_type { UNKNOWN, PLAYER, ADMIN }
 

Public Member Functions

 Account ()
 
 Account (char *scallsign, char *spasswd)
 
 Account (string scallsign, string spasswd)
 
void display ()
 
short isNew ()
 
void setIsNew (int new1)
 
ObjSerial getSerial ()
 
void setSerial (ObjSerial sernum)
 
SOCKETALT getSocket ()
 
void setSocket (SOCKETALT sck)
 
void set (char *scallsign, char *spasswd)
 
void set (string scallsign, string spasswd)
 
int compareName (char *str)
 
int comparePass (char *str)
 
int compareName (string str)
 
int comparePass (string str)
 
bool isConnected ()
 
int retryConnectedCount ()
 
void setConnected (bool mode)
 
void incConnected ()
 

Public Attributes

enum Account::account_type type
 
FILE * fp
 
string callsign
 
string passwd
 
string serverip
 
string serverport
 

Detailed Description

Definition at line 37 of file accountsxml.h.

Member Enumeration Documentation

Enumerator
UNKNOWN 
PLAYER 
ADMIN 

Definition at line 47 of file accountsxml.h.

48  {
49  UNKNOWN,
50  PLAYER,
51  ADMIN,
52  }

Constructor & Destructor Documentation

Account::Account ( )
inline

Definition at line 61 of file accountsxml.h.

62  {
63  haschar = 1;
64  isconnected = 0;
65  }
Account::Account ( char *  scallsign,
char *  spasswd 
)
inline

Definition at line 66 of file accountsxml.h.

References callsign, and passwd.

67  {
68  callsign = string( scallsign );
69  passwd = string( spasswd );
70  }
Account::Account ( string  scallsign,
string  spasswd 
)
inline

Definition at line 71 of file accountsxml.h.

References callsign, and passwd.

72  {
73  callsign = scallsign;
74  passwd = spasswd;
75  }

Member Function Documentation

int Account::compareName ( char *  str)
inline

Definition at line 114 of file accountsxml.h.

References callsign.

Referenced by AccountServer::recvMsg().

115  {
116  return callsign != string( str );
117  }
int Account::compareName ( string  str)
inline

Definition at line 123 of file accountsxml.h.

References callsign.

124  {
125  return callsign != str;
126  }
int Account::comparePass ( char *  str)
inline

Definition at line 118 of file accountsxml.h.

References passwd.

119  {
120  return passwd != string( str );
121  }
int Account::comparePass ( string  str)
inline

Definition at line 127 of file accountsxml.h.

References passwd.

128  {
129  return passwd != str;
130  }
void Account::display ( )

Definition at line 50 of file accountsxml.cpp.

51 {
52  cout<<"Serial #: "<<serial<<endl;
53  cout<<"Name: "<<callsign<<endl;
54  cout<<"Pass: "<<passwd<<endl;
55  if (this->type == 0)
56  cout<<"Type : UNKNOWN"<<endl;
57  else if (this->type == 1)
58  cout<<"Type : PLAYER"<<endl;
59  else if (this->type == 2)
60  cout<<"Type : ADMIN"<<endl;
61  else
62  cout<<"Type : ERROR"<<endl;
63 }
ObjSerial Account::getSerial ( )
inline

Definition at line 87 of file accountsxml.h.

Referenced by AccountServer::sendAlreadyConnected().

88  {
89  return this->serial;
90  }
SOCKETALT Account::getSocket ( )
inline

Definition at line 95 of file accountsxml.h.

96  {
97  return this->server_sock;
98  }
void Account::incConnected ( )
inline

Definition at line 143 of file accountsxml.h.

144  {
145  if (isconnected) isconnected++;
146  }
bool Account::isConnected ( )
inline

Definition at line 131 of file accountsxml.h.

Referenced by AccountServer::recvMsg().

132  {
133  return isconnected != 0;
134  }
short Account::isNew ( )
inline

Definition at line 78 of file accountsxml.h.

Referenced by AccountServer::sendAuthorized().

79  {
80  return !haschar;
81  }
int Account::retryConnectedCount ( )
inline

Definition at line 135 of file accountsxml.h.

Referenced by AccountServer::recvMsg().

136  {
137  return isconnected;
138  }
void Account::set ( char *  scallsign,
char *  spasswd 
)
inline

Definition at line 103 of file accountsxml.h.

References callsign, and passwd.

104  {
105  callsign = string( scallsign );
106  passwd = string( spasswd );
107  }
void Account::set ( string  scallsign,
string  spasswd 
)
inline

Definition at line 108 of file accountsxml.h.

References callsign, and passwd.

109  {
110  callsign = scallsign;
111  passwd = spasswd;
112  }
void Account::setConnected ( bool  mode)
inline

Definition at line 139 of file accountsxml.h.

Referenced by AccountServer::recvMsg(), and AccountServer::removeDeadSockets().

140  {
141  isconnected = mode ? 1 : 0;
142  }
void Account::setIsNew ( int  new1)
inline

Definition at line 82 of file accountsxml.h.

83  {
84  haschar = new1;
85  }
void Account::setSerial ( ObjSerial  sernum)
inline

Definition at line 91 of file accountsxml.h.

Referenced by AccountServer::sendAuthorized().

92  {
93  this->serial = sernum;
94  }
void Account::setSocket ( SOCKETALT  sck)
inline

Definition at line 99 of file accountsxml.h.

Referenced by AccountServer::sendAuthorized().

100  {
101  this->server_sock = sck;
102  }

Member Data Documentation

FILE* Account::fp

Definition at line 54 of file accountsxml.h.

string Account::serverip
string Account::serverport
enum Account::account_type Account::type

The documentation for this class was generated from the following files: