uLib  User mode C/C++ extended API library for Win32 programmers.
uLib::SortDynArray Class Reference

#include <uLib/DynArray.h>

Inheritance diagram for uLib::SortDynArray:
uLib::DynArray

Detailed Description

Sorted dynamic array.

Definition at line 156 of file DynArray.h.

Public Data

bool Duplicates
 
- Public Data inherited from uLib::DynArray
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)
 
- Public Functions inherited from uLib::DynArray
 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 & Destructor Documentation

◆ SortDynArray()

uLib::SortDynArray::SortDynArray ( DWORD  Size = 16,
WORD  Delta = 16 
)

Constructor. See DynArray::DynArray().

Definition at line 217 of file DynArray.cpp.

Member Function Documentation

◆ operator+=()

PVOID uLib::SortDynArray::operator+= ( PVOID  Item)
inline

Add an item in sorted order.

Definition at line 163 of file DynArray.h.

◆ KeyOf()

PVOID uLib::SortDynArray::KeyOf ( PVOID  Item)
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.

◆ Compare()

short uLib::SortDynArray::Compare ( PVOID  Key1,
PVOID  Key2 
)
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.

◆ Search()

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.

Parameters
KeyKey of the sought item.
IndexVariable to recieve the index of the sought item.

Definition at line 235 of file DynArray.cpp.

◆ Insert()

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.

Member Data Documentation

◆ Duplicates

bool uLib::SortDynArray::Duplicates

Set to true if duplicates are to be allowed

Definition at line 158 of file DynArray.h.


The documentation for this class was generated from the following files: