KVIrc 5.2.6
Developer APIs
KviDataBuffer.h
Go to the documentation of this file.
1#ifndef _KVI_DATABUFFER_H_
2#define _KVI_DATABUFFER_H_
3//=============================================================================
4//
5// File : KviDataBuffer.h
6// Creation date : Thu Aug 23 17:04:25 2001 GMT by Szymon Stefanek
7//
8// This file is part of the KVIrc IRC client distribution
9// Copyright (C) 2001 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
27#include "kvi_settings.h"
28#include "KviHeapObject.h"
29
31{
32public:
33 // uSize MUST be greater than 0
34 // if data is non-zero, it MUST point to a buffer at least uSize bytes long
35 // and the data is COPIED from that buffer!
36 KviDataBuffer(int uSize, const unsigned char * data = nullptr);
39
40private:
42 unsigned char * m_pData;
43
44public:
45 int size() const { return m_uSize; };
46 unsigned char * data() const { return m_pData; };
47 // uSize MUST be smaller or equal to size()
48 // consumes data!
49 void remove(int uSize);
50 void clear()
51 {
52 if(m_uSize > 0)
54 };
55 // uSize MUST be greater than 0
56 void resize(int uSize);
57 void addSize(int uSize) { resize(m_uSize + uSize); };
58 void append(const unsigned char * data, int uSize);
59 void append(const KviDataBuffer & b) { append(b.data(), b.size()); };
60 int find(unsigned char c);
61 int find(const unsigned char * block, int uSize);
62};
63
64#endif //_KVI_DATABUFFER_H_
Heap Object.
KviDataBuffer(int uSize, const unsigned char *data=nullptr)
Definition KviDataBuffer.cpp:34
unsigned char * m_pData
Definition KviDataBuffer.h:42
void clear()
Definition KviDataBuffer.h:50
void append(const KviDataBuffer &b)
Definition KviDataBuffer.h:59
void addSize(int uSize)
Definition KviDataBuffer.h:57
int size() const
Definition KviDataBuffer.h:45
unsigned char * data() const
Definition KviDataBuffer.h:46
int m_uSize
Definition KviDataBuffer.h:41
void resize(int uSize)
Definition KviDataBuffer.cpp:122
void remove(int uSize)
Definition KviDataBuffer.cpp:104
Definition KviHeapObject.h:119
This file contains compile time settings.
#define KVILIB_API
Definition kvi_settings.h:124