KVIrc  4.9.2
DeveloperAPIs
Public Member Functions | Private Attributes | List of all members
KviKvsHash Class Reference

This class defines a new data type which contains hash data. More...

#include <KviKvsHash.h>

+ Inheritance diagram for KviKvsHash:

Public Member Functions

void appendAsString (QString &szBuffer) const
 Appends data to the hash converting it into a string. More...
 
void clear ()
 clear the hash More...
 
const KviPointerHashTable
< QString, KviKvsVariant > * 
dict ()
 Returns the internal dictionary of the hash. More...
 
KviKvsVariantfind (const QString &szKey) const
 Returns the element associated to the given key. More...
 
KviKvsVariantget (const QString &szKey)
 Returns the element associated to the given key. More...
 
bool isEmpty () const
 Returns true if the hash is empty. More...
 
 KviKvsHash ()
 Constructs the hash data. More...
 
 KviKvsHash (const KviKvsHash &hash)
 Constructs the hash data. More...
 
void serialize (QString &szResult)
 Serializes the hash to a given buffer. More...
 
void set (const QString &szKey, KviKvsVariant *pVal)
 Sets an element into the hash. More...
 
kvs_uint_t size () const
 Returns the size of the hash. More...
 
void unset (const QString &szKey)
 Unsets an element from the hash. More...
 
 ~KviKvsHash ()
 Destroys the array data. More...
 

Private Attributes

KviPointerHashTable< QString,
KviKvsVariant > * 
m_pDict
 

Detailed Description

This class defines a new data type which contains hash data.

Warning
This class must not have virtual functions nor destructor. Otherwise it will happily crash on windows when it is allocated in modules and destroyed anywhere else around

Constructor & Destructor Documentation

KviKvsHash::KviKvsHash ( )

Constructs the hash data.

Returns
KviKvsHash

References m_pDict, and KviPointerHashTable< Key, T >::setAutoDelete().

KviKvsHash::KviKvsHash ( const KviKvsHash hash)
KviKvsHash::~KviKvsHash ( )

Destroys the array data.

References m_pDict.

Member Function Documentation

void KviKvsHash::appendAsString ( QString &  szBuffer) const

Appends data to the hash converting it into a string.

Parameters
szBufferThe string to append
Returns
void

References KviPointerHashTableIterator< Key, T >::current(), and m_pDict.

Referenced by KviKvsVariant::appendAsString(), and KviKvsVariant::asString().

void KviKvsHash::clear ( )

clear the hash

References KviPointerHashTable< Key, T >::clear(), and m_pDict.

const KviPointerHashTable< QString, KviKvsVariant > * KviKvsHash::dict ( )
KviKvsVariant * KviKvsHash::find ( const QString &  szKey) const
KviKvsVariant * KviKvsHash::get ( const QString &  szKey)

Returns the element associated to the given key.

If the element doesn't exists, it returns an empty element. If the index is out of hash bounds, it increases the hash size, fillin the hash in with empty strings.

Parameters
szKeyThe key of the element to retrieve
Returns
KviKvsVariant *

References KviPointerHashTable< Key, T >::find(), m_pDict, and KviPointerHashTable< Key, T >::replace().

Referenced by KviKvsTreeNodeExtendedScopeVariable::evaluateReadWrite(), KviKvsTreeNodeGlobalVariable::evaluateReadWrite(), KviKvsTreeNodeLocalVariable::evaluateReadWrite(), KviKvsTreeNodeObjectField::evaluateReadWriteInObjectScope(), and KviKvsTreeNodeHashElement::evaluateReadWriteInObjectScope().

bool KviKvsHash::isEmpty ( ) const
void KviKvsHash::serialize ( QString &  szResult)

Serializes the hash to a given buffer.

Parameters
szResultThe buffer to store
Returns
void

References KviPointerHashTableIterator< Key, T >::current(), KviPointerHashTableIterator< Key, T >::currentKey(), m_pDict, and KviKvsVariant::serializeString().

Referenced by KviKvsVariant::serialize().

void KviKvsHash::set ( const QString &  szKey,
KviKvsVariant pVal 
)
kvs_uint_t KviKvsHash::size ( ) const
void KviKvsHash::unset ( const QString &  szKey)

Unsets an element from the hash.

Parameters
szKeyThe key of the element to unset
Returns
void

References m_pDict, and KviPointerHashTable< Key, T >::remove().

Referenced by KviKvsHashElement::~KviKvsHashElement().

Member Data Documentation

KviPointerHashTable<QString, KviKvsVariant>* KviKvsHash::m_pDict
private

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