]> jfr.im git - irc/gameservirc.git/blob - gameserv-2.0/libgameservgldl/include/GameServ/DataLayer/File/FilePlayerDAO.h
Added code for the start of the DataLayer format as well as a basic FilePlayerDAO...
[irc/gameservirc.git] / gameserv-2.0 / libgameservgldl / include / GameServ / DataLayer / File / FilePlayerDAO.h
1 #ifndef __GS__FilePlayerDAO_H__
2 #define __GS__FilePlayerDAO_H__
3
4 #include <GameServ/GameLayer/GameObjects/PlayerGO.h>
5 #include <GameServ/DataLayer/IPlayerDAO.h>
6 using GameServ::GameLayer::GameObjects::PlayerGO;
7 using GameServ::DataLayer::DataAccessObjects::IPlayerDAO;
8
9 #include <boost/shared_ptr.hpp>
10 using boost::shared_ptr;
11
12 #include <string>
13 using std::string;
14
15 namespace GameServ { namespace DataLayer { namespace File
16 {
17 //! File implementation of IPlayerDAO interface
18 /*!
19 If you're using an File datasource, you will be using this
20 DAO to access Players.
21 */
22 class FilePlayerDAO : public IPlayerDAO
23 {
24 public:
25 // Ctors, Dtors ///////////////////////////////////////////////////////
26 FilePlayerDAO(void);
27 FilePlayerDAO(const string &filename);
28 virtual ~FilePlayerDAO();
29
30 // Methods ////////////////////////////////////////////////////////////
31 virtual shared_ptr<PlayerGO> GetById(const string &Id) const;
32
33 virtual list<string> GetIdsByName(const string &Name) const;
34
35 virtual bool IdExists(const string &Id) const;
36
37 virtual void Insert(shared_ptr<PlayerGO> spPlayer);
38 virtual void Update(shared_ptr<PlayerGO> spPlayer);
39
40 private:
41 //! Data file
42 string mFilename;
43
44 // Constants //////////////////////////////////////////////////////////
45
46 // Helper Methods /////////////////////////////////////////////////////
47 //! Get control sector information
48 void GetControlInfo(void);
49
50 //! Creates the PlayerGO found at iterator position
51 shared_ptr<PlayerGO> CreatePlayerFromLine(const string &line) const;
52
53 //! Get the Player database file path
54 string GetPlayerFilePath(void) const;
55
56 void Initialize(const string &filename);
57
58 };
59 } } } // GameServ.DataLayer.DataAccessObjects.File
60
61 #endif // __GS__FilePlayerDAO_H__