#include <simplear.h>
Inheritance diagram for SIMPLE_ARRAY< _CT >:

Public Member Functions | |
| SIMPLE_ARRAY () | |
| SIMPLE_ARRAY (const SIMPLE_ARRAY< _CT > &rhs) | |
| ~SIMPLE_ARRAY () | |
| SIMPLE_ARRAY< _CT > & | operator= (const SIMPLE_ARRAY< _CT > &rhs) |
| bool | operator== (const SIMPLE_ARRAY< _CT > &rhs) const |
| bool | operator!= (const SIMPLE_ARRAY< _CT > &rhs) const |
| operator const _CT * () const | |
| operator _CT * () | |
| const _CT & | operator[] (int index) const |
| _CT & | operator[] (int index) |
| ERRVALUE | Append (const _CT &item) |
| ERRVALUE | Append (const _CT *items, int numitems) |
| ERRVALUE | Append (const SIMPLE_ARRAY< _CT > &rhs) |
| void | AppendExc (const _CT &item) |
| void | AppendExc (const _CT *items, int numitems) |
| void | AppendExc (const SIMPLE_ARRAY< _CT > &rhs) |
| ERRVALUE | AppendUnique (const _CT &item) |
| void | AppendUniqueExc (const _CT &item) |
| ERRVALUE | Assign (const _CT *items, int numitems) |
| void | Attach (_CT *&items, int numitems) |
| void | Clear () |
| void | ClearItems (int start=0, int end=-1) |
| ERRVALUE | Copy (const SIMPLE_ARRAY< _CT > &rhs) |
| _CT * | Detach () |
| void | Free () |
| const _CT & | GetItem (int index) const |
| int | GetMaxItems () const |
| int | GetNumItems () const |
| int | GetSizeInBytes () const |
| bool | HasItem (const _CT &item) const |
| void | InsertItems (int start, int num=1) |
| bool | IsEmpty () const |
| void | RemoveDuplicates () |
| void | RemoveFast (INT32 item) |
| void | RemoveItem (INT32 item) |
| bool | RemoveMatchingItems (const _CT &item) |
| ERRVALUE | Reserve (int newmaxitems, bool clear=false) |
| void | ReserveExc (int newmaxitems, bool clear=false) |
| ERRVALUE | Resize (int numitems, bool keepold=true, bool clear=false) |
| void | Reverse () |
| void | SetItem (int index, const _CT &item) |
| ERRVALUE | SetItems (int firstitem, const _CT *items, int numitems) |
| void | Sort (int(*CompFunc)(_CT *, _CT *, void *), void *data=0) |
| void | Swap (SIMPLE_ARRAY< _CT > &rhs) |
| void | SwapBytes () |
This template is designed to contain an array of items which can be allocated using MmAlloc/MmRealloc. The primary purpose of this template is to replace allocated arrays where direct access to both array elements and the ability to access a pointer to the first element (as for a C array) is required. Do not use this template with classes which require constructors or have virtual methods or which do not have compiler-generated assignment operators.
For maximum efficiency, only minimal validation of access to array elements is performed. No initialization of array items is performed by the template.
For doubles and objects based on doubles, use DOUBLE_ARRAY<> in mi32/doublear.h
Instances of this class are passed to DLLs, so do not add or remove members.
Definition at line 173 of file simplear.h.
|
|||||||||
|
Default constructor, creates empty array.
Definition at line 177 of file simplear.h. |
|
||||||||||
|
Copy constructor.
Definition at line 186 of file simplear.h. |
|
|||||||||
|
Destructor.
Definition at line 197 of file simplear.h. |
|
||||||||||
|
Append items from SIMPLE_ARRAY reserving space if needed.
Definition at line 314 of file simplear.h. |
|
||||||||||||||||
|
Append items from C array, reserving space if needed.
Definition at line 302 of file simplear.h. |
|
||||||||||
|
Append item to end of array, extending if necessary.
Reimplemented in MENUITEMARRAY. Definition at line 290 of file simplear.h. |
|
||||||||||
|
Append items from SIMPLE_ARRAY reserving space if needed. Throws exception if out of memory. Definition at line 350 of file simplear.h. |
|
||||||||||||||||
|
Append items from C array, reserving space if needed. Throws exception if out of memory.
Definition at line 338 of file simplear.h. |
|
||||||||||
|
Append item to end of array, extending if necessary. Throws exception if out of memory. Definition at line 326 of file simplear.h. |
|
||||||||||
|
Append item to end of array if unique, extending if necessary.
Definition at line 360 of file simplear.h. |
|
||||||||||
|
Append item to end of array if unique, extending if necessary. Throws exception if out of memory. Definition at line 372 of file simplear.h. |
|
||||||||||||||||
|
Assign from C array, reserving space if needed. Resizes the array to the specified number of items.
Definition at line 385 of file simplear.h. |
|
||||||||||||||||
|
Attach a buffer to the SIMPLE_ARRAY. After passing a buffer to Attach(), the SIMPLE_ARRAY "<b>owns</b>" the buffer and will free it in its destructor.
Definition at line 404 of file simplear.h. |
|
|||||||||
|
Clear the array, does not free resources.
Definition at line 417 of file simplear.h. |
|
||||||||||||||||
|
Clear items in the array. Start might be larger than end
Definition at line 424 of file simplear.h. |
|
||||||||||
|
Copy the contents of another SIMPLE_ARRAY. Same as assignment, but returns an error code instead of throwing an exception. Free the old array instead of using realloc to avoid expensive copy. Definition at line 438 of file simplear.h. |
|
|||||||||
|
Detach the buffer from the SIMPLE_ARRAY. This turns ownership of the buffer over to the caller, who is then responsibile for seeing that it gets disposed of. After calling Detach(), the SIMPLE_ARRAY will behave as if it had just been constructed. In other words, it will be a NULL pointer pointing to 0 items. This means that if you want to know how many items are in the array returned, you'd better find out before} you call Detach()! Definition at line 464 of file simplear.h. |
|
|||||||||
|
Free the array.
Definition at line 473 of file simplear.h. |
|
||||||||||
|
Get array item, does not verify index range.
Definition at line 481 of file simplear.h. |
|
|||||||||
|
Get maximum number of items in array.
Definition at line 486 of file simplear.h. |
|
|||||||||
|
Get number of items in array.
Definition at line 490 of file simplear.h. |
|
|||||||||
|
Get size of array required to hold current number of items in bytes.
Definition at line 494 of file simplear.h. |
|
||||||||||
|
Determine if an item exists in the array. Item must have a valid operator==()
Definition at line 500 of file simplear.h. |
|
||||||||||||||||
|
Insert multiple items into the array.
Definition at line 510 of file simplear.h. |
|
|||||||||
|
Determine if array is empty.
Definition at line 521 of file simplear.h. |
|
|||||||||
|
Cast to array of template type.
Definition at line 242 of file simplear.h. |
|
|||||||||
|
Cast to const array of template type.
Definition at line 236 of file simplear.h. |
|
||||||||||
|
Inequality operator.
Definition at line 229 of file simplear.h. |
|
||||||||||
|
Assignment. Free the old array instead of using realloc to avoid expensive copy. Definition at line 203 of file simplear.h. |
|
||||||||||
|
Equality operator.
Definition at line 220 of file simplear.h. |
|
||||||||||
|
GENERATING_DOXYGEN_OUTPUT.
Definition at line 259 of file simplear.h. |
|
||||||||||
|
Read (const) access to array element.
Definition at line 250 of file simplear.h. |
|
|||||||||
|
Remove duplicate entries in the list, assume not sorted.
Definition at line 525 of file simplear.h. |
|
||||||||||
|
Remove an item by placing the end item in its place.
Definition at line 540 of file simplear.h. |
|
||||||||||
|
Remove item at specified index, maintaining order. Note that this is inefficient for large arrays. Definition at line 552 of file simplear.h. |
|
||||||||||
|
Remove items matching the item passed in. _CT must have a operator==() defined Maintains item order
< Avoid expensive copy if not needed Definition at line 565 of file simplear.h. |
|
||||||||||||||||
|
Reserve space in array for up to specified number of items. Free the old array to avoid expensive copy in reallocation
Definition at line 581 of file simplear.h. |
|
||||||||||||||||
|
Reserve space in array for up to specified number of items. Throws exception if out of memory. Free the old array to avoid expensive copy in reallocation
Definition at line 600 of file simplear.h. |
|
||||||||||||||||||||
|
Resize array to specified number of items. If the new size is larger than the previous size and the array is not cleared the new array entries will have indeterminant values.
Definition at line 619 of file simplear.h. |
|
|||||||||
|
Reverse order of items in array.
Definition at line 632 of file simplear.h. |
|
||||||||||||||||
|
Set single item, does not verify index range.
Definition at line 643 of file simplear.h. |
|
||||||||||||||||||||
|
Set array items from C array, expanding if needed. Will not reduce the number of items in the array.
Definition at line 652 of file simplear.h. |
|
||||||||||||||||
|
Sort the items in the array. CompFunc should return 1 if the first item < the 2nd item Otherwise, return 0. Compare function cannot return 'bool', must be 'int'. Definition at line 667 of file simplear.h. |
|
||||||||||
|
Swap (exchange) two SIMPLE_ARRAYs. This exchanges the internal buffers so minimal copying is performed for efficiency. Definition at line 677 of file simplear.h. |
|
|||||||||
|
Swap bytes in a SIMPLE_ARRAY, assume that there is an overload to swap a _CT.
Definition at line 692 of file simplear.h. |
1.3.4-20031026