This class contains a collection of static functions for reading and writing simple types in network byte order (MSB first) from/to bzip2 files. More...
#include <DwmBZ2IO.hh>
Static Public Member Functions | |
| static int | BZRead (BZFILE *bzf, char &c) |
Reads from bzf. | |
| static int | BZWrite (BZFILE *bzf, char c) |
Writes c to bzf. | |
| static int | BZRead (BZFILE *bzf, uint8_t &c) |
Reads c from bzf. | |
| static int | BZWrite (BZFILE *bzf, uint8_t c) |
Writes c to bzf. | |
| static int | BZRead (BZFILE *bzf, bool &b) |
Reads b from bzf. | |
| static int | BZWrite (BZFILE *bzf, bool b) |
Writes b to bzf. | |
| static int | BZRead (BZFILE *bzf, int16_t &val) |
Reads val from bzf, in network byte order (MSB first). | |
| static int | BZWrite (BZFILE *bzf, int16_t val) |
Writes val to bzf, in network byte order (MSB first). | |
| static int | BZRead (BZFILE *bzf, uint16_t &val) |
Reads val from bzf, in network byte order (MSB first). | |
| static int | BZWrite (BZFILE *bzf, uint16_t val) |
Writes val to bzf, in network byte order (MSB first). | |
| static int | BZRead (BZFILE *bzf, int32_t &val) |
Reads val from bzf, in network byte order (MSB first). | |
| static int | BZWrite (BZFILE *bzf, int32_t val) |
Writes val to bzf, in network byte order (MSB first). | |
| static int | BZRead (BZFILE *bzf, uint32_t &val) |
Reads val from bzf, in network byte order (MSB first). | |
| static int | BZWrite (BZFILE *bzf, uint32_t val) |
Writes val to bzf, in network byte order (MSB first). | |
| static int | BZRead (BZFILE *bzf, int64_t &val) |
Reads val from bzf, in network byte order (MSB first). | |
| static int | BZWrite (BZFILE *bzf, const int64_t &val) |
Writes val to bzf, in network byte order (MSB first). | |
| static int | BZRead (BZFILE *bzf, uint64_t &val) |
Reads val from bzf, in network byte order (MSB first). | |
| static int | BZWrite (BZFILE *bzf, const uint64_t &val) |
Writes val to bzf, in network byte order (MSB first). | |
| static int | BZRead (BZFILE *bzf, float &val) |
Reads val from bzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985). | |
| static int | BZWrite (BZFILE *bzf, float val) |
Writes val tp bzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985). | |
| static int | BZRead (BZFILE *bzf, double &val) |
Reads val from bzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985). | |
| static int | BZWrite (BZFILE *bzf, const double &val) |
Writes val tp bzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985). | |
| static int | BZRead (BZFILE *bzf, std::string &s) |
Reads s from bzf. | |
| static int | BZWrite (BZFILE *bzf, const std::string &s) |
Writes s to bzf. | |
| static int | BZRead (BZFILE *bzf, BZ2Readable &val) |
| Wrapper function to read a BZ2Readable object from a BZFILE pointer. | |
| static int | BZRead (BZFILE *bzf, HasBZRead auto &val) |
Reads val from bzf, where val meets the requirements of the HasBZRead concept. | |
| static int | BZWrite (BZFILE *bzf, const BZ2Writable &val) |
| Wrapper function to write a BZ2Writable object to a BZFILE pointer. | |
| static int | BZWrite (BZFILE *bzf, const HasBZWrite auto &val) |
Writes val to bzf, where val meets the requirements of the HasBZWrite concept. | |
| template<typename _firstT , typename _secondT > | |
| static int | BZRead (BZFILE *bzf, std::pair< _firstT, _secondT > &p) |
| Reads a pair<_firstT,_secondT> from a BZFILE pointer. | |
| template<typename _firstT , typename _secondT > | |
| static int | BZWrite (BZFILE *bzf, const std::pair< _firstT, _secondT > &p) |
| Writes a pair<_firstT,_secondT> to a BZFILE pointer. | |
| template<typename _keyT , typename _valueT , typename _Compare , typename _Alloc > | |
| static int | BZRead (BZFILE *bzf, std::map< _keyT, _valueT, _Compare, _Alloc > &m) |
| Reads a map<_keyT,_valueT> from a BZFILE pointer. | |
| template<typename _keyT , typename _valueT , typename _Compare , typename _Alloc > | |
| static int | BZWrite (BZFILE *bzf, const std::map< _keyT, _valueT, _Compare, _Alloc > &m) |
| Writes a map<_keyT,_valueT> to a BZFILE pointer. | |
| template<typename _keyT , typename _valueT , typename _Compare , typename _Alloc > | |
| static int | BZRead (BZFILE *bzf, std::multimap< _keyT, _valueT, _Compare, _Alloc > &m) |
| Reads a multimap<_keyT,_valueT> from a BZFILE pointer. | |
| template<typename _keyT , typename _valueT , typename _Compare , typename _Alloc > | |
| static int | BZWrite (BZFILE *bzf, const std::multimap< _keyT, _valueT, _Compare, _Alloc > &m) |
| Writes a multimap<_keyT,_valueT> to a BZFILE pointer. | |
| template<typename _valueT , size_t N> | |
| static int | BZRead (BZFILE *bzf, std::array< _valueT, N > &a) |
| Reads an array<_valueT,N> from a BZFILE pointer. | |
| template<typename _valueT , size_t N> | |
| static int | BZWrite (BZFILE *bzf, const std::array< _valueT, N > &a) |
| Writes an array<_valueT,N> to a BZFILE pointer. | |
| template<typename _valueT , typename _Alloc > | |
| static int | BZRead (BZFILE *bzf, std::vector< _valueT, _Alloc > &v) |
| Reads a vector<_valueT> from a BZFILE pointer. | |
| template<typename _valueT , typename _Alloc > | |
| static int | BZWrite (BZFILE *bzf, const std::vector< _valueT, _Alloc > &v) |
| Writes a vector<_valueT> to a BZFILE pointer. | |
| template<typename _valueT , typename _Alloc > | |
| static int | BZRead (BZFILE *bzf, std::deque< _valueT, _Alloc > &d) |
| Reads a deque<_valueT> from a BZFILE pointer. | |
| template<typename _valueT , typename _Alloc > | |
| static int | BZWrite (BZFILE *bzf, const std::deque< _valueT, _Alloc > &d) |
| Writes a deque<_valueT> to a BZFILE pointer. | |
| template<typename _valueT , typename _Alloc > | |
| static int | BZRead (BZFILE *bzf, std::list< _valueT, _Alloc > &l) |
| Reads a list<_valueT> from a BZFILE pointer. | |
| template<typename _valueT , typename _Alloc > | |
| static int | BZWrite (BZFILE *bzf, const std::list< _valueT, _Alloc > &l) |
| Writes a list<_valueT> to a BZFILE pointer. | |
| template<typename _valueT , typename _Compare , typename _Alloc > | |
| static int | BZRead (BZFILE *bzf, std::set< _valueT, _Compare, _Alloc > &l) |
| Reads a set<_valueT> from a BZFILE pointer. | |
| template<typename _valueT , typename _Compare , typename _Alloc > | |
| static int | BZWrite (BZFILE *bzf, const std::set< _valueT, _Compare, _Alloc > &l) |
| Writes a set<_valueT> to a BZFILE pointer. | |
| template<typename _valueT , typename _Compare , typename _Alloc > | |
| static int | BZRead (BZFILE *bzf, std::multiset< _valueT, _Compare, _Alloc > &l) |
| Reads a multiset<_valueT> from a BZFILE pointer. | |
| template<typename _valueT , typename _Compare , typename _Alloc > | |
| static int | BZWrite (BZFILE *bzf, const std::multiset< _valueT, _Compare, _Alloc > &l) |
| Writes a multiset<_valueT> to a BZFILE pointer. | |
| template<typename... Args> | |
| static int | BZWrite (BZFILE *bzf, const std::tuple< Args... > &t) |
| template<typename... Args> | |
| static int | BZRead (BZFILE *bzf, std::tuple< Args... > &t) |
| template<typename _keyT , typename _valueT , typename _Hash , typename _Pred , typename _Alloc > | |
| static int | BZRead (BZFILE *bzf, std::unordered_map< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm) |
| Reads an unordered_map from a BZFILE pointer. | |
| template<typename _keyT , typename _valueT , typename _Hash , typename _Pred , typename _Alloc > | |
| static int | BZWrite (BZFILE *bzf, const std::unordered_map< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm) |
| Writes an unordered_map to a BZFILE pointer. | |
| template<typename _valueT , typename _Hash , typename _Pred , typename _Alloc > | |
| static int | BZRead (BZFILE *bzf, std::unordered_set< _valueT, _Hash, _Pred, _Alloc > &hm) |
| Reads an unordered_set from a BZFILE pointer. | |
| template<typename _valueT , typename _Hash , typename _Pred , typename _Alloc > | |
| static int | BZWrite (BZFILE *bzf, const std::unordered_set< _valueT, _Hash, _Pred, _Alloc > &hm) |
| Writes an unordered_set to a BZFILE pointer. | |
| template<typename _keyT , typename _valueT , typename _Hash , typename _Pred , typename _Alloc > | |
| static int | BZRead (BZFILE *bzf, std::unordered_multimap< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm) |
| Reads an unordered_multimap from a BZFILE pointer. | |
| template<typename _keyT , typename _valueT , typename _Hash , typename _Pred , typename _Alloc > | |
| static int | BZWrite (BZFILE *bzf, const std::unordered_multimap< _keyT, _valueT, _Hash, _Pred, _Alloc > &hm) |
| Writes an unordered_multimap to a BZFILE pointer. | |
| template<typename _valueT , typename _Hash , typename _Pred , typename _Alloc > | |
| static int | BZRead (BZFILE *bzf, std::unordered_multiset< _valueT, _Hash, _Pred, _Alloc > &hm) |
| Reads an unordered_multiset from a BZFILE pointer. | |
| template<typename _valueT , typename _Hash , typename _Pred , typename _Alloc > | |
| static int | BZWrite (BZFILE *bzf, const std::unordered_multiset< _valueT, _Hash, _Pred, _Alloc > &hm) |
| Writes an unordered_multiset to a BZFILE pointer. | |
| static int | BZRead (BZFILE *bzf, std::monostate &sm) |
| Just a dummy helper function for std::variant instances that hold a std::monostate. | |
| static int | BZWrite (BZFILE *bzf, const std::monostate &sm) |
| Just a dummy helper function for std::variant instances that hold a std::monostate. | |
| template<typename... Ts> | |
| static int | BZRead (BZFILE *bzf, std::variant< Ts... > &v) |
| Reads a variant from a BZFILE. | |
| template<typename... Ts> | |
| static int | BZWrite (BZFILE *bzf, const std::variant< Ts... > &v) |
| template<typename ... Args> | |
| static int | BZReadV (BZFILE *bzf, Args &...args) |
Reads args from bzf. | |
| template<typename ... Args> | |
| static int | BZWriteV (BZFILE *bzf, const Args &...args) |
Writes args to bzf. | |
This class contains a collection of static functions for reading and writing simple types in network byte order (MSB first) from/to bzip2 files.
It also contains functions to read and write strings from/to bzip2 files. It also contains function templates to read and write arrays, deques, lists, vectors, maps, multimaps, sets, multisets, unordered_maps, unordered_multimaps, unordered_sets, unordered_multisets, tuples and variants from/to bzip2 files. We use our member functions to handle reading and writing simple types in these containers, and function templates to handle reading and writing other class types. In the latter case, the class must implement the BZ2Readable and BZ2Writable interfaces, since our function templates simply call out to them.
|
static |
Reads b from bzf.
Returns the number of bytes read (1) on success, less on failure.
|
static |
Reads from bzf.
Returns the number of bytes read (1) on success, less on failure.
|
static |
Reads val from bzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985).
Returns number of bytes read (8) on success, less on failure.
|
static |
Reads val from bzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985).
Returns number of bytes read (4) on success, less on failure.
|
static |
Reads val from bzf, in network byte order (MSB first).
Returns number of bytes read (2) on success, less on failure.
|
static |
Reads val from bzf, in network byte order (MSB first).
Returns number of bytes read (4) on success, less on failure.
|
static |
Reads val from bzf, in network byte order (MSB first).
Returns number of bytes read (8) on success, less on failure.
|
inlinestatic |
Reads an array<_valueT,N> from a BZFILE pointer.
Returns the number of bytes read on success, -1 on failure.

