summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-03-12 17:33:12 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-03-12 17:33:12 (GMT)
commitd1a913e2b94e01ebe3f91aff547c37ba8b2cd125 (patch)
treee63ae567b4eb16548c364026313f2850758ed08a
parentb4c4b7c2e8866f256944767d2265d04c103b31bd (diff)
downloadswift-contrib-d1a913e2b94e01ebe3f91aff547c37ba8b2cd125.zip
swift-contrib-d1a913e2b94e01ebe3f91aff547c37ba8b2cd125.tar.bz2
Add ByteArray -> vector conversion functions.
-rw-r--r--Swiften/Base/ByteArray.h11
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();