Sirikata
|
Represents a single block of data, and also knows the range of the file it came from. More...
#include <TransferData.hpp>
Public Member Functions | |
DenseData (const Range &range) | |
DenseData (const std::string &str, Range::base_type start=0, bool wholeFile=true) | |
DenseData (const Range &range, const char *str) | |
DenseData (const Range &range, const std::vector< unsigned char > &data) | |
const unsigned char * | data () const |
equals dataAt(startbyte()). | |
const unsigned char * | begin () const |
const unsigned char * | end () const |
unsigned char * | writableData () |
Returns a non-const data, starting at startbyte(). | |
const unsigned char * | dataAt (base_type offset) const |
Returns a char* to data at a cetain offset. | |
std::string | asString () const |
void | setLength (size_t len, bool is_npos) |
Sets the length of the range, as well as allocates more space in the data vector. | |
void | append (const char *data, size_t len, bool is_npos) |
void | append (const std::vector< unsigned char > &data, bool is_npos) |
void | append (const std::vector< unsigned char > &data, bool is_npos, std::vector< unsigned char >::const_iterator begin, std::vector< unsigned char >::const_iterator end) |
Private Member Functions | |
DenseData (const char *str, size_t len) | |
DenseData (const unsigned char *str, size_t len) | |
Private Attributes | |
std::vector< unsigned char > | mData |
Represents a single block of data, and also knows the range of the file it came from.
Sirikata::Transfer::DenseData::DenseData | ( | const char * | str, |
size_t | len | ||
) | [inline, private] |
Sirikata::Transfer::DenseData::DenseData | ( | const unsigned char * | str, |
size_t | len | ||
) | [inline, private] |
Sirikata::Transfer::DenseData::DenseData | ( | const Range & | range | ) | [inline] |
References Sirikata::Transfer::Range::length(), and mData.
Sirikata::Transfer::DenseData::DenseData | ( | const std::string & | str, |
Range::base_type | start = 0 , |
||
bool | wholeFile = true |
||
) | [inline] |
References setLength(), and writableData().
Sirikata::Transfer::DenseData::DenseData | ( | const Range & | range, |
const char * | str | ||
) | [inline] |
References Sirikata::Transfer::Range::length().
Sirikata::Transfer::DenseData::DenseData | ( | const Range & | range, |
const std::vector< unsigned char > & | data | ||
) | [inline] |
References Sirikata::Transfer::Range::length().
void Sirikata::Transfer::DenseData::append | ( | const char * | data, |
size_t | len, | ||
bool | is_npos | ||
) | [inline] |
References Sirikata::Transfer::Range::length(), mData, setLength(), and writableData().
Referenced by append().
void Sirikata::Transfer::DenseData::append | ( | const std::vector< unsigned char > & | data, |
bool | is_npos | ||
) | [inline] |
References append().
void Sirikata::Transfer::DenseData::append | ( | const std::vector< unsigned char > & | data, |
bool | is_npos, | ||
std::vector< unsigned char >::const_iterator | begin, | ||
std::vector< unsigned char >::const_iterator | end | ||
) | [inline] |
References begin(), end(), Sirikata::Transfer::Range::length(), mData, and setLength().
std::string Sirikata::Transfer::DenseData::asString | ( | ) | const [inline] |
References data(), and Sirikata::Transfer::Range::length().
const unsigned char* Sirikata::Transfer::DenseData::begin | ( | ) | const [inline] |
const unsigned char* Sirikata::Transfer::DenseData::data | ( | ) | const [inline] |
equals dataAt(startbyte()).
References mData.
Referenced by asString(), begin(), end(), and Sirikata::Transfer::SparseData::const_iterator::setDataPtr().
const unsigned char* Sirikata::Transfer::DenseData::dataAt | ( | base_type | offset | ) | const [inline] |
Returns a char* to data at a cetain offset.
Does not return the corresponding Length, but it is your responsibility to compare to endbyte(). Note that it will also return NULL if startbyte() > offset.
References Sirikata::Transfer::Range::endbyte(), mData, and Sirikata::Transfer::Range::startbyte().
const unsigned char* Sirikata::Transfer::DenseData::end | ( | ) | const [inline] |
References data(), and Sirikata::Transfer::Range::length().
Referenced by append().
void Sirikata::Transfer::DenseData::setLength | ( | size_t | len, |
bool | is_npos | ||
) | [inline] |
Sets the length of the range, as well as allocates more space in the data vector.
References mData.
Referenced by append(), and DenseData().
unsigned char* Sirikata::Transfer::DenseData::writableData | ( | ) | [inline] |
Returns a non-const data, starting at startbyte().
References mData.
Referenced by append(), Sirikata::Graphics::CDNArchive::CDNArchive(), and DenseData().
std::vector<unsigned char> Sirikata::Transfer::DenseData::mData [private] |
Referenced by append(), data(), dataAt(), DenseData(), setLength(), and writableData().