# RadioLib: src/protocols/Print/ITA2String.h Source File

ITA2String.h
#if !defined(_RADIOLIB_ITA2_STRING_H)
#define _RADIOLIB_ITA2_STRING_H
#include "../../TypeDef.h"
#define RADIOLIB_ITA2_FIGS 0x1B
#define RADIOLIB_ITA2_LTRS 0x1F
#define RADIOLIB_ITA2_LENGTH 32
// ITA2 character table: - position in array corresponds to 5-bit ITA2 code
// - characters to the left are in letters shift, characters to the right in figures shift
// - characters marked 0x7F do not have ASCII equivalent
static const char ITA2Table[RADIOLIB_ITA2_LENGTH][2] RADIOLIB_NONVOLATILE = {
{'\0', '\0'}, {'E', '3'}, {'\n', '\n'}, {'A', '-'}, {' ', ' '}, {'S', '\''}, {'I', '8'}, {'U', '7'},
{'\r', '\r'}, {'D', 0x05}, {'R', '4'}, {'J', '\a'}, {'N', ','}, {'F', '!'}, {'C', ':'}, {'K', '('},
{'T', '5'}, {'Z', '+'}, {'L', ')'}, {'W', '2'}, {'H', 0x7F}, {'Y', '6'}, {'P', '0'}, {'Q', '1'},
{'O', '9'}, {'B', '?'}, {'G', '&'}, {0x7F, 0x7F}, {'M', '.'}, {'X', '/'}, {'V', ';'}, {0x7F, 0x7F}
};
class ITA2String {
public:
explicit ITA2String(char c);
explicit ITA2String(const char* str);
ITA2String(const ITA2String& ita2);
ITA2String& operator=(const ITA2String& ita2);
~ITA2String();
size_t length();
uint8_t* byteArr();
#if !RADIOLIB_GODMODE
private:
#endif
#if RADIOLIB_STATIC_ONLY
char strAscii[RADIOLIB_STATIC_ARRAY_SIZE];
#else
char* strAscii;
#endif
size_t asciiLen;
size_t ita2Len;
static uint16_t getBits(char c);
};
#endif
ITA2String
ITA2-encoded string.
Definition: ITA2String.h:24
ITA2String::byteArr
uint8_t * byteArr()
Gets the ITA2 representation of the ASCII string set in constructor.
Definition: ITA2String.cpp:60
ITA2String::length
size_t length()
Gets the length of the ITA2 string. This number is not the same as the length of ASCII-encoded string...
Definition: ITA2String.cpp:48
ITA2String::operator=
ITA2String & operator=(const ITA2String &ita2)
Overload for assignment operator.
Definition: ITA2String.cpp:32
ITA2String::ITA2String
ITA2String(char c)
Default single-character constructor.
Definition: ITA2String.cpp:5
ITA2String::~ITA2String
~ITA2String()
Default destructor.
Definition: ITA2String.cpp:42