15 constexpr byte 
operator"" _b(
unsigned long long int i)  { 
return static_cast<byte
>(i); }
 
   17 constexpr byte 
operator"" _b(
char c)                    { 
return static_cast<byte
>(c); }
 
   26 class Bytes : 
public vector<byte>
 
   32     Bytes(ByteBufConst bs)                              : vector(bs.begin(), bs.end()) {}
 
   43 inline Bytes operator"" _b(
const char* str, 
szt len)    { 
return Bytes(str, str+len); }
 
   46 inline ostream& 
operator<<(ostream& os, ByteBufConst val)   { os << 
Bytes(val); 
return os; }
 
   50 typename std::enable_if<std::is_integral<Int>::value, Bytes>::type
 
   53     typedef typename std::make_unsigned<Int>::type Unsigned;
 
   54     Bytes bs(
sizeof(Int));
 
   58         BitOp::toPartsLittle(static_cast<Unsigned>(val), bs.data());
 
   61         BitOp::toPartsBig(static_cast<Unsigned>(val), bs.data());
 
   69 typename std::enable_if<std::is_integral<Int>::value, Int>::type
 
   72     typedef typename std::make_unsigned<Int>::type Unsigned;
 
   76         return static_cast<Int
>(BitOp::fromPartsLittle<Unsigned>(bs.data()));
 
   78         return static_cast<Int
>(BitOp::fromPartsBig<Unsigned>(bs.data()));
 
   84 struct ByteArray : array<byte, N>
 
   90     template<
class... 
Bytes>
 
A contiguous region of referenced (not owned by object) memory. 
Definition: Buffer.h:17
 
friend istream & operator>>(istream &is, Bytes &val)
Read bytes from string stream using current decoding. 
Definition: Bytes.cpp:16
 
uint8 byte
An unsigned 8-bit integer. 
Definition: Bytes.h:12
 
friend istream & operator>>(istream &is, ByteArray &val)
Read byte array from string stream using current decoding. 
Definition: Bytes.h:98
 
std::enable_if< std::is_integral< Int >::value, Int >::type fromBytes(const Bytes &bs, Endian order=Endian::big)
Convert bytes to integral value. 
Definition: Bytes.h:70
 
friend ostream & operator<<(ostream &os, const ByteArray &val)
Write byte array to string stream using current encoding. 
Definition: Bytes.h:96
 
Buffer< const byte > ByteBufConst
Definition: Bytes.h:21
 
Bytes(const ByteArray< N > &bs)
Definition: Bytes.h:34
 
ByteArray(ByteBufConst bs)
Definition: Bytes.h:92
 
ByteArray(const Bytes &bs)
Definition: Bytes.h:93
 
unsigned char uint8
Definition: Core.h:12
 
T * end() const 
Returns an iterator to the end. 
Definition: Buffer.h:67
 
#define assert(...)                                                              
Forwards to assert_#args. See assert_1(), assert_2(). 
Definition: Debug.h:24
 
szt size() const 
Returns the number of elements. 
Definition: Buffer.h:78
 
friend ostream & operator<<(ostream &os, const Bytes &val)
Write bytes to string stream using current encoding. 
Definition: Bytes.cpp:9
 
String of bytes. 
Definition: Bytes.h:26
 
size_t szt
Size type, shorthand for size_t. 
Definition: Core.h:90
 
ByteArray(byte b, Bytes &&...bs)
Construct from list of byte values. 
Definition: Bytes.h:91
 
std::enable_if< std::is_integral< Int >::value, Bytes >::type toBytes(Int val, Endian order=Endian::big)
Convert integral value to bytes. 
Definition: Bytes.h:51
 
Buffer< byte > ByteBuf
A buffer of bytes. 
Definition: Bytes.h:20
 
int size(const StdContainer &cont)
Safely get the size of a std container as a signed integer. 
Definition: StdUtil.h:19
 
T * begin() const 
Returns an iterator to the beginning. 
Definition: Buffer.h:65
 
Bytes(ByteBufConst bs)
Definition: Bytes.h:32
 
Fixed array of N bytes. 
Definition: Bytes.h:23
 
ostream & operator<<(ostream &os, const Bytes &val)
Definition: Bytes.cpp:9
 
array< byte, N > Super
Definition: Bytes.h:86
 
Endian
Endian (byte order) types. 
Definition: BitOp.h:11
 
Global Honeycomb namespace.