stlencoders  1.1.3
Classes | Functions
stlencoders Namespace Reference

C++ namespace used for the stlencoders public API. More...

Classes

struct  base16_traits
 base16 character encoding traits class template. More...
 
struct  base16_traits< char >
 Character encoding traits specialization for char. More...
 
struct  base16_traits< wchar_t >
 Character encoding traits specialization for wchar_t. More...
 
class  base16
 This class template implements the Base16 encoding as defined in RFC 4648 for a given character type and encoding alphabet. More...
 
struct  base2_traits
 base2 character encoding traits class template. More...
 
struct  base2_traits< char >
 Character encoding traits specialization for char. More...
 
struct  base2_traits< wchar_t >
 Character encoding traits specialization for wchar_t. More...
 
class  base2
 This class template implements the standard Base2, or binary, encoding. More...
 
struct  base32_traits
 base32 character encoding traits class template. More...
 
struct  base32_traits< char >
 Character encoding traits specialization for char. More...
 
struct  base32_traits< wchar_t >
 Character encoding traits specialization for wchar_t. More...
 
struct  base32hex_traits
 base32hex character encoding traits class template. More...
 
struct  base32hex_traits< char >
 Character encoding traits specialization for char. More...
 
struct  base32hex_traits< wchar_t >
 Character encoding traits specialization for wchar_t. More...
 
class  base32
 This class template implements the Base32 encoding as defined in RFC 4648 for a given character type and encoding alphabet. More...
 
struct  base64_traits
 base64 character encoding traits class template. More...
 
struct  base64_traits< char >
 Character encoding traits specialization for char. More...
 
struct  base64_traits< wchar_t >
 Character encoding traits specialization for wchar_t. More...
 
struct  base64url_traits
 base64hex character encoding traits class template. More...
 
struct  base64url_traits< char >
 Character encoding traits specialization for char. More...
 
struct  base64url_traits< wchar_t >
 Character encoding traits specialization for wchar_t. More...
 
class  base64
 This class template implements the Base64 encoding as defined in RFC 4648 for a given character type and encoding alphabet. More...
 
class  decode_error
 Exception class thrown to report an unspecified error in a decode operation. More...
 
class  invalid_character
 Exception class thrown to report an invalid character. More...
 
class  invalid_length
 Exception class thrown to report an invalid length of a character sequence. More...
 
class  line_wrap_iterator
 An output iterator adaptor used to wrap lines after a set number of characters. More...
 
struct  portable_wchar_encoding_traits
 A character encoding traits adaptor that converts an underlying encoding traits class for type char to type wchar_t. More...
 
struct  lower_char_encoding_traits
 A character encoding traits adaptor that uses the lowercase alphabet of an underlying encoding traits class. More...
 
struct  upper_char_encoding_traits
 A character encoding traits adaptor that uses the uppercase alphabet of an underlying encoding traits class. More...
 

Functions

template<class Iterator , class charT , class sizeT >
line_wrap_iterator< Iterator,
charT > 
line_wrapper (Iterator i, sizeT n, const charT *s)
 Creates a line_wrap_iterator adaptor which will copy a delimiter string to a given iterator after every n characters. More...
 
template<template< char > class LUT, class T >
const T & lookup (char c)
 Maps a character to its corresponding value in a lookup table. More...
 

Detailed Description

C++ namespace used for the stlencoders public API.

Function Documentation

template<class Iterator , class charT , class sizeT >
line_wrap_iterator<Iterator, charT> stlencoders::line_wrapper ( Iterator  i,
sizeT  n,
const charT *  s 
)
inline

Creates a line_wrap_iterator adaptor which will copy a delimiter string to a given iterator after every n characters.

Template Parameters
Iteratorthe underlying iterator class
charTthe output character type
sizeTan integral type
Parameters
ithe underlying iterator
nthe number of characters per line
sthe line delimiter string
Returns
a line_wrap_iterator
template<template< char > class LUT, class T >
const T& stlencoders::lookup ( char  c)
inline

Maps a character to its corresponding value in a lookup table.

The lookup table is statically initialized from the class template LUT, which is parameterized by a non-type argument of type char, and shall provide a constant expression LUT<c>::value implicitly convertible to type T for each character c.

To create a lookup table that maps the characters '0' and '1' to their corresponding integral values, and any other character to -1, a class template may be defined as:

template<char C> struct base2_table {
enum { value = -1 };
};
template<> struct base2_table<'0'> {
enum { value = 0 };
};
template<> struct base2_table<'1'> {
enum { value = 1 };
};
lookup<base2_table, int>('0'); // returns 0
lookup<base2_table, int>('1'); // returns 1
lookup<base2_table, int>('2'); // returns -1
Template Parameters
LUTthe class template defining the lookup table
Tthe lookup table's value type
Parameters
cthe character to map
Returns
LUT<c>::value
Note
This implementation limits the size of the lookup table to 256 entries, even on platforms where char is more than eight bits wide. For characters whose unsigned representation is outside this range, LUT<'\0'>::value is returned.