#include <iniparser.h>
Classes | |
struct | BoolParam |
struct | DoubleParam |
struct | IntParam |
struct | Param |
struct | ParamVisitor |
struct | StringParam |
Public Types | |
typedef std::vector< Param * > | ParamVector |
Public Member Functions | |
DLLEXPORT | ParamSection () |
virtual bool | parse (IniParser *parser) |
parse text starting right after the "]" token. | |
virtual void | print (FILE *f) |
This method helps IniParser::dumpExampleFile() to do it's job. | |
DLLEXPORT void | addDoubleParam (const char *name, double *val, double def, double min=-DBL_MAX, double max=DBL_MAX) |
register a parameter of type "double". | |
DLLEXPORT void | addBoolParam (const char *name, bool *val, bool def) |
register a parameter of type "bool". | |
DLLEXPORT void | addStringParam (const char *name, char **val, const char *def) |
register a parameter of type "string". | |
DLLEXPORT void | addIntParam (const char *name, int *val, int def, int min=INT_MIN, int max=INT_MAX) |
register a parameter of type "int". | |
Public Attributes | |
ParamVector | params |
4 types of parameters exists: int, double, boolean and string.
Definition at line 130 of file iniparser.h.
typedef std::vector<Param *> ParamSection::ParamVector |
Definition at line 216 of file iniparser.h.
ParamSection::ParamSection | ( | ) |
void ParamSection::addBoolParam | ( | const char * | name, | |
bool * | val, | |||
bool | def | |||
) |
register a parameter of type "bool".
Example: param = true param = false
name | the keyword name will appear as "keyword = value" in the .ini file. | |
val | the pointer where to save the parsed value. | |
def | the default value if this parameter is ommited in the .ini file. |
Definition at line 384 of file iniparser.cpp.
References ParamSection::Param::name, params, and ParamSection::BoolParam::val.
Referenced by OpenCVFactory::registerParameters(), MPlayerFactory::registerParameters(), FlyCaptureFactory::registerParameters(), DShowFileFactory::registerParameters(), DShowCBFactory::registerParameters(), DC1394Factory::registerParameters(), and BmpFactory::registerParameters().
void ParamSection::addDoubleParam | ( | const char * | name, | |
double * | val, | |||
double | def, | |||
double | min = -DBL_MAX , |
|||
double | max = DBL_MAX | |||
) |
register a parameter of type "double".
name | the keyword name will appear as "keyword = value" in the .ini file. | |
val | the pointer where to save the parsed value. | |
def | the default value if this parameter is ommited in the .ini file. | |
min | the minimum acceptable value. | |
max | the maximum acceptable value. |
Definition at line 371 of file iniparser.cpp.
References ParamSection::DoubleParam::max, ParamSection::DoubleParam::min, ParamSection::Param::name, params, and ParamSection::DoubleParam::val.
void ParamSection::addIntParam | ( | const char * | name, | |
int * | val, | |||
int | def, | |||
int | min = INT_MIN , |
|||
int | max = INT_MAX | |||
) |
register a parameter of type "int".
name | the keyword name will appear as "keyword = value" in the .ini file. | |
val | the pointer where to save the parsed value. | |
def | the default value if this parameter is ommited in the .ini file. | |
min | the minimum acceptable value. | |
max | the maximum acceptable value. |
Definition at line 402 of file iniparser.cpp.
References ParamSection::IntParam::max, ParamSection::IntParam::min, ParamSection::Param::name, params, and ParamSection::IntParam::val.
Referenced by OpenCVFactory::registerParameters(), DC1394Factory::registerParameters(), and BmpFactory::registerParameters().
void ParamSection::addStringParam | ( | const char * | name, | |
char ** | val, | |||
const char * | def | |||
) |
register a parameter of type "string".
Example: param = "c:/directory/file.avi" param = singleword
name | the keyword name will appear as "keyword = value" in the .ini file. | |
val | the pointer where to save the parsed value. Memory will be allocated and should be freed by the caller. | |
def | the default value if this parameter is ommited in the .ini file. |
Definition at line 393 of file iniparser.cpp.
References ParamSection::Param::name, params, and ParamSection::StringParam::val.
Referenced by OpenCVFactory::registerParameters(), MPlayerFactory::registerParameters(), DShowFileFactory::registerParameters(), and BmpFactory::registerParameters().
bool ParamSection::parse | ( | IniParser * | parser | ) | [virtual] |
parse text starting right after the "]" token.
The parser object should be used to read the file in order to remove comments correctly and to count lines. Once parsed, this method do something usefull with the data.
Implements IniSection.
Definition at line 238 of file iniparser.cpp.
References IniParser::buffer, IniParser::nextToken(), params, and IniParser::printError().
void ParamSection::print | ( | FILE * | f | ) | [virtual] |
This method helps IniParser::dumpExampleFile() to do it's job.
It prints an example section.
Reimplemented from IniSection.
Definition at line 274 of file iniparser.cpp.
References params.
Definition at line 217 of file iniparser.h.
Referenced by addBoolParam(), addDoubleParam(), addIntParam(), addStringParam(), parse(), and print().