Honeycomb  0.1
Component-Model Framework
Classes | Namespaces | Functions
ByteStream.h File Reference
#include "Honey/String/String.h"
#include "Honey/String/Bytes.h"
#include "Honey/Misc/StdUtil.h"
#include "Honey/String/Id.h"
#include "Honey/Memory/SharedPtr.h"
Include dependency graph for ByteStream.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  honey::ByteStreamBuf
 A stream I/O buffer of bytes, to be passed into ByteStream. More...
 
class  honey::ByteStream
 An I/O stream into which objects may be serialized and subsequently deserialized. More...
 

Namespaces

 honey
 Global Honeycomb namespace.
 
 honey::bytestream
 ByteStream util.
 

Functions

ByteStream & honey::operator<< (ByteStream &os, const bool val)
 Bool to bytes. More...
 
ByteStream & honey::operator<< (ByteStream &os, const byte val)
 Byte to bytes. More...
 
ByteStream & honey::operator<< (ByteStream &os, const char val)
 UTF-8 char to bytes. More...
 
template<class T , typename std::enable_if< std::is_integral< T >::value||std::is_floating_point< T >::value, int >::type = 0>
ByteStream & honey::operator<< (ByteStream &os, const T val)
 Multi-byte number to big-endian bytes. More...
 
ByteStream & honey::operator<< (ByteStream &os, Char val)
 Char to bytes. More...
 
ByteStream & honey::operator>> (ByteStream &is, bool &val)
 Bool from bytes. More...
 
ByteStream & honey::operator>> (ByteStream &is, byte &val)
 Byte from bytes. More...
 
ByteStream & honey::operator>> (ByteStream &is, char &val)
 UTF-8 char from bytes. More...
 
template<class T , typename std::enable_if< std::is_integral< T >::value||std::is_floating_point< T >::value, int >::type = 0>
ByteStream & honey::operator>> (ByteStream &is, T &val)
 Multi-byte number from big-endian bytes. More...
 
ByteStream & honey::operator>> (ByteStream &is, Char &val)
 Char from bytes. More...
 
template<class Int , typename std::enable_if< std::is_integral< typename mt::removeRef< Int >::type >::value, int >::type = 0>
auto honey::bytestream::varSize (Int &&val)
 Write or read a size (a positive integer) using a minimal number of bytes. More...
 
template<class T1 , class T2 >
ByteStream & honey::operator<< (ByteStream &os, const pair< T1, T2 > &p)
 Pair to bytes. More...
 
template<class Tuple >
std::enable_if< mt::isTuple< Tuple >::value, ByteStream & >::type honey::operator<< (ByteStream &os, Tuple &&t)
 Tuple to bytes. More...
 
template<class T , szt N>
ByteStream & honey::operator<< (ByteStream &os, const array< T, N > &a)
 Array to bytes. More...
 
template<class T , szt N, typename std::enable_if<!std::is_same< T, char >::value &&!std::is_same< T, Char >::value, int >::type = 0>
ByteStream & honey::operator<< (ByteStream &os, const T(&a)[N])
 C-array to bytes. C-arrays of chars are interpreted as C-strings, so for proper char arrays use std::array instead. More...
 
template<class T , class Alloc >
ByteStream & honey::operator<< (ByteStream &os, const vector< T, Alloc > &vec)
 Vector to bytes. More...
 
ByteStream & honey::operator<< (ByteStream &os, const String &str)
 String to bytes. More...
 
ByteStream & honey::operator<< (ByteStream &os, const Char *str)
 C-string to bytes. More...
 
ByteStream & honey::operator<< (ByteStream &os, const std::string &str)
 UTF-8 string to bytes. More...
 
ByteStream & honey::operator<< (ByteStream &os, const char *str)
 UTF-8 C-string to bytes. More...
 
ByteStream & honey::operator<< (ByteStream &os, const Bytes &bs)
 Bytes to bytes. More...
 
ByteStream & honey::operator<< (ByteStream &os, ByteBufConst bs)
 Byte buffer to bytes. More...
 
