iutil/array.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2006 by Frank Richter 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_IUTIL_ARRAY_H__ 00020 #define __CS_IUTIL_ARRAY_H__ 00021 00026 #include "csutil/scf.h" 00027 00049 template<typename T> 00050 struct iArrayReadOnly : public virtual iBase 00051 { 00052 typedef T ContainedType; 00053 00055 virtual size_t GetSize () const = 0; 00057 virtual T const& Get (size_t n) const = 0; 00059 virtual T const& Top () const = 0; 00065 virtual size_t Find (T const& which) const = 0; 00072 virtual size_t GetIndex (const T* which) const = 0; 00078 virtual bool IsEmpty() const = 0; 00084 virtual void GetAll (T* dest) const = 0; 00085 }; 00086 00093 #define SCF_IARRAYREADONLY_INTERFACE(Name) \ 00094 SCF_INTERFACE(Name, 0, 0, 1) 00095 00114 template<typename T> 00115 struct iArrayChangeElements : public virtual iArrayReadOnly<T> 00116 { 00118 virtual T& Get (size_t n) = 0; 00120 virtual T& Top () = 0; 00121 }; 00122 00130 #define SCF_IARRAYCHANGEELEMENTS_INTERFACE(Name) \ 00131 SCF_INTERFACE(Name, 0, 0, 1) 00132 00150 template<typename T> 00151 struct iArrayChangeAll : public virtual iArrayChangeElements<T> 00152 { 00162 virtual void SetSize (size_t n, T const& what) = 0; 00170 virtual void SetSize (size_t n) = 0; 00176 virtual T& GetExtend (size_t n) = 0; 00178 virtual void Put (size_t n, T const& what) = 0; 00183 virtual size_t Push (T const& what) = 0; 00188 virtual size_t PushSmart (T const& what) = 0; 00190 virtual T Pop () = 0; 00192 virtual bool Insert (size_t n, T const& item) = 0; 00194 virtual void DeleteAll () = 0; 00206 virtual void Truncate (size_t n) = 0; 00212 virtual void Empty () = 0; 00221 virtual bool DeleteIndex (size_t n) = 0; 00231 virtual bool DeleteIndexFast (size_t n) = 0; 00237 virtual bool Delete (T const& item) = 0; 00251 CS_DEPRECATED_METHOD_MSG("'Fast' is illusional; see documentation") 00252 virtual bool DeleteFast (T const& item) = 0; 00253 }; 00254 00262 #define SCF_IARRAYCHANGEALL_INTERFACE(Name) \ 00263 SCF_INTERFACE(Name, 0, 0, 1) 00264 00267 #endif // __CS_IUTIL_ARRAY_H__
Generated for Crystal Space by doxygen 1.4.7