uLib
User mode C/C++ extended API library for Win32 programmers.
|
#include <uLib/DynArray.h>
Sorted dynamic array.
Definition at line 156 of file DynArray.h.
Public Data | |
bool | Duplicates |
![]() | |
DWORD const & | Count |
DWORD const & | Size |
DynArray const & | Items |
Public Functions | |
SortDynArray (DWORD Size=16, WORD Delta=16) | |
PVOID | operator+= (PVOID Item) |
virtual PVOID | KeyOf (PVOID Item) |
virtual short | Compare (PVOID Key1, PVOID Key2) |
bool | Search (PVOID Key, DWORD &Index) |
PVOID | Insert (PVOID Item) |
![]() | |
DynArray (DWORD Size=16, WORD Delta=16) | |
virtual | ~DynArray () |
void | Init (DWORD Size, WORD Delta) |
void | Done () |
PVOID | operator+= (PVOID Item) |
PVOID | operator -= (PVOID Item) |
PVOID | Insert (PVOID Item) |
PVOID | InsertAt (DWORD Index, PVOID Item) |
PVOID | Push (PVOID Item) |
PVOID | Pull (void) |
PVOID | Pop (void) |
virtual void | DeleteItem (PVOID &Item) |
virtual void | DeleteAll (void) |
void | Delete (PVOID &Item) |
< More... | |
void | Delete (DWORD Index) |
PVOID | Remove (PVOID Item) |
PVOID | Remove (DWORD Index) |
LONG | IndexOf (PVOID Item) const |
PVOID | At (DWORD Index) const |
PVOID | FirstThat (DYN_ITEMFUNC Match, PVOID userData) const |
PVOID | LastThat (DYN_ITEMFUNC Match, PVOID userData) const |
bool | ForEach (DYN_ITEMFUNC Action, PVOID userData) const |
PVOID | operator[] (DWORD Index) const |
Constructor. See DynArray::DynArray().
Definition at line 217 of file DynArray.cpp.
|
inline |
Add an item in sorted order.
Definition at line 163 of file DynArray.h.
|
virtual |
Should return the item's key, if it's not the item itself.
Override: Base implementation simply returns Item.
Definition at line 223 of file DynArray.cpp.
|
virtual |
Provide customized item comparison.
Compare() should return:
-1 if Key1 < Key2
0 if Key1 = Key2
1 if Key1 > Key2
The base implementation assume items are char strings, and use
_tcscmp() to compare them. Otherwise you must override this method.
Definition at line 228 of file DynArray.cpp.
bool uLib::SortDynArray::Search | ( | PVOID | Key, |
DWORD & | Index | ||
) |
Search returns true if Key is found, and Index return it's index.
If Key is not found, Search() returns false and Index returns the index
where it would have been if it existed.
Key | Key of the sought item. |
Index | Variable to recieve the index of the sought item. |
Definition at line 235 of file DynArray.cpp.
PVOID uLib::SortDynArray::Insert | ( | PVOID | Item | ) |
Overrides DynArray::Insert() to provide item sorting.
See also DynArray::Insert().
Definition at line 251 of file DynArray.cpp.
bool uLib::SortDynArray::Duplicates |
Set to true if duplicates are to be allowed
Definition at line 158 of file DynArray.h.