Tawara  0.1.0
Namespaces | Typedefs | Functions
vint.h File Reference
#include <cstddef>
#include <istream>
#include <ostream>
#include <stdint.h>
#include <utility>
#include <vector>
Include dependency graph for vint.h:

Go to the source code of this file.

Namespaces

 tawara
 
 tawara::vint
 Functions for managing variable-length integers.
 

Typedefs

typedef std::pair< uint64_t,
std::streamsize > 
tawara::vint::OffsetInt
 The result type of s_to_u(). More...
 
typedef std::pair< uint64_t,
std::vector< char >
::const_iterator > 
tawara::vint::DecodeResult
 The result of a decode operation is a pair of the integer decoded and an iterator pointing to the first element after the used data. More...
 
typedef std::pair< uint64_t,
std::streamsize > 
tawara::vint::ReadResult
 The result of a read operation is a pair of the integer read and the number of bytes read. More...
 

Functions

std::streamsize tawara::vint::size (uint64_t integer)
 Get the size of an integer after encoding. More...
 
OffsetInt tawara::vint::s_to_u (int64_t integer)
 Offsets a signed integer into unsigned territory. More...
 
int64_t tawara::vint::u_to_s (OffsetInt integer)
 Offsets an unsigned integer into signed territory. More...
 
std::vector< char > tawara::vint::encode (uint64_t integer, std::streamsize req_size=0)
 Encode an unsigned integer into a buffer. More...
 
DecodeResult tawara::vint::decode (std::vector< char > const &buffer)
 Decode an unsigned variable-length integer from a buffer. More...
 
std::streamsize tawara::vint::write (uint64_t integer, std::ostream &output, std::streamsize req_size=0)
 Encode an unsigned integer and write it to an output stream. More...
 
ReadResult tawara::vint::read (std::istream &input)
 Decode an unsigned integer from an input stream. More...