libconfig.h   libconfig.h 
/* ------------------------------------------------------------------------ ---- /* ------------------------------------------------------------------------ ----
libconfig - A library for processing structured configuration files libconfig - A library for processing structured configuration files
Copyright (C) 2005-2010 Mark A Lindner Copyright (C) 2005-2014 Mark A Lindner
This file is part of libconfig. This file is part of libconfig.
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version. the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 43 skipping to change at line 43
#elif defined(LIBCONFIG_EXPORTS) #elif defined(LIBCONFIG_EXPORTS)
#define LIBCONFIG_API __declspec(dllexport) #define LIBCONFIG_API __declspec(dllexport)
#else /* ! LIBCONFIG_EXPORTS */ #else /* ! LIBCONFIG_EXPORTS */
#define LIBCONFIG_API __declspec(dllimport) #define LIBCONFIG_API __declspec(dllimport)
#endif /* LIBCONFIG_STATIC */ #endif /* LIBCONFIG_STATIC */
#else /* ! WIN32 */ #else /* ! WIN32 */
#define LIBCONFIG_API #define LIBCONFIG_API
#endif /* WIN32 */ #endif /* WIN32 */
#define LIBCONFIG_VER_MAJOR 1 #define LIBCONFIG_VER_MAJOR 1
#define LIBCONFIG_VER_MINOR 4 #define LIBCONFIG_VER_MINOR 5
#define LIBCONFIG_VER_REVISION 9 #define LIBCONFIG_VER_REVISION 0
#include <stdio.h> #include <stdio.h>
#define CONFIG_TYPE_NONE 0 #define CONFIG_TYPE_NONE 0
#define CONFIG_TYPE_GROUP 1 #define CONFIG_TYPE_GROUP 1
#define CONFIG_TYPE_INT 2 #define CONFIG_TYPE_INT 2
#define CONFIG_TYPE_INT64 3 #define CONFIG_TYPE_INT64 3
#define CONFIG_TYPE_FLOAT 4 #define CONFIG_TYPE_FLOAT 4
#define CONFIG_TYPE_STRING 5 #define CONFIG_TYPE_STRING 5
#define CONFIG_TYPE_BOOL 6 #define CONFIG_TYPE_BOOL 6
#define CONFIG_TYPE_ARRAY 7 #define CONFIG_TYPE_ARRAY 7
#define CONFIG_TYPE_LIST 8 #define CONFIG_TYPE_LIST 8
#define CONFIG_FORMAT_DEFAULT 0 #define CONFIG_FORMAT_DEFAULT 0
#define CONFIG_FORMAT_HEX 1 #define CONFIG_FORMAT_HEX 1
#define CONFIG_OPTION_AUTOCONVERT 0x01 #define CONFIG_OPTION_AUTOCONVERT 0x01
#define CONFIG_OPTION_SEMICOLON_SEPARATORS 0x02
#define CONFIG_OPTION_COLON_ASSIGNMENT_FOR_GROUPS 0x04
#define CONFIG_OPTION_COLON_ASSIGNMENT_FOR_NON_GROUPS 0x08
#define CONFIG_OPTION_OPEN_BRACE_ON_SEPARATE_LINE 0x10
#define CONFIG_TRUE (1) #define CONFIG_TRUE (1)
#define CONFIG_FALSE (0) #define CONFIG_FALSE (0)
typedef union config_value_t typedef union config_value_t
{ {
int ival; int ival;
long long llval; long long llval;
double fval; double fval;
char *sval; char *sval;
skipping to change at line 105 skipping to change at line 109
typedef struct config_list_t typedef struct config_list_t
{ {
unsigned int length; unsigned int length;
config_setting_t **elements; config_setting_t **elements;
} config_list_t; } config_list_t;
typedef struct config_t typedef struct config_t
{ {
config_setting_t *root; config_setting_t *root;
void (*destructor)(void *); void (*destructor)(void *);
unsigned short flags; int options;
unsigned short tab_width; unsigned short tab_width;
short default_format; short default_format;
const char *include_dir; const char *include_dir;
const char *error_text; const char *error_text;
const char *error_file; const char *error_file;
int error_line; int error_line;
config_error_t error_type; config_error_t error_type;
const char **filenames; const char **filenames;
unsigned int num_filenames; unsigned int num_filenames;
} config_t; } config_t;
extern LIBCONFIG_API int config_read(config_t *config, FILE *stream); extern LIBCONFIG_API int config_read(config_t *config, FILE *stream);
extern LIBCONFIG_API void config_write(const config_t *config, FILE *stream ); extern LIBCONFIG_API void config_write(const config_t *config, FILE *stream );
extern LIBCONFIG_API void config_set_default_format(config_t *config, extern LIBCONFIG_API void config_set_default_format(config_t *config,
short format); short format);
extern LIBCONFIG_API void config_set_options(config_t *config, int options)
;
extern LIBCONFIG_API int config_get_options(const config_t *config);
extern LIBCONFIG_API void config_set_auto_convert(config_t *config, int fla g); extern LIBCONFIG_API void config_set_auto_convert(config_t *config, int fla g);
extern LIBCONFIG_API int config_get_auto_convert(const config_t *config); extern LIBCONFIG_API int config_get_auto_convert(const config_t *config);
extern LIBCONFIG_API int config_read_string(config_t *config, const char *s tr); extern LIBCONFIG_API int config_read_string(config_t *config, const char *s tr);
extern LIBCONFIG_API int config_read_file(config_t *config, extern LIBCONFIG_API int config_read_file(config_t *config,
const char *filename); const char *filename);
extern LIBCONFIG_API int config_write_file(config_t *config, extern LIBCONFIG_API int config_write_file(config_t *config,
const char *filename); const char *filename);
skipping to change at line 263 skipping to change at line 270
const char *name); const char *name);
extern LIBCONFIG_API int config_setting_remove_elem(config_setting_t *paren t, extern LIBCONFIG_API int config_setting_remove_elem(config_setting_t *paren t,
unsigned int idx); unsigned int idx);
extern LIBCONFIG_API void config_setting_set_hook(config_setting_t *setting , extern LIBCONFIG_API void config_setting_set_hook(config_setting_t *setting ,
void *hook); void *hook);
#define config_setting_get_hook(S) ((S)->hook) #define config_setting_get_hook(S) ((S)->hook)
extern LIBCONFIG_API config_setting_t *config_lookup(const config_t *config , extern LIBCONFIG_API config_setting_t *config_lookup(const config_t *config ,
const char *path); const char *path);
extern LIBCONFIG_API config_setting_t *config_lookup_from( extern LIBCONFIG_API config_setting_t *config_setting_lookup(
config_setting_t *setting, const char *path); config_setting_t *setting, const char *path);
extern LIBCONFIG_API int config_lookup_int(const config_t *config, extern LIBCONFIG_API int config_lookup_int(const config_t *config,
const char *path, int *value); const char *path, int *value);
extern LIBCONFIG_API int config_lookup_int64(const config_t *config, extern LIBCONFIG_API int config_lookup_int64(const config_t *config,
const char *path, const char *path,
long long *value); long long *value);
extern LIBCONFIG_API int config_lookup_float(const config_t *config, extern LIBCONFIG_API int config_lookup_float(const config_t *config,
const char *path, double *valu e); const char *path, double *valu e);
extern LIBCONFIG_API int config_lookup_bool(const config_t *config, extern LIBCONFIG_API int config_lookup_bool(const config_t *config,
 End of changes. 6 change blocks. 
6 lines changed or deleted 14 lines changed or added


 libconfig.h++   libconfig.h++ 
/* ------------------------------------------------------------------------ ---- /* ------------------------------------------------------------------------ ----
libconfig - A library for processing structured configuration files libconfig - A library for processing structured configuration files
Copyright (C) 2005-2010 Mark A Lindner Copyright (C) 2005-2014 Mark A Lindner
This file is part of libconfig. This file is part of libconfig.
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1 of as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version. the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of
skipping to change at line 43 skipping to change at line 43
#elif defined(LIBCONFIGXX_EXPORTS) #elif defined(LIBCONFIGXX_EXPORTS)
#define LIBCONFIGXX_API __declspec(dllexport) #define LIBCONFIGXX_API __declspec(dllexport)
#else /* ! LIBCONFIGXX_EXPORTS */ #else /* ! LIBCONFIGXX_EXPORTS */
#define LIBCONFIGXX_API __declspec(dllimport) #define LIBCONFIGXX_API __declspec(dllimport)
#endif /* LIBCONFIGXX_STATIC */ #endif /* LIBCONFIGXX_STATIC */
#else /* ! WIN32 */ #else /* ! WIN32 */
#define LIBCONFIGXX_API #define LIBCONFIGXX_API
#endif /* WIN32 */ #endif /* WIN32 */
#define LIBCONFIGXX_VER_MAJOR 1 #define LIBCONFIGXX_VER_MAJOR 1
#define LIBCONFIGXX_VER_MINOR 4 #define LIBCONFIGXX_VER_MINOR 5
#define LIBCONFIGXX_VER_REVISION 9 #define LIBCONFIGXX_VER_REVISION 0
struct config_t; // fwd decl struct config_t; // fwd decl
struct config_setting_t; // fwd decl struct config_setting_t; // fwd decl
namespace libconfig { namespace libconfig {
class LIBCONFIGXX_API ConfigException : public std::exception { }; class LIBCONFIGXX_API ConfigException : public std::exception { };
class Setting; // fwd decl class Setting; // fwd decl
class SettingIterator;
class SettingConstIterator;
class LIBCONFIGXX_API SettingException : public ConfigException class LIBCONFIGXX_API SettingException : public ConfigException
{ {
friend class Config;
public: public:
SettingException(const Setting &setting);
SettingException(const Setting &setting, int idx);
SettingException(const Setting &setting, const char *name);
SettingException(const char *path);
SettingException(const SettingException &other); SettingException(const SettingException &other);
SettingException& operator=(const SettingException &other); SettingException& operator=(const SettingException &other);
virtual ~SettingException() throw(); virtual ~SettingException() throw();
const char *getPath() const; const char *getPath() const;
virtual const char *what() const throw(); virtual const char *what() const throw();
protected:
SettingException(const Setting &setting);
SettingException(const Setting &setting, int idx);
SettingException(const Setting &setting, const char *name);
SettingException(const char *path);
private: private:
char *_path; char *_path;
}; };
class LIBCONFIGXX_API SettingTypeException : public SettingException class LIBCONFIGXX_API SettingTypeException : public SettingException
{ {
friend class Config;
friend class Setting;
public: public:
virtual const char *what() const throw();
private:
SettingTypeException(const Setting &setting); SettingTypeException(const Setting &setting);
SettingTypeException(const Setting &setting, int idx); SettingTypeException(const Setting &setting, int idx);
SettingTypeException(const Setting &setting, const char *name); SettingTypeException(const Setting &setting, const char *name);
virtual const char *what() const throw();
}; };
class LIBCONFIGXX_API SettingNotFoundException : public SettingException class LIBCONFIGXX_API SettingNotFoundException : public SettingException
{ {
friend class Config;
friend class Setting;
public: public:
virtual const char *what() const throw(); SettingNotFoundException(const char *path);
private:
SettingNotFoundException(const Setting &setting, int idx); SettingNotFoundException(const Setting &setting, int idx);
SettingNotFoundException(const Setting &setting, const char *name); SettingNotFoundException(const Setting &setting, const char *name);
SettingNotFoundException(const char *path);
virtual const char *what() const throw();
}; };
class LIBCONFIGXX_API SettingNameException : public SettingException class LIBCONFIGXX_API SettingNameException : public SettingException
{ {
friend class Config;
friend class Setting;
public: public:
virtual const char *what() const throw();
private:
SettingNameException(const Setting &setting, const char *name); SettingNameException(const Setting &setting, const char *name);
virtual const char *what() const throw();
}; };
class LIBCONFIGXX_API FileIOException : public ConfigException class LIBCONFIGXX_API FileIOException : public ConfigException
{ {
public: public:
virtual const char *what() const throw(); virtual const char *what() const throw();
}; };
class LIBCONFIGXX_API ParseException : public ConfigException class LIBCONFIGXX_API ParseException : public ConfigException
{ {
friend class Config;
public: public:
ParseException(const char *file, int line, const char *error);
ParseException(const ParseException &other); ParseException(const ParseException &other);
virtual ~ParseException() throw(); virtual ~ParseException() throw();
inline const char *getFile() const throw() inline const char *getFile() const
{ return(_file); } { return(_file); }
inline int getLine() const throw() inline int getLine() const
{ return(_line); } { return(_line); }
inline const char *getError() const throw() inline const char *getError() const
{ return(_error); } { return(_error); }
virtual const char *what() const throw(); virtual const char *what() const throw();
private: private:
ParseException(const char *file, int line, const char *error);
const char *_file; const char *_file;
int _line; int _line;
const char *_error; const char *_error;
}; };
class LIBCONFIGXX_API Setting class LIBCONFIGXX_API Setting
{ {
friend class Config; friend class Config;
public: public:
skipping to change at line 192 skipping to change at line 173
TypeArray, TypeArray,
TypeList TypeList
}; };
enum Format enum Format
{ {
FormatDefault = 0, FormatDefault = 0,
FormatHex = 1 FormatHex = 1
}; };
private: enum Option
{
OptionNone = 0,
OptionAutoConvert = 0x01,
OptionSemicolonSeparators = 0x02,
OptionColonAssignmentForGroups = 0x04,
OptionColonAssignmentForNonGroups = 0x08,
OptionOpenBraceOnSeparateLine = 0x10
};
config_setting_t *_setting; typedef SettingIterator iterator;
Type _type; typedef SettingConstIterator const_iterator;
Format _format;
Setting(config_setting_t *setting); public:
void assertType(Type type) const throw(SettingTypeException); virtual ~Setting();
static Setting & wrapSetting(config_setting_t *setting);
Setting(const Setting& other); // not supported inline Type getType() const { return(_type); }
Setting& operator=(const Setting& other); // not supported
public: inline Format getFormat() const { return(_format); }
void setFormat(Format format);
virtual ~Setting() throw(); operator bool() const;
operator int() const;
operator unsigned int() const;
operator long() const;
operator unsigned long() const;
operator long long() const;
operator unsigned long long() const;
operator double() const;
operator float() const;
operator const char *() const;
operator std::string() const;
inline const char *c_str() const
{ return operator const char *(); }
Setting & operator=(bool value);
Setting & operator=(int value);
Setting & operator=(long value);
Setting & operator=(const long long &value);
Setting & operator=(const double &value);
Setting & operator=(float value);
Setting & operator=(const char *value);
Setting & operator=(const std::string &value);
inline Type getType() const throw() { return(_type); } Setting & lookup(const char *path) const;
inline Setting & lookup(const std::string &path) const
{ return(lookup(path.c_str())); }
inline Format getFormat() const throw() { return(_format); } Setting & operator[](const char *name) const;
void setFormat(Format format) throw(); Setting & operator[](int index) const;
operator bool() const throw(SettingTypeException); bool lookupValue(const char *name, bool &value) const;
operator int() const throw(SettingTypeException); bool lookupValue(const char *name, int &value) const;
operator unsigned int() const throw(SettingTypeException); bool lookupValue(const char *name, unsigned int &value) const;
operator long() const throw(SettingTypeException); bool lookupValue(const char *name, long long &value) const;
operator unsigned long() const throw(SettingTypeException); bool lookupValue(const char *name, unsigned long long &value) const;
operator long long() const throw(SettingTypeException); bool lookupValue(const char *name, double &value) const;
operator unsigned long long() const throw(SettingTypeException); bool lookupValue(const char *name, float &value) const;
operator double() const throw(SettingTypeException); bool lookupValue(const char *name, const char *&value) const;
operator float() const throw(SettingTypeException); bool lookupValue(const char *name, std::string &value) const;
operator const char *() const throw(SettingTypeException);
operator std::string() const throw(SettingTypeException);
inline const char *c_str() const throw(SettingTypeException)
{ return operator const char*(); }
Setting & operator=(bool value) throw(SettingTypeException);
Setting & operator=(int value) throw(SettingTypeException);
Setting & operator=(long value) throw(SettingTypeException);
Setting & operator=(const long long &value) throw(SettingTypeException);
Setting & operator=(const double &value) throw(SettingTypeException);
Setting & operator=(float value) throw(SettingTypeException);
Setting & operator=(const char *value) throw(SettingTypeException);
Setting & operator=(const std::string &value) throw(SettingTypeException)
;
Setting & operator[](const char *key) const
throw(SettingTypeException, SettingNotFoundException);
inline Setting & operator[](const std::string &key) const
throw(SettingTypeException, SettingNotFoundException)
{ return(operator[](key.c_str())); }
Setting & operator[](int index) const
throw(SettingTypeException, SettingNotFoundException);
bool lookupValue(const char *name, bool &value) const throw();
bool lookupValue(const char *name, int &value) const throw();
bool lookupValue(const char *name, unsigned int &value) const throw();
bool lookupValue(const char *name, long long &value) const throw();
bool lookupValue(const char *name, unsigned long long &value)
const throw();
bool lookupValue(const char *name, double &value) const throw();
bool lookupValue(const char *name, float &value) const throw();
bool lookupValue(const char *name, const char *&value) const throw();
bool lookupValue(const char *name, std::string &value) const throw();
inline bool lookupValue(const std::string &name, bool &value) inline bool lookupValue(const std::string &name, bool &value) const
const throw()
{ return(lookupValue(name.c_str(), value)); } { return(lookupValue(name.c_str(), value)); }
inline bool lookupValue(const std::string &name, int &value) inline bool lookupValue(const std::string &name, int &value) const
const throw()
{ return(lookupValue(name.c_str(), value)); } { return(lookupValue(name.c_str(), value)); }
inline bool lookupValue(const std::string &name, unsigned int &value) inline bool lookupValue(const std::string &name, unsigned int &value) con
const throw() st
{ return(lookupValue(name.c_str(), value)); } { return(lookupValue(name.c_str(), value)); }
inline bool lookupValue(const std::string &name, long long &value) inline bool lookupValue(const std::string &name, long long &value) const
const throw()
{ return(lookupValue(name.c_str(), value)); } { return(lookupValue(name.c_str(), value)); }
inline bool lookupValue(const std::string &name, inline bool lookupValue(const std::string &name,
unsigned long long &value) const throw() unsigned long long &value) const
{ return(lookupValue(name.c_str(), value)); } { return(lookupValue(name.c_str(), value)); }
inline bool lookupValue(const std::string &name, double &value) const inline bool lookupValue(const std::string &name, double &value) const
throw()
{ return(lookupValue(name.c_str(), value)); } { return(lookupValue(name.c_str(), value)); }
inline bool lookupValue(const std::string &name, float &value) const inline bool lookupValue(const std::string &name, float &value) const
throw()
{ return(lookupValue(name.c_str(), value)); } { return(lookupValue(name.c_str(), value)); }
inline bool lookupValue(const std::string &name, const char *&value) cons t inline bool lookupValue(const std::string &name, const char *&value) cons t
throw()
{ return(lookupValue(name.c_str(), value)); } { return(lookupValue(name.c_str(), value)); }
inline bool lookupValue(const std::string &name, std::string &value) cons t inline bool lookupValue(const std::string &name, std::string &value) cons t
throw()
{ return(lookupValue(name.c_str(), value)); } { return(lookupValue(name.c_str(), value)); }
void remove(const char *name) void remove(const char *name);
throw(SettingTypeException, SettingNotFoundException);
inline void remove(const std::string & name) inline void remove(const std::string &name)
throw(SettingTypeException, SettingNotFoundException)
{ remove(name.c_str()); } { remove(name.c_str()); }
void remove(unsigned int idx) void remove(unsigned int idx);
throw(SettingTypeException, SettingNotFoundException);
Setting & add(const char *name, Type type);
inline Setting & add(const std::string & name, Type type) inline Setting & add(const std::string &name, Type type)
throw(SettingNameException, SettingTypeException)
{ return(add(name.c_str(), type)); } { return(add(name.c_str(), type)); }
Setting & add(const char *name, Type type) Setting & add(Type type);
throw(SettingNameException, SettingTypeException);
Setting & add(Type type) throw(SettingTypeException); bool exists(const char *name) const;
inline bool exists(const std::string &name) const throw() inline bool exists(const std::string &name) const
{ return(exists(name.c_str())); } { return(exists(name.c_str())); }
bool exists(const char *name) const throw(); int getLength() const;
const char *getName() const;
int getLength() const throw();
const char *getName() const throw();
std::string getPath() const; std::string getPath() const;
int getIndex() const throw(); int getIndex() const;
const Setting & getParent() const throw(SettingNotFoundException); const Setting & getParent() const;
Setting & getParent() throw(SettingNotFoundException); Setting & getParent();
bool isRoot() const throw(); bool isRoot() const;
inline bool isGroup() const throw() inline bool isGroup() const
{ return(_type == TypeGroup); } { return(_type == TypeGroup); }
inline bool isArray() const throw() inline bool isArray() const
{ return(_type == TypeArray); } { return(_type == TypeArray); }
inline bool isList() const throw() inline bool isList() const
{ return(_type == TypeList); } { return(_type == TypeList); }
inline bool isAggregate() const throw() inline bool isAggregate() const
{ return(_type >= TypeGroup); } { return(_type >= TypeGroup); }
inline bool isScalar() const throw() inline bool isScalar() const
{ return((_type > TypeNone) && (_type < TypeGroup)); } { return((_type > TypeNone) && (_type < TypeGroup)); }
inline bool isNumber() const throw() inline bool isNumber() const
{ return((_type == TypeInt) || (_type == TypeInt64) {
|| (_type == TypeFloat)); } return((_type == TypeInt) || (_type == TypeInt64) || (_type == TypeFloa
t));
}
unsigned int getSourceLine() const;
const char *getSourceFile() const;
iterator begin();
iterator end();
const_iterator begin() const;
const_iterator end() const;
private:
config_setting_t *_setting;
Type _type;
Format _format;
Setting(config_setting_t *setting);
unsigned int getSourceLine() const throw(); void assertType(Type type) const;
const char *getSourceFile() const throw(); static Setting & wrapSetting(config_setting_t *setting);
Setting(const Setting& other); // not supported
Setting& operator=(const Setting& other); // not supported
}; };
class LIBCONFIGXX_API Config class LIBCONFIGXX_API SettingIterator
{ {
public:
SettingIterator(Setting &setting, bool endIterator = false);
SettingIterator(const SettingIterator &other);
SettingIterator& operator=(const SettingIterator &other);
// Equality comparison.
inline bool operator==(SettingIterator const &other) const
{ return((_setting == other._setting) && (_idx == other._idx)); }
inline bool operator!=(SettingIterator const &other) const
{ return(!operator==(other)); }
bool operator<(SettingIterator const &other) const;
// Dereference operators.
inline Setting & operator*()
{ return((*_setting)[_idx]); }
inline Setting * operator->()
{ return(&(*_setting)[_idx]); }
inline const Setting & operator*() const
{ return(*_setting)[_idx]; }
inline const Setting * operator->() const
{ return(&(*_setting)[_idx]); }
// Increment and decrement operators.
SettingIterator & operator++();
SettingIterator operator++(int);
SettingIterator & operator--();
SettingIterator operator--(int);
// Arithmetic operators.
SettingIterator operator+(int offset) const;
SettingIterator & operator+=(int offset);
SettingIterator operator-(int offset) const;
SettingIterator & operator-=(int offset);
int operator-(const SettingIterator &other) const;
private: private:
config_t *_config; Setting *_setting;
static void ConfigDestructor(void *arg); int _count;
Config(const Config& other); // not supported int _idx;
Config& operator=(const Config& other); // not supported };
SettingIterator operator+(int offset, const SettingIterator &si);
class LIBCONFIGXX_API SettingConstIterator
{
public:
SettingConstIterator(const Setting &setting, bool endIterator = false);
SettingConstIterator(const SettingConstIterator &rhs);
SettingConstIterator& operator=(const SettingConstIterator &rhs);
// Equality comparison.
bool operator==(SettingConstIterator const &other) const
{ return((_setting == other._setting) && (_idx == other._idx)); }
inline bool operator!=(SettingConstIterator const &other) const
{ return(!operator==(other)); }
// Dereference operators.
inline Setting const & operator*()
{ return((*_setting)[_idx]); }
inline Setting const * operator->()
{ return(&(*_setting)[_idx]); }
inline const Setting& operator*() const
{ return((*_setting)[_idx]); }
inline const Setting * operator->() const
{ return(&(*_setting)[_idx]); }
// Increment and decrement operators.
SettingConstIterator & operator++();
SettingConstIterator operator++(int);
SettingConstIterator & operator--();
SettingConstIterator operator--(int);
// Arithmetic operators.
SettingConstIterator operator+(int offset) const;
SettingConstIterator & operator+=(int offset);
SettingConstIterator operator-(int offset) const;
SettingConstIterator & operator-=(int offset);
int operator-(const SettingConstIterator &other) const;
private:
const Setting *_setting;
int _count;
int _idx;
};
SettingConstIterator operator+(int offset, const SettingConstIterator &si);
class LIBCONFIGXX_API Config
{
public: public:
Config(); Config();
virtual ~Config(); virtual ~Config();
void setOptions(int options);
int getOptions() const;
void setAutoConvert(bool flag); void setAutoConvert(bool flag);
bool getAutoConvert() const; bool getAutoConvert() const;
void setDefaultFormat(Setting::Format format); void setDefaultFormat(Setting::Format format);
inline Setting::Format getDefaultFormat() const inline Setting::Format getDefaultFormat() const
{ return(_defaultFormat); } { return(_defaultFormat); }
void setTabWidth(unsigned short width) throw(); void setTabWidth(unsigned short width);
unsigned short getTabWidth() const throw(); unsigned short getTabWidth() const;
void setIncludeDir(const char *includeDir) throw(); void setIncludeDir(const char *includeDir);
const char *getIncludeDir() const throw(); const char *getIncludeDir() const;
void read(FILE *stream) throw(ParseException); void read(FILE *stream);
void write(FILE *stream) const; void write(FILE *stream) const;
void readString(const char *str) throw(ParseException); void readString(const char *str);
inline void readString(const std::string &str) throw(ParseException) inline void readString(const std::string &str)
{ return(readString(str.c_str())); } { return(readString(str.c_str())); }
void readFile(const char *filename) throw(FileIOException, ParseException void readFile(const char *filename);
); void writeFile(const char *filename);
void writeFile(const char *filename) throw(FileIOException);
Setting & lookup(const char *path) const;
inline Setting & lookup(const std::string &path) const inline Setting & lookup(const std::string &path) const
throw(SettingNotFoundException)
{ return(lookup(path.c_str())); } { return(lookup(path.c_str())); }
Setting & lookup(const char *path) const throw(SettingNotFoundException); bool exists(const char *path) const;
inline bool exists(const std::string &path) const
inline bool exists(const std::string & path) const throw()
{ return(exists(path.c_str())); } { return(exists(path.c_str())); }
bool exists(const char *path) const throw(); bool lookupValue(const char *path, bool &value) const;
bool lookupValue(const char *path, int &value) const;
bool lookupValue(const char *path, bool &value) const throw(); bool lookupValue(const char *path, unsigned int &value) const;
bool lookupValue(const char *path, int &value) const throw(); bool lookupValue(const char *path, long long &value) const;
bool lookupValue(const char *path, unsigned int &value) const throw(); bool lookupValue(const char *path, unsigned long long &value) const;
bool lookupValue(const char *path, long long &value) const throw(); bool lookupValue(const char *path, double &value) const;
bool lookupValue(const char *path, unsigned long long &value) bool lookupValue(const char *path, float &value) const;
const throw(); bool lookupValue(const char *path, const char *&value) const;
bool lookupValue(const char *path, double &value) const throw(); bool lookupValue(const char *path, std::string &value) const;
bool lookupValue(const char *path, float &value) const throw();
bool lookupValue(const char *path, const char *&value) const throw();
bool lookupValue(const char *path, std::string &value) const throw();
inline bool lookupValue(const std::string &path, bool &value) const throw () inline bool lookupValue(const std::string &path, bool &value) const
{ return(lookupValue(path.c_str(), value)); } { return(lookupValue(path.c_str(), value)); }
inline bool lookupValue(const std::string &path, int &value) const throw( ) inline bool lookupValue(const std::string &path, int &value) const
{ return(lookupValue(path.c_str(), value)); } { return(lookupValue(path.c_str(), value)); }
inline bool lookupValue(const std::string &path, unsigned int &value) inline bool lookupValue(const std::string &path, unsigned int &value) con
const throw() st
{ return(lookupValue(path.c_str(), value)); } { return(lookupValue(path.c_str(), value)); }
inline bool lookupValue(const std::string &path, long long &value) inline bool lookupValue(const std::string &path, long long &value) const
const throw()
{ return(lookupValue(path.c_str(), value)); } { return(lookupValue(path.c_str(), value)); }
inline bool lookupValue(const std::string &path, inline bool lookupValue(const std::string &path,
unsigned long long &value) const throw() unsigned long long &value) const
{ return(lookupValue(path.c_str(), value)); } { return(lookupValue(path.c_str(), value)); }
inline bool lookupValue(const std::string &path, double &value) inline bool lookupValue(const std::string &path, double &value) const
const throw()
{ return(lookupValue(path.c_str(), value)); } { return(lookupValue(path.c_str(), value)); }
inline bool lookupValue(const std::string &path, float &value) inline bool lookupValue(const std::string &path, float &value) const
const throw()
{ return(lookupValue(path.c_str(), value)); } { return(lookupValue(path.c_str(), value)); }
inline bool lookupValue(const std::string &path, const char *&value) inline bool lookupValue(const std::string &path, const char *&value) cons
const throw() t
{ return(lookupValue(path.c_str(), value)); } { return(lookupValue(path.c_str(), value)); }
inline bool lookupValue(const std::string &path, std::string &value) inline bool lookupValue(const std::string &path, std::string &value) cons
const throw() t
{ return(lookupValue(path.c_str(), value)); } { return(lookupValue(path.c_str(), value)); }
Setting & getRoot() const; Setting & getRoot() const;
private: private:
static void ConfigDestructor(void *arg);
void handleError() const;
config_t *_config;
Setting::Format _defaultFormat; Setting::Format _defaultFormat;
void handleError() const; Config(const Config& other); // not supported
Config& operator=(const Config& other); // not supported
}; };
} // namespace libconfig } // namespace libconfig
#endif // __libconfig_hpp #endif // __libconfig_hpp
 End of changes. 84 change blocks. 
190 lines changed or deleted 274 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/