diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-07-28 15:04:42 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-07-28 16:34:18 -0700 |
commit | 232df43611df80153de43d1747b61c0da9f6c5c0 (patch) | |
tree | 27de456323ec9bde89177452a720c8d1551ea653 | |
parent | 3e731cc575d3e56af4537a74a2f42bf278ad172f (diff) |
til_settings: add til_settings_get_label() getter
Preparatory commit for rkt_scener scenes editing, which will be
replacing the current scene's settings instance with a newly
constructed one. This enables simply duplicating the existing
scene setting's positional label, which will be identical in the
replacement.
-rw-r--r-- | src/til_settings.c | 8 | ||||
-rw-r--r-- | src/til_settings.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/til_settings.c b/src/til_settings.c index be8457d..907e114 100644 --- a/src/til_settings.c +++ b/src/til_settings.c @@ -245,6 +245,14 @@ int til_settings_set_label(til_settings_t *settings, const char *label) } +const char * til_settings_get_label(const til_settings_t *settings) +{ + assert(settings); + + return settings->label; +} + + /* find key= in settings, return value NULL if missing, optionally store setting @res_setting if found */ const char * til_settings_get_value_by_key(const til_settings_t *settings, const char *key, til_setting_t **res_setting) { diff --git a/src/til_settings.h b/src/til_settings.h index b025158..85df105 100644 --- a/src/til_settings.h +++ b/src/til_settings.h @@ -50,6 +50,7 @@ til_settings_t * til_settings_free(til_settings_t *settings); unsigned til_settings_get_count(const til_settings_t *settings); const til_settings_t * til_settings_get_parent(const til_settings_t *settings); int til_settings_set_label(til_settings_t *settings, const char *label); +const char * til_settings_get_label(const til_settings_t *settings); const char * til_settings_get_value_by_key(const til_settings_t *settings, const char *key, til_setting_t **res_setting); const char * til_settings_get_value_by_idx(const til_settings_t *settings, unsigned idx, til_setting_t **res_setting); til_setting_t * til_settings_add_value(til_settings_t *settings, const char *key, const char *value); |