itemlist.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. ** Copyright (C) 2003-2006 Nullsoft, Inc.
  3. **
  4. ** This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held
  5. ** liable for any damages arising from the use of this software.
  6. **
  7. ** Permission is granted to anyone to use this software for any purpose, including commercial applications, and to
  8. ** alter it and redistribute it freely, subject to the following restrictions:
  9. **
  10. ** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
  11. ** If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  12. **
  13. ** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  14. **
  15. ** 3. This notice may not be removed or altered from any source distribution.
  16. **
  17. */
  18. #ifndef _C_ITEMLIST_H_
  19. #define _C_ITEMLIST_H_
  20. #define MEMORY_STEP 32
  21. class C_ItemList
  22. {
  23. public:
  24. C_ItemList();
  25. ~C_ItemList();
  26. void *Add( void *i );
  27. void Set( int w, void *newv );
  28. void *Get( int w ) const;
  29. void Del( int idx );
  30. void *Insert( void *i, int pos );
  31. int GetSize( void ) const { return current_index; }
  32. void **GetAll() { return m_list; }
  33. void for_all( void ( *for_all_func )( void * ) );
  34. void for_all_ctx( void ( *for_all_func )( void *, void * ), void * );
  35. protected:
  36. void **m_list = NULL;
  37. int current_index = 0;
  38. int alloc_size = 0;
  39. };
  40. #endif //_C_ITEMLIST_H_