Tc Unicode Helper
Public Types | Public Member Functions | List of all members
tccore::Utf8TextProcessor Class Reference

#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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Utf8TextProcessor()

tccore::Utf8TextProcessor::Utf8TextProcessor ( UnicodeCharacterHandler  handler,
void *  userData,
UnicodeEncodingMode  mode 
)
explicit

Create an instance of a UTF-8 decoder that will asynchronous process data calling the handler as characters are decoded from the stream.

Parameters
handlerthe callback that receives characters
userDataan optional piece of data to pass back to you in the callback, can be nullptr
modeprocessing mode, either ENCMODE_UTF8 or ENCMODE_EXT_ASCII

Member Function Documentation

◆ pushChar()

void Utf8TextProcessor::pushChar ( char  ch)

Pushes a single character through the decoder. As characters are decoded the callback will fire.

Parameters
chthe character to process

◆ pushChars()

void Utf8TextProcessor::pushChars ( const char *  str)

Pushes a string of character data through the encoder. As characters are decoded the callback will fire.

Parameters
strthe string of data to process

◆ reset()

void Utf8TextProcessor::reset ( )

completely reset the decoder back to initial state


The documentation for this class was generated from the following files: