@ -646,6 +646,13 @@ char *yon_char_append_c(const char *source, char append);
*/
char * yon_char_append_element ( char * source , char * target , char * divider ) ;
/// @brief Append string of elements with another string of elements
/// @param source sSource string of elements.
/// @param target Appended string of elements.
/// @param separator String, separating elements within parameter's value
/// @return A newly allocated string of elements
char * yon_char_append_elements ( char * source , char * target , char * separator ) ;
char * yon_char_force_append_element ( char * source , char * target , char * divider ) ;
/**
* @ brief Remove substring from string .
@ -1107,89 +1114,69 @@ double yon_size_long_convert_to_mod(double size, char mod);
double yon_size_long_convert_automatic ( unsigned long bytes , char * size ) ;
/**yon_file_path_proceed_spaces(char *path)
* [ EN ]
*
* [ RU ]
* О б о р а ч и в а е т в с е п р о б е л ы в п у т и д л я п р а в и л ь н о й о б р а б о т к и
*/
/// @brief Wrap all spaces in paths for proper handling in commands
/// @return A newly allocated string or NULL if path was empty.
char * yon_file_path_proceed_spaces ( char * path ) ;
/**yon_file_open(char *file_path, int *size)
* [ EN ]
*
* [ RU ]
* О т к р ы в а е т ф а й л [ file_path ] , в о з в р а щ а е т с о д е р ж и м о е в в и д е м а с с и в а с т р о к р а з м е р а [ size ]
*/
/// @brief Read file and return its contents as string array, separated by new line symbols.
/// @param file_path Path to file.
/// @param size Size of returned list.
/// @return A newly allocated array of strings containing the entire contents of the file.
config_str yon_file_open ( char * file_path , int * size ) ;
/**yon_file_save(char *file_path, char *text)
* [ EN ]
*
* [ RU ]
* С о х р а н и т ь т е к с т [ text ] в ф а й л п о п у т и [ file_path ] . Е с л и ф а й л а н е с у щ е с т в у е т , о н с о з д а ё т с я
*/
/// @brief Save string to file
/// @param file_path File where text will be saved.
/// @param text Text to save.
/// @return TRUE if successful, FALSE otherwise
int yon_file_save ( char * file_path , char * text ) ;
/**yon_file_create(char *path, char *name, int rules)
* [ EN ]
*
* [ RU ]
* С о з д а т ь ф а й л с н а з в а н и е м [ name ] , н а х о д я щ и м с я п о п у т и [ path ]
* С п р а в а м и д о с т у п а [ rules ] ( о т 0000 д о 0777 )
*/
/// @brief Create a file for path.
/// @param path Path to create file.
/// @param name File name.
/// @param rules Rules for all created directories and file (from 0000 to 0777).
/// @return TRUE if file were successfully created, FALSE if file exist/invalid path/error occured while creating file.
int yon_file_create ( char * path , char * name , int rules ) ;
/**yon_file_create_full_path(char *path, char *name, int rules)
* [ EN ]
*
* [ RU ]
* С о з д а т ь ф а й л п о п у т и [ path ]
* С п р а в а м и д о с т у п а [ rules ] ( о т 0000 д о 0777 )
*/
/// @brief Create a file and any missing directories for path.
/// @param rules Rules for all created directories and file (from 0000 to 0777).
/// @return TRUE if file were successfully created, FALSE if file exist/invalid path/error occured while creating file.
int yon_file_create_full_path ( char * path , mode_t rules ) ;
/**yon_file_ls (char *path, int *size)
* [ EN ]
*
* [ RU ]
* В о з в р а щ а е т м а с с и в н а з в а н и й д и р е к т о р и й р а з м е р а [ size ] , н а х о д я щ и х с я в н у т р и д и р е к т о р и и [ path ] .
*/
/// @brief Get a list of directory names for path.
/// @param size Size of returned list.
/// @return A newly allocated string array or NULL.
config_str yon_file_list_dirs ( char * path , int * size ) ;
/**
* [ EN ]
*
* [ RU ]
* В о з в р а щ а е т м а с с и в с т р о к р а з м е р а [ size ] с и м е н а м и в с е х ф а й л о в и п а п о к и з д и р е к т о р и и [ path ]
*/
/// @brief Get a list of file/directory names for path.
/// @param path Path string.
/// @param size Size of returned list.
/// @return A newly allocated string array or NULL.
config_str yon_file_ls ( char * path , int * size ) ;
/**yon_file_is_directory(const char *path)
* [ EN ]
*
* [ RU ]
* П р о в е р я е т у к а з ы в а е т л и п у т ь [ path ] н а д и р е к т о р и ю
*/
/// @brief Get parent directory from path.
/// @return Newly allocated string with parent path or NULL.
char * yon_file_get_parent ( const char * path ) ;
/// @brief Check if path points to directory.
/// @return TRUE if path is pointing to directory, 0 otherwise.
int yon_file_is_directory ( const char * path ) ;
/**yon_dir_remove(const char *path)
* [ EN ]
*
* [ RU ]
* П р о в е р я е т у к а з ы в а е т л и п у т ь [ path ] н а д и р е к т о р и ю и у д а л я е т е ё
*/
/// @brief Removes directory for path. If path is not directory, nothing happens.
void yon_dir_remove ( const char * path ) ;
/** yon_dir_get_contents(char *dir_path, int *size)
* [ EN ]
* [ DEPRECATED ]
*
* [ RU ]
* [ У С Т А Р Е Л О ]
* П р о в е р я е т с у щ е с т в у е т л и п а п к а [ dir_path ] и
* в о з в р а щ а е т с п и с о к в с е х в л о ж е н н ы х ф а й л о в и п а п о к ,
* п е р е д а в а я в [ size ] д л и н у с п и с к а .
*/
config_str yon_dir_get_contents ( char * dir_path , int * size ) ;
__attribute__ ( ( deprecated ( " Use yon_file_ls() instead " ) ) ) config_str yon_dir_get_contents ( char * dir_path , int * size ) ;
config_str yon_dir_get_by_mask ( char * path , char * mask , int * size ) ;
@ -1333,25 +1320,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
@ -1375,6 +1373,13 @@ int yon_config_remove_elements(char *key, char *delete_target, char *separator);
/// @return 1 if element was successfully added, 0 otherwise
int yon_config_append_element ( char * key , char * append , char * separator ) ;
/// @brief Append registered parameter value string of elements with another string of elements
/// @param key parameter key
/// @param append string to append
/// @param separator string, separating elements within parameter's value
/// @return 1 if element was successfully added, 0 otherwise
int yon_config_append_elements ( char * key , char * append , char * divider ) ;
/// @brief Append parameter value string event if appended string already exists in parameter value or empty
/// @param key parameter key
/// @param append string to append
@ -1517,6 +1522,37 @@ enum YON_CONFIG_SAVED_TYPE yon_config_register_default(char *key,char *config_lo
/// @return
char * yon_config_save_simple ( YON_CONFIG_TYPE target , char * path ) ;
/// @brief Save list of parameters into configuration.
/// @param parameters_keys List of parameter keys.
/// @param size size of parameter keys list.
/// @param path Path to configuration .ini.
/// @return TRUE if successful, FALSE otherwise.
int yon_config_save_list_simple ( config_str parameters_keys , size_t size , char * path ) ;
/// @brief Save list of parameters into configuration.
/// @param path Path to configuration .ini.
/// @param ... A NULL-terminated list of parameter keys.
/// @return TRUE if successful, FALSE otherwise.
int yon_config_save_args_simple ( char * path , . . . ) ;
/// @brief Update parameter's value from configuration.
/// @param key Parameter's key.
/// @return TRUE if parameter successfully updated, FALSE if parameter doesn't registered in configuration
int yon_config_update_by_key ( char * key ) ;
/// @brief Update parameter's value from configuration.
/// @param key Parameters key list.
/// @param size size of parameters keys list.
/// @return TRUE if parameter successfully updated, FALSE if parameter doesn't registered in configuration
int yon_config_update_by_list ( config_str keys , size_t size ) ;
/// @brief Update parameters value from configuration.
/// @param key First parameter's key.
/// @param ... NULL-terminated list of parameter keys.
/// @return TRUE if parameter successfully updated, FALSE if parameter doesn't registered in configuration
int yon_config_update_by_args ( char * key , . . . ) ;
/**int yon_config_force_save_registered(char *path, char *section)
* [ EN ]
* Force config to save at [ path ] config ignoring parameter save status .