#include<kset.h>
List of all members.
Detailed Description
Class to manipulate set.
Definition at line49of filekset.h.
|
Constructors and Destructor |
| KSet(int pItemPerBlock=KITEM_PER_BLOCK) |
| Int constructor.
|
| KSet(constKSet&other) |
| Copy constructor.
|
| ~KSet() |
| Destructor.
|
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.
|
constKSet& | operator=(constKSet&) |
| KStringassignment operator.
|
Constructor&Destructor Documentation
KSet | ( | int | pItemPerBlock=KITEM_PER_BLOCK | ) | |
Int constructor.
- Parameters:
| pItemPerBlock | The number of items that every block included |
Copy constructor.
- Parameters:
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:
- 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.
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:
- 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 line128of filekset.h.
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.
Sort the array according the value of Reference in each item.
- Returns:
- If sort successfully return true,otherwise return false.