KVIrc
4.9.2
DeveloperAPIs
|
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. More... | |
KviKvsVariant * | at (kvs_uint_t uIdx) const |
Returns the element at the given index. More... | |
KviKvsVariant * | getAt (kvs_uint_t uIdx) |
Returns the element at the given index. More... | |
bool | isEmpty () |
Returns true if the array is empty. More... | |
KviKvsArray () | |
Constructs the array data. More... | |
KviKvsArray (const KviKvsArray &array) | |
Constructs the array data. More... | |
void | rsort () |
Sorts the array in reverse order. More... | |
void | serialize (QString &szResult) |
Serializes the array to a given buffer. More... | |
void | set (kvs_uint_t uIdx, KviKvsVariant *pVal) |
Sets an element into the array at the given index. More... | |
kvs_uint_t | size () |
Returns the size of the array. More... | |
void | sort () |
Sorts the array. More... | |
void | unset (kvs_uint_t uIdx) |
Unsets an element from the array. More... | |
~KviKvsArray () | |
Destroys the array data. More... | |
Protected Member Functions | |
void | findNewSize () |
Finds the new size of the array. More... | |
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. More... | |
static int | compareReverse (const void *pV1, const void *pV2) |
Compares two elements of the array in reverse order. More... | |
This class defines a new data type which contains array data.
KviKvsArray::KviKvsArray | ( | ) |
KviKvsArray::KviKvsArray | ( | const KviKvsArray & | array | ) |
Constructs the array data.
This is a carbon copy
array | The array to copy from |
References KviMemory::allocate(), 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(), and spellchecker_kvs_suggestions().
void KviKvsArray::appendAsString | ( | QString & | szBuffer | ) |
Appends data to the array converting it into a string.
szBuffer | The string to append |
References KviKvsVariant::appendAsString(), m_pData, m_uSize, and u.
Referenced by KviKvsVariant::appendAsString(), and KviKvsVariant::asString().
|
inline |
Returns the element at the given index.
uIdx | The index of the element to retrieve |
Referenced by KviKvsTreeNodeArrayElement::evaluateReadOnlyInObjectScope(), KviKvsTreeNodeSpecialCommandForeach::execute(), KviKvsTreeNodeOperationArrayAppend::execute(), file_kvs_cmd_writeBytes(), file_kvs_cmd_writeLines(), KviInputEditor::fillSpellCheckerCorrectionsPopup(), KviKvsObject::function_setProperty(), KvsObject_textedit::functionsetColor(), KviKvsCoreFunctions::KVSCF(), KVSO_CLASS_FUNCTION(), KviCellItemDelegate::sizeHint(), str_kvs_fnc_grep(), and theme_kvs_cmd_pack().
|
staticprivate |
Compares two elements of the array.
pV1 | The first element to compare |
pV2 | The second element to compare |
Referenced by compareReverse(), and sort().
|
staticprivate |
|
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.
Referenced by KviKvsVariant::asBoolean(), KviKvsVariantComparison::compareBoolArray(), KviKvsVariantComparison::compareHObjectArray(), KviKvsVariantComparison::compareIntArray(), KviKvsVariantComparison::compareRealArray(), KviKvsVariantComparison::compareStringArray(), KviKvsVariant::isEmpty(), and KviKvsVariant::isEqualToNothing().
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 | ) |
Serializes the array to a given buffer.
szResult | The buffer to store |
References m_pData, m_uSize, KviKvsVariant::serialize(), szBuffer, and u.
Referenced by KviKvsVariant::serialize().
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(), KviKvsVariant::castToArray(), chan_kvs_fnc_banexceptionlist(), chan_kvs_fnc_banlist(), chan_kvs_fnc_invitelist(), chan_kvs_fnc_masklist(), chan_kvs_fnc_users(), config_kvs_fnc_filelist(), config_kvs_fnc_keylist(), config_kvs_fnc_sectionlist(), context_kvs_fnc_list(), KviKvsVariant::convertToArray(), dcc_kvs_fnc_sessionList(), KviKvsCallbackFileDialog::done(), dumpChildObjects(), KviKvsTreeNodeOperationArrayAppend::execute(), file_kvs_fnc_allSizes(), file_kvs_fnc_ls(), file_kvs_fnc_readBytes(), file_kvs_fnc_readLines(), KviKvsObject::function_children(), KviKvsObject::function_listProperties(), KviKvsObject::function_property(), KvsObject_textedit::functionCursorPosition(), if(), KviKvsCoreFunctions::KVSCF(), KVSO_CLASS_FUNCTION(), language_kvs_cmd_detect(), MP_KVS_FUNCTION(), objects_kvs_fnc_classes(), objects_kvs_fnc_instances(), objects_kvs_fnc_listObjects(), regchan_kvs_fnc_list(), reguser_kvs_fnc_list(), reguser_kvs_fnc_mask(), KvsObject_http::slotSslErrors(), str_kvs_fnc_grep(), str_kvs_fnc_split(), TC_KVS_FUNCTION(), toolbar_kvs_fnc_items(), toolbar_kvs_fnc_list(), KviKvsVariant::unserializeArray(), userlist_kvs_fnc_selected(), and window_kvs_fnc_list().
|
inline |
Returns the size of the array.
Referenced by KviKvsVariant::castToInteger(), KviKvsVariant::compare(), KviKvsVariantComparison::compareArrayHash(), KviKvsTreeNodeArrayCount::evaluateReadOnlyInObjectScope(), KviKvsTreeNodeOperationArrayAppend::execute(), file_kvs_cmd_writeBytes(), file_kvs_cmd_writeLines(), KviInputEditor::fillSpellCheckerCorrectionsPopup(), KvsObject_textedit::functionsetColor(), KviKvsCoreFunctions::KVSCF(), KVSO_CLASS_FUNCTION(), KviCellItemDelegate::sizeHint(), str_kvs_fnc_grep(), and theme_kvs_cmd_pack().
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.
Referenced by KviKvsArrayElement::~KviKvsArrayElement().
|
protected |
Referenced by appendAsString(), findNewSize(), getAt(), KviKvsArray(), rsort(), serialize(), set(), sort(), unset(), and ~KviKvsArray().
|
protected |
Referenced by findNewSize(), getAt(), KviKvsArray(), and set().
|
protected |
Referenced by append(), appendAsString(), findNewSize(), getAt(), KviKvsArray(), rsort(), serialize(), set(), sort(), unset(), and ~KviKvsArray().