]> jfr.im git - irc/gameservirc.git/blame - gameserv-2.0/libgameservgldl/include/GameServ/DataLayer/File/FileItemDAO.h
Consolidated all the individual level files into a single levels.dat file.
[irc/gameservirc.git] / gameserv-2.0 / libgameservgldl / include / GameServ / DataLayer / File / FileItemDAO.h
CommitLineData
317ce8de 1#ifndef __GS__FILEITEMDAO_H__\r
2#define __GS__FILEITEMDAO_H__\r
3\r
4\r
5\r
6#include <GameServ/GameLayer/GameObjects/ItemGO.h>\r
7using GameServ::GameLayer::GameObjects::ItemGO;\r
8#include <GameServ/DataLayer/IItemDAO.h>\r
9using GameServ::DataLayer::DataAccessObjects::IItemDAO;\r
10\r
11#include <boost/shared_ptr.hpp>\r
12using boost::shared_ptr;\r
13\r
14#include <string>\r
15using std::string;\r
16\r
17#include <list>\r
18using std::list;\r
19\r
20#include <map>\r
21using std::map;\r
22\r
23namespace GameServ { namespace DataLayer { namespace File\r
24{\r
25 //! File implementation of IItemDAO interface\r
26 /*!\r
27 If you're using an File datasource, you will be using this\r
28 DAO to access Items.\r
29 */\r
30 class FileItemDAO : public IItemDAO\r
31 {\r
32 public:\r
33 // Ctors, Dtors ///////////////////////////////////////////////////////\r
34 FileItemDAO(void);\r
35 FileItemDAO(const string &filename);\r
36 virtual ~FileItemDAO();\r
37\r
38 // Methods ////////////////////////////////////////////////////////////\r
39 virtual shared_ptr<ItemGO> GetById(const string &Id) const;\r
40\r
41 virtual bool IdExists(const string &Id) const;\r
42\r
43 void LoadItemCache(void);\r
44\r
45 private:\r
46 //! Data file\r
47 string mFilename;\r
48\r
49 // Helper Methods /////////////////////////////////////////////////////\r
50\r
51 //! Creates the ItemGO found at iterator position\r
52 shared_ptr<ItemGO> CreateItemFromLine(const string &line) const;\r
8e6e952d 53 shared_ptr<ItemGO> CreatePotionFromLine(const string &line) const;\r
317ce8de 54\r
55 //! Get the Item database file path\r
56 string GetItemFilePath(void) const;\r
57\r
58 void Initialize(const string &filename);\r
59\r
60\r
61 map<string, shared_ptr<ItemGO> > spItemCache;\r
62 };\r
63} } } // GameServ.DataLayer.DataAccessObjects.File\r
64\r
65#endif // __GS__FILEITEMDAO_H__