|
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
21 #ifndef ELM_UTIL_BUFFER_H_
22 #define ELM_UTIL_BUFFER_H_
24 #include <elm/array.h>
25 #include <elm/types.h>
26 #include <elm/util/Exception.h>
37 _size(
size), _buf(new char[
size]), _free(true) { }
39 : _size(
size), _buf(buf), _free(false) { }
40 inline ~Buffer() {
if(_free)
delete [] _buf; }
45 { check(i);
return _buf[i]; }
47 { check(i);
return _buf[i]; }
void copy(T *target, const T *source, int size)
Definition: array.h:70
Printable< T, M > p(const T &data, const M &man)
Definition: Output.h:302
void copyTo(void *p, t::size size, t::size offset=0) const
Definition: Buffer.h:49
void read(F f, t::size size, t::size offset=0) const
Definition: Buffer.h:55
Definition: Exception.h:29
~Buffer()
Definition: Buffer.h:40
char operator[](t::size i) const
Definition: Buffer.h:44
t::size size() const
Definition: Buffer.h:42
char & operator[](t::size i)
Definition: Buffer.h:46
uint64 size
Definition: arch.h:35
static const t::size default_size
Definition: Buffer.h:34
void write(F f, t::size size, t::size offset=0)
Definition: Buffer.h:58
void copyFrom(void *p, t::size size, t::size offset=0)
Definition: Buffer.h:51
Buffer(t::size size=default_size)
Definition: Buffer.h:36
Buffer(char *buf, t::size size)
Definition: Buffer.h:38
uint64 offset
Definition: arch.h:36