|
NSUNI/NSLAR Library a250670
|
Classes | |
| struct | nnl::text::Text |
| Represents an in-game text archive. More... | |
Typedefs | |
| using | nnl::text::IndexedString = std::vector<u16> |
| A string consisting of special codes and indices into the character lookup table. | |
Functions | |
| std::vector< std::string > | nnl::text::Convert (const Text &text, const std::unordered_map< u16, std::string_view > &replacements=kSpecialCodeToString) |
| Converts an in-game text archive to a vector of UTF-8 encoded strings. | |
| Text | nnl::text::Convert (const std::vector< std::string > &stext, const std::unordered_map< u16, std::string_view > &replacements=kSpecialCodeToString, const std::vector< u16 > &characters={}) |
| Converts a vector of UTF-8 encoded strings to an in-game text archive. | |
| bool | nnl::text::IsOfType (BufferView buffer) |
| Tests if the provided file is a text archive. | |
| Text | nnl::text::Import (BufferView buffer) |
| Parses a binary file and converts it to a Text object. | |
| Buffer | nnl::text::Export (const Text &text) |
| Converts a text archive to a binary file representation. | |
Variables | |
| constexpr u16 | nnl::text::kSpecialCodeMask = 0xF000 |
| A bitmask for identifying special codes within an IndexedString. | |
| const std::unordered_map< u16, std::string_view > | nnl::text::kSpecialCodeToString |
| A default mapping of special codes to string representations. | |
| struct nnl::text::Text |
Represents an in-game text archive.
This structure represents an in-game text archive that consists of strings. These strings may be used in dialogs, menus, and in other UI elements.
Public Attributes | |
| std::vector< IndexedString > | strings |
| Strings consisting of special codes and indices that reference the characters array. | |
| std::vector< u16 > | characters |
| A palette of unique UCS-2 encoded characters used by the strings. | |
| std::vector<u16> nnl::text::Text::characters |
A palette of unique UCS-2 encoded characters used by the strings.
| std::vector<IndexedString> nnl::text::Text::strings |
Strings consisting of special codes and indices that reference the characters array.
| using nnl::text::IndexedString = std::vector<u16> |
A string consisting of special codes and indices into the character lookup table.
| Text nnl::text::Convert | ( | const std::vector< std::string > & | stext, |
| const std::unordered_map< u16, std::string_view > & | replacements = kSpecialCodeToString, | ||
| const std::vector< u16 > & | characters = {} ) |
Converts a vector of UTF-8 encoded strings to an in-game text archive.
This function takes a vector of UTF-8 strings and converts them into Text.
| stext | A vector of UTF-8 encoded strings to be converted. |
| replacements | An optional map that provides replacements for certain substrings with their code representations. |
| characters | Precomputed UCS-2 character set. If provided, used as the character "palette" instead of generating one from the input text. |
| std::vector< std::string > nnl::text::Convert | ( | const Text & | text, |
| const std::unordered_map< u16, std::string_view > & | replacements = kSpecialCodeToString ) |
Converts an in-game text archive to a vector of UTF-8 encoded strings.
This function takes a Text archive and converts it into a vector of UTF-8 strings. It can also apply optional replacements for special codes using the provided mapping.
| text | The Text object to be converted. |
| replacements | An optional map that provides replacements for special codes with their string representations. |
Converts a text archive to a binary file representation.
This function takes a Text object and converts it into a Buffer, which represents the binary format of the text.
| text | The Text object to be converted into a binary format. |
| Text nnl::text::Import | ( | BufferView | buffer | ) |
Parses a binary file and converts it to a Text object.
This function takes a binary representation of a text archive, parses its contents, and converts them into a Text struct for easier access and manipulation.
| buffer | The binary data to be processed. |
| bool nnl::text::IsOfType | ( | BufferView | buffer | ) |
Tests if the provided file is a text archive.
This function takes data representing a file and checks whether it corresponds to the in-game text archive format.
| buffer | The binary file to be tested. |
|
constexpr |
A bitmask for identifying special codes within an IndexedString.
Values where the upper 4 bits match this mask are interpreted as formatting, control, or special characters rather than character indices.
| const std::unordered_map<u16, std::string_view> nnl::text::kSpecialCodeToString |
A default mapping of special codes to string representations.
This map associates special codes that are used within indexed strings with their possible textual representations. These codes represent symbols, special or control characters in the text.