template<class T , class Compare , class Alloc >
ByteStream & honey::operator<< (ByteStream &os, const set< T, Compare, Alloc > &set)
 Set to bytes. More...
 
template<class T , class Compare , class Alloc >
ByteStream & honey::operator<< (ByteStream &os, const multiset< T, Compare, Alloc > &set)
 Multi-Set to bytes. More...
 
template<class Key , class Hash , class KeyEqual , class Alloc >
ByteStream & honey::operator<< (ByteStream &os, const unordered_set< Key, Hash, KeyEqual, Alloc > &set)
 Unordered Set to bytes. More...
 
template<class Key , class Hash , class KeyEqual , class Alloc >
ByteStream & honey::operator<< (ByteStream &os, const unordered_multiset< Key, Hash, KeyEqual, Alloc > &set)
 Unordered Multi-Set to bytes. More...
 
template<class Key , class T , class Compare , class Alloc >
ByteStream & honey::operator<< (ByteStream &os, const std::map< Key, T, Compare, Alloc > &map)
 Map to bytes. More...
 
template<class Key , class T , class Compare , class Alloc >
ByteStream & honey::operator<< (ByteStream &os, const multimap< Key, T, Compare, Alloc > &map)
 Multi-Map to bytes. More...
 
template<class Key , class T , class Hash , class KeyEqual , class Alloc >
ByteStream & honey::operator<< (ByteStream &os, const unordered_map< Key, T, Hash, KeyEqual, Alloc > &map)
 Unordered Map to bytes. More...
 
template<class Key , class T , class Hash , class KeyEqual , class Alloc >
ByteStream & honey::operator<< (ByteStream &os, const unordered_multimap< Key, T, Hash, KeyEqual, Alloc > &map)
 Unordered Multi-Map to bytes. More...
 
template<class T1 , class T2 >
ByteStream & honey::operator>> (ByteStream &is, pair< T1, T2 > &p)
 Pair from bytes. More...
 
template<class Tuple >
std::enable_if< mt::isTuple< Tuple >::value, ByteStream & >::type honey::operator>> (ByteStream &is, Tuple &t)
 Tuple from bytes. More...
 
template<class T , szt N>
ByteStream & honey::operator>> (ByteStream &is, array< T, N > &a)
 Array from bytes. More...
 
template<class T , szt N, typename std::enable_if<!std::is_same< T, char >::value &&!std::is_same< T, Char >::value, int >::type = 0>
ByteStream & honey::operator>> (ByteStream &is, T(&a)[N])
 C-array from bytes. C-arrays of chars are interpreted as C-strings, so for proper char arrays use std::array instead. More...
 
template<class T , class Alloc >
ByteStream & honey::operator>> (ByteStream &is, vector< T, Alloc > &vec)
 Vector from bytes. More...
 
ByteStream & honey::operator>> (ByteStream &is, String &str)
 String from bytes. More...
 
ByteStream & honey::operator>> (ByteStream &is, Char *str)
 C-string from bytes. Pointer must point to allocated memory that is large enough to hold string including null character. More...
 
ByteStream & honey::operator>> (ByteStream &is, std::string &str)
 UTF-8 string from bytes. More...
 
ByteStream & honey::operator>> (ByteStream &is, char *str)
 UTF-8 C-string from bytes. Pointer must point to allocated memory that is large enough to hold string including null character. More...
 
ByteStream & honey::operator>> (ByteStream &is, Bytes &bs)
 Bytes from bytes. More...
 
template<class T , typename std::enable_if< std::is_same< T, byte * >::value, int >::type = 0>
ByteStream & honey::operator>> (ByteStream &is, T bs)
 Byte C-string from bytes, unimplemented, use ByteStream::read(bs, n) instead. More...
 
template<class T , class Compare , class Alloc >
ByteStream & honey::operator>> (ByteStream &is, set< T, Compare, Alloc > &set)
 Set from bytes. More...
 
