KVIrc  4.9.2
DeveloperAPIs
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 {
32 public:
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 = 0);
37  KviDataBuffer();
38  ~KviDataBuffer();
39 
40 private:
41  int m_uSize;
42  unsigned char * m_pData;
43 
44 public:
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)
53  remove(m_uSize);
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_
Definition: KviHeapObject.h:124
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
Definition: KviDataBuffer.h:30
unsigned char * m_pData
Definition: KviDataBuffer.h:42
void append(const KviDataBuffer &b)
Definition: KviDataBuffer.h:59
int m_uSize
Definition: KviDataBuffer.h:41
unsigned char * data() const
Definition: KviDataBuffer.h:46
Heap Object.
void clear()
Definition: KviDataBuffer.h:50
This file contains compile time settings.
#define KVILIB_API
Definition: kvi_settings.h:125
int size() const
Definition: KviDataBuffer.h:45
void addSize(int uSize)
Definition: KviDataBuffer.h:57