Public Types | Public Member Functions

KSet Class Reference

Search for all occurrences

Detailed Description

Class to manipulate set.

Definition at line 57 of file kset.h.

#include <kset.h>

List of all members.

Public Types

enum   { KFBX_NOT_FOUND = 0x0L, KFBX_ITEM_PER_BLOCK = 20 }

Public Member Functions

bool  Add (kReference pReference, kReference pItem)
  If can't find the matching item,append a item at the end of the array.
bool  Remove (kReference pReference)
  Remove the first matching item, whose reference is the same as given.
bool  RemoveItem (kReference pItem)
  Remove all the matching item, whose item is the same as given.
bool  SetItem (kReference pReference, kReference pItem)
  Set first matching item with the given parameter.
kReference  Get (kReference pReference, int *pIndex=NULL) const
  Get first matching item with the given parameter.
void  Clear ()
  Delete the array.
kReference  GetFromIndex (int pIndex, kReference *pReference=NULL) const
  Get the item of the given index.
bool  RemoveFromIndex (int pIndex)
  Remove the item of the given index.
int  GetCount () const
  Get number of items in the array.
bool  Swap () const
  Swap the value of Reference and Item in every item of array, and sort the new array with the value of Reference.
bool  Sort () const
  Sort the array according the value of Reference in each item.
const KSet operator= (const KSet &)
  KString assignment operator.

Constructors and Destructor

  KSet (int pItemPerBlock=KFBX_ITEM_PER_BLOCK)
  Int constructor.
  KSet (const KSet &other)
  Copy constructor.
  ~KSet ()
  Destructor.

Member Enumeration Documentation

anonymous enum
Enumerator:
KFBX_NOT_FOUND 
KFBX_ITEM_PER_BLOCK 

Definition at line 59 of file kset.h.


Constructor & Destructor Documentation

KSet ( int  pItemPerBlock = KFBX_ITEM_PER_BLOCK )

Int constructor.

Parameters:
pItemPerBlock The number of items that every block included
KSet ( const KSet other )

Copy constructor.

Parameters:
other Given object.
~KSet ( )

Destructor.


Member Function Documentation

bool Add ( kReference  pReference,
kReference  pItem 
)

If can't find the matching item,append a item at the end of the array.

If find the matching item ,insert the new item before the matching item.

Parameters:
pReference The value of Reference in new item, also is the character for matching.
pItem The value of Item in new item.
Returns:
If add successfully return true,otherwise return false.
bool Remove ( kReference  pReference )

Remove the first matching item, whose reference is the same as given.

Parameters:
pReference The given reference.
Returns:
If remove successfully return true,otherwise return false.
bool RemoveItem ( kReference  pItem )

Remove all the matching item, whose item is the same as given.

Parameters:
pItem The given item.
Returns:
If remove successfully return true,otherwise return false.
bool SetItem ( kReference  pReference,
kReference  pItem 
)

Set first matching item with the given parameter.

Parameters:
pReference The character for matching.
pItem The value of Item that the matching item will be set.
Returns:
If set successfully return true,otherwise return false.
kReference Get ( kReference  pReference,
int *  pIndex = NULL 
) const

Get first matching item with the given parameter.

Parameters:
pReference The character for matching.
pIndex The pointer to the index of the matching item.
Returns:
The value of Item in the matching item.
Remarks:
If there are multiple elements that match the character, the index returned is unspecified.
void Clear ( )

Delete the array.

kReference GetFromIndex ( int  pIndex,
kReference pReference = NULL 
) const

Get the item of the given index.

Parameters:
pIndex The index for matching.
pReference The pointer to the Reference of the matching item.
Returns:
The value of Item in the matching item.
bool RemoveFromIndex ( int  pIndex )

Remove the item of the given index.

Parameters:
pIndex The given index.
Returns:
If remove successfully return true,otherwise return false.
int GetCount ( ) const [inline]

Get number of items in the array.

Returns:
The number of items in the array.

Definition at line 143 of file kset.h.

{ return mSetCount; }
bool Swap ( ) const

Swap the value of Reference and Item in every item of array, and sort the new array with the value of Reference.

Returns:
If swap successfully return true,otherwise return false.
bool Sort ( ) const

Sort the array according the value of Reference in each item.

Returns:
If sort successfully return true,otherwise return false.
const KSet& operator= ( const KSet )

KString assignment operator.


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

KSet KSet KSet KSet KSet KSet KSet KSet KSet KSet
KSet KSet KSet KSet KSet KSet KSet KSet KSet KSet