/* * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once #include #include #include #include namespace Swift { typedef std::vector ByteArray; SWIFTEN_API ByteArray createByteArray(const std::string& s); SWIFTEN_API ByteArray createByteArray(const char* c); inline ByteArray createByteArray(const unsigned char* c, size_t n) { return ByteArray(c, c + n); } inline ByteArray createByteArray(const char* c, size_t n) { return ByteArray(c, c + n); } inline ByteArray createByteArray(char c) { return std::vector(1, static_cast(c)); } template static const T* vecptr(const std::vector& v) { return v.empty() ? nullptr : &v[0]; } template static T* vecptr(std::vector& v) { return v.empty() ? nullptr : &v[0]; } SWIFTEN_API std::string byteArrayToString(const ByteArray& b); SWIFTEN_API void readByteArrayFromFile(ByteArray&, const boost::filesystem::path& file); }