#include <Utf8TextProcessor.h>
Public Types | |
enum | DecoderState { WAITING_BYTE_0 , WAITING_BYTE_1 , WAITING_BYTE_2 , WAITING_BYTE_3 , UTF_CHAR_FOUND } |
Public Member Functions | |
Utf8TextProcessor (UnicodeCharacterHandler handler, void *userData, UnicodeEncodingMode mode) | |
void | reset () |
void | pushChar (char ch) |
void | pushChars (const char *str) |
A completely asynchronous implementation of a UTF8 encoder. Can work with the Print interface as it expects no end to the stream, and requires only a very simple change in the write function.
|
explicit |
Create an instance of a UTF-8 decoder that will asynchronous process data calling the handler as characters are decoded from the stream.
handler | the callback that receives characters |
userData | an optional piece of data to pass back to you in the callback, can be nullptr |
mode | processing mode, either ENCMODE_UTF8 or ENCMODE_EXT_ASCII |
void Utf8TextProcessor::pushChar | ( | char | ch | ) |
Pushes a single character through the decoder. As characters are decoded the callback will fire.
ch | the character to process |
void Utf8TextProcessor::pushChars | ( | const char * | str | ) |
Pushes a string of character data through the encoder. As characters are decoded the callback will fire.
str | the string of data to process |
void Utf8TextProcessor::reset | ( | ) |
completely reset the decoder back to initial state