This class template implements the Base32 encoding as defined in RFC 4648 for a given character type and encoding alphabet.
More...
|
template<class InputIterator , class OutputIterator > |
static OutputIterator | encode (InputIterator first, InputIterator last, OutputIterator result, bool pad=true) |
| Encodes a range of octets. More...
|
|
template<class InputIterator , class OutputIterator > |
static OutputIterator | encode_lower (InputIterator first, InputIterator last, OutputIterator result, bool pad=true) |
| Encodes a range of octets using the lowercase encoding alphabet. More...
|
|
template<class InputIterator , class OutputIterator > |
static OutputIterator | encode_upper (InputIterator first, InputIterator last, OutputIterator result, bool pad=true) |
| Encodes a range of octets using the uppercase encoding alphabet. More...
|
|
template<class InputIterator , class OutputIterator > |
static OutputIterator | decode (InputIterator first, InputIterator last, OutputIterator result) |
| Decodes a range of characters. More...
|
|
template<class InputIterator , class OutputIterator , class Predicate > |
static OutputIterator | decode (InputIterator first, InputIterator last, OutputIterator result, Predicate skip) |
| Decodes a range of characters. More...
|
|
template<class sizeT > |
static sizeT | max_encode_size (sizeT n) |
| Computes the maximum length of an encoded character sequence. More...
|
|
template<class sizeT > |
static sizeT | max_decode_size (sizeT n) |
| Computes the maximum length of a decoded octet sequence. More...
|
|
template<class charT, class traits = base32_traits<charT>>
class stlencoders::base32< charT, traits >
This class template implements the Base32 encoding as defined in RFC 4648 for a given character type and encoding alphabet.
The Base32 encoding is designed to represent arbitrary sequences of octets in a form that needs to be case insensitive but that need not be human readable.
The encoding process represents 40-bit groups of input data as output strings of 8 encoded characters. Proceeding from left to right, a 40-bit input group is formed by concatenating 5 8-bit input groups. These 40 bits are then treated as 8 concatenated 5-bit groups, each of which is translated into a single character in the Base32 alphabet.
- Template Parameters
-
charT | the encoding character type |
traits | the character encoding traits type |
template<class charT , class traits = base32_traits<charT>>
template<class InputIterator , class OutputIterator , class Predicate >
static OutputIterator stlencoders::base32< charT, traits >::decode |
( |
InputIterator |
first, |
|
|
InputIterator |
last, |
|
|
OutputIterator |
result, |
|
|
Predicate |
skip |
|
) |
| |
|
inlinestatic |
Decodes a range of characters.
For every character c
not in the encoding alphabet,
- if skip(c) evaluates to
true
, the character is ignored
- if
c
equals traits::pad()
, returns
- otherwise, throws invalid_character
- Template Parameters
-
InputIterator | an iterator type satisfying input iterator requirements and referring to elements implicitly convertible to char_type |
OutputIterator | an iterator type satisfying output iterator requirements |
Predicate | a predicate type |
- Parameters
-
first | an input iterator to the first position in the character range to be decoded |
last | an input iterator to the final position in the character range to be decoded |
result | an output iterator to the decoded octet range |
skip | a function object that, when applied to a value of type char_type, returns a value testable as true |
- Returns
- an output iterator referring to one past the last value assigned to the output range
- Exceptions
-
invalid_character | if a character not in the encoding alphabet is encountered |
invalid_length | if the input range contains an invalid number of encoding characters |