TextEncoding.hpp

Plugs into Text with the specification of a given encoding.

Note

Status: ALPHA

Functions

template<typename ENCODING_T, typename ...Ts>
Text MakeEncodedText(Ts&&... args)
class TextEncoding : public TextEncoding_Interface
#include <TextEncoding.hpp>

Subclassed by EmphaticEncoding, HTMLEncoding

Public Functions

inline TextEncoding()
~TextEncoding() = default
inline void Reset()
inline virtual void Append(Text &text, const String &in) override
inline virtual String Encode(const Text &text) const override
inline virtual void PrintDebug(std::ostream &os = std::cout) const override

Protected Functions

inline size_t GetTagID(const String &tag_name, const String &tag_pattern)
inline size_t GetTagID(const String &tag_name)
inline Style &GetStyle(const String &style_name)
inline void SetupStyleTags(String style_name, String open_name, String close_name)
inline void SetupReplaceTag(String tag_name, char replace_char, String style_name = "")
inline String GetStyleDesc(const Style &style, const Tag &start_tag, const String &lexeme)
inline void Append_RawText(Text &text, const String &in)
inline void Append_Tag(Text &text, int token_id, const String &lexeme)
inline void SetupLexer()
inline void _EncodeChar(const Text &text, String &out_string, const size_t char_pos) const
inline void _EncodeTo(const Text &text, String &out_string, size_t &start, const size_t end) const
inline void AddOutputTags(const Text &text, std::map<size_t, String> &tag_map, String style, String start_tag, String end_tag) const

Protected Attributes

vector<Tag> tag_set
vector<Style> style_set
std::map<String, size_t> pattern_to_tag_id
std::map<int, size_t> token_to_tag_id
std::map<String, size_t> name_to_style_id
array<size_t, 128> char_tags
Lexer lexer
int text_token = -1
std::vector<StyleEntry> active_styles
struct Style
#include <TextEncoding.hpp>

Public Members

String name
size_t id = MAX_SIZE_T
std::set<size_t> open_tag_ids
std::set<size_t> close_tag_ids
std::set<size_t> replace_tag_ids
std::function<String(String)> make_open_tag
std::function<String(String)> make_close_tag
struct StyleEntry
#include <TextEncoding.hpp>

Public Members

size_t style_id
String full_info
struct Tag
#include <TextEncoding.hpp>

Public Members

String name
String pattern
size_t id = MAX_SIZE_T
int token_id = -1
size_t start_style_id = 0
std::function<String(String)> get_style_args
std::set<size_t> end_style_ids
bool multi_end = false
char replace_char = '\0'
size_t replace_style_id = 0
String out_encoding = ""