Couldn't find wdiff. Falling back to builtin diff colouring...
| libconfig.h | | libconfig.h | |
| /* ------------------------------------------------------------------------
---- | | /* ------------------------------------------------------------------------
---- | |
|
| libconfig - A structured configuration file parsing library | | libconfig - A library for processing structured configuration files | |
| Copyright (C) 2005-2007 Mark A Lindner | | Copyright (C) 2005-2008 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 | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Lesser General Public License for more details. | | Lesser General Public License for more details. | |
| | | | |
|
| You should have received a copy of the GNU Lesser General Public | | You should have received a copy of the GNU Library General Public | |
| License along with this library; if not, write to the Free Software | | License along with this library; if not, see | |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | <http://www.gnu.org/licenses/>. | |
| ------------------------------------------------------------------------
---- | | ------------------------------------------------------------------------
---- | |
| */ | | */ | |
| | | | |
| #ifndef __libconfig_h | | #ifndef __libconfig_h | |
| #define __libconfig_h | | #define __libconfig_h | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif /* __cplusplus */ | | #endif /* __cplusplus */ | |
| | | | |
| | | | |
| skipping to change at line 47 | | skipping to change at line 47 | |
| #endif /* LIBCONFIG_STATIC */ | | #endif /* LIBCONFIG_STATIC */ | |
| #else /* ! WIN32 */ | | #else /* ! WIN32 */ | |
| #define LIBCONFIG_API | | #define LIBCONFIG_API | |
| #endif /* WIN32 */ | | #endif /* WIN32 */ | |
| | | | |
| #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_FLOAT 3 | | #define CONFIG_TYPE_INT64 3 | |
| #define CONFIG_TYPE_STRING 4 | | #define CONFIG_TYPE_FLOAT 4 | |
| #define CONFIG_TYPE_BOOL 5 | | #define CONFIG_TYPE_STRING 5 | |
| #define CONFIG_TYPE_ARRAY 6 | | #define CONFIG_TYPE_BOOL 6 | |
| #define CONFIG_TYPE_LIST 7 | | #define CONFIG_TYPE_ARRAY 7 | |
| | | #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_TRUE (1) | | #define CONFIG_TRUE (1) | |
| #define CONFIG_FALSE (0) | | #define CONFIG_FALSE (0) | |
| | | | |
| typedef union config_value_t | | typedef union config_value_t | |
| { | | { | |
| long ival; | | long ival; | |
|
| | | long long llval; | |
| double fval; | | double fval; | |
| char *sval; | | char *sval; | |
|
| int bval; | | | |
| struct config_list_t *list; | | struct config_list_t *list; | |
| } config_value_t; | | } config_value_t; | |
| | | | |
| typedef struct config_setting_t | | typedef struct config_setting_t | |
| { | | { | |
| char *name; | | char *name; | |
| short type; | | short type; | |
| short format; | | short format; | |
| config_value_t value; | | config_value_t value; | |
| struct config_setting_t *parent; | | struct config_setting_t *parent; | |
| | | | |
| skipping to change at line 117 | | skipping to change at line 118 | |
| const char *filename); | | const char *filename); | |
| | | | |
| extern LIBCONFIG_API void config_set_destructor(config_t *config, | | extern LIBCONFIG_API void config_set_destructor(config_t *config, | |
| void (*destructor)(void *))
; | | void (*destructor)(void *))
; | |
| | | | |
| extern LIBCONFIG_API void config_init(config_t *config); | | extern LIBCONFIG_API void config_init(config_t *config); | |
| extern LIBCONFIG_API void config_destroy(config_t *config); | | extern LIBCONFIG_API void config_destroy(config_t *config); | |
| | | | |
| extern LIBCONFIG_API long config_setting_get_int( | | extern LIBCONFIG_API long config_setting_get_int( | |
| const config_setting_t *setting); | | const config_setting_t *setting); | |
|
| | | extern LIBCONFIG_API long long config_setting_get_int64( | |
| | | const config_setting_t *setting); | |
| extern LIBCONFIG_API double config_setting_get_float( | | extern LIBCONFIG_API double config_setting_get_float( | |
| const config_setting_t *setting); | | const config_setting_t *setting); | |
| extern LIBCONFIG_API int config_setting_get_bool( | | extern LIBCONFIG_API int config_setting_get_bool( | |
| const config_setting_t *setting); | | const config_setting_t *setting); | |
| extern LIBCONFIG_API const char *config_setting_get_string( | | extern LIBCONFIG_API const char *config_setting_get_string( | |
| const config_setting_t *setting); | | const config_setting_t *setting); | |
| | | | |
| extern LIBCONFIG_API int config_setting_set_int(config_setting_t *setting, | | extern LIBCONFIG_API int config_setting_set_int(config_setting_t *setting, | |
| long value); | | long value); | |
|
| | | extern LIBCONFIG_API int config_setting_set_int64(config_setting_t *setting
, | |
| | | long long value); | |
| extern LIBCONFIG_API int config_setting_set_float(config_setting_t *setting
, | | extern LIBCONFIG_API int config_setting_set_float(config_setting_t *setting
, | |
| double value); | | double value); | |
| extern LIBCONFIG_API int config_setting_set_bool(config_setting_t *setting, | | extern LIBCONFIG_API int config_setting_set_bool(config_setting_t *setting, | |
| int value); | | int value); | |
| extern LIBCONFIG_API int config_setting_set_string(config_setting_t *settin
g, | | extern LIBCONFIG_API int config_setting_set_string(config_setting_t *settin
g, | |
| const char *value); | | const char *value); | |
| | | | |
| extern LIBCONFIG_API int config_setting_set_format(config_setting_t *settin
g, | | extern LIBCONFIG_API int config_setting_set_format(config_setting_t *settin
g, | |
| short format); | | short format); | |
| extern LIBCONFIG_API short config_setting_get_format(config_setting_t *sett
ing); | | extern LIBCONFIG_API short config_setting_get_format(config_setting_t *sett
ing); | |
| | | | |
| extern LIBCONFIG_API long config_setting_get_int_elem( | | extern LIBCONFIG_API long config_setting_get_int_elem( | |
|
| const config_setting_t *setting, int index); | | const config_setting_t *setting, int idx); | |
| | | extern LIBCONFIG_API long long config_setting_get_int64_elem( | |
| | | const config_setting_t *setting, int idx); | |
| extern LIBCONFIG_API double config_setting_get_float_elem( | | extern LIBCONFIG_API double config_setting_get_float_elem( | |
|
| const config_setting_t *setting, int index); | | const config_setting_t *setting, int idx); | |
| extern LIBCONFIG_API int config_setting_get_bool_elem( | | extern LIBCONFIG_API int config_setting_get_bool_elem( | |
|
| const config_setting_t *setting, int index); | | const config_setting_t *setting, int idx); | |
| extern LIBCONFIG_API const char *config_setting_get_string_elem( | | extern LIBCONFIG_API const char *config_setting_get_string_elem( | |
|
| const config_setting_t *setting, int index); | | const config_setting_t *setting, int idx); | |
| | | | |
| extern LIBCONFIG_API config_setting_t *config_setting_set_int_elem( | | extern LIBCONFIG_API config_setting_t *config_setting_set_int_elem( | |
|
| config_setting_t *setting, int index, long value); | | config_setting_t *setting, int idx, long value); | |
| | | extern LIBCONFIG_API config_setting_t *config_setting_set_int64_elem( | |
| | | config_setting_t *setting, int idx, long long value); | |
| extern LIBCONFIG_API config_setting_t *config_setting_set_float_elem( | | extern LIBCONFIG_API config_setting_t *config_setting_set_float_elem( | |
|
| config_setting_t *setting, int index, double value); | | config_setting_t *setting, int idx, double value); | |
| extern LIBCONFIG_API config_setting_t *config_setting_set_bool_elem( | | extern LIBCONFIG_API config_setting_t *config_setting_set_bool_elem( | |
|
| config_setting_t *setting, int index, int value); | | config_setting_t *setting, int idx, int value); | |
| extern LIBCONFIG_API config_setting_t *config_setting_set_string_elem( | | extern LIBCONFIG_API config_setting_t *config_setting_set_string_elem( | |
|
| config_setting_t *setting, int index, const char *value); | | config_setting_t *setting, int idx, const char *value); | |
| | | | |
| #define /* int */ config_setting_type(/* const config_setting_t * */ S) \ | | #define /* int */ config_setting_type(/* const config_setting_t * */ S) \ | |
| ((S)->type) | | ((S)->type) | |
| | | | |
| #define /* int */ config_setting_is_group(/* const config_setting_t * */ S)
\ | | #define /* int */ config_setting_is_group(/* const config_setting_t * */ S)
\ | |
| ((S)->type == CONFIG_TYPE_GROUP) | | ((S)->type == CONFIG_TYPE_GROUP) | |
| #define /* int */ config_setting_is_array(/* const config_setting_t * */ S)
\ | | #define /* int */ config_setting_is_array(/* const config_setting_t * */ S)
\ | |
| ((S)->type == CONFIG_TYPE_ARRAY) | | ((S)->type == CONFIG_TYPE_ARRAY) | |
| #define /* int */ config_setting_is_list(/* const config_setting_t * */ S)
\ | | #define /* int */ config_setting_is_list(/* const config_setting_t * */ S)
\ | |
| ((S)->type == CONFIG_TYPE_LIST) | | ((S)->type == CONFIG_TYPE_LIST) | |
| | | | |
| #define /* int */ config_setting_is_aggregate( \ | | #define /* int */ config_setting_is_aggregate( \ | |
| /* const config_setting_t * */ S) \ | | /* const config_setting_t * */ S) \ | |
| (((S)->type == CONFIG_TYPE_GROUP) || ((S)->type == CONFIG_TYPE_LIST) \ | | (((S)->type == CONFIG_TYPE_GROUP) || ((S)->type == CONFIG_TYPE_LIST) \ | |
| || ((S)->type == CONFIG_TYPE_ARRAY)) | | || ((S)->type == CONFIG_TYPE_ARRAY)) | |
| | | | |
| #define /* int */ config_setting_is_number(/* const config_setting_t * */ S
) \ | | #define /* int */ config_setting_is_number(/* const config_setting_t * */ S
) \ | |
|
| (((S)->type == CONFIG_TYPE_INT) || ((S)->type == CONFIG_TYPE_FLOAT)) | | (((S)->type == CONFIG_TYPE_INT) \ | |
| | | || ((S)->type == CONFIG_TYPE_INT64) \ | |
| | | || ((S)->type == CONFIG_TYPE_FLOAT)) | |
| | | | |
| #define /* int */ config_setting_is_scalar(/* const config_setting_t * */ S
) \ | | #define /* int */ config_setting_is_scalar(/* const config_setting_t * */ S
) \ | |
| (((S)->type == CONFIG_TYPE_BOOL) || ((S)->type == CONFIG_TYPE_STRING) \ | | (((S)->type == CONFIG_TYPE_BOOL) || ((S)->type == CONFIG_TYPE_STRING) \ | |
| || config_setting_is_number(S)) | | || config_setting_is_number(S)) | |
| | | | |
| #define /* const char * */ config_setting_name( \ | | #define /* const char * */ config_setting_name( \ | |
| /* const config_setting_t * */ S) \ | | /* const config_setting_t * */ S) \ | |
| ((S)->name) | | ((S)->name) | |
| | | | |
|
| | | #define /* config_setting_t * */ config_setting_parent( \ | |
| | | /* const config_setting_t * */ S) \ | |
| | | ((S)->parent) | |
| | | | |
| | | #define /* int */ config_setting_is_root( \ | |
| | | /* const config_setting_t * */ S) \ | |
| | | ((S)->parent ? CONFIG_FALSE : CONFIG_TRUE) | |
| | | | |
| | | extern LIBCONFIG_API int config_setting_index(const config_setting_t *setti
ng); | |
| | | | |
| extern LIBCONFIG_API int config_setting_length( | | extern LIBCONFIG_API int config_setting_length( | |
| const config_setting_t *setting); | | const config_setting_t *setting); | |
| extern LIBCONFIG_API config_setting_t *config_setting_get_elem( | | extern LIBCONFIG_API config_setting_t *config_setting_get_elem( | |
|
| const config_setting_t *setting, unsigned int index); | | const config_setting_t *setting, unsigned int idx); | |
| | | | |
| extern LIBCONFIG_API config_setting_t *config_setting_get_member( | | extern LIBCONFIG_API config_setting_t *config_setting_get_member( | |
| const config_setting_t *setting, const char *name); | | const config_setting_t *setting, const char *name); | |
| | | | |
| extern LIBCONFIG_API config_setting_t *config_setting_add( | | extern LIBCONFIG_API config_setting_t *config_setting_add( | |
| config_setting_t *parent, const char *name, int type); | | config_setting_t *parent, const char *name, int type); | |
| extern LIBCONFIG_API int config_setting_remove(config_setting_t *parent, | | extern LIBCONFIG_API int config_setting_remove(config_setting_t *parent, | |
| const char *name); | | const char *name); | |
|
| | | extern LIBCONFIG_API int config_setting_remove_elem(config_setting_t *paren
t, | |
| | | 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 long config_lookup_int(const config_t *config, | | extern LIBCONFIG_API long config_lookup_int(const config_t *config, | |
| const char *path); | | const char *path); | |
|
| | | extern LIBCONFIG_API long long config_lookup_int64(const config_t *config, | |
| | | const char *path); | |
| extern LIBCONFIG_API double config_lookup_float(const config_t *config, | | extern LIBCONFIG_API double config_lookup_float(const config_t *config, | |
| const char *path); | | const char *path); | |
| extern LIBCONFIG_API int config_lookup_bool(const config_t *config, | | extern LIBCONFIG_API int config_lookup_bool(const config_t *config, | |
| const char *path); | | const char *path); | |
| extern LIBCONFIG_API const char *config_lookup_string(const config_t *confi
g, | | extern LIBCONFIG_API const char *config_lookup_string(const config_t *confi
g, | |
| const char *path); | | const char *path); | |
| | | | |
| #define /* config_setting_t * */ config_root_setting( \ | | #define /* config_setting_t * */ config_root_setting( \ | |
| /* const config_t * */ C) \ | | /* const config_t * */ C) \ | |
| ((C)->root) | | ((C)->root) | |
| | | | |
End of changes. 20 change blocks. |
| 21 lines changed or deleted | | 46 lines changed or added | |
|
| libconfig.h++ | | libconfig.h++ | |
| /* ------------------------------------------------------------------------
---- | | /* ------------------------------------------------------------------------
---- | |
|
| libconfig - A structured configuration file parsing library | | libconfig - A library for processing structured configuration files | |
| Copyright (C) 2005-2007 Mark A Lindner | | Copyright (C) 2005-2008 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 | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| Lesser General Public License for more details. | | Lesser General Public License for more details. | |
| | | | |
|
| You should have received a copy of the GNU Lesser General Public | | You should have received a copy of the GNU Library General Public | |
| License along with this library; if not, write to the Free Software | | License along with this library; if not, see | |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | | <http://www.gnu.org/licenses/>. | |
| ------------------------------------------------------------------------
---- | | ------------------------------------------------------------------------
---- | |
| */ | | */ | |
| | | | |
| #ifndef __libconfig_hpp | | #ifndef __libconfig_hpp | |
| #define __libconfig_hpp | | #define __libconfig_hpp | |
| | | | |
| #include <stdio.h> | | #include <stdio.h> | |
| #include <string> | | #include <string> | |
| #include <map> | | #include <map> | |
| | | | |
| namespace libconfig | | namespace libconfig | |
| { | | { | |
| | | | |
|
| #include "libconfig.h" | | #include <libconfig.h> | |
| | | | |
|
| class LIBCONFIG_API ConfigException { }; | | class LIBCONFIG_API ConfigException : public std::exception { }; | |
| | | | |
|
| class LIBCONFIG_API SettingTypeException : public ConfigException { }; | | class Setting; // fwd decl | |
| | | | |
|
| class LIBCONFIG_API SettingNotFoundException : public ConfigException { }
; | | class LIBCONFIG_API SettingException : public ConfigException | |
| | | { | |
| | | friend class Config; | |
| | | | |
|
| class LIBCONFIG_API SettingExistsException : public ConfigException { }; | | public: | |
| | | | |
|
| class LIBCONFIG_API FileIOException : public ConfigException { }; | | SettingException(const SettingException &other); | |
| | | SettingException& operator=(const SettingException &other); | |
| | | | |
|
| class LIBCONFIG_API ParseException : public ConfigException | | virtual ~SettingException() throw(); | |
| | | | |
| | | const char *getPath() const; | |
| | | | |
| | | 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: | |
| | | | |
| | | char *_path; | |
| | | }; | |
| | | | |
| | | class LIBCONFIG_API SettingTypeException : public SettingException | |
| { | | { | |
| friend class Config; | | friend class Config; | |
|
| | | friend class Setting; | |
| | | | |
| | | const char *what() const throw(); | |
| | | | |
| private: | | private: | |
| | | | |
|
| int _line; | | SettingTypeException(const Setting &setting); | |
| const char *_error; | | SettingTypeException(const Setting &setting, int idx); | |
| | | SettingTypeException(const Setting &setting, const char *name); | |
| | | }; | |
| | | | |
|
| ParseException(int line, const char *error) | | class LIBCONFIG_API SettingNotFoundException : public SettingException | |
| : _line(line), _error(error) {} | | { | |
| | | friend class Config; | |
| | | friend class Setting; | |
| | | | |
| | | const char *what() const throw(); | |
| | | | |
| | | private: | |
| | | | |
| | | SettingNotFoundException(const Setting &setting, int idx); | |
| | | SettingNotFoundException(const Setting &setting, const char *name); | |
| | | SettingNotFoundException(const char *path); | |
| | | }; | |
| | | | |
| | | class LIBCONFIG_API SettingNameException : public SettingException | |
| | | { | |
| | | friend class Config; | |
| | | friend class Setting; | |
| | | | |
| | | const char *what() const throw(); | |
| | | | |
| | | private: | |
| | | | |
| | | SettingNameException(const Setting &setting, const char *name); | |
| | | }; | |
| | | | |
| | | class LIBCONFIG_API FileIOException : public ConfigException | |
| | | { | |
| | | const char *what() const throw(); | |
| | | }; | |
| | | | |
| | | class LIBCONFIG_API ParseException : public ConfigException | |
| | | { | |
| | | friend class Config; | |
| | | | |
| public: | | public: | |
| | | | |
|
| virtual ~ParseException() { } | | virtual ~ParseException() throw(); | |
| | | | |
|
| inline int getLine() throw() { return(_line); } | | inline int getLine() throw() | |
| inline const char *getError() throw() { return(_error); } | | { return(_line); } | |
| | | | |
| | | inline const char *getError() throw() | |
| | | { return(_error); } | |
| | | | |
| | | const char *what() const throw(); | |
| | | | |
| | | private: | |
| | | | |
| | | ParseException(int line, const char *error); | |
| | | | |
| | | int _line; | |
| | | const char *_error; | |
| }; | | }; | |
| | | | |
| class LIBCONFIG_API Setting | | class LIBCONFIG_API Setting | |
| { | | { | |
| friend class Config; | | friend class Config; | |
| | | | |
| public: | | public: | |
| | | | |
| enum Type | | enum Type | |
| { | | { | |
| TypeNone = 0, | | TypeNone = 0, | |
| // scalar types | | // scalar types | |
| TypeInt, | | TypeInt, | |
|
| | | TypeInt64, | |
| TypeFloat, | | TypeFloat, | |
| TypeString, | | TypeString, | |
| TypeBoolean, | | TypeBoolean, | |
| // aggregate types | | // aggregate types | |
| TypeGroup, | | TypeGroup, | |
| TypeArray, | | TypeArray, | |
| TypeList | | TypeList | |
| }; | | }; | |
| | | | |
| enum Format | | enum Format | |
| | | | |
| skipping to change at line 120 | | skipping to change at line 191 | |
| inline Type getType() const throw() { return(_type); } | | inline Type getType() const throw() { return(_type); } | |
| | | | |
| inline Format getFormat() const throw() { return(_format); } | | inline Format getFormat() const throw() { return(_format); } | |
| void setFormat(Format format) throw(); | | void setFormat(Format format) throw(); | |
| | | | |
| operator bool() const throw(SettingTypeException); | | operator bool() const throw(SettingTypeException); | |
| operator long() const throw(SettingTypeException); | | operator long() const throw(SettingTypeException); | |
| operator unsigned long() const throw(SettingTypeException); | | operator unsigned long() const throw(SettingTypeException); | |
| operator int() const throw(SettingTypeException); | | operator int() const throw(SettingTypeException); | |
| operator unsigned int() const throw(SettingTypeException); | | operator unsigned int() const throw(SettingTypeException); | |
|
| | | operator long long() const throw(SettingTypeException); | |
| | | operator unsigned long long() const throw(SettingTypeException); | |
| operator double() const throw(SettingTypeException); | | operator double() const throw(SettingTypeException); | |
| operator float() const throw(SettingTypeException); | | operator float() const throw(SettingTypeException); | |
| operator const char *() const throw(SettingTypeException); | | operator const char *() const throw(SettingTypeException); | |
| operator std::string() const throw(SettingTypeException); | | operator std::string() const throw(SettingTypeException); | |
| | | | |
| Setting & operator=(bool value) throw(SettingTypeException); | | Setting & operator=(bool value) throw(SettingTypeException); | |
| Setting & operator=(long value) throw(SettingTypeException); | | Setting & operator=(long value) throw(SettingTypeException); | |
| Setting & operator=(int value) throw(SettingTypeException); | | Setting & operator=(int value) throw(SettingTypeException); | |
|
| | | Setting & operator=(const long long &value) throw(SettingTypeException)
; | |
| Setting & operator=(const double &value) throw(SettingTypeException); | | Setting & operator=(const double &value) throw(SettingTypeException); | |
| Setting & operator=(float value) throw(SettingTypeException); | | Setting & operator=(float value) throw(SettingTypeException); | |
| Setting & operator=(const char *value) throw(SettingTypeException); | | Setting & operator=(const char *value) throw(SettingTypeException); | |
| Setting & operator=(const std::string &value) throw(SettingTypeExceptio
n); | | Setting & operator=(const std::string &value) throw(SettingTypeExceptio
n); | |
| | | | |
| Setting & operator[](const char * key) const | | Setting & operator[](const char * key) const | |
| throw(SettingTypeException, SettingNotFoundException); | | throw(SettingTypeException, SettingNotFoundException); | |
| | | | |
| inline Setting & operator[](const std::string & key) const | | inline Setting & operator[](const std::string & key) const | |
| throw(SettingTypeException, SettingNotFoundException) | | throw(SettingTypeException, SettingNotFoundException) | |
| { return(operator[](key.c_str())); } | | { return(operator[](key.c_str())); } | |
| | | | |
| Setting & operator[](int index) const | | Setting & operator[](int index) const | |
| throw(SettingTypeException, SettingNotFoundException); | | throw(SettingTypeException, SettingNotFoundException); | |
| | | | |
| bool lookupValue(const char *name, bool &value) const throw(); | | bool lookupValue(const char *name, bool &value) const throw(); | |
| bool lookupValue(const char *name, long &value) const throw(); | | bool lookupValue(const char *name, long &value) const throw(); | |
| bool lookupValue(const char *name, unsigned long &value) const throw(); | | bool lookupValue(const char *name, unsigned long &value) const throw(); | |
| bool lookupValue(const char *name, int &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, 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, double &value) const throw(); | |
| bool lookupValue(const char *name, float &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, const char *&value) const throw(); | |
| bool lookupValue(const char *name, std::string &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 throw() | | const throw() | |
| { return(lookupValue(name.c_str(), value)); } | | { return(lookupValue(name.c_str(), value)); } | |
| | | | |
|
| inline bool lookupValue(const std::string &name, long &value) const thr
ow() | | inline bool lookupValue(const std::string &name, long &value) | |
| | | const throw() | |
| { return(lookupValue(name.c_str(), value)); } | | { return(lookupValue(name.c_str(), value)); } | |
| | | | |
| inline bool lookupValue(const std::string &name, unsigned long &value) | | inline bool lookupValue(const std::string &name, unsigned long &value) | |
| const throw() | | const throw() | |
| { return(lookupValue(name.c_str(), value)); } | | { return(lookupValue(name.c_str(), value)); } | |
| | | | |
| inline bool lookupValue(const std::string &name, int &value) const thro
w() | | inline bool lookupValue(const std::string &name, int &value) const thro
w() | |
| { 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) | |
| const throw() | | const throw() | |
| { return(lookupValue(name.c_str(), value)); } | | { return(lookupValue(name.c_str(), value)); } | |
| | | | |
|
| | | inline bool lookupValue(const std::string &name, long long &value) | |
| | | const throw() | |
| | | { return(lookupValue(name.c_str(), value)); } | |
| | | | |
| | | inline bool lookupValue(const std::string &name, | |
| | | unsigned long long &value) const throw() | |
| | | { 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() | | 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() | | throw() | |
| { return(lookupValue(name.c_str(), value)); } | | { return(lookupValue(name.c_str(), value)); } | |
| | | | |
| inline bool lookupValue(const std::string &name, const char *&value) co
nst | | inline bool lookupValue(const std::string &name, const char *&value) co
nst | |
| throw() | | throw() | |
| | | | |
| skipping to change at line 194 | | skipping to change at line 280 | |
| throw() | | 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); | | throw(SettingTypeException, SettingNotFoundException); | |
| | | | |
| inline void remove(const std::string & name) | | inline void remove(const std::string & name) | |
| throw(SettingTypeException, SettingNotFoundException) | | throw(SettingTypeException, SettingNotFoundException) | |
| { remove(name.c_str()); } | | { remove(name.c_str()); } | |
| | | | |
|
| | | void remove(unsigned int idx) | |
| | | throw(SettingTypeException, SettingNotFoundException); | |
| | | | |
| inline Setting & add(const std::string & name, Type type) | | inline Setting & add(const std::string & name, Type type) | |
|
| throw(SettingTypeException, SettingExistsException) | | throw(SettingNameException, SettingTypeException) | |
| { return(add(name.c_str(), type)); } | | { return(add(name.c_str(), type)); } | |
| | | | |
| Setting & add(const char *name, Type type) | | Setting & add(const char *name, Type type) | |
|
| throw(SettingTypeException, SettingExistsException); | | throw(SettingNameException, SettingTypeException); | |
| | | | |
| Setting & add(Type type) | | Setting & add(Type type) | |
| throw(SettingTypeException); | | throw(SettingTypeException); | |
| | | | |
| inline bool exists(const std::string & name) const throw() | | inline bool exists(const std::string & name) const throw() | |
| { return(exists(name.c_str())); } | | { return(exists(name.c_str())); } | |
| | | | |
| bool exists(const char *name) const throw(); | | bool exists(const char *name) const throw(); | |
| | | | |
| int getLength() const throw(); | | int getLength() const throw(); | |
| const char *getName() const throw(); | | const char *getName() const throw(); | |
|
| | | std::string getPath() const; | |
| | | int getIndex() const throw(); | |
| | | | |
| | | const Setting & getParent() const throw(SettingNotFoundException); | |
| | | Setting & getParent() throw(SettingNotFoundException); | |
| | | | |
| | | bool isRoot() const throw(); | |
| | | | |
| inline bool isGroup() const throw() | | inline bool isGroup() const throw() | |
| { return(_type == TypeGroup); } | | { return(_type == TypeGroup); } | |
| | | | |
| inline bool isArray() const throw() | | inline bool isArray() const throw() | |
| { return(_type == TypeArray); } | | { return(_type == TypeArray); } | |
| | | | |
| inline bool isList() const throw() | | inline bool isList() const throw() | |
| { return(_type == TypeList); } | | { return(_type == TypeList); } | |
| | | | |
| inline bool isAggregate() const throw() | | inline bool isAggregate() const throw() | |
| { return(_type >= TypeGroup); } | | { return(_type >= TypeGroup); } | |
| | | | |
| inline bool isScalar() const throw() | | inline bool isScalar() const throw() | |
| { return((_type > TypeNone) && (_type < TypeGroup)); } | | { return((_type > TypeNone) && (_type < TypeGroup)); } | |
| | | | |
| inline bool isNumber() const throw() | | inline bool isNumber() const throw() | |
|
| { return((_type == TypeInt) || (_type == TypeFloat)); } | | { return((_type == TypeInt) || (_type == TypeInt64) | |
| | | || (_type == TypeFloat)); } | |
| | | | |
| inline unsigned int getSourceLine() const throw() | | inline unsigned int getSourceLine() const throw() | |
| { return(config_setting_source_line(_setting)); } | | { return(config_setting_source_line(_setting)); } | |
| }; | | }; | |
| | | | |
| class LIBCONFIG_API Config | | class LIBCONFIG_API Config | |
| { | | { | |
| private: | | private: | |
| | | | |
| config_t _config; | | config_t _config; | |
| | | | |
| skipping to change at line 275 | | skipping to change at line 372 | |
| inline bool exists(const std::string & path) const throw() | | 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 exists(const char *path) const throw(); | |
| | | | |
| bool lookupValue(const char *path, bool &value) const throw(); | | bool lookupValue(const char *path, bool &value) const throw(); | |
| bool lookupValue(const char *path, long &value) const throw(); | | bool lookupValue(const char *path, long &value) const throw(); | |
| bool lookupValue(const char *path, unsigned long &value) const throw(); | | bool lookupValue(const char *path, unsigned long &value) const throw(); | |
| bool lookupValue(const char *path, int &value) const throw(); | | bool lookupValue(const char *path, int &value) const throw(); | |
| bool lookupValue(const char *path, unsigned int &value) const throw(); | | bool lookupValue(const char *path, unsigned int &value) const throw(); | |
|
| | | bool lookupValue(const char *path, long long &value) const throw(); | |
| | | bool lookupValue(const char *path, unsigned long long &value) | |
| | | const throw(); | |
| bool lookupValue(const char *path, double &value) const throw(); | | bool lookupValue(const char *path, double &value) const throw(); | |
| bool lookupValue(const char *path, float &value) const throw(); | | bool lookupValue(const char *path, float &value) const throw(); | |
| bool lookupValue(const char *path, const char *&value) const throw(); | | bool lookupValue(const char *path, const char *&value) const throw(); | |
| bool lookupValue(const char *path, std::string &value) const throw(); | | bool lookupValue(const char *path, std::string &value) const throw(); | |
| | | | |
| inline bool lookupValue(const std::string &path, bool &value) | | inline bool lookupValue(const std::string &path, bool &value) | |
| const throw() | | const throw() | |
| { return(lookupValue(path.c_str(), value)); } | | { return(lookupValue(path.c_str(), value)); } | |
| | | | |
|
| inline bool lookupValue(const std::string &path, long &value) const thr
ow() | | inline bool lookupValue(const std::string &path, long &value) | |
| | | const throw() | |
| { return(lookupValue(path.c_str(), value)); } | | { return(lookupValue(path.c_str(), value)); } | |
| | | | |
| inline bool lookupValue(const std::string &path, unsigned long &value) | | inline bool lookupValue(const std::string &path, unsigned long &value) | |
| const throw() | | const throw() | |
| { return(lookupValue(path.c_str(), value)); } | | { return(lookupValue(path.c_str(), value)); } | |
| | | | |
| inline bool lookupValue(const std::string &path, int &value) const thro
w() | | inline bool lookupValue(const std::string &path, int &value) const thro
w() | |
| { 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) | |
| const throw() | | const throw() | |
| { return(lookupValue(path.c_str(), value)); } | | { return(lookupValue(path.c_str(), value)); } | |
| | | | |
|
| | | inline bool lookupValue(const std::string &path, long long &value) | |
| | | const throw() | |
| | | { return(lookupValue(path.c_str(), value)); } | |
| | | | |
| | | inline bool lookupValue(const std::string &path, | |
| | | unsigned long long &value) const throw() | |
| | | { return(lookupValue(path.c_str(), value)); } | |
| | | | |
| inline bool lookupValue(const std::string &path, double &value) const | | inline bool lookupValue(const std::string &path, double &value) const | |
| throw() | | throw() | |
| { return(lookupValue(path.c_str(), value)); } | | { return(lookupValue(path.c_str(), value)); } | |
| | | | |
| inline bool lookupValue(const std::string &path, float &value) const | | inline bool lookupValue(const std::string &path, float &value) const | |
| throw() | | throw() | |
| { return(lookupValue(path.c_str(), value)); } | | { return(lookupValue(path.c_str(), value)); } | |
| | | | |
| inline bool lookupValue(const std::string &path, const char *&value) co
nst | | inline bool lookupValue(const std::string &path, const char *&value) co
nst | |
| throw() | | throw() | |
| | | | |
End of changes. 28 change blocks. |
| 24 lines changed or deleted | | 133 lines changed or added | |
|