📄 confuse.h.3
字号:
\fBParameters:\fP.RS 4\fIcfg\fP The configuration file context. .br\fIname\fP The name of the option. .br\fIindex\fP Index of the value to get. Zero based. .RE.PP\fBSee also:\fP.RS 4\fBcfg_getfloat\fP .RE.PP.SS "DLLIMPORT long int __export cfg_getnint (\fBcfg_t\fP * cfg, const char * name, unsigned int index)".PPIndexed version of \fBcfg_getint()\fP, used for lists. .PP\fBParameters:\fP.RS 4\fIcfg\fP The configuration file context. .br\fIname\fP The name of the option. .br\fIindex\fP Index of the value to get. Zero based. .RE.PP\fBSee also:\fP.RS 4\fBcfg_getint\fP .RE.PP.SS "DLLIMPORT \fBcfg_t\fP* __export cfg_getnsec (\fBcfg_t\fP * cfg, const char * name, unsigned int index)".PPIndexed version of \fBcfg_getsec()\fP, used for sections with the CFGF_MULTI flag set. .PP\fBParameters:\fP.RS 4\fIcfg\fP The configuration file context. .br\fIname\fP The name of the option. .br\fIindex\fP Index of the section to get. Zero based. .RE.PP\fBSee also:\fP.RS 4\fBcfg_getsec\fP .RE.PP.PP\fBExamples: \fP.in +1c\fBftpconf.c\fP, and \fBreread.c\fP..SS "DLLIMPORT char* __export cfg_getnstr (\fBcfg_t\fP * cfg, const char * name, unsigned int index)".PPIndexed version of \fBcfg_getstr()\fP, used for lists. .PP\fBParameters:\fP.RS 4\fIcfg\fP The configuration file context. .br\fIname\fP The name of the option. .br\fIindex\fP Index of the value to get. Zero based. .RE.PP\fBSee also:\fP.RS 4\fBcfg_getstr\fP .RE.PP.PP\fBExamples: \fP.in +1c\fBftpconf.c\fP..SS "DLLIMPORT \fBcfg_opt_t\fP* __export cfg_getopt (\fBcfg_t\fP * cfg, const char * name)".PPReturn an option given it's name. .PP\fBParameters:\fP.RS 4\fIcfg\fP The configuration file context. .br\fIname\fP The name of the option..RE.PP\fBReturns:\fP.RS 4Returns a pointer to the option. If the option isn't declared, libConfuse will print an error message and return 0. .RE.PP.SS "DLLIMPORT void* __export cfg_getptr (\fBcfg_t\fP * cfg, const char * name)".PPReturns the value of a user-defined option (void pointer). .PP\fBParameters:\fP.RS 4\fIcfg\fP The configuration file context. .br\fIname\fP The name of the option. .RE.PP\fBReturns:\fP.RS 4The requested value is returned. If the option was not set in the configuration file, the default value given in the corresponding \fBcfg_opt_t\fP structure is returned. It is an error to try to get an option that isn't declared. .RE.PP.SS "DLLIMPORT \fBcfg_t\fP* __export cfg_getsec (\fBcfg_t\fP * cfg, const char * name)".PPReturns the value of a section option. .PPThe returned value is another \fBcfg_t\fP structure that can be used in following calls to cfg_getint, cfg_getstr or other get-functions. .PP\fBParameters:\fP.RS 4\fIcfg\fP The configuration file context. .br\fIname\fP The name of the option. .RE.PP\fBReturns:\fP.RS 4The requested section is returned. If no section is found with that name, 0 is returned. There can only be default values for section without the CFGF_MULTI flag set. It is an error to try to get a section that isn't declared. .RE.PP.SS "DLLIMPORT char* __export cfg_getstr (\fBcfg_t\fP * cfg, const char * name)".PPReturns the value of a string option. .PP\fBParameters:\fP.RS 4\fIcfg\fP The configuration file context. .br\fIname\fP The name of the option. .RE.PP\fBReturns:\fP.RS 4The requested value is returned. If the option was not set in the configuration file, the default value given in the corresponding \fBcfg_opt_t\fP structure is returned. It is an error to try to get an option that isn't declared. .RE.PP.PP\fBExamples: \fP.in +1c\fBftpconf.c\fP, and \fBreread.c\fP..SS "DLLIMPORT \fBcfg_t\fP* __export cfg_gettsec (\fBcfg_t\fP * cfg, const char * name, const char * title)".PPReturn a section given the title, used for section with the CFGF_TITLE flag set. .PP\fBParameters:\fP.RS 4\fIcfg\fP The configuration file context. .br\fIname\fP The name of the option. .br\fItitle\fP The title of this section. The CFGF_TITLE flag must have been set for this option. .RE.PP\fBSee also:\fP.RS 4\fBcfg_getsec\fP .RE.PP.SS "DLLIMPORT int __export cfg_include (\fBcfg_t\fP * cfg, \fBcfg_opt_t\fP * opt, int argc, const char ** argv)".PPPredefined include-function. .PPThis function can be used in the options passed to \fBcfg_init()\fP to specify a function for including other configuration files in the parsing. For example: CFG_FUNC('include', &cfg_include) .PP\fBExamples: \fP.in +1c\fBftpconf.c\fP..SS "DLLIMPORT \fBcfg_t\fP* __export cfg_init (\fBcfg_opt_t\fP * opts, cfg_flag_t flags)".PPCreate and initialize a \fBcfg_t\fP structure. .PPThis should be the first function called when setting up the parsing of a configuration file. The options passed in the first parameter is initialized using the CFG_* initializers. The last option in the option array must be \fBCFG_END()\fP, unless you like segmentation faults..PPThe options must no longer be defined in the same scope as where the cfg_xxx functions are used (since version 2.3)..PP\fBParameters:\fP.RS 4\fIopts\fP An arrary of options .br\fIflags\fP One or more flags (bitwise or'ed together). Currently only CFGF_NOCASE is available. Use 0 if no flags are needed..RE.PP\fBReturns:\fP.RS 4A configuration context structure. This pointer is passed to almost all other functions as the first parameter. .RE.PP.PP\fBExamples: \fP.in +1c\fBftpconf.c\fP, \fBreread.c\fP, and \fBsimple.c\fP..SS "DLLIMPORT const char* __export cfg_name (\fBcfg_t\fP * cfg)".PPReturn the name of a section. .PP\fBParameters:\fP.RS 4\fIcfg\fP The configuration file context. .RE.PP\fBReturns:\fP.RS 4Returns the title, or 0 if there is no title. This string should not be modified. .RE.PP.PP\fBExamples: \fP.in +1c\fBftpconf.c\fP..SS "DLLIMPORT \fBcfg_bool_t\fP __export cfg_opt_getnbool (\fBcfg_opt_t\fP * opt, unsigned int index)".PPReturns the value of a boolean option, given a \fBcfg_opt_t\fP pointer. .PP\fBParameters:\fP.RS 4\fIopt\fP The option structure (eg, as returned from \fBcfg_getopt()\fP) .br\fIindex\fP Index of the value to get. Zero based. .RE.PP\fBSee also:\fP.RS 4\fBcfg_getnbool\fP .RE.PP.SS "DLLIMPORT double __export cfg_opt_getnfloat (\fBcfg_opt_t\fP * opt, unsigned int index)".PPReturns the value of a floating point option, given a \fBcfg_opt_t\fP pointer. .PP\fBParameters:\fP.RS 4\fIopt\fP The option structure (eg, as returned from \fBcfg_getopt()\fP) .br\fIindex\fP Index of the value to get. Zero based. .RE.PP\fBSee also:\fP.RS 4\fBcfg_getnfloat\fP .RE.PP.SS "DLLIMPORT signed long __export cfg_opt_getnint (\fBcfg_opt_t\fP * opt, unsigned int index)".PPReturns the value of an integer option, given a \fBcfg_opt_t\fP pointer. .PP\fBParameters:\fP.RS 4\fIopt\fP The option structure (eg, as returned from \fBcfg_getopt()\fP) .br\fIindex\fP Index of the value to get. Zero based. .RE.PP\fBSee also:\fP.RS 4\fBcfg_getnint\fP .RE.PP.PP\fBExamples: \fP.in +1c\fBftpconf.c\fP..SS "DLLIMPORT \fBcfg_t\fP* __export cfg_opt_getnsec (\fBcfg_opt_t\fP * opt, unsigned int index)".PPReturns the value of a section option, given a \fBcfg_opt_t\fP pointer. .PP\fBParameters:\fP.RS 4\fIopt\fP The option structure (eg, as returned from \fBcfg_getopt()\fP) .br\fIindex\fP Index of the value to get. Zero based. .RE.PP\fBSee also:\fP.RS 4\fBcfg_getnsec\fP .RE.PP.PP\fBExamples: \fP.in +1c\fBftpconf.c\fP..SS "DLLIMPORT char* __export cfg_opt_getnstr (\fBcfg_opt_t\fP * opt, unsigned int index)".PPReturns the value of a string option, given a \fBcfg_opt_t\fP pointer. .PP\fBParameters:\fP.RS 4\fIopt\fP The option structure (eg, as returned from \fBcfg_getopt()\fP) .br\fIindex\fP Index of the value to get. Zero based. .RE.PP\fBSee also:\fP.RS 4\fBcfg_getnstr\fP .RE.PP.SS "DLLIMPORT \fBcfg_t\fP* __export cfg_opt_gettsec (\fBcfg_opt_t\fP * opt, const char * title)".PPReturns the value of a section option, given a \fBcfg_opt_t\fP pointer and the title. .PP\fBParameters:\fP.RS 4\fIopt\fP The option structure (eg, as returned from \fBcfg_getopt()\fP) .br\fItitle\fP The title of this section. The CFGF_TITLE flag must have been set for this option. .RE.PP\fBSee also:\fP.RS 4\fBcfg_gettsec\fP .RE.PP.SS "DLLIMPORT const char* __export cfg_opt_name (\fBcfg_opt_t\fP * opt)".PPReturn the name of an option. .PP\fBParameters:\fP.RS 4\fIopt\fP The option structure (eg, as returned from \fBcfg_getopt()\fP) .RE.PP\fBReturns:\fP.RS 4Returns the title, or 0 if there is no title. This string should not be modified. .RE.PP.PP\fBExamples: \fP.in +1c\fBftpconf.c\fP..SS "DLLIMPORT void __export cfg_opt_nprint_var (\fBcfg_opt_t\fP * opt, unsigned int index, FILE * fp)".PPDefault value print function. .PPPrint only the value of a given option. Does not handle sections or functions. Use cfg_opt_print to print the whole assignment ('option = value'), or cfg_print to print the whole config file..PP\fBParameters:\fP.RS 4\fIopt\fP The option structure (eg, as returned from \fBcfg_getopt()\fP) .br\fIindex\fP The index in the option value array that should be printed .br\fIfp\fP File stream to print to..RE.PP\fBSee also:\fP.RS 4\fBcfg_print\fP, \fBcfg_opt_print\fP .RE.PP.SS "DLLIMPORT void __export cfg_opt_print (\fBcfg_opt_t\fP * opt, FILE * fp)".PPPrint an option and its value to a file. .PPIf a print callback function is specified for the option, it is used instead of cfg_opt_nprint_var..PP\fBParameters:\fP.RS 4\fIopt\fP The option structure (eg, as returned from \fBcfg_getopt()\fP) .br\fIfp\fP File stream to print to..RE.PP\fBSee also:\fP.RS 4\fBcfg_print_func_t\fP .RE.PP.SS "DLLIMPORT void __export cfg_opt_print_indent (\fBcfg_opt_t\fP * opt, FILE * fp, int indent)".PPPrint an option and its value to a file. .PPSame as cfg_opt_print, but with the indentation level specified. .PP\fBSee also:\fP.RS 4\fBcfg_opt_print\fP .RE.PP.SS "DLLIMPORT \fBcfg_print_func_t\fP __export cfg_opt_set_print_func (\fBcfg_opt_t\fP * opt, \fBcfg_print_func_t\fP pf)".PPSet a print callback function for an option. .PP\fBParameters:\fP.RS 4\fIopt\fP The option structure (eg, as returned from \fBcfg_getopt()\fP) .br\fIpf\fP The print function callback..RE.PP\fBSee also:\fP.RS 4\fBcfg_print_func_t\fP .RE.PP.SS "DLLIMPORT void __export cfg_opt_setnbool (\fBcfg_opt_t\fP * opt, \fBcfg_bool_t\fP value, unsigned int index)".PP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -