KVIrc  4.9.2
DeveloperAPIs
KviKvsArray.h
Go to the documentation of this file.
1 #ifndef _KVI_KVS_ARRAY_H_
2 #define _KVI_KVS_ARRAY_H_
3 //=============================================================================
4 //
5 // File : KviKvsArray.h
6 // Creation date : Tue 07 Oct 2003 01:07:31 by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2003-2010 Szymon Stefanek <pragma at kvirc dot net>
10 //
11 // This program is FREE software. You can redistribute it and/or
12 // modify it under the terms of the GNU General Public License
13 // as published by the Free Software Foundation; either version 2
14 // of the License, or (at your option) any later version.
15 //
16 // This program is distributed in the HOPE that it will be USEFUL,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 // See the GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, write to the Free Software Foundation,
23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 //
25 //=============================================================================
26 
33 #include "kvi_settings.h"
34 #include "KviKvsVariant.h"
35 #include "KviHeapObject.h"
36 
44 {
45 public:
50  KviKvsArray();
51 
59  KviKvsArray(const KviKvsArray & array);
60 
64  ~KviKvsArray();
65 
66 protected:
70 
71 public:
77  void unset(kvs_uint_t uIdx);
78 
85  void set(kvs_uint_t uIdx, KviKvsVariant * pVal);
86 
90  void append(KviKvsVariant * pVal);
91 
97  KviKvsVariant * at(kvs_uint_t uIdx) const { return (uIdx < m_uSize) ? m_pData[uIdx] : 0; };
98 
107  KviKvsVariant * getAt(kvs_uint_t uIdx);
108 
113  bool isEmpty() { return m_uSize == 0; };
114 
119  kvs_uint_t size() { return m_uSize; };
120 
126  void appendAsString(QString & szBuffer);
127 
133  void serialize(QString & szResult);
134 
139  void sort();
140 
145  void rsort();
146 
147 protected:
152  void findNewSize();
153 
154 private:
161  static int compare(const void * pV1, const void * pV2);
162 
169  static int compareReverse(const void * pV1, const void * pV2);
170 };
171 
172 #endif // _KVI_KVS_ARRAY_H_
Definition: KviHeapObject.h:124
This class defines a new data type which contains variant data.
Definition: KviKvsVariant.h:351
#define KVIRC_API
Definition: kvi_settings.h:128
KviKvsVariant * at(kvs_uint_t uIdx) const
Returns the element at the given index.
Definition: KviKvsArray.h:97
kvs_uint_t m_uAllocSize
Definition: KviKvsArray.h:69
kvs_uint_t m_uSize
Definition: KviKvsArray.h:68
KviKvsVariant ** m_pData
Definition: KviKvsArray.h:67
kvi_u64_t kvs_uint_t
Definition: KviKvsTypes.h:34
kvs_uint_t size()
Returns the size of the array.
Definition: KviKvsArray.h:119
bool isEmpty()
Returns true if the array is empty.
Definition: KviKvsArray.h:113
Heap Object.
void set(void *dst_ptr, char c, int len)
Initializes len bytes of memory starting from dst_ptr to c.
Definition: KviMemory.h:152
This class defines a new data type which contains array data.
Definition: KviKvsArray.h:43
Handling of variant data type in KVS.
char szBuffer[4096]
Definition: winamp.cpp:77
This file contains compile time settings.