#include <dht/basic_data.h>
Inheritance diagram for dht::basic_data:
Public Member Functions | |
basic_data () | |
constructor | |
basic_data (const void *data, size_t len) | |
constructor | |
basic_data (const std::string &str) | |
constructor | |
basic_data (const char *str) | |
constructor | |
virtual | ~basic_data () |
Destructor. | |
void | set (const void *data, size_t len) |
Sets data. | |
void | set (const std::string &str) |
Sets data from string object. | |
void | set (const char *str) |
Sets data from C string. | |
const void * | data () const |
Returns a pointer to the data. | |
const char * | c_str () const |
Returns a pointer to the data. | |
size_t | size () const |
Returns the length of the data. |
This class encapsulates a simple data block which may contain also non-alphanumeric data. Should be used for relatively short amounts of data.
dht::basic_data::basic_data | ( | ) | [inline] |
constructor
dht::basic_data::basic_data | ( | const void * | data, | |
size_t | len | |||
) | [inline] |
constructor
data | a pointer to the data | |
len | length of the data |
dht::basic_data::basic_data | ( | const std::string & | str | ) | [inline] |
constructor
str | string object |
dht::basic_data::basic_data | ( | const char * | str | ) | [inline] |
constructor
str | NULL terminated C string |
virtual dht::basic_data::~basic_data | ( | ) | [virtual] |
Destructor.
Frees the data held by this object
void dht::basic_data::set | ( | const void * | data, | |
size_t | len | |||
) | [inline] |
Sets data.
data | a pointer to the data | |
len | length of the data |
void dht::basic_data::set | ( | const std::string & | str | ) | [inline] |
Sets data from string object.
str | string object |
void dht::basic_data::set | ( | const char * | str | ) | [inline] |
Sets data from C string.
str | NULL terminated C string |
const void * dht::basic_data::data | ( | ) | const [inline] |
Returns a pointer to the data.
const char * dht::basic_data::c_str | ( | ) | const [inline] |
Returns a pointer to the data.
size_t dht::basic_data::size | ( | ) | const [inline] |
Returns the length of the data.