Special properties

In this chapter are functions for manipulating with special libcfg+ properties described. They all use the same function synopsis as other API functions mentioned in previous chapters. This chapter starts with functions, which affect command line and configuration file special properties in one call. Chapter continues with command line related functions and at the end are configuration file related functions described.

For changing multi values separators use these functions. Affects both, command line and configuration file. Multi values separators are strings used for separation option values initialized with one argument. Option must have CFG_MULTI_SEPARATED flag set. By default are space, , and ; initialized.

void cfg_clear_multi_vals_separator(CFG_CONTEXT con);

int cfg_add_multi_vals_separator(CFG_CONTEXT con, char *str);

int cfg_remove_multi_vals_separator(CFG_CONTEXT con, char *str);

For changing option argument separator use these functions. Affects both, command line and configuration file. Option argument separators are strings used to separate option and its argument. By default is = character used for both, command line and config file.

void cfg_clear_option_arg_separator(CFG_CONTEXT con);

int cfg_add_option_arg_separator(CFG_CONTEXT con, char *str);

int cfg_remove_option_arg_separator(CFG_CONTEXT con, char *str);

Following functions are used for changing quoting prefix and postfix. They affect both, command line and configuration file. By default are quotes (" with ") and apostrophes (' with ') initialized.

void cfg_clear_quote_strings(CFG_CONTEXT con);

int cfg_add_quote_strings(CFG_CONTEXT con, char *prefix, char *postfix);

int cfg_remove_quote_strings(CFG_CONTEXT con, char *prefix, char *postfix);

Command line related

On following line are described functions, which affect only special properties related to command line.

For changing command line stop string use these functions. Set this property if you want to stop parsing on specified string which occurs on command line. Error code CFG_ERROR_STOP_STR_FOUND is returned from parsing function to determine this event. By default is -- initialized.

void cfg_clear_cmdline_stop_string(CFG_CONTEXT con);

int cfg_add_cmdline_stop_string(CFG_CONTEXT con, char *str);

int cfg_remove_cmdline_stop_string(CFG_CONTEXT con, char *str);

For changing command line short option prefix use these functions. Default value is of course single dash (-), because it is most offten used in applications. You will probably don't need to redefine this property.

void cfg_clear_cmdline_short_option_prefix(CFG_CONTEXT con);

int cfg_add_cmdline_short_option_prefix(CFG_CONTEXT con, char *str);

int cfg_remove_cmdline_short_option_prefix(CFG_CONTEXT con, char *str);

For changing command line long option prefix use these functions. Default value is of course double dash (--), because it is most offten used in applications. You will probably don't need to redefine this property.

void cfg_clear_cmdline_long_option_prefix(CFG_CONTEXT con);

int cfg_add_cmdline_long_option_prefix(CFG_CONTEXT con, char *str);

int cfg_remove_cmdline_long_option_prefix(CFG_CONTEXT con, char *str);

For changing command line multi values separators use these functions. Multi values separators are strings used for separation option values initialized with one argument. For example if separator is comma, one command line argument will be similar to this: --multi=val1,val2,val3. Option must have CFG_MULTI_SEPARATED flag set. By default are space, , and ; initialized.

void cfg_clear_cmdline_multi_vals_separator(CFG_CONTEXT con);

int cfg_add_cmdline_multi_vals_separator(CFG_CONTEXT con, char *str);

int cfg_remove_cmdline_multi_vals_separator(CFG_CONTEXT con, char *str);

For changing command line option argument separator use these functions. Option argument separators are strings used to separate option and its argument. By default is = character used. For example --option=argument. Note that on command line argument can be initialized also as following string with no need of separator usage (like this: --option argument).

void cfg_clear_cmdline_option_arg_separator(CFG_CONTEXT con);

int cfg_add_cmdline_option_arg_separator(CFG_CONTEXT con, char *str);

int cfg_remove_cmdline_option_arg_separator(CFG_CONTEXT con, char *str);

Configuration file related

On following line are described functions, which affect only special properties related to configuration file.

For changing configuration file stop string use these functions. Set this property if you want to stop parsing on specified string which occurs on configration file line. Error code CFG_ERROR_STOP_STR_FOUND is returned from parsing function to determine this event. By default is [ initialized (to stop parsing on section header).

void cfg_clear_cfgfile_stop_string(CFG_CONTEXT con);

int cfg_add_cfgfile_stop_string(CFG_CONTEXT con, char *str);

int cfg_remove_cfgfile_stop_string(CFG_CONTEXT con, char *str);

For changing configuration comment prefix use these functions. Lines started with one of these prefixes are skipped. By default are #, ; and // initialized.

void cfg_clear_cfgfile_comment_prefix(CFG_CONTEXT con);

int cfg_add_cfgfile_comment_prefix(CFG_CONTEXT con, char *str);

int cfg_remove_cfgfile_comment_prefix(CFG_CONTEXT con, char *str);

For changing configuration file multi line postfix use these functions. Multi line postfixes are strings used to determine situation, that line continues on next line. Multi lines are are concatenated to one and that is parsed. Multui line postfixes are removed from concatenated line. By deault is backslash (\) initialized.

void cfg_clear_cfgfile_multi_line_postfix(CFG_CONTEXT con);

int cfg_add_cfgfile_multi_line_postfix(CFG_CONTEXT con, char *str);

int cfg_remove_cfgfile_multi_line_postfix(CFG_CONTEXT con, char *str);

For changing configuration file multi values separators use these functions. Multi values separators are strings used for separation option values initialized with one argument. For example if separator is comma one line in configuration fill will be similar to this: multi = val1,val2,val2. Option must have CFG_MULTI_SEPARATED flag set. By default are space, , and ; initialized.

void cfg_clear_cfgfile_multi_vals_separator(CFG_CONTEXT con);

int cfg_add_cfgfile_multi_vals_separator(CFG_CONTEXT con, char *str);

int cfg_remove_cfgfile_multi_vals_separator(CFG_CONTEXT con, char *str);

For changing configuration file option argument separator use these functions. Option argument separators are strings used to separate option and its argument. By default is = character used. For example option = argument.

void cfg_clear_cfgfile_option_arg_separator(CFG_CONTEXT con);

int cfg_add_cfgfile_option_arg_separator(CFG_CONTEXT con, char *str);

int cfg_remove_cfgfile_option_arg_separator(CFG_CONTEXT con, char *str);