HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_Integers.h
Go to the documentation of this file.
1 #ifndef __UT_Integers__
2 #define __UT_Integers__
3 
4 #include "UT_API.h"
5 /*
6  * A UT_Integers is a utility class which maintains a collection
7  * of integers. You can add and remove integers from the
8  * collection without having to deal with memory management using
9  * either the addMember/removeMember methods or the [] operator.
10  */
11 
13 {
14 public:
15  UT_Integers() { list = iterator = (int *)0; nentries = size = 0; }
16  ~UT_Integers() { if( list ) delete list; }
17 
18  long index(int contents) const;
19  long addMember(int value); // Returns index
20  int removeMember(long index); // Returns old value
21  void insertMember(int value, long index);
22 
23  void iterateInit(long index = 0);
24  int iterateGet(int *value); // Returns zero when done
25 
26  void iterateReverseInit(long index = 0);
27  int iterateReverseGet(int *value); // Returns zero when done
28 
29  long count() const { return nentries; }
30  void empty();
31 
32  int &operator[](long index);
33 
34  void sortIntegers(int (*compare)(const void *, const void *));
35  long searchIntegers(int (*compare)(const void *, const void *),
36  const void *key) const;
37 
38  UT_Integers &operator=(const UT_Integers &from);
39 
40 private:
41  void grow(long newsize);
42 
43  int *list;
44  int *iterator;
45  long size;
46  long nentries;
47 };
48 
49 #endif
#define UT_API
Definition: UT_API.h:12
GLsizeiptr size
Definition: glcorearb.h:663
GLsizei const GLfloat * value
Definition: glcorearb.h:823
GLuint index
Definition: glcorearb.h:785
png_infop png_sPLT_tp int nentries
Definition: png.h:2486
long count() const
Definition: UT_Integers.h:29