template<class T , class Compare , class Alloc >
ByteStream & honey::operator>> (ByteStream &is, multiset< T, Compare, Alloc > &set)
 Multi-Set from bytes. More...
 
template<class Key , class Hash , class KeyEqual , class Alloc >
ByteStream & honey::operator>> (ByteStream &is, unordered_set< Key, Hash, KeyEqual, Alloc > &set)
 Unordered Set from bytes. More...
 
template<class Key , class Hash , class KeyEqual , class Alloc >
ByteStream & honey::operator>> (ByteStream &is, unordered_multiset< Key, Hash, KeyEqual, Alloc > &set)
 Unordered Multi-Set from bytes. More...
 
template<class Key , class T , class Compare , class Alloc >
ByteStream & honey::operator>> (ByteStream &is, std::map< Key, T, Compare, Alloc > &map)
 Map from bytes. More...
 
template<class Key , class T , class Compare , class Alloc >
ByteStream & honey::operator>> (ByteStream &is, multimap< Key, T, Compare, Alloc > &map)
 Multi-Map from bytes. More...
 
template<class Key , class T , class Hash , class KeyEqual , class Alloc >
ByteStream & honey::operator>> (ByteStream &is, unordered_map< Key, T, Hash, KeyEqual, Alloc > &map)
 Unordered Map from bytes. More...
 
template<class Key , class T , class Hash , class KeyEqual , class Alloc >
ByteStream & honey::operator>> (ByteStream &is, unordered_multimap< Key, T, Hash, KeyEqual, Alloc > &map)
 Unordered Multi-Map from bytes. More...
 
ByteStream & honey::operator<< (ByteStream &os, const Id &val)
 Id to bytes. More...
 
ByteStream & honey::operator>> (ByteStream &is, Id &val)
 Id from bytes. More...
 
ByteStream & honey::operator<< (ByteStream &os, const IdLiteral &val)
 Literal id to bytes. More...
 
ByteStream & honey::operator<< (ByteStream &os, const NameId &val)
 Named id to bytes. More...
 
ByteStream & honey::operator>> (ByteStream &is, NameId &val)
 Named id from bytes. More...
 
auto honey::bytestream::pushAlloc (const function< void *(szt)> &alloc)
 Push an allocator onto the input bytestream for subsequent unique/shared pointer object allocations. More...
 
auto honey::bytestream::popAlloc ()
 Pop an allocator from the input bytestream. More...
 
auto honey::bytestream::pushSharedTable (const Id &id)
 Push a shared table id onto the bytestream for subsequent shared pointer serialization. More...
 
auto honey::bytestream::popSharedTable ()
 Pop a shared table id from the bytestream. More...
 
auto honey::bytestream::reset ()
 Reset bytestream manipulator state. More...
 
template<class T , class Fin >
ByteStream & honey::operator<< (ByteStream &os, const UniquePtr< T, Fin > &p)
 UniquePtr to bytes, outputs object pointed to (and exists flag), or a null flag if no object. More...
 
template<class T , class Fin >
ByteStream & honey::operator>> (ByteStream &is, UniquePtr< T, Fin > &p)
 UniquePtr from bytes, object is allocated if necessary using current bytestream allocator. More...
 
template<class T >
ByteStream & honey::operator<< (ByteStream &os, const SharedPtr< T > &p)
 SharedPtr to bytes, outputs object pointed to (and exists flag), or index into current shared table if already output (index=flag-2), or a null flag if no object. More...
 
template<class T >
ByteStream & honey::operator>> (ByteStream &is, SharedPtr< T > &p)
 SharedPtr from bytes, object is allocated if necessary using current bytestream allocator. More...
 
template<class Rep , class Period >
ByteStream & honey::operator<< (ByteStream &os, const Duration< Rep, Period > &d)
 Duration to bytes. More...
 
template<class Rep , class Period >
ByteStream & honey::operator>> (ByteStream &is, Duration< Rep, Period > &d)
 Duration from bytes. More...