67#define TLD_FILE_VERSION_MAJOR 1
68#define TLD_FILE_VERSION_MINOR 0
70#define TLD_HUNK(a, b, c, d) ((uint32_t)((a)|((b)<<8)|((c)<<16)|((d)<<24)))
72#define TLD_MAGIC TLD_HUNK('R','I','F','F')
73#define TLD_TLDS TLD_HUNK('T','L','D','S')
74#define TLD_HEADER TLD_HUNK('H','E','A','D')
75#define TLD_DESCRIPTIONS TLD_HUNK('D','E','S','C')
76#define TLD_TAGS TLD_HUNK('T','A','G','S')
77#define TLD_STRING_OFFSETS TLD_HUNK('S','O','F','F')
78#define TLD_STRING_LENGTHS TLD_HUNK('S','L','E','N')
79#define TLD_STRINGS TLD_HUNK('S','T','R','S')
104 uint8_t f_version_major;
105 uint8_t f_version_minor;
107 uint8_t f_tld_max_level;
109 uint16_t f_tld_start_offset;
110 uint16_t f_tld_end_offset;
112 int64_t f_created_on;
135 uint32_t f_tag_value;
141 uint32_t f_string_offset;
147 uint16_t f_string_length;
154 uint32_t f_descriptions_count;
156 uint32_t f_tags_size;
158 uint32_t f_strings_count;
162 char * f_strings_end;
168 TLD_FILE_ERROR_NONE = 0,
169 TLD_FILE_ERROR_INVALID_POINTER,
170 TLD_FILE_ERROR_POINTER_PRESENT,
171 TLD_FILE_ERROR_CANNOT_OPEN_FILE,
172 TLD_FILE_ERROR_CANNOT_READ_FILE,
173 TLD_FILE_ERROR_UNRECOGNIZED_FILE,
174 TLD_FILE_ERROR_INVALID_FILE_SIZE,
175 TLD_FILE_ERROR_OUT_OF_MEMORY,
176 TLD_FILE_ERROR_INVALID_HUNK_SIZE,
177 TLD_FILE_ERROR_INVALID_STRUCTURE_SIZE,
178 TLD_FILE_ERROR_INVALID_ARRAY_SIZE,
179 TLD_FILE_ERROR_UNSUPPORTED_VERSION,
180 TLD_FILE_ERROR_MISSING_HUNK,
181 TLD_FILE_ERROR_HUNK_FOUND_TWICE,
185enum tld_file_error tld_file_load(
const char * filename,
struct tld_file ** file);
186const char * tld_file_errstr(
enum tld_file_error err);
188const struct tld_tag * tld_file_tag(
struct tld_file const * file, uint32_t
id);
189const char * tld_file_string(
struct tld_file const * file, uint32_t
id, uint32_t * length);
191void tld_file_free(
struct tld_file ** file);
196enum tld_file_error tld_file_load_stream(
tld_file ** file, std::istream & in);
212 char * f_string =
nullptr;
226 tld_file_free(f_file);
[internal] The description of one TLD.
uint16_t f_end_offset
The last offset of a list of TLDs.
uint16_t f_tags_count
The number of tags defined by this TLD.
uint16_t f_start_offset
The first offset of a list of TLDs.
uint16_t f_tld
The actual TLD of this entry.
uint16_t f_exception_apply_to
This TLD is an exception of the "apply to" TLD.
uint16_t f_tags
The tags of this TLD.
uint8_t f_exception_level
This entry is an exception representing a TLD at this specified level.
uint8_t f_status
The status of this TLD.
char * tld_file_to_json(tld_file const *file)
Transform a tld_file to a JSON string.