7 #ifndef ATLAS_OBJECTS_ENTITY_ENTITY_H
8 #define ATLAS_OBJECTS_ENTITY_ENTITY_H
10 #include <Atlas/Objects/RootEntity.h>
11 #include <Atlas/Objects/Anonymous.h>
14 namespace Atlas {
namespace Objects {
namespace Entity {
22 class AdminEntityData;
23 typedef SmartPtr<AdminEntityData> AdminEntity;
25 static const int ADMIN_ENTITY_NO = 3;
38 m_class_no = ADMIN_ENTITY_NO;
51 virtual void iterate(
int& current_class, std::string& attr)
const
85 static const int ACCOUNT_NO = 4;
98 m_class_no = ACCOUNT_NO;
114 virtual void setAttr(
const std::string& name,
117 virtual void removeAttr(
const std::string& name);
123 virtual void addToMessage(Atlas::Message::MapType &)
const;
130 inline void setCharacters(
const std::list<std::string>& val);
160 virtual int getAttrFlag(
const std::string& name)
const;
175 virtual void iterate(
int& current_class, std::string& attr)
const;
197 static std::map<std::string, int> * attr_flags_AccountData;
204 extern const std::string USERNAME_ATTR;
205 extern const std::string PASSWORD_ATTR;
206 extern const std::string CHARACTERS_ATTR;
212 const int USERNAME_FLAG = 1 << 11;
217 m_attrFlags |= USERNAME_FLAG;
220 const int PASSWORD_FLAG = 1 << 12;
225 m_attrFlags |= PASSWORD_FLAG;
228 const int CHARACTERS_FLAG = 1 << 13;
233 m_attrFlags |= CHARACTERS_FLAG;
238 m_attrFlags |= CHARACTERS_FLAG;
240 for(Atlas::Message::ListType::const_iterator I = val.begin();
244 if((*I).isString()) {
252 if(m_attrFlags & USERNAME_FLAG)
260 if(!(m_attrFlags & USERNAME_FLAG))
267 if(m_attrFlags & PASSWORD_FLAG)
275 if(!(m_attrFlags & PASSWORD_FLAG))
282 if(m_attrFlags & CHARACTERS_FLAG)
285 return ((
AccountData*)m_defaults)->attr_characters;
290 if(!(m_attrFlags & CHARACTERS_FLAG))
298 Atlas::Message::ListType lst_out;
299 for(std::list<std::string>::const_iterator I = lst_in.begin();
303 lst_out.push_back(std::string(*I));
310 return (m_attrFlags & USERNAME_FLAG) == 0;
315 return (m_attrFlags & PASSWORD_FLAG) == 0;
320 return (m_attrFlags & CHARACTERS_FLAG) == 0;
334 static const int PLAYER_NO = 5;
347 m_class_no = PLAYER_NO;
360 virtual void iterate(
int& current_class, std::string& attr)
const
394 static const int ADMIN_NO = 6;
407 m_class_no = ADMIN_NO;
420 virtual void iterate(
int& current_class, std::string& attr)
const
454 static const int GAME_NO = 7;
467 m_class_no = GAME_NO;
480 virtual void iterate(
int& current_class, std::string& attr)
const
511 class GameEntityData;
514 static const int GAME_ENTITY_NO = 8;
527 m_class_no = GAME_ENTITY_NO;
540 virtual void iterate(
int& current_class, std::string& attr)
const
566 #endif // ATLAS_OBJECTS_ENTITY_ENTITY_H
PlayerData(PlayerData *defaults=NULL)
Construct a PlayerData class definition.
Definition: Entity.h:344
void setUsername(const std::string &val)
Set the "username" attribute.
Definition: Entity.h:214
AccountData(AccountData *defaults=NULL)
Construct a AccountData class definition.
Definition: Entity.h:95
std::string & modifyPassword()
Retrieve the "password" attribute as a non-const reference.
Definition: Entity.h:273
virtual GameData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
virtual PlayerData * copy() const
Copy this object.
Atlas stream bridge.
Definition: Bridge.h:35
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:480
virtual bool instanceOf(int classNo) const
Is this instance of some class?
All In Game classes and objects.
Definition: Entity.h:520
std::string attr_password
Password for account usually.
Definition: Entity.h:164
virtual void free()
Free an instance of this class, returning it to the memory pool.
GameData(GameData *defaults=NULL)
Construct a GameData class definition.
Definition: Entity.h:464
Games this server hosts.
Definition: Entity.h:460
virtual AdminEntityData * copy() const
Copy this object.
virtual void setAttr(const std::string &name, const Atlas::Message::Element &attr)
Set the attribute "name" to the value given by"attr".
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:360
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:540
virtual ~AdminEntityData()
Default destructor.
Player accounts.
Definition: Entity.h:340
virtual GameEntityData * copy() const
Copy this object.
void sendPassword(Atlas::Bridge &) const
Send the "password" attribute to an Atlas::Bridge.
virtual void free()
Free an instance of this class, returning it to the memory pool.
virtual void free()
Free an instance of this class, returning it to the memory pool.
virtual bool instanceOf(int classNo) const
Is this instance of some class?
virtual AdminEntityData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
static AdminData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class.
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:420
bool isDefaultCharacters() const
Is "characters" value default?
Definition: Entity.h:318
const std::list< std::string > & getCharacters() const
Retrieve the "characters" attribute.
Definition: Entity.h:280
virtual GameData * copy() const
Copy this object.
void sendCharacters(Atlas::Bridge &) const
Send the "characters" attribute to an Atlas::Bridge.
virtual bool instanceOf(int classNo) const
Is this instance of some class?
Multi-type container.
Definition: Element.h:60
virtual PlayerData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
std::string attr_username
Username for account usually.
Definition: Entity.h:162
virtual bool instanceOf(int classNo) const
Is this instance of some class?
std::string & modifyUsername()
Retrieve the "username" attribute as a non-const reference.
Definition: Entity.h:258
virtual AccountData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
virtual AdminData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
virtual void free()
Free an instance of this class, returning it to the memory pool.
virtual bool instanceOf(int classNo) const
Is this instance of some class?
AdminEntityData(AdminEntityData *defaults=NULL)
Construct a AdminEntityData class definition.
Definition: Entity.h:35
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
virtual void removeAttr(const std::string &name)
Remove the attribute "name". This will not work for static attributes.
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
void setPassword(const std::string &val)
Set the "password" attribute.
Definition: Entity.h:222
const std::string & getPassword() const
Retrieve the "password" attribute.
Definition: Entity.h:265
std::list< std::string > & modifyCharacters()
Retrieve the "characters" attribute as a non-const reference.
Definition: Entity.h:288
virtual ~AdminData()
Default destructor.
static GameData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class.
GameEntityData(GameEntityData *defaults=NULL)
Construct a GameEntityData class definition.
Definition: Entity.h:524
virtual void free()
Free an instance of this class, returning it to the memory pool.
void setCharacters(const std::list< std::string > &val)
Set the "characters" attribute.
Definition: Entity.h:230
AdminData(AdminData *defaults=NULL)
Construct a AdminData class definition.
Definition: Entity.h:404
virtual void sendContents(Atlas::Bridge &b) const
Send the contents of this object to a Bridge.
Base class for accounts.
Definition: Entity.h:91
void sendUsername(Atlas::Bridge &) const
Send the "username" attribute to an Atlas::Bridge.
Starting point for entity hierarchy.
Definition: RootEntity.h:30
static AdminEntityData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class.
virtual ~GameEntityData()
Default destructor.
Privileged accounts.
Definition: Entity.h:400
virtual ~PlayerData()
Default destructor.
bool isDefaultPassword() const
Is "password" value default?
Definition: Entity.h:313
static AccountData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class.
const Atlas::Message::ListType getCharactersAsList() const
Retrieve the "characters" attribute AsList.
Definition: Entity.h:295
All classes and objects used for adminitrativive purposes.
Definition: Entity.h:31
virtual GameEntityData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
bool isDefaultUsername() const
Is "username" value default?
Definition: Entity.h:308
void setCharactersAsList(const Atlas::Message::ListType &val)
Set the "characters" attribute AsList.
Definition: Entity.h:236
virtual int copyAttr(const std::string &name, Atlas::Message::Element &attr) const
Retrieve the attribute "name".
const std::string & getUsername() const
Retrieve the "username" attribute.
Definition: Entity.h:250
virtual int getAttrFlag(const std::string &name) const
Find the flag for the attribute "name".
virtual bool instanceOf(int classNo) const
Is this instance of some class?
virtual void addToMessage(Atlas::Message::MapType &) const
Write this object to an existing Element.
static GameEntityData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class.
The Atlas namespace.
Definition: Bridge.h:20
virtual ~AccountData()
Default destructor.
std::list< std::string > attr_characters
List of characters account can control.
Definition: Entity.h:166
virtual AdminData * copy() const
Copy this object.
virtual AccountData * copy() const
Copy this object.
static PlayerData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class.
virtual ~GameData()
Default destructor.
virtual int getAttrClass(const std::string &name) const
Find the class which contains the attribute "name".
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:51
virtual void free()
Free an instance of this class, returning it to the memory pool.
Copyright 2000-2004 the respective authors.
This document can be licensed under the terms of the GNU Free Documentation
License or the GNU General Public License and may be freely distributed under
the terms given by one of these licenses.