From d1a913e2b94e01ebe3f91aff547c37ba8b2cd125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be> Date: Sat, 12 Mar 2011 18:33:12 +0100 Subject: Add ByteArray -> vector conversion functions. 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(); -- cgit v0.10.2-6-g49f6