|
inlinestatic |
Reads a deque<_valueT> from a BZFILE pointer.
Returns the number of bytes read on success, -1 on failure.
|
inlinestatic |
Reads a list<_valueT> from a BZFILE pointer.
Returns the number of bytes read on success, -1 on failure.
|
inlinestatic |
Reads a map<_keyT,_valueT> from a BZFILE pointer.
Returns the number of bytes read on success, -1 on failure.
|
inlinestatic |
Just a dummy helper function for std::variant instances that hold a std::monostate.
This should only be called from our Read() for std::variant (via std::visit()), and does nothing. Returns 0.
|
inlinestatic |
Reads a multimap<_keyT,_valueT> from a BZFILE pointer.
Returns the number of bytes read on success, -1 on failure.
|
inlinestatic |
Reads a multiset<_valueT> from a BZFILE pointer.
Returns the number of bytes read on success, -1 on failure.
|
inlinestatic |
Reads a pair<_firstT,_secondT> from a BZFILE pointer.
Returns the number of bytes read on success, -1 on failure.

|
inlinestatic |
Reads a set<_valueT> from a BZFILE pointer.
Returns the number of bytes read on success, -1 on failure.
|
static |
Reads s from bzf.
Returns the number of bytes read on success, -1 on failure. Since we write strings with a 64-bit unsigned length value preceding the actual string, and always have a terminating NULL, this always reads at least 9 bytes on success.
|
inlinestatic |
Reads an unordered_map from a BZFILE pointer.
Returns the number of bytes read on success, -1 on failure.
|
inlinestatic |
Reads an unordered_multimap from a BZFILE pointer.
Returns the number of bytes read on success, -1 on failure.
|
inlinestatic |
Reads an unordered_multiset from a BZFILE pointer.
Returns the number of bytes read on success, -1 on failure.
|
inlinestatic |
Reads an unordered_set from a BZFILE pointer.
Returns the number of bytes read on success, -1 on failure.
|
inlinestatic |
Reads a variant from a BZFILE.
Returns the number of bytes read on success, -1 on failure.

