From 427bf1a542e8af53e0942dc69c425b6fe37099fc Mon Sep 17 00:00:00 2001 From: Ivan Dmitrievich Yartsev Date: Wed, 18 Mar 2026 17:40:31 +0600 Subject: [PATCH] Added new functions; Added new function descripyions --- source/libublsettings-config.c | 37 ++++++++++++++++++++++++++++++++++ source/libublsettings.h | 37 ++++++++++++++++++++++------------ 2 files changed, 61 insertions(+), 13 deletions(-) diff --git a/source/libublsettings-config.c b/source/libublsettings-config.c index 9a13425..30a6337 100644 --- a/source/libublsettings-config.c +++ b/source/libublsettings-config.c @@ -595,6 +595,43 @@ int yon_config_remove_by_key(char *key){ return 0; } +int yon_config_remove_by_list(config_str keys, size_t size){ + int result = 0; + check_config{ + for (size_t i = 0;ikey); + ((yon_config_parameter*)dict)->flag1=-1; + dict->data=""; + result=1; + } + } + } + return result; +} + +int yon_config_remove_by_args(char *key, ...){ + int result = 0; + check_config{ + va_list args; + va_start(args,key); + char *cur_key = key; + while (!yon_char_is_empty(cur_key)){ + dictionary *dict = yon_dictionary_get((dictionary**)&__yon__config__strings,cur_key); + if (dict){ + yon_config_remove_ignore(dict->key); + ((yon_config_parameter*)dict)->flag1=-1; + dict->data=""; + result=1; + } + cur_key = va_arg(args,char*); + } + va_end(args); + } + return result; +} + int yon_config_clear_by_key(const char *key){ check_config{ dictionary *dict = yon_dictionary_get((dictionary**)&__yon__config__strings,(char*)key); diff --git a/source/libublsettings.h b/source/libublsettings.h index ca1dbd1..99062ca 100644 --- a/source/libublsettings.h +++ b/source/libublsettings.h @@ -1340,25 +1340,36 @@ int yon_config_load_register_no_cleaning(YON_CONFIG_TYPE config_type,char *secti [[ deprecated ( "Use yon_config_load_config instead" ) ]] int yon_config_load_register(YON_CONFIG_TYPE config_type,char *section,char *parameter, ...); +/// @brief Set configuration parameter ignore status. Determines whether the parameter will be compared with the value from the configuration or the old value will be ignored when saving. +/// @param key Key of parameter. +/// @param status New status void yon_config_compare_ignore_set(char *key, int status); +/// @brief Get configuration parameter ignore status +/// @param key Key of parameter. +/// @return TRUE if parameter is ignored, FALSE otherwise int yon_config_compare_ignore_get(char *key); -/**yon_config_remove_by_key(char *key) - * [EN] - * - * [RU] - * Удаляет параметр конфига по ключу [key] -*/ +/// @brief Mark parameter from configuration for remove. It will be removed from target configuration at save. +/// @param key Key of parameter. +/// @return TRUE if parameter was successfully removed, FALSE otherwise. int yon_config_remove_by_key(char *key); -/**yon_config_remove_by_key(char *key) - * [EN] - * - * [RU] - * Очищает параметр конфига по ключу [key]. - * Параметр удаляется как при полной очистке всего конфига. -*/ +/// @brief Mark list of parameters from configuration for remove. It will be removed from target configuration at save. +/// @param keys string array of parameters removing parameter keys. +/// @param size size of string array. +/// @return TRUE if parameter was successfully removed, FALSE otherwise. +int yon_config_remove_by_list(config_str keys, size_t size); + +/// @brief Mark list of parameters from configuration for remove. It will be removed from target configuration at save. +/// @param key First of parameter keys to remove. +/// @param ... A null-terminated list of remaining parameter keys. +/// @return TRUE if parameter was successfully removed, FALSE otherwise. +int yon_config_remove_by_args(char *key, ...); + +/// @brief Clear a configuration parameter. Remove it completely, as if it had never been added - a parameter removed this way will not be compared when saving. +/// @param key Key of parameter. +/// @return TRUE if parameter was successfully removed, FALSE otherwise. int yon_config_clear_by_key(const char *key); /// @brief Remove substring from registered parameter value string