![]() |
LibGame
v0.4.0
The LG Game Engine - Copyright (C) 2024-2025 ETMSoftware
|
Functions | |
LG_String * | lg_string_get_root () |
zboolean | is_lg_string (LG_String *node) |
LG_String * | lg_string_new (const char *data) |
const char * | lg_string_get_data (LG_String *string) |
void | lg_string_remove (LG_String *node) |
void | lg_string_remove_all () |
int | lg_string_count (uint32_t *total_size) |
zboolean | lgstring_array_to_lgstringdata_array (LG_String_Data *str_data[], const LG_String *str[], uint32_t n_strings) |
zboolean | lgstringdata_array_to_lgstring_array (LG_String *str[], const LG_String_Data *str_data[], uint32_t n_strings) |
void | lg_string_info (LG_String *node) |
Unique global doubly-linked list of dynamically allocated strings used specifically to store path efficiently in struct instances during runtime, similarily to the LG_Texture implementation).
Max string length = LG_STRING_MAX_LEN, defined in lg_string.h
Not to be used to store paths in files or configs, use instead (const char *) lg_string_get_data().
LG_String* lg_string_get_root | ( | ) |
Returns the first node (Node_0) of the unique global doubly-linked list of dynamically allocated strings
zboolean is_lg_string | ( | LG_String * | node | ) |
Check if a LG_String node is valid, ie non NULL and with a valid signature
LG_String* lg_string_new | ( | const char * | data | ) |
Create a new LG_String instance, set content, AND add it at end of the unique gloabal strings list
=== WARNING: data max size = LG_STRING_MAX_LEN (is this making sense ?) ===
data | String data, most probably some text - can't be an empty string, ie "" |
const char* lg_string_get_data | ( | LG_String * | string | ) |
Get string data that you can copy in case you need to remove the string (huh ?)
Actually just return string->data
string | A pointer to a LG_String instance |
void lg_string_remove | ( | LG_String * | node | ) |
Remove string from the unique gloabal strings list, and free resources
Can't remove the root node
node | A pointer to a LG_String instance |
void lg_string_remove_all | ( | ) |
Remove and free all strings and resources (but the root node)
WARNING:
int lg_string_count | ( | uint32_t * | total_size | ) |
Return total number of strings in the unique gloabal strings list (including the root node) and total allocated heap memory
total_size | Pointer to uint32_t that will get the total size |
zboolean lgstring_array_to_lgstringdata_array | ( | LG_String_Data * | str_data[], |
const LG_String * | str[], | ||
uint32_t | n_strings | ||
) |
LG_String *[] —> LG_String_Data *[]
Example use:
str_data | An array of pointer to LG_String_Data (DEST) |
str | An array of pointer to LG_String (SRC) |
zboolean lgstringdata_array_to_lgstring_array | ( | LG_String * | str[], |
const LG_String_Data * | str_data[], | ||
uint32_t | n_strings | ||
) |
LG_String_Data *[] —> LG_String *[]
Example use: see above
str | An array of pointer to LG_String (DEST) |
str_data | An array of pointer to LG_String_Data (SRC) |