/* * Copyright (c) 2010 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #pragma once #include #include namespace Swift { typedef std::vector ByteArray; ByteArray createByteArray(const std::string& s); 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, c); } template static const T* vecptr(const std::vector& v) { return v.empty() ? NULL : &v[0]; } template static T* vecptr(std::vector& v) { return v.empty() ? NULL : &v[0]; } std::string byteArrayToString(const ByteArray& b); void readByteArrayFromFile(ByteArray&, const std::string& file); }