22 #ifndef QDENGINE_QDCORE_QD_OBJECT_MAP_CONTAINER_H 23 #define QDENGINE_QDCORE_QD_OBJECT_MAP_CONTAINER_H 25 #include "common/system.h" 27 #include "qdengine/qdengine.h" 40 const object_list_t &get_list()
const {
44 T *get_object(
const char *name);
45 const T *get_object(
const char *name)
const;
47 bool add_object(T *p);
48 bool remove_object(T *p);
49 bool rename_object(T *p,
const char *name);
50 bool remove_object(
const char *name);
51 bool is_in_list(
const char *name)
const {
52 return (get_object(name) != 0);
54 bool is_in_list(
const T *p)
const {
55 return (get_object(p->name()) != 0);
63 object_list_t _object_list;
64 object_map_t _object_map;
69 typename object_map_t::iterator it = _object_map.find(p->name());
70 if (it != _object_map.end())
73 _object_map[p->name()] = p;
82 typename object_map_t::const_iterator it = _object_map.find(name);
83 if (it != _object_map.end())
91 typename object_map_t::iterator it = _object_map.find(name);
92 if (it != _object_map.end())
101 for (it = _object_list.
begin(); it != _object_list.
end(); it++) {
103 _object_list.
erase(it);
104 typename object_map_t::iterator im = _object_map.find(p->name());
105 if (im != _object_map.end())
106 _object_map.
erase(im);
117 T *p = get_object(name);
118 if (!p)
return false;
120 return remove_object(p);
125 typename object_map_t::iterator im = _object_map.find(p->name());
126 if (im != _object_map.end()) {
127 _object_map.
erase(im);
129 _object_map[p->name()] = p;
152 _object_list.
clear();
159 #endif // QDENGINE_QDCORE_QD_OBJECT_MAP_CONTAINER_H void clear(bool shrinkArray=0)
Definition: hashmap.h:427
iterator end()
Definition: list.h:240
Базовый класс для игровых ресурсов.
Definition: console.h:28
iterator begin()
Definition: list.h:227
void clear()
Definition: list.h:206
void erase(iterator entry)
Definition: hashmap.h:710
Definition: list_intern.h:51
iterator erase(iterator pos)
Definition: list.h:95
void push_back(const t_T &element)
Definition: list.h:140
Definition: qd_object_map_container.h:33