|
inlinestatic |
Reads a vector<_valueT> from a BZFILE pointer.
Returns the number of bytes read on success, -1 on failure.
|
static |
Reads val from bzf, in network byte order (MSB first).
Returns number of bytes read (2) on success, less on failure.
|
static |
Reads val from bzf, in network byte order (MSB first).
Returns number of bytes read (4) on success, less on failure.
|
static |
Reads val from bzf, in network byte order (MSB first).
Returns number of bytes read (8) on success, less on failure.
|
static |
Reads c from bzf.
Returns the number of bytes read (1) on success, less on failure.
|
inlinestatic |
Reads args from bzf.
Returns the number of bytes read on success, -1 on failure.

|
static |
Writes b to bzf.
Returns the number of bytes written (1) on success, less on failure.
|
static |
Writes c to bzf.
Returns the number of bytes written on success, -1 on failure.
|
static |
Writes val tp bzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985).
Returns the number of bytes written (8) on success, less on failure.
|
static |
Writes val to bzf, in network byte order (MSB first).
Returns the number of bytes written (8) on success, less on failure.
|
inlinestatic |
Writes an array<_valueT,N> to a BZFILE pointer.
Returns the number of bytes written on success, -1 on failure.

|
inlinestatic |
Writes a deque<_valueT> to a BZFILE pointer.
Returns the number of bytes written on success, -1 on failure.
|
inlinestatic |
Writes a list<_valueT> to a BZFILE pointer.
Returns the number of bytes written on success, -1 on failure.
|
inlinestatic |
Writes a map<_keyT,_valueT> to a BZFILE pointer.
Returns the number of bytes written on success, -1 on failure.
|
inlinestatic |
Just a dummy helper function for std::variant instances that hold a std::monostate.
This should only be called from our Write() for std::variant (via std::visit()), and does nothing. Returns 0.
|
inlinestatic |
Writes a multimap<_keyT,_valueT> to a BZFILE pointer.
Returns the number of bytes written on success, -1 on failure.
|
inlinestatic |
Writes a multiset<_valueT> to a BZFILE pointer.
Returns the number of bytes written on success, -1 on failure.
|
inlinestatic |
Writes a pair<_firstT,_secondT> to a BZFILE pointer.
Returns the number of bytes written on success, -1 on failure.

