Changeset 9693 in orxonox.OLD for branches/new_class_id/src
- Timestamp:
- Aug 23, 2006, 8:44:58 PM (18 years ago)
- Location:
- branches/new_class_id/src/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/graphics/effects/atmospheric_engine.cc
r9685 r9693 23 23 #include "util/loading/factory.h" 24 24 25 NewObjectListDefinition (AtmosphericEngine);25 NewObjectListDefinitionID(AtmosphericEngine, CL_ATMOS_ENGINE); 26 26 27 27 /** -
branches/new_class_id/src/lib/lang/new_object_list.h
r9692 r9693 44 44 { 45 45 public: 46 class base_iterator47 {48 public:49 virtual base_iterator operator++() = 0;50 virtual base_iterator operator--() = 0;51 virtual BaseObject* operator*() = 0;52 virtual base_iterator& operator=(const base_iterator& iterator) = 0;53 virtual bool operator==(const base_iterator& iterator) = 0;54 protected:55 void* _it;56 };57 58 virtual base_iterator& base_begin() = 0;59 virtual base_iterator& base_end() = 0;60 61 46 //! A fast iterator Base-Class, for iterator-casting and storing. 62 47 /** … … 93 78 static bool classNameExists(const std::string& className); 94 79 80 public: 81 class base_iterator 82 { 83 public: 84 /// @NOTE Do not use this class. For internal handling. 85 class __base_iterator_base 86 { 87 public: 88 virtual void operator++(int) = 0; 89 virtual void operator++() = 0; 90 virtual void operator--(int) = 0; 91 virtual void operator--() = 0; 92 virtual BaseObject* operator*() = 0; 93 virtual __base_iterator_base& operator=(const base_iterator& iterator) = 0; 94 virtual bool operator==(const __base_iterator_base& iterator) const = 0; 95 virtual bool operator!=(const __base_iterator_base& iterator) const = 0; 96 virtual __base_iterator_base* clone() const; 97 }; 98 99 public: 100 base_iterator(__base_iterator_base& it) { _it = it.clone(); }; 101 ~base_iterator() { delete _it; } 102 void operator++() { (*_it)++; }; 103 void operator++(int) { ++(*_it); }; 104 void operator--() { (*_it)--; }; 105 void operator--(int) { --(*_it); }; 106 BaseObject* operator*() { return *(*_it); }; 107 base_iterator& operator=(const base_iterator& iterator); 108 bool operator==(const base_iterator& iter) const { return *this->_it == *iter._it; }; 109 bool operator!=(const base_iterator& iter) const { return *this->_it != *iter._it; }; 110 111 private: 112 __base_iterator_base* _it; 113 }; 114 115 virtual base_iterator base_begin() const = 0; 116 virtual base_iterator base_end() const = 0; 117 118 95 119 protected: 96 120 typedef std::map<int, NewObjectListBase*> classIDMap; //!< The Generic Map. … … 126 150 typedef typename list::const_iterator const_iterator; 127 151 128 virtual base_iterator & base_begin() {};129 virtual base_iterator & base_end() {};152 virtual base_iterator base_begin() const { return base_iterator(__base_iterator(this->_objects.begin())); }; 153 virtual base_iterator base_end() const { return base_iterator(__base_iterator(this->_objects.end())); }; 130 154 131 155 … … 159 183 160 184 virtual void debug() const; 185 186 protected: 187 class __base_iterator : public base_iterator::__base_iterator_base 188 { 189 public: 190 __base_iterator(const const_iterator& iter); 191 void operator++(int) { ++_iter; }; 192 void operator++() { _iter++; }; 193 void operator--(int) { --_iter; }; 194 void operator--() { _iter--; }; 195 BaseObject* operator*() { return *iter; }; 196 base_iterator::__base_iterator_base& operator=(const base_iterator& iterator) { _iter = iterator._iter; return *this; }; 197 bool operator==(const __base_iterator_base& iterator) const { return _iter == iterator._iter; }; 198 bool operator!=(const __base_iterator_base& iterator) const { return _iter != iterator._iter; }; 199 private: 200 iterator _iter; 201 }; 161 202 162 203 private:
Note: See TracChangeset
for help on using the changeset viewer.