AMFP Enhanced
C++ reference: the code this unofficial fork added
Loading...
Searching...
No Matches
LangTextDecode.h File Reference

decoding of a .lang <Entry> text into the engine's 16-bit wide string. More...

#include <cstdlib>
#include <string>
#include <vector>
#include "../../../../crates/hpl-cjk-text/include/hpl_cjk_text.h"

Go to the source code of this file.

Namespaces

namespace  hpl

Functions

void hpl::LangAppendUtf8 (const std::string &asText, size_t aStart, size_t aEnd, std::wstring &aOut)
 Appends asText[aStart, aEnd) (non-ASCII bytes) decoded by hpl-cjk-text.
std::wstring hpl::LangDecodeText (const std::string &sString, bool abNativeUtf8)

Detailed Description

decoding of a .lang <Entry> text into the engine's 16-bit wide string.

Moved out of LanguageFile.cpp so it can be unit tested (tests/cpp/test_lang_text_decode.cpp).

Commands: [br] -> '
', [uNNNN] -> that code unit. Other bytes are UTF-8. abNativeUtf8=false keeps the stock decoder, which only understands 2-byte UTF-8. abNativeUtf8=true decodes 1-4 byte UTF-8 through hpl-cjk-text (BMP only; astral code points and malformed bytes become U+FFFD).

Definition in file LangTextDecode.h.