|
inlinestatic |
Writes a set<_valueT> to a BZFILE pointer.
Returns the number of bytes written on success, -1 on failure.
|
static |
Writes s to bzf.
Returns the number of bytes written on success, -1 on failure. Note that a 64-bit value is written first, holding the length of the string. The terminating NULL is also written. Hence, on success this will always return a value of 9 or greater.
|
inlinestatic |
Writes an unordered_map to a BZFILE pointer.
Returns the number of bytes written on success, -1 on failure.
|
inlinestatic |
Writes an unordered_multimap to a BZFILE pointer.
Returns the number of bytes written on success, -1 on failure.
|
inlinestatic |
Writes an unordered_multiset to a BZFILE pointer.
Returns the number of bytes written on success, -1 on failure.
|
inlinestatic |
Writes an unordered_set to a BZFILE pointer.
Returns the number of bytes written on success, -1 on failure.
|
inlinestatic |
Writes a vector<_valueT> to a BZFILE pointer.
Returns the number of bytes written on success, -1 on failure.
|
static |
Writes val to bzf, in network byte order (MSB first).
Returns the number of bytes written (8) on success, less on failure.
|
static |
Writes val tp bzf, in IEEE format (see RFC 1832 and/or ANSI/IEEE Standard 754-1985).
Returns the number of bytes written (4) on success, less on failure.
|
static |
Writes val to bzf, in network byte order (MSB first).
Returns the number of bytes written (2) on success, less on failure.
|
static |
Writes val to bzf, in network byte order (MSB first).
Returns the number of bytes written (4) on success, less on failure.
|
static |
Writes val to bzf, in network byte order (MSB first).
Returns the number of bytes written (2) on success, less on failure.
|
static |
Writes val to bzf, in network byte order (MSB first).
Returns the number of bytes written (4) on success, less on failure.
|
static |
Writes c to bzf.
Returns the number of bytes written (1) on success, less on failure.
|
inlinestatic |
Writes args to bzf.
Returns the number of bytes written on success, -1 on failure.
