MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
legato_stringtable.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries.
3 *
4 * Subject to your compliance with these terms, you may use Microchip software
5 * and any derivatives exclusively with Microchip products. It is your
6 * responsibility to comply with third party license terms applicable to your
7 * use of third party software (including open source software) that may
8 * accompany Microchip software.
9 *
10 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
11 * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
12 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
13 * PARTICULAR PURPOSE.
14 *
15 * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
16 * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
17 * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
18 * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
19 * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
20 * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
21 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
22 *******************************************************************************/
23 
30 #ifndef LEGATO_STRINGTABLE_H
31 #define LEGATO_STRINGTABLE_H
32 
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 // defines meta data sizes for the string table, don't change!
41 #define LE_STRING_ARRAY_SIZE 4
42 #define LE_STRING_ENTRY_SIZE 2
43 #define LE_STRING_MAX_CHAR_WIDTH 6
44 
45 // *****************************************************************************
51 {
52  LE_STRING_ENCODING_ASCII,
53  LE_STRING_ENCODING_UTF8,
54  LE_STRING_ENCODING_UTF16
56 
57 // *****************************************************************************
58 /* Structure:
59  leStringTable
60 
61  Summary:
62  Describes a string table asset. There is typically only ever one of these
63  defined at any one time.
64 
65  header - standard asset header
66  languageCount - the number of languages in the string table
67  stringCount - the number of strings in the string table
68  stringIndexTable - the pointer to the string index table. the string index
69  table is a table that contains all of the unique strings
70  defined in the string table.
71  fontTable - the font table contains an array of pointers to all defined
72  font assets that the string table references
73  fontIndexTable - the font index table is a table that maps strings to font
74  indices which can then be used to get an actual font pointer
75  from the font table
76  encodingMode - indicates how strings are encoded in the stringIndexTable
77 */
83 typedef struct leStringTable
84 {
85  leStreamDescriptor header;
86  uint8_t* stringTableData;
87  leFont** fontTable;
88  leStringEncodingMode encodingMode;
90 
91 // *****************************************************************************
92 /* Structure:
93  struct leStringInfo
94 
95  Summary:
96  Struct containing the details of a string table entry
97 
98  Remarks:
99  None.
100 */
105 typedef struct leStringInfo
106 {
107  uint32_t stringIndex;
108  uint32_t languageID;
109  uint32_t offset;
110  uint8_t* data;
111  uint32_t dataSize;
112  uint32_t length;
113 } leStringInfo;
114 
115 // *****************************************************************************
126 uint32_t leStringTable_GetStringCount(const leStringTable* table);
127 
128 // *****************************************************************************
139 uint32_t leStringTable_GetLanguageCount(const leStringTable* table);
140 
141 // *****************************************************************************
155 uint32_t leStringTable_GetStringOffset(const leStringTable* table,
156  uint32_t stringID,
157  uint32_t languageID);
158 
159 // *****************************************************************************
173  uint32_t stringID);
174 
175 // *****************************************************************************
193  uint32_t stringID,
194  uint32_t languageID);
195 
196 // *****************************************************************************
210  leStringInfo* info);
211 
212 // *****************************************************************************
227  leStringInfo* info);
228 
229 #ifdef __cplusplus
230 }
231 #endif
232 
233 #endif /* LEGATO_STRINGTABLE_H */
virtual uint32_t length(const leString *_this)
Get length of the string.
leResult leStringTable_GetStringLength(const leStringTable *table, leStringInfo *info)
Get length of a string in the string table in codepoints.
Definition: legato_stringtable.c:214
Common macros and definitions used by Legato.
Font functions and definitions.
leResult leStringTable_StringLookup(const leStringTable *table, leStringInfo *info)
Get info for a string table string.
Definition: legato_stringtable.c:184
uint32_t leStringTable_GetStringCount(const leStringTable *table)
Gets the number of strings in a string table.
Definition: legato_stringtable.c:49
struct leStringInfo leStringInfo
This struct represents string a string table entry.
This struct represents a font object.
Definition: legato_font.h:156
leResult
This enum represents function call results.
Definition: legato_common.h:123
This struct represents a stream descriptor.
Definition: legato_stream.h:60
leStringEncodingMode
This enum represents string encoding modes.
Definition: legato_stringtable.h:50
uint32_t leStringTable_GetStringOffset(const leStringTable *table, uint32_t stringID, uint32_t languageID)
Get offset of a string in table by string and language ID.
Definition: legato_stringtable.c:73
This struct represents string a string table.
Definition: legato_stringtable.h:83
uint32_t leStringTable_GetActiveStringOffset(const leStringTable *table, uint32_t stringID)
Get offset of a string in table using active global language.
Definition: legato_stringtable.c:104
struct leStringTable leStringTable
This struct represents string a string table.
This struct represents string a string table entry.
Definition: legato_stringtable.h:105
uint32_t leStringTable_GetLanguageCount(const leStringTable *table)
Get number of languages in a string table.
Definition: legato_stringtable.c:61
leFont * leStringTable_GetStringFont(const leStringTable *table, uint32_t stringID, uint32_t languageID)
Get font for a string table string.
Definition: legato_stringtable.c:110