limal
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
limal
ByteBuffer.hpp
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| |
3
| _ _ _ _ __ _ |
4
| | | | | | \_/ | / \ | | |
5
| | | | | | |_| | / /\ \ | | |
6
| | |__ | | | | | | / ____ \ | |__ |
7
| |____||_| |_| |_|/ / \ \|____| |
8
| |
9
| core library |
10
| |
11
| (C) SUSE Linux Products GmbH |
12
\----------------------------------------------------------------------/
13
14
File: ByteBuffer.hpp
15
16
Maintainer: Michael Calmer
17
18
/-*/
26
#ifndef LIMAL_BYTEBUFFER_HPP
27
#define LIMAL_BYTEBUFFER_HPP
28
29
#include <
limal/config.h
>
30
#include <blocxx/COWIntrusiveReference.hpp>
31
#include <iostream>
32
extern
"C"
33
{
34
#include <sys/types.h>
35
}
36
37
namespace
LIMAL_NAMESPACE
38
{
39
40
/*
41
* Forward declaration.
42
*/
43
class
ByteBufferImpl;
44
45
55
class
ByteBuffer
56
{
57
public
:
58
62
ByteBuffer
();
63
72
ByteBuffer
(
const
char
*str);
73
82
ByteBuffer
(
const
char
*ptr,
size_t
len);
83
94
ByteBuffer
(
const
ByteBuffer
&buf);
95
99
~
ByteBuffer
();
100
108
void
clear();
109
113
bool
empty()
const
;
114
120
size_t
size()
const
;
121
127
const
char
* data()
const
;
128
136
char
at(
size_t
pos)
const
;
137
145
void
append(
const
char
*ptr,
size_t
len);
146
153
void
append(
char
c);
154
155
#ifndef SWIG
156
167
ByteBuffer
& operator=(
const
ByteBuffer
& buf);
168
178
const
char
& operator[](
size_t
pos)
const
;
179
189
char
& operator[](
size_t
pos);
190
202
ByteBuffer
& operator+=(
const
ByteBuffer
& buf);
203
204
205
// friends
206
210
friend
std::ostream&
operator<<
(std::ostream &out,
211
const
ByteBuffer
&buf);
212
217
friend
bool
operator==
(
const
ByteBuffer
&l,
const
ByteBuffer
&r);
218
223
friend
bool
operator!=
(
const
ByteBuffer
&l,
const
ByteBuffer
&r);
224
229
friend
bool
operator<(
const
ByteBuffer
&l,
const
ByteBuffer
&r);
230
235
friend
bool
operator>(
const
ByteBuffer
&l,
const
ByteBuffer
&r);
236
241
friend
bool
operator<=(
const
ByteBuffer
&l,
const
ByteBuffer
&r);
242
247
friend
bool
operator>=(
const
ByteBuffer
&l,
const
ByteBuffer
&r);
248
255
friend
ByteBuffer
operator+
(
const
ByteBuffer
& b1,
const
ByteBuffer
& b2);
256
257
#endif
258
259
private
:
260
blocxx::COWIntrusiveReference<ByteBufferImpl>
m_impl
;
261
};
262
263
}
// End Of LIMAL_NAMESPACE
264
#endif // LIMAL_BYTEBUFFER_HPP
Generated by
1.8.2