Pol
Revision:cb584c9
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
storage.h
Go to the documentation of this file.
1
7
#ifndef H_STORAGE_H
8
#define H_STORAGE_H
9
10
#include <map>
11
#include <string>
12
13
#include "../clib/maputil.h"
14
15
namespace
Pol
16
{
17
namespace
Items
18
{
19
class
Item
;
20
}
21
namespace
Realms
22
{
23
class
Realm;
24
}
25
namespace
Clib
26
{
27
class
ConfigFile;
28
class
ConfigElem;
29
class
StreamWriter;
30
}
31
namespace
Core
32
{
33
class
StorageArea
34
{
35
public
:
36
StorageArea
( std::string
name
);
37
~
StorageArea
();
38
39
Items::Item
* find_root_item(
const
std::string& name );
40
void
insert_root_item(
Items::Item
* item );
41
bool
delete_root_item(
const
std::string& name );
42
void
on_delete_realm(
Realms::Realm
* realm );
43
44
void
print(
Clib::StreamWriter
& sw )
const
;
45
void
load_item(
Clib::ConfigElem
& elem );
46
size_t
estimateSize()
const
;
47
48
private
:
49
std::string
_name
;
50
51
// TODO: ref_ptr<Item> ?
52
typedef
std::map<std::string, Items::Item*, Clib::ci_cmp_pred>
Cont
;
53
Cont
_items
;
// owns its items.
54
55
friend
class
StorageAreaImp
;
56
friend
class
StorageAreaIterator
;
57
friend
void
write_dirty_storage
(
Clib::StreamWriter
& );
58
};
59
60
class
Storage
61
{
62
public
:
63
StorageArea
* find_area(
const
std::string&
name
);
64
StorageArea
* create_area(
const
std::string& name );
65
StorageArea
* create_area(
Clib::ConfigElem
& elem );
66
void
on_delete_realm(
Realms::Realm
* realm );
67
68
void
print(
Clib::StreamWriter
& sw )
const
;
69
void
read(
Clib::ConfigFile
& cf );
70
void
clear();
71
size_t
estimateSize()
const
;
72
73
private
:
74
// TODO: investigate if this could store objects. Does find()
75
// return object copies, or references?
76
typedef
std::map<std::string, StorageArea*>
AreaCont
;
77
AreaCont
areas
;
78
79
friend
class
StorageAreasImp
;
80
friend
class
StorageAreasIterator
;
81
friend
void
write_dirty_storage
(
Clib::StreamWriter
& );
82
};
83
}
84
}
85
#endif
Pol::Core::StorageAreaIterator
Definition:
storage.cpp:299
Pol::Core::write_dirty_storage
void write_dirty_storage(Clib::StreamWriter &sw_data)
Definition:
savedata.cpp:61
Pol::Core::Storage
Definition:
storage.h:60
Pol::Core::StorageArea::_name
std::string _name
Definition:
storage.h:49
Pol::Realms::Realm
Definition:
realm.h:58
Pol::Core::StorageAreasIterator
Definition:
storage.cpp:372
Pol::Clib::StreamWriter
Definition:
streamsaver.h:21
Pol::Core::StorageArea::Cont
std::map< std::string, Items::Item *, Clib::ci_cmp_pred > Cont
Definition:
storage.h:52
Pol::Core::Storage::AreaCont
std::map< std::string, StorageArea * > AreaCont
Definition:
storage.h:76
Pol::Core::StorageArea::_items
Cont _items
Definition:
storage.h:53
Pol::Core::Storage::areas
AreaCont areas
Definition:
storage.h:77
Pol::Items::Item
Definition:
item.h:78
Pol::Core::StorageArea
Definition:
storage.h:33
name
std::string name
Definition:
osmod.cpp:943
Pol::Clib::ConfigFile
Definition:
cfgfile.h:44
Pol::Core::StorageAreaImp
Definition:
storage.cpp:334
Pol::Clib::ConfigElem
Definition:
cfgelem.h:53
Pol
Definition:
berror.cpp:12
Pol::Core::FilterType::Item
Pol::Core::StorageAreasImp
Definition:
storage.cpp:405
pol
storage.h
Generated on Wed Oct 10 2018 02:42:28 for Pol by
1.8.11