eolib-cpp 0.1.0-beta.7
Core C++ library for writing Endless Online applications
Loading...
Searching...
No Matches
eolib::data::StringEncoder Class Reference

Encodes and decodes EO strings. More...

#include <eolib/data/string_encoder.hpp>

Public Member Functions

 StringEncoder ()=delete

Static Public Member Functions

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.

Detailed Description

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

Constructor & Destructor Documentation

◆ StringEncoder()

eolib::data::StringEncoder::StringEncoder ( )
delete

Member Function Documentation

◆ 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
bytesa pointer to the bytes to encode.
lengththe 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
bytesthe bytes to encode.

◆ EncodeString() [3/3]

void eolib::data::StringEncoder::EncodeString ( std::string & str)
inlinestaticnoexcept

Encodes a string in place.

Parameters
strthe string to encode.

◆ 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
bytesa pointer to the bytes to decode.
lengththe 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
bytesthe bytes to decode.

◆ DecodeString() [3/3]

void eolib::data::StringEncoder::DecodeString ( std::string & str)
inlinestaticnoexcept

Decodes a string in place.

Parameters
strthe string to decode.