![]() |
Mapper
0.9.0
API documentation
|
Macros | |
#define | F_TEMPL "\ts%d\tx%d\ty%d\ta%lg\tu%lg\tv%lg\td%d\tp%d\tt%d\to%d" |
Functions | |
int | ocad_to_background (OCADBackground *bg, OCADCString *templ) |
Converts an OCAD string of the correct type into an OCADBackground structure. More... | |
int | ocad_string_size_background (OCADBackground *bg) |
void | ocad_background_to_string (char *buf, int size, OCADBackground *bg) |
OCADStringIndex * | ocad_string_index_first (OCADFile *pfile) |
Returns a pointer to the first string index block, or nullptr if the file isn't valid. More... | |
OCADStringIndex * | ocad_string_index_next (OCADFile *pfile, OCADStringIndex *current) |
Returns a pointer to the next string index block after the given one, or nullptr if there is none. More... | |
OCADStringEntry * | ocad_string_entry_at (OCADFile *pfile, OCADStringIndex *current, int index) |
Returns a pointer to the given string index entry, or nullptr if the file isn't valid. More... | |
OCADStringEntry * | ocad_string_entry_new (OCADFile *pfile, u32 size) |
Creates a new string entry large enough to fit the specified number of bytes. More... | |
int | ocad_string_remove (OCADFile *pfile, OCADStringEntry *entry) |
Removes the string at the given entry. More... | |
bool | ocad_string_entry_iterate (OCADFile *pfile, OCADStringEntryCallback callback, void *param) |
Iterates over all string entries in the file. More... | |
OCADCString * | ocad_string_at (OCADFile *pfile, OCADStringIndex *current, int index) |
Returns a pointer to the string in the specified location within the index block, or nullptr if there is no such string. More... | |
OCADCString * | ocad_string (OCADFile *pfile, OCADStringEntry *entry) |
Returns a pointer to a string, given a valid pointer to its index entry. More... | |
int | ocad_string_add_background (OCADFile *pfile, OCADBackground *bg) |
Adds a background template to the file. More... | |
#define F_TEMPL "\ts%d\tx%d\ty%d\ta%lg\tu%lg\tv%lg\td%d\tp%d\tt%d\to%d" |
void ocad_background_to_string | ( | char * | buf, |
int | size, | ||
OCADBackground * | bg | ||
) |
OCADCString* ocad_string | ( | OCADFile * | pfile, |
OCADStringEntry * | entry | ||
) |
Returns a pointer to a string, given a valid pointer to its index entry.
Returns nullptr if the file isn't valid or the index entry is empty.
int ocad_string_add_background | ( | OCADFile * | pfile, |
OCADBackground * | bg | ||
) |
Adds a background template to the file.
OCADCString* ocad_string_at | ( | OCADFile * | pfile, |
OCADStringIndex * | current, | ||
int | index | ||
) |
Returns a pointer to the string in the specified location within the index block, or nullptr if there is no such string.
OCADStringEntry* ocad_string_entry_at | ( | OCADFile * | pfile, |
OCADStringIndex * | current, | ||
int | index | ||
) |
Returns a pointer to the given string index entry, or nullptr if the file isn't valid.
Also returns nullptr if the index is out of range, but always returns a valid pointer if the file, index block, and index are valid.
bool ocad_string_entry_iterate | ( | OCADFile * | pfile, |
OCADStringEntryCallback | callback, | ||
void * | param | ||
) |
Iterates over all string entries in the file.
Creates a new string entry large enough to fit the specified number of bytes.
If there is an empty string index entry of sufficient size, it will be used; otherwise, a new entry will be allocated. The entry returned will have its ptr and size fields set; the size field may be larger than the size requested in the parameter. The caller is responsible for copying data into the actual string (retrieved via ocad_string()). If there is not enough memory to create a new entry, nullptr is returned.
OCADStringIndex* ocad_string_index_first | ( | OCADFile * | pfile | ) |
Returns a pointer to the first string index block, or nullptr if the file isn't valid.
Also returns nullptr if the file contains no object.
OCADStringIndex* ocad_string_index_next | ( | OCADFile * | pfile, |
OCADStringIndex * | current | ||
) |
Returns a pointer to the next string index block after the given one, or nullptr if there is none.
int ocad_string_remove | ( | OCADFile * | pfile, |
OCADStringEntry * | entry | ||
) |
Removes the string at the given entry.
The string type is set to zero and the entry becomes eligibile to be returned by ocad_string_entry_new().
int ocad_string_size_background | ( | OCADBackground * | bg | ) |
int ocad_to_background | ( | OCADBackground * | bg, |
OCADCString * | templ | ||
) |
Converts an OCAD string of the correct type into an OCADBackground structure.