sprint 1-alpha
|
Use an user buffer to implement IO and cat of string/data. More...
#include <storage_buffer.h>
Public Member Functions | |
template<class R > | |
storage_buffer (R *ptr, unsigned int capacity) | |
initialize from an user buffer | |
template<class R > | |
storage_buffer (const R &buf) | |
initialize from a buffer object | |
template<class T > | |
void | insert (const T *a, int len) |
insert array data | |
void | push_back (char c) |
storage_buffer & | operator<< (const char *str) |
storage_buffer & | operator<< (char c) |
template<class T > | |
storage_buffer & | operator<< (const T &c) |
const char * | str () |
place \0 at the end of buffer and return the string | |
const char * | data () const |
return the inner buffer | |
unsigned int | size () const |
size of string | |
unsigned int | lenght () const |
size of data stored in bytes | |
unsigned int | capacity () const |
max capacity |
Use an user buffer to implement IO and cat of string/data.
char buffer[256]; // ... foo(storage_buffer<char> (buffer, 256));
storage_buffer& sprint::storage_buffer::operator<< | ( | char | c | ) |
insert a char
storage << 'a';
storage_buffer& sprint::storage_buffer::operator<< | ( | const T & | c | ) |
add a generic T object
storage << my_class;
storage_buffer& sprint::storage_buffer::operator<< | ( | const char * | str | ) |
insert a string
storage << "Hello World";
void sprint::storage_buffer::push_back | ( | char | c | ) |
insert a single char for compatibilty with policy based on vector