Encodes and decodes EO strings.
More...
#include <eolib/data/string_encoder.hpp>
|
| static void | EncodeString (std::uint8_t *bytes, std::size_t length) noexcept |
| | Encodes a sequence of bytes in place.
|
| static void | EncodeString (std::vector< std::uint8_t > &bytes) noexcept |
| | Encodes a sequence of bytes in place.
|
| static void | EncodeString (std::string &str) noexcept |
| | Encodes a string in place.
|
| static void | DecodeString (std::uint8_t *bytes, std::size_t length) noexcept |
| | Decodes a sequence of bytes in place.
|
| static void | DecodeString (std::vector< std::uint8_t > &bytes) noexcept |
| | Decodes a sequence of bytes in place.
|
| static void | DecodeString (std::string &str) noexcept |
| | Decodes a string in place.
|
Encodes and decodes EO strings.
Strings are treated as raw byte sequences (Windows-1252 in the official client). No transcoding is performed.
All functions transform the data in place. To keep the original data, transform a copy.
See: https://github.com/Cirras/eo-protocol/blob/master/docs/encoding.md#strings
◆ StringEncoder()
| eolib::data::StringEncoder::StringEncoder |
( |
| ) |
|
|
delete |
◆ EncodeString() [1/3]
| void eolib::data::StringEncoder::EncodeString |
( |
std::uint8_t * | bytes, |
|
|
std::size_t | length ) |
|
staticnoexcept |
Encodes a sequence of bytes in place.
- Parameters
-
| bytes | a pointer to the bytes to encode. |
| length | the number of bytes to encode. |
◆ EncodeString() [2/3]
| void eolib::data::StringEncoder::EncodeString |
( |
std::vector< std::uint8_t > & | bytes | ) |
|
|
inlinestaticnoexcept |
Encodes a sequence of bytes in place.
- Parameters
-
| bytes | the bytes to encode. |
◆ EncodeString() [3/3]
| void eolib::data::StringEncoder::EncodeString |
( |
std::string & | str | ) |
|
|
inlinestaticnoexcept |
Encodes a string in place.
- Parameters
-
◆ DecodeString() [1/3]
| void eolib::data::StringEncoder::DecodeString |
( |
std::uint8_t * | bytes, |
|
|
std::size_t | length ) |
|
staticnoexcept |
Decodes a sequence of bytes in place.
- Parameters
-
| bytes | a pointer to the bytes to decode. |
| length | the number of bytes to decode. |
◆ DecodeString() [2/3]
| void eolib::data::StringEncoder::DecodeString |
( |
std::vector< std::uint8_t > & | bytes | ) |
|
|
inlinestaticnoexcept |
Decodes a sequence of bytes in place.
- Parameters
-
| bytes | the bytes to decode. |
◆ DecodeString() [3/3]
| void eolib::data::StringEncoder::DecodeString |
( |
std::string & | str | ) |
|
|
inlinestaticnoexcept |
Decodes a string in place.
- Parameters
-