22#ifndef QDENGINE_QDCORE_QD_OBJECT_LIST_CONTAINER_H
23#define QDENGINE_QDCORE_QD_OBJECT_LIST_CONTAINER_H
25#include "common/str.h"
26#include "common/std/list.h"
43 T *get_object(
const char *name);
44 const T *get_object(
const char *name)
const;
46 bool add_object(T *p);
47 bool remove_object(T *p);
48 bool rename_object(T *p,
const char *name);
49 bool remove_object(
const char *name);
50 bool is_in_list(
const char *name)
const {
51 return (get_object(name) != 0);
53 bool is_in_list(
const T *p)
const {
54 return (get_object(p->name()) != 0);
65 if (get_object(p->name()))
return false;
66 _object_list.push_back(p);
72const T *qdObjectListContainer<T>::get_object(
const char *name)
const {
73 if (!name)
return NULL;
75 for (
typename object_list_t::const_iterator it = _object_list.begin(); it != _object_list.end(); ++it) {
76 if (!scumm_stricmp(name, (*it)->name()))
84T *qdObjectListContainer<T>::get_object(
const char *name) {
85 if (!name)
return NULL;
87 for (
typename object_list_t::const_iterator it = _object_list.begin(); it != _object_list.end(); ++it) {
88 if (!scumm_stricmp(name, (*it)->name()))
96bool qdObjectListContainer<T>::remove_object(T *p) {
97 for (
typename object_list_t::iterator it = _object_list.begin(); it != _object_list.end(); ++it) {
99 _object_list.erase(it);
108bool qdObjectListContainer<T>::remove_object(
const char *name) {
109 T *p = get_object(name);
110 if (!p)
return false;
112 return remove_object(p);
116bool qdObjectListContainer<T>::rename_object(T *p,
const char *name) {
122qdObjectListContainer<T>::qdObjectListContainer() {
126qdObjectListContainer<T>::~qdObjectListContainer() {
131bool qdObjectListContainer<T>::clear() {
132 for (
typename object_list_t::iterator it = _object_list.begin(); it != _object_list.end(); ++it)
135 _object_list.clear();
Definition: qd_object_list_container.h:32
Базовый класс для игровых ресурсов.
Definition: console.h:28