dht::basic_data Class Reference

A simple data block. More...

#include <dht/basic_data.h>

Inheritance diagram for dht::basic_data:

dht::store_data dht::key dht::value List of all members.

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.

Detailed Description

A simple data block.

This class encapsulates a simple data block which may contain also non-alphanumeric data. Should be used for relatively short amounts of data.


Constructor & Destructor Documentation

dht::basic_data::basic_data (  )  [inline]

constructor

dht::basic_data::basic_data ( const void *  data,
size_t  len 
) [inline]

constructor

Parameters:
data a pointer to the data
len length of the data
Copies the data.

dht::basic_data::basic_data ( const std::string &  str  )  [inline]

constructor

Parameters:
str string object
Copies the string data

dht::basic_data::basic_data ( const char *  str  )  [inline]

constructor

Parameters:
str NULL terminated C string
Copies the string data

virtual dht::basic_data::~basic_data (  )  [virtual]

Destructor.

Frees the data held by this object


Member Function Documentation

void dht::basic_data::set ( const void *  data,
size_t  len 
) [inline]

Sets data.

Parameters:
data a pointer to the data
len length of the data
Copies the data.

void dht::basic_data::set ( const std::string &  str  )  [inline]

Sets data from string object.

Parameters:
str string object
Copies the string data

void dht::basic_data::set ( const char *  str  )  [inline]

Sets data from C string.

Parameters:
str NULL terminated C string
Copies the string data

const void * dht::basic_data::data (  )  const [inline]

Returns a pointer to the data.

Returns:
a pointer to the data.

const char * dht::basic_data::c_str (  )  const [inline]

Returns a pointer to the data.

Returns:
a NULL terminated pointer to the data

size_t dht::basic_data::size (  )  const [inline]

Returns the length of the data.

Returns:
length of the data


The documentation for this class was generated from the following file:
Generated on Thu Mar 1 16:18:47 2007 for libdht by  doxygen 1.5.1