00001 #ifndef PROTON_BINARY_HPP
00002 #define PROTON_BINARY_HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "./internal/export.hpp"
00026 #include "./types_fwd.hpp"
00027
00028 #include <iosfwd>
00029 #include <vector>
00030
00031 namespace proton {
00032
00034 class binary : public std::vector<uint8_t> {
00035 public:
00038 explicit binary() : std::vector<value_type>() {}
00039 explicit binary(size_t n) : std::vector<value_type>(n) {}
00040 explicit binary(size_t n, value_type x) : std::vector<value_type>(n, x) {}
00041 explicit binary(const std::string& s) : std::vector<value_type>(s.begin(), s.end()) {}
00042 template <class Iter> binary(Iter first, Iter last) : std::vector<value_type>(first, last) {}
00044
00046 operator std::string() const { return std::string(begin(), end()); }
00047
00049 binary& operator=(const std::string& x) { assign(x.begin(), x.end()); return *this; }
00050 };
00051
00053 PN_CPP_EXTERN std::ostream& operator<<(std::ostream&, const binary&);
00054
00055 }
00056
00057 #endif // PROTON_BINARY_HPP