![]() |
KVIrc 5.2.6
Developer APIs
|
This class defines a new data type which contains array data. More...
#include <KviKvsArray.h>
Public Member Functions | |
void | append (KviKvsVariant *pVal) |
void | appendAsString (QString &szBuffer) |
Appends data to the array converting it into a string. | |
KviKvsVariant * | at (kvs_uint_t uIdx) const |
Returns the element at the given index. | |
KviKvsVariant * | getAt (kvs_uint_t uIdx) |
Returns the element at the given index. | |
bool | isEmpty () |
Returns true if the array is empty. | |
KviKvsArray () | |
Constructs the array data. | |
KviKvsArray (const KviKvsArray &array) | |
Constructs the array data. | |
void | rsort () |
Sorts the array in reverse order. | |
void | serialize (QString &szResult) |
Serializes the array to a given buffer. | |
void | set (kvs_uint_t uIdx, KviKvsVariant *pVal) |
Sets an element into the array at the given index. | |
kvs_uint_t | size () |
Returns the size of the array. | |
void | sort () |
Sorts the array. | |
void | unset (kvs_uint_t uIdx) |
Unsets an element from the array. | |
~KviKvsArray () | |
Destroys the array data. | |
Protected Member Functions | |
void | findNewSize () |
Finds the new size of the array. | |
Protected Attributes | |
KviKvsVariant ** | m_pData |
kvs_uint_t | m_uAllocSize |
kvs_uint_t | m_uSize |
Static Private Member Functions | |
static int | compare (const void *pV1, const void *pV2) |
Compares two elements of the array. | |
static int | compareReverse (const void *pV1, const void *pV2) |
Compares two elements of the array in reverse order. | |
This class defines a new data type which contains array data.
KviKvsArray::KviKvsArray | ( | ) |
Constructs the array data.
References m_pData, m_uAllocSize, and m_uSize.
Referenced by KviKvsArray().
KviKvsArray::KviKvsArray | ( | const KviKvsArray & | array | ) |
Constructs the array data.
This is a carbon copy
array | The array to copy from |
References KviMemory::allocate(), KviKvsArray(), m_pData, m_uAllocSize, m_uSize, and u.
KviKvsArray::~KviKvsArray | ( | ) |
Destroys the array data.
References KviMemory::free(), m_pData, m_uSize, and u.
void KviKvsArray::append | ( | KviKvsVariant * | pVal | ) |
Appends a variant to this array.
References m_uSize, and set().
Referenced by package_kvs_fnc_info().
void KviKvsArray::appendAsString | ( | QString & | szBuffer | ) |
|
inline |
Returns the element at the given index.
uIdx | The index of the element to retrieve |
References m_pData, and m_uSize.
Referenced by KviKvsTreeNodeArrayElement::evaluateReadOnlyInObjectScope(), KviKvsTreeNodeSpecialCommandForeach::execute(), KvsObject_textedit::functionsetColor(), KVSO_CLASS_FUNCTION(), KVSO_CLASS_FUNCTION(), KVSO_CLASS_FUNCTION(), KVSO_CLASS_FUNCTION(), KVSO_CLASS_FUNCTION(), KVSO_CLASS_FUNCTION(), KviCellItemDelegate::sizeHint(), and KviKvsWidget::sizeHint().
|
staticprivate |
Compares two elements of the array.
pV1 | The first element to compare |
pV2 | The second element to compare |
Referenced by sort().
|
staticprivate |
Compares two elements of the array in reverse order.
pV1 | The first element to compare |
pV2 | The second element to compare |
Referenced by rsort().
|
protected |
Finds the new size of the array.
References KviMemory::free(), KVI_KVS_ARRAY_ALLOC_CHUNK, m_pData, m_uAllocSize, m_uSize, KviMemory::reallocate(), and u.
KviKvsVariant * KviKvsArray::getAt | ( | kvs_uint_t | uIdx | ) |
Returns the element at the given index.
If the element doesn't exists, it returns an empty element. If the index is out of array bounds, it increases the array size, fillin the array in with zeros.
uIdx | The index of the element to retrieve |
References KviMemory::allocate(), KVI_KVS_ARRAY_ALLOC_CHUNK, m_pData, m_uAllocSize, m_uSize, KviMemory::reallocate(), and u.
Referenced by KviKvsTreeNodeArrayElement::evaluateReadWriteInObjectScope().
|
inline |
Returns true if the array is empty.
References m_uSize.
Referenced by KviKvsVariantComparison::compareBoolArray(), KviKvsVariantComparison::compareHObjectArray(), KviKvsVariantComparison::compareIntArray(), KviKvsVariantComparison::compareRealArray(), and KviKvsVariantComparison::compareStringArray().
void KviKvsArray::rsort | ( | ) |
Sorts the array in reverse order.
References compareReverse(), findNewSize(), m_pData, and m_uSize.
Referenced by KviKvsCoreFunctions::KVSCF().
void KviKvsArray::serialize | ( | QString & | szResult | ) |
void KviKvsArray::set | ( | kvs_uint_t | uIdx, |
KviKvsVariant * | pVal ) |
Sets an element into the array at the given index.
uIdx | The index of the element to set |
pVal | The value to set |
References KviMemory::allocate(), KVI_KVS_ARRAY_ALLOC_CHUNK, m_pData, m_uAllocSize, m_uSize, KviMemory::reallocate(), and u.
Referenced by append(), language_kvs_cmd_detect(), objects_kvs_fnc_instances(), and system_kvs_fnc_dbus().
|
inline |
Returns the size of the array.
References m_uSize.
Referenced by KviKvsVariant::compare(), KviKvsVariantComparison::compareArrayHash(), KviKvsTreeNodeArrayCount::evaluateReadOnlyInObjectScope(), KvsObject_textedit::functionsetColor(), KviKvsCoreFunctions::KVSCF(), KVSO_CLASS_FUNCTION(), KVSO_CLASS_FUNCTION(), KVSO_CLASS_FUNCTION(), KVSO_CLASS_FUNCTION(), KVSO_CLASS_FUNCTION(), KVSO_CLASS_FUNCTION(), KviCellItemDelegate::sizeHint(), and KviKvsWidget::sizeHint().
void KviKvsArray::sort | ( | ) |
Sorts the array.
References compare(), findNewSize(), m_pData, and m_uSize.
Referenced by KviKvsCoreFunctions::KVSCF().
void KviKvsArray::unset | ( | kvs_uint_t | uIdx | ) |
Unsets an element from the array.
uIdx | The index of the element to unset |
References findNewSize(), m_pData, and m_uSize.
|
protected |
Referenced by appendAsString(), at(), findNewSize(), getAt(), KviKvsArray(), KviKvsArray(), rsort(), serialize(), set(), sort(), unset(), and ~KviKvsArray().
|
protected |
Referenced by findNewSize(), getAt(), KviKvsArray(), KviKvsArray(), and set().
|
protected |
Referenced by append(), appendAsString(), at(), findNewSize(), getAt(), isEmpty(), KviKvsArray(), KviKvsArray(), rsort(), serialize(), set(), size(), sort(), unset(), and ~KviKvsArray().