]> jfr.im git - irc/gameservirc.git/blob - gameserv-2.0/libgameservgldl/include/GameServ/DataLayer/File/FileWeaponDAO.h
Added a FileWeaponDAO which is basically the same as the FileArmorDAO
[irc/gameservirc.git] / gameserv-2.0 / libgameservgldl / include / GameServ / DataLayer / File / FileWeaponDAO.h
1 #ifndef __GS__FILEWEAPONDAO_H__
2 #define __GS__FILEWEAPONDAO_H__
3
4 #include <GameServ/GameLayer/GameObjects/WeaponGO.h>
5 #include <GameServ/DataLayer/IWeaponDAO.h>
6 using GameServ::GameLayer::GameObjects::WeaponGO;
7 using GameServ::DataLayer::DataAccessObjects::IWeaponDAO;
8
9 #include <boost/shared_ptr.hpp>
10 using boost::shared_ptr;
11
12 #include <string>
13 using std::string;
14
15 #include <list>
16 using std::list;
17
18 #include <map>
19 using std::map;
20
21 namespace GameServ { namespace DataLayer { namespace File
22 {
23 //! File implementation of IWeaponDAO interface
24 /*!
25 If you're using an File datasource, you will be using this
26 DAO to access Weapons.
27 */
28 class FileWeaponDAO : public IWeaponDAO
29 {
30 public:
31 // Ctors, Dtors ///////////////////////////////////////////////////////
32 FileWeaponDAO(void);
33 FileWeaponDAO(const string &filename);
34 virtual ~FileWeaponDAO();
35
36 // Methods ////////////////////////////////////////////////////////////
37 virtual shared_ptr<WeaponGO> GetById(const string &Id) const;
38
39 virtual bool IdExists(const string &Id) const;
40
41 void LoadWeaponCache(void);
42
43 private:
44 //! Data file
45 string mFilename;
46
47 // Helper Methods /////////////////////////////////////////////////////
48
49 //! Creates the WeaponGO found at iterator position
50 shared_ptr<WeaponGO> CreateWeaponFromLine(const string &line) const;
51
52 //! Get the Weapon database file path
53 string GetWeaponFilePath(void) const;
54
55 void Initialize(const string &filename);
56
57
58 map<string, shared_ptr<WeaponGO> > spWeaponCache;
59 };
60 } } } // GameServ.DataLayer.DataAccessObjects.File
61
62 #endif // __GS__FileWeaponDAO_H__