diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-03-12 17:33:12 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-03-12 17:33:12 (GMT) |
commit | d1a913e2b94e01ebe3f91aff547c37ba8b2cd125 (patch) | |
tree | e63ae567b4eb16548c364026313f2850758ed08a /Swiften | |
parent | b4c4b7c2e8866f256944767d2265d04c103b31bd (diff) | |
download | swift-contrib-d1a913e2b94e01ebe3f91aff547c37ba8b2cd125.zip swift-contrib-d1a913e2b94e01ebe3f91aff547c37ba8b2cd125.tar.bz2 |
Add ByteArray -> vector conversion functions.
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/Base/ByteArray.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Swiften/Base/ByteArray.h b/Swiften/Base/ByteArray.h index 26adedc..ad2c1e5 100644 --- a/Swiften/Base/ByteArray.h +++ b/Swiften/Base/ByteArray.h @@ -43,6 +43,9 @@ namespace Swift { } } + ByteArray(const std::vector<unsigned char>& data) : data_(data) { + } + const unsigned char* getData() const { return data_.empty() ? NULL : &data_[0]; } @@ -50,6 +53,14 @@ namespace Swift { unsigned char* getData() { return data_.empty() ? NULL : &data_[0]; } + + const std::vector<unsigned char>& getVector() const { + return data_; + } + + std::vector<unsigned char>& getVector() { + return data_; + } size_t getSize() const { return data_.size(); |