jaulib v1.3.0
Jau Support Library (C++, Java, ..)
|
Data Stream Encoder and Decoder. More...
Classes | |
class | jau::codec::base::alphabet |
Base Alphabet Specification providing the alphabet for encode() and decode(). More... | |
class | jau::codec::base::ascii38_alphabet |
Safe base 38 alphabet with ASCII code-point sorting order. More... | |
class | jau::codec::base::ascii64_alphabet |
Safe base 64 alphabet with ASCII code-point sorting order. More... | |
class | jau::codec::base::ascii86_alphabet |
Base 86 alphabet with ASCII code-point sorting order. More... | |
class | jau::codec::base::base64_alphabet |
Safe canonical base64 alphabet, without ASCII code-point sorting order. More... | |
class | jau::codec::base::base64url_alphabet |
Safe canonical base64url alphabet, without ASCII code-point sorting order. More... | |
class | jau::codec::base::natural64_alphabet |
Safe natural base 64 alphabet, both without ASCII code-point sorting order. More... | |
class | jau::codec::base::natural86_alphabet |
Natural base 86 alphabet, without ASCII code-point sorting order. More... | |
Functions | |
int64_t | jau::codec::base::decode (const std::string_view &str, const alphabet &aspec) noexcept |
Decodes a given symbolic string representing a given alphabet and its base to a positive decimal number. More... | |
std::vector< uint8_t > | jau::codec::base::decode64 (const std::string_view &str, const alphabet &aspec) noexcept |
Decodes a given symbolic string representing using given alphabet and fixed base 64 to octets according to base64 RFC 4648. More... | |
std::vector< uint8_t > | jau::codec::base::decode64_lf (const std::string_view &str, const alphabet &aspec) noexcept |
Decodes a given symbolic string representing using given alphabet and fixed base 64 to octets according to base64 RFC 4648 and removes all linefeeds before decoding as required for PEM and MIME. More... | |
std::vector< uint8_t > | jau::codec::base::decode64_lf (std::string &str, const alphabet &aspec) noexcept |
Decodes a given symbolic string representing using given alphabet and fixed base 64 to octets according to base64 RFC 4648 and removes all linefeeds before decoding as required for PEM and MIME. More... | |
std::string | jau::codec::base::encode (int num, const alphabet &aspec, const unsigned int min_width=0) noexcept |
Encodes a given positive decimal number to a symbolic string representing a given alphabet and its base. More... | |
std::string | jau::codec::base::encode (int64_t num, const alphabet &aspec, const unsigned int min_width=0) noexcept |
Encodes a given positive decimal number to a symbolic string representing a given alphabet and its base. More... | |
std::string | jau::codec::base::encode64 (const void *in_octets, size_t in_len, const alphabet &aspec) noexcept |
Encodes given octets using the given alphabet and fixed base 64 encoding according to base64 RFC 4648. More... | |
std::string | jau::codec::base::encode64_mime (const void *in_octets, size_t in_len, const alphabet &aspec) noexcept |
Encodes given octets using the given alphabet and fixed base 64 encoding according to base64 RFC 4648 and adds line-feeds every 76 characters as required for MIME. More... | |
std::string | jau::codec::base::encode64_pem (const void *in_octets, size_t in_len, const alphabet &aspec) noexcept |
Encodes given octets using the given alphabet and fixed base 64 encoding according to base64 RFC 4648 and adds line-feeds every 64 characters as required for PEM. More... | |
size_t | jau::codec::base::insert_lf (std::string &str, const size_t period) noexcept |
Inserts a line feed (LF) character \n (ASCII 0x0a) after every period of characters. More... | |
bool | jau::codec::base::operator!= (const alphabet &lhs, const alphabet &rhs) noexcept |
bool | jau::codec::base::operator== (const alphabet &lhs, const alphabet &rhs) noexcept |
size_t | jau::codec::base::remove_lf (std::string &str) noexcept |
Removes line feed character from str. More... | |
std::string | jau::codec::base::to_string (const alphabet &v) noexcept |
Data Stream Encoder and Decoder.
Supported codecs:
|
inlinenoexcept |
Definition at line 97 of file base_codec.hpp.
Definition at line 99 of file base_codec.hpp.
Definition at line 103 of file base_codec.hpp.
|
noexcept |
Encodes a given positive decimal number to a symbolic string representing a given alphabet and its base.
Besides using a custom alphabet, the following build-in alphabets are provided
num | a positive decimal number |
aspec | the used alphabet specification |
min_width | minimum width of the encoded string, encoded zero is used for padding |
Definition at line 33 of file base_codec.cpp.
|
noexcept |
Encodes a given positive decimal number to a symbolic string representing a given alphabet and its base.
Besides using a custom alphabet, the following build-in alphabets are provided
num | a positive decimal number |
aspec | the used alphabet specification |
min_width | minimum width of the encoded string, encoded zero is used for padding |
Definition at line 53 of file base_codec.cpp.
|
noexcept |
Decodes a given symbolic string representing a given alphabet and its base to a positive decimal number.
Besides using a custom alphabet, the following build-in alphabets are provided
str | an encoded string |
aspec | the used alphabet specification |
Definition at line 72 of file base_codec.cpp.
|
noexcept |
Encodes given octets using the given alphabet and fixed base 64 encoding according to base64
RFC 4648.
An error only occurs if in_len > 0 and resulting encoded string is empty.
in_octets | pointer to octets start |
in_len | length of octets in bytes |
aspec | the used base 64 alphabet specification |
Definition at line 90 of file base_codec.cpp.
|
noexcept |
Decodes a given symbolic string representing using given alphabet and fixed base 64 to octets according to base64
RFC 4648.
An error only occurs if the encoded string length > 0 and resulting decoded octets size is empty.
str | encoded string |
aspec | the used base 64 alphabet specification |
Definition at line 141 of file base_codec.cpp.
|
noexcept |
Inserts a line feed (LF) character \n
(ASCII 0x0a) after every period of characters.
str | the input string of characters, which will be mutated. |
period | period of characters after which one LF will be inserted. |
Definition at line 212 of file base_codec.cpp.
|
noexcept |
Removes line feed character from str.
str | the input string of characters, which will be mutated. |
Definition at line 224 of file base_codec.cpp.
|
inlinenoexcept |
Encodes given octets using the given alphabet and fixed base 64 encoding according to base64
RFC 4648 and adds line-feeds every 64 characters as required for PEM.
An error only occurs if in_len > 0 and resulting encoded string is empty.
in_octets | pointer to octets start |
in_len | length of octets in bytes |
aspec | the used base 64 alphabet specification |
Definition at line 560 of file base_codec.hpp.
|
inlinenoexcept |
Encodes given octets using the given alphabet and fixed base 64 encoding according to base64
RFC 4648 and adds line-feeds every 76 characters as required for MIME.
An error only occurs if in_len > 0 and resulting encoded string is empty.
in_octets | pointer to octets start |
in_len | length of octets in bytes |
aspec | the used base 64 alphabet specification |
Definition at line 578 of file base_codec.hpp.
|
inlinenoexcept |
Decodes a given symbolic string representing using given alphabet and fixed base 64 to octets according to base64
RFC 4648 and removes all linefeeds before decoding as required for PEM and MIME.
An error only occurs if the encoded string length > 0 and resulting decoded octets size is empty.
str | and encoded string, will be copied |
aspec | the used base 64 alphabet specification |
Definition at line 595 of file base_codec.hpp.
|
inlinenoexcept |
Decodes a given symbolic string representing using given alphabet and fixed base 64 to octets according to base64
RFC 4648 and removes all linefeeds before decoding as required for PEM and MIME.
An error only occurs if the encoded string length > 0 and resulting decoded octets size is empty.
str | and encoded string, no copy, will be mutated |
aspec | the used base 64 alphabet specification |
Definition at line 612 of file base_codec.hpp.