From 2ae87e72131a8e88327dbb0b5b286accddafe05d Mon Sep 17 00:00:00 2001 From: truebrain Date: Mon, 19 Dec 2011 21:05:46 +0000 Subject: (svn r23634) -Add: support language files for GameScript (Rubidium) --- src/core/smallvec_type.hpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/core') diff --git a/src/core/smallvec_type.hpp b/src/core/smallvec_type.hpp index 00fb7c5a0..40793788d 100644 --- a/src/core/smallvec_type.hpp +++ b/src/core/smallvec_type.hpp @@ -326,6 +326,37 @@ public: } }; +/** + * Simple vector template class, with automatic delete. + * + * @note There are no asserts in the class so you have + * to care about that you grab an item which is + * inside the list. + * + * @param T The type of the items stored, must be a pointer + * @param S The steps of allocation + */ +template +class AutoDeleteSmallVector : public SmallVector { +public: + ~AutoDeleteSmallVector() + { + this->Clear(); + } + + /** + * Remove all items from the list. + */ + FORCEINLINE void Clear() + { + for (uint i = 0; i < this->items; i++) { + delete this->data[i]; + } + + this->items = 0; + } +}; + typedef AutoFreeSmallVector StringList; ///< Type for a list of strings. #endif /* SMALLVEC_TYPE_HPP */ -- cgit v1.2.3-54-g00ecf