Libconfig Manual
Libconfig Manual
Mark A. Lindner
Copyright
c 2004-2021 Mark A Lindner
Permission is granted to make and distribute verbatim copies of this manual provided the
copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the con-
ditions for verbatim copying, provided that the entire resulting derived work is distributed
under the terms of a permission notice identical to this one.
i
Table of Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Why Another Configuration File Library? . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Using the Library from a C Program . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Using the Library from a C++ Program . . . . . . . . . . . . . . . . . . . . . . . . 1
1.4 Multithreading Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.5 Internationalization Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.6 Compiling Using pkg-config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.7 Version Test Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Configuration Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1 Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Groups. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.4 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.5 Integer Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.6 64-bit Integer Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.7 Floating Point Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.8 Boolean Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.9 String Values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.10 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.11 Include Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3 The C API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5 Example Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Appendix A License . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
ii libconfig
Function Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Type Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Concept Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Chapter 1: Introduction 1
1 Introduction
Libconfig is a library for reading, manipulating, and writing structured configuration
files. The library features a fully reentrant parser and includes bindings for both the C and
C++ programming languages.
The library runs on modern POSIX-compilant systems, such as Linux, Solaris, and Mac
OS X (Darwin), as well as on Microsoft Windows 2000/XP and later (with either Microsoft
Visual Studio 2005 or later, or the GNU toolchain via the MinGW environment).
#include <libconfig.h>
#include <libconfig.h++>
Or, alternatively:
#include <libconfig.hh>
2 libconfig
The C++ API classes are defined in the namespace ‘libconfig’, hence the following
statement may optionally be used:
LIBCONFIG_VER_MAJOR [Macro]
LIBCONFIG_VER_MINOR [Macro]
LIBCONFIG_VER_REVISION [Macro]
These macros represent the major version, minor version, and revision of the libconfig
library. For example, in libconfig 1.4 these are defined as ‘1’, ‘4’, and ‘0’, respectively.
These macros can be used in preprocessor directives to determine which libconfig
features and/or APIs are present. For example:
#if (((LIBCONFIG_VER_MAJOR == 1) && (LIBCONFIG_VER_MINOR >= 4)) \
|| (LIBCONFIG_VER_MAJOR > 1))
/* use features present in libconfig 1.4 and later */
#endif
These macros were introduced in libconfig 1.4.
LIBCONFIGXX_VER_MAJOR [Macro]
LIBCONFIGXX_VER_MINOR [Macro]
LIBCONFIGXX_VER_REVISION [Macro]
These macros represent the major version, minor version, and revision of the libcon-
fig++ library.
Chapter 2: Configuration Files 5
2 Configuration Files
Libconfig supports structured, hierarchical configurations. These configurations can be
read from and written to files and manipulated in memory.
A configuration consists of a group of settings, which associate names with values. A
value can be one of the following:
• A scalar value: integer, 64-bit integer, floating-point number, boolean, or string
• An array, which is a sequence of scalar values, all of which must have the same type
• A group, which is a collection of settings
• A list, which is a sequence of values of any type, including other lists
Consider the following configuration file for a hypothetical GUI application, which illus-
trates all of the elements of the configuration file grammar.
# Example application configuration file
version = "1.0";
application:
{
window:
{
title = "My Application";
size = { w = 640; h = 480; };
pos = { x = 350; y = 250; };
};
misc:
{
pi = 3.141592654;
bigint = 9223372036854775807L;
columns = [ "Last Name", "First Name", "MI" ];
bitmask = 0x1FC3; // hex
umask = 0027; // octal. Range limited to that of "int"
};
};
Settings can be uniquely identified within the configuration by a path. The path is a
dot-separated sequence of names, beginning at a top-level group and ending at the setting
itself. Each name in the path is the name of a setting; if the setting has no name because
6 libconfig
it is an element in a list or array, an integer index in square brackets can be used as the
name.
For example, in our hypothetical configuration file, the path to the x setting is
application.window.pos.x; the path to the version setting is simply version;
and the path to the title setting of the second book in the books list is
application.books.[1].title.
The datatype of a value is determined from the format of the value itself. If the value
is enclosed in double quotes, it is treated as a string. If it looks like an integer or floating
point number, it is treated as such. If it is one of the values TRUE, true, FALSE, or false
(or any other mixed-case version of those tokens, e.g., True or FaLsE), it is treated as a
boolean. If it consists of a comma-separated list of values enclosed in square brackets, it
is treated as an array. And if it consists of a comma-separated list of values enclosed in
parentheses, it is treated as a list. Any value which does not meet any of these criteria is
considered invalid and results in a parse error.
All names are case-sensitive. They may consist only of alphanumeric characters, dashes
(‘-’), underscores (‘_’), and asterisks (‘*’), and must begin with a letter or asterisk. No
other characters are allowed.
In C and C++, integer, 64-bit integer, floating point, and string values are mapped to the
native types int, long long, double, and const char *, respectively. The boolean type is
mapped to int in C and bool in C++.
The following sections describe the elements of the configuration file grammar in addi-
tional detail.
2.1 Settings
A setting has the form:
name = value ;
or:
name : value ;
The trailing semicolon is optional. Whitespace is not significant.
The value may be a scalar value, an array, a group, or a list.
2.2 Groups
A group has the form:
{ settings ... }
Groups can contain any number of settings, but each setting must have a unique name
within the group.
2.3 Arrays
An array has the form:
[ value, value ... ]
An array may have zero or more elements, but the elements must all be scalar values of
the same type.
The last element in an array may be followed by a comma, which will be ignored.
Chapter 2: Configuration Files 7
2.4 Lists
A list has the form:
( value, value ... )
A list may have zero or more elements, each of which can be a scalar value, an array, a
group, or another list.
The last element in a list may be followed by a comma, which will be ignored.
In addition, the ‘\x’ escape sequence is supported; this sequence must be followed by
exactly two hexadecimal digits, which represent an 8-bit ASCII value. For example, ‘\xFF’
represents the character with ASCII code 0xFF.
No other escape sequences are currently supported.
Adjacent strings are automatically concatenated, as in C/C++ source code. This is useful
for formatting very long strings as sequences of shorter strings. For example, the following
constructs are equivalent:
• "The quick brown fox jumped over the lazy dog."
• "The quick brown fox"
" jumped over the lazy dog."
• "The quick" /* comment */ " brown fox " // another comment
"jumped over the lazy dog."
Chapter 2: Configuration Files 9
2.10 Comments
Three types of comments are allowed within a configuration:
• Script-style comments. All text beginning with a ‘#’ character to the end of the line is
ignored.
• C-style comments. All text, including line breaks, between a starting ‘/*’ sequence and
an ending ‘*/’ sequence is ignored.
• C++-style comments. All text beginning with a ‘//’ sequence to the end of the line is
ignored.
As expected, comment delimiters appearing within quoted strings are treated as literal
text.
Comments are ignored when the configuration is read in, so they are not treated as part
of the configuration. Therefore if the configuration is written back out to a stream, any
comments that were present in the original configuration will be lost.
# file: test.cfg
info: {
name = "Winston Churchill";
@include "quote.cfg"
country = "UK";
};
The resulting configuration will be equivalent to one in which the contents of the file
‘quote.cfg’ appeared at the point where the include directive is placed.
10 libconfig
Include files may be nested to a maximum of 10 levels; exceeding this limit results in a
parse error.
When the path argument to an @include directive is a relative path, then it will be
interpreted as being relative to the include directory that has been been set by means of
config_set_include_dir(). If no include directory has been set, then it will be taken as
being relative to the program’s current working directory.
Like comments, include directives are not part of the configuration file syntax. They
are processed before the configuration itself is parsed. Therefore, they are not preserved
when the configuration is written back out to a stream. There is presently no support for
programmatically inserting include directives into a configuration.
Chapter 3: The C API 11
3 The C API
This chapter describes the C library API. The type config t represents a configuration,
and the type config setting t represents a configuration setting.
The boolean values CONFIG_TRUE and CONFIG_FALSE are macros defined as (1) and (0),
respectively.
the paths appear in the array. Both the array and its elements should be heap
allocated; the library will take ownership of and eventually free the strings in
the array and the array itself.
On failure, the function should return NULL and set *error to a static error
string which should be used as the parse error for the configuration; the library
does not take ownership of or free this string.
The default include function, config_default_include_func(), simply re-
turns a NULL-terminated array containing either a copy of path if it’s an absolute
path, or a concatenation of include dir and path if it’s a relative path.
Application-supplied include functions can perform custom tasks like wildcard expan-
sion or variable substitution. For example, consider the include directive:
@include "configs/*.cfg"
The include function would be invoked with the path ‘configs/*.cfg’ and could
do wildcard expansion on that path, returning a list of paths to files with the file
extension ‘.cfg’ in the subdirectory ‘configs’. Each of these files would then be
inlined at the location of the include directive.
Tasks like wildcard expansion and variable substitution are non-trivial to implement
and typically require platform-specific code. In the interests of keeping the library
as compact and platform-independent as possible, implementations of such include
functions are not included.
CONFIG_OPTION_SEMICOLON_SEPARATORS
This option controls whether a semicolon (‘;’) is output after each setting
when the configuration is written to a file or stream. (The semicolon sep-
arators are optional in the configuration syntax.) By default this option
is turned on.
CONFIG_OPTION_COLON_ASSIGNMENT_FOR_GROUPS
This option controls whether a colon (‘:’) is output between each group
setting’s name and its value when the configuration is written to a file
or stream. If the option is turned off, an equals sign (‘=’) is output
instead. (These tokens are interchangeable in the configuration syntax.)
By default this option is turned on.
CONFIG_OPTION_COLON_ASSIGNMENT_FOR_NON_GROUPS
This option controls whether a colon (‘:’) is output between each non-
group setting’s name and its value when the configuration is written to a
file or stream. If the option is turned off, an equals sign (‘=’) is output
instead. (These tokens are interchangeable in the configuration syntax.)
By default this option is turned off.
CONFIG_OPTION_OPEN_BRACE_ON_SEPARATE_LINE
This option controls whether an open brace (‘{’) will be written on its
own line when the configuration is written to a file or stream. If the
option is turned off, the brace will be written at the end of the previous
line. By default this option is turned on.
CONFIG_OPTION_ALLOW_SCIENTIFIC_NOTATION
(Since v1.7 ) This option controls whether scientific notation may be
used as appropriate when writing floating point values (corresponding
to printf() ‘%g’ format) or should never be used (corresponding to
printf() ‘%f’ format). By default this option is turned off.
CONFIG_OPTION_FSYNC
(Since v1.7.1 ) This option controls whether the config_write_file()
function performs an fsync operation after writing the configuration and
before closing the file. By default this option is turned off.
CONFIG_OPTION_ALLOW_OVERRIDES
(Since v1.7.3 ) This option controls whether duplicate settings override
previous settings with the same name. If this option is turned off, dupli-
cate settings are rejected. By default this option is turned off.
setting was not found or if the type of the value did not match the type requested,
they leave the data pointed to by value unmodified and return CONFIG_FALSE.
Storage for the string returned by config_setting_lookup_string() is managed
by the library and released automatically when the setting is destroyed or when the
setting’s value is changed; the string must not be freed by the caller.
and released automatically when the setting is destroyed or when its value is changed;
the string must not be freed by the caller.
The function returns CONFIG_TRUE on success. If parent is not a group, list, or array,
or if index is out of range, it returns CONFIG_FALSE.
config_setting_t * config_root_setting [Function]
(const config t * config)
This function, which is implemented as a macro, returns the root setting for the
configuration config. The root setting is a group.
const char * config_setting_name [Function]
(const config setting t * setting)
This function returns the name of the given setting, or NULL if the setting has no name.
Storage for the returned string is managed by the library and released automatically
when the setting is destroyed; the string must not be freed by the caller.
config_setting_t * config_setting_parent [Function]
(const config setting t * setting)
This function returns the parent setting of the given setting, or NULL if setting is the
root setting.
int config_setting_is_root (const config setting t * setting) [Function]
This function returns CONFIG_TRUE if the given setting is the root setting, and
CONFIG_FALSE otherwise.
int config_setting_index (const config setting t * setting) [Function]
This function returns the index of the given setting within its parent setting. If
setting is the root setting, this function returns -1.
int config_setting_length (const config setting t * setting) [Function]
This function returns the number of settings in a group, or the number of elements
in a list or array. For other types of settings, it returns 0.
int config_setting_type (const config setting t * setting) [Function]
This function returns the type of the given setting. The return value is one of the con-
stants CONFIG_TYPE_INT, CONFIG_TYPE_INT64, CONFIG_TYPE_FLOAT, CONFIG_TYPE_
STRING, CONFIG_TYPE_BOOL, CONFIG_TYPE_ARRAY, CONFIG_TYPE_LIST, or CONFIG_
TYPE_GROUP.
int config_setting_is_group (const config setting t * setting) [Function]
int config_setting_is_array (const config setting t * setting) [Function]
int config_setting_is_list (const config setting t * setting) [Function]
These convenience functions, which are implemented as macros, test if the setting
setting is of a given type. They return CONFIG_TRUE or CONFIG_FALSE.
int config_setting_is_aggregate [Function]
(const config setting t * setting)
int config_setting_is_scalar (const config setting t * setting) [Function]
int config_setting_is_number (const config setting t * setting) [Function]
These convenience functions, some of which are implemented as macros, test if the
setting setting is of an aggregate type (a group, array, or list), of a scalar type (integer,
64-bit integer, floating point, boolean, or string), and of a number (integer, 64-bit
integer, or floating point), respectively. They return CONFIG_TRUE or CONFIG_FALSE.
20 libconfig
Config::OptionSemicolonSeparators
This option controls whether a semicolon (‘;’) is output after each setting
when the configuration is written to a file or stream. (The semicolon sep-
arators are optional in the configuration syntax.) By default this option
is turned on.
Config::OptionColonAssignmentForGroups
This option controls whether a colon (‘:’) is output between each group
setting’s name and its value when the configuration is written to a file
or stream. If the option is turned off, an equals sign (‘=’) is output
instead. (These tokens are interchangeable in the configuration syntax.)
By default this option is turned on.
Config::OptionColonAssignmentForNonGroups
This option controls whether a colon (‘:’) is output between each non-
group setting’s name and its value when the configuration is written to a
file or stream. If the option is turned off, an equals sign (‘=’) is output
instead. (These tokens are interchangeable in the configuration syntax.)
By default this option is turned off.
Config::OptionOpenBraceOnSeparateLine
This option controls whether an open brace (‘{’) will be written on its
own line when the configuration is written to a file or stream. If the
option is turned off, the brace will be written at the end of the previous
line. By default this option is turned on.
Config::OptionAllowScientificNotation
(Since v1.7 ) This option controls whether scientific notation may be
used as appropriate when writing floating point values (corresponding
to printf() ‘%g’ format) or should never be used (corresponding to
printf() ‘%f’ format). By default this option is turned off.
Config::OptionFsync
(Since v1.7.1 ) This option controls whether the writeFile() method
performs an fsync operation after writing the configuration and before
closing the file. By default this option is turned off.
Config::OptionAllowOverrides
(Since v1.7.3 ) This option controls whether duplicate settings override
previous settings with the same name. If this option is turned off, dupli-
cate settings are rejected. By default this option is turned off.
bool lookupValue (const char *path, bool &value) const [Method on Config]
bool lookupValue (const std::string &path, bool &value) [Method on Config]
const
bool lookupValue (const char *path, int &value) const [Method on Config]
bool lookupValue (const std::string &path, int &value) [Method on Config]
const
26 libconfig
bool lookupValue (const char *path, unsigned int &value) [Method on Config]
const
bool lookupValue (const std::string &path, [Method on Config]
unsigned int &value) const
bool lookupValue (const char *path, long long &value) [Method on Config]
const
bool lookupValue (const std::string &path, [Method on Config]
long long &value) const
bool lookupValue (const char *path, float &value) const [Method on Config]
bool lookupValue (const std::string &path, float &value) [Method on Config]
const
bool lookupValue (const char *path, double &value) const [Method on Config]
bool lookupValue (const std::string &path, double &value) [Method on Config]
const
bool lookupValue (const char *path, const char *&value) [Method on Config]
const
bool lookupValue (const std::string &path, [Method on Config]
const char *&value) const
bool lookupValue (const char *path, std::string &value) [Method on Config]
const
bool lookupValue (const std::string &path, [Method on Config]
std::string &value) const
These are convenience methods for looking up the value of a setting with the given
path. If the setting is found and is of an appropriate type, the value is stored in value
and the method returns true. Otherwise, value is left unmodified and the method
returns false. These methods do not throw exceptions.
Storage for const char * values is managed by the library and released automatically
when the setting is destroyed or when its value is changed; the string must not be
freed by the caller. For safety and convenience, always assigning string values to a
std::string is suggested.
Since these methods have boolean return values and do not throw exceptions, they can
be used within boolean logic expressions. The following example presents a concise
way to look up three values at once and perform error handling if any of them are
not found or are of the wrong type:
Chapter 4: The C++ API 27
int var1;
double var2;
const char *var3;
if(config.lookupValue("values.var1", var1)
&& config.lookupValue("values.var2", var2)
&& config.lookupValue("values.var3", var3))
{
// use var1, var2, var3
}
else
{
// error handling here
}
This approach also takes advantage of the short-circuit evaluation rules of C++, e.g.,
if the first lookup fails (returning false), the remaining lookups are skipped entirely.
as 0), or a double-precision value to a float. The library does not treat these lossy
conversions as errors.
Perhaps surprisingly, the following code in particular will cause a compiler error:
std::string title;
.
.
.
title = config.lookup("application.window.title");
This is because the assignment operator of std::string is being invoked with a
Setting & as an argument. The compiler is unable to make an implicit conversion
because both the const char * and the std::string cast operators of Setting are
equally appropriate. This is not a bug in libconfig; providing only the const char *
cast operator would resolve this particular ambiguity, but would cause assignments
to std::string like the one in the previous example to produce a compiler error.
(To understand why, see section 11.4.1 of The C++ Programming Language.)
The solution to this problem is to use an explicit conversion that avoids the construc-
tion of an intermediate std::string object, as follows:
std::string title;
.
.
.
title = (const char *)config.lookup("application.window.title");
Or, alternatively, use the c_str() method, which has the same effect:
std::string title;
.
.
.
title = config.lookup("application.window.title").c_str();
If the assignment is invalid due to a type mismatch, a SettingTypeException is
thrown.
Setting & operator= (bool value) [Method on Setting]
Setting & operator= (int value) [Method on Setting]
Setting & operator= (long value) [Method on Setting]
Setting & operator= (const long long &value) [Method on Setting]
Setting & operator= (float value) [Method on Setting]
Setting & operator= (const double &value) [Method on Setting]
Setting & operator= (const char *value) [Method on Setting]
Setting & operator= (const std::string &value) [Method on Setting]
These assignment operators allow values of type bool, int, long, long long, float, double,
const char *, and std::string to be assigned to a setting. In the case of strings, the
library makes a copy of the passed string value, so it may be subsequently freed or
modified by the caller without affecting the value of the setting.
Chapter 4: The C++ API 29
The following example code looks up a (presumably) integer setting and changes its
value:
Setting &setting = config.lookup("application.window.size.w");
setting = 1024;
If the assignment is invalid due to a type mismatch, a SettingTypeException is
thrown.
bool lookupValue (const char *name, bool &value) const [Method on Setting]
bool lookupValue (const std::string &name, bool &value) [Method on Setting]
const
bool lookupValue (const char *name, int &value) const [Method on Setting]
bool lookupValue (const std::string &name, int &value) [Method on Setting]
const
bool lookupValue (const char *name, unsigned int &value) [Method on Setting]
const
bool lookupValue (const std::string &name, [Method on Setting]
unsigned int &value) const
bool lookupValue (const char *name, long long &value) [Method on Setting]
const
bool lookupValue (const std::string &name, [Method on Setting]
long long &value) const
bool lookupValue (const char *name, [Method on Setting]
unsigned long long &value) const
30 libconfig
Storage for const char * values is managed by the library and released automatically
when the setting is destroyed or when its value is changed; the string must not be
freed by the caller. For safety and convenience, always assigning string values to a
std::string is suggested.
Since these methods have boolean return values and do not throw exceptions, they can
be used within boolean logic expressions. The following example presents a concise
way to look up three values at once and perform error handling if any of them are
not found or are of the wrong type:
int var1;
double var2;
const char *var3;
if(setting.lookupValue("var1", var1)
&& setting.lookupValue("var2", var2)
&& setting.lookupValue("var3", var3))
{
// use var1, var2, var3
}
else
{
// error handling here
}
This approach also takes advantage of the short-circuit evaluation rules of C++, e.g.,
if the first lookup fails (returning false), the remaining lookups are skipped entirely.
Chapter 4: The C++ API 31
Setting & add (const std::string &name, Setting::Type type) [Method on Setting]
Setting & add (const char *name, Setting::Type type) [Method on Setting]
These methods add a new child setting with the given name and type to the
setting, which must be a group. They return a reference to the new setting. If
the setting already has a child setting with the given name, or if the name is
invalid, a SettingNameException is thrown. If the setting is not a group, a
SettingTypeException is thrown.
Once a setting has been created, neither its name nor type can be changed.
5 Example Programs
Practical example programs that illustrate how to use libconfig from both C and C++
are included in the examples subdirectory of the distribution. These examples include:
examples/c/example1.c
An example C program that reads a configuration from an existing file
example.cfg (also located in examples/c) and displays some of its contents.
examples/c++/example1.cpp
The C++ equivalent of example1.c.
examples/c/example2.c
An example C program that reads a configuration from an existing file
example.cfg (also located in examples/c), adds new settings to the
configuration, and writes the updated configuration to another file.
examples/c++/example2.cpp
The C++ equivalent of example2.c
examples/c/example3.c
An example C program that constructs a new configuration in memory and
writes it to a file.
examples/c++/example3.cpp
The C++ equivalent of example3.c
examples/c/example4.c
An example C program that uses a custom include function for processing
wildcard includes. Note that this code will not compile on Windows.
Chapter 6: Other Bindings and Implementations 37
6.2 D
Remi Thebault’s libconfig-d is a port of libconfig to the D programming language. It
may be found at https://code.dlang.org/packages/libconfig-d.
6.3 Haskell
Matthew Peddie’s libconfig provides Haskell bindings to libconfig. It may be found at
https://hackage.haskell.org/package/libconfig-0.3.0.0.
6.4 Java
Andrey V. Pleskach has a pure-Java implementation of libconfig. It may be found on
github at https://github.com/willyborankin/libconfig.
6.5 Lisp
Oleg Shalaev’s cl-libconfig provides Common Lisp bindings for libconfig. It may be found
on github at https://github.com/chalaev/cl-libconfig.
6.6 Perl
The Conf::Libconfig module provides Perl bindings for libconfig. It may be found on
CPAN at http://search.cpan.org/~cnangel/Conf-Libconfig-0.05/ or on github at
https://github.com/cnangel/Conf-Libconfig.
6.7 Python
Heiner Tholen’s pylibconfig2 is a Python library that is syntax-compatible with libconfig.
It may be found at https://pypi.python.org/pypi/pylibconfig2/0.1.2.
6.8 Ruby
Christopher Mark Gore’s ruby-libconfig is a Ruby library that provides Ruby bindings
for libconfig. It may be found at https://rubygems.org/gems/libconfig or on github at
https://github.com/cgore/ruby-libconfig.
There is also another Ruby wrapper, libconfig-ruby, that is included in the libconfig git
repository at https://github.com/hyperrealm/libconfig, in the contrib/libconfig-
ruby subdirectory.
Appendix A: License 39
Appendix A License
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright
c 1991, 1999 Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies of this license document,
but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts as the successor of
the GNU Library Public License, version 2, hence the version number 2.1.]
Preamble
The licenses for most software are designed to take away your freedom to share and
change it. By contrast, the GNU General Public Licenses are intended to guarantee your
freedom to share and change free software–to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some specially designated
software packages–typically libraries–of the Free Software Foundation and other authors
who decide to use it. You can use it too, but we suggest you first think carefully about
whether this license or the ordinary General Public License is the better strategy to use in
any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use, not price. Our
General Public Licenses are designed to make sure that you have the freedom to distribute
copies of free software (and charge for this service if you wish); that you receive source code
or can get it if you want it; that you can change the software and use pieces of it in new
free programs; and that you are informed that you can do these things.
To protect your rights, we need to make restrictions that forbid distributors to deny you
these rights or to ask you to surrender these rights. These restrictions translate to certain
responsibilities for you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis or for a fee, you must
give the recipients all the rights that we gave you. You must make sure that they, too,
receive or can get the source code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them with the library after
making changes to the library and recompiling it. And you must show them these terms so
they know their rights.
We protect your rights with a two-step method: (1) we copyright the library, and (2) we
offer you this license, which gives you legal permission to copy, distribute and/or modify
the library.
To protect each distributor, we want to make it very clear that there is no warranty for
the free library. Also, if the library is modified by someone else and passed on, the recipients
should know that what they have is not the original version, so that the original author’s
reputation will not be affected by problems that might be introduced by others.
Finally, software patents pose a constant threat to the existence of any free program.
We wish to make sure that a company cannot effectively restrict the users of a free program
40 libconfig
by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent
license obtained for a version of the library must be consistent with the full freedom of use
specified in this license.
Most GNU software, including some libraries, is covered by the ordinary GNU General
Public License. This license, the GNU Lesser General Public License, applies to certain
designated libraries, and is quite different from the ordinary General Public License. We
use this license for certain libraries in order to permit linking those libraries into non-free
programs.
When a program is linked with a library, whether statically or using a shared library,
the combination of the two is legally speaking a combined work, a derivative of the original
library. The ordinary General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General Public License permits
more lax criteria for linking other code with the library.
We call this license the “Lesser” General Public License because it does Less to protect
the user’s freedom than the ordinary General Public License. It also provides other free
software developers Less of an advantage over competing non-free programs. These dis-
advantages are the reason we use the ordinary General Public License for many libraries.
However, the Lesser license provides advantages in certain special circumstances.
For example, on rare occasions, there may be a special need to encourage the widest
possible use of a certain library, so that it becomes a de-facto standard. To achieve this,
non-free programs must be allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this case, there is little to
gain by limiting the free library to free software only, so we use the Lesser General Public
License.
In other cases, permission to use a particular library in non-free programs enables a
greater number of people to use a large body of free software. For example, permission to
use the GNU C Library in non-free programs enables many more people to use the whole
GNU operating system, as well as its variant, the GNU/Linux operating system.
Although the Lesser General Public License is Less protective of the users’ freedom, it
does ensure that the user of a program that is linked with the Library has the freedom and
the wherewithal to run that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and modification follow. Pay
close attention to the difference between a “work based on the library” and a “work that
uses the library”. The former contains code derived from the library, whereas the latter
must be combined with the library in order to run.
Appendix A: License 41
0. This License Agreement applies to any software library or other program which contains
a notice placed by the copyright holder or other authorized party saying it may be
distributed under the terms of this Lesser General Public License (also called “this
License”). Each licensee is addressed as “you”.
A “library” means a collection of software functions and/or data prepared so as to be
conveniently linked with application programs (which use some of those functions and
data) to form executables.
The “Library”, below, refers to any such software library or work which has been
distributed under these terms. A “work based on the Library” means either the Library
or any derivative work under copyright law: that is to say, a work containing the
Library or a portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is included without
limitation in the term “modification”.)
“Source code” for a work means the preferred form of the work for making modifications
to it. For a library, complete source code means all the source code for all modules it
contains, plus any associated interface definition files, plus the scripts used to control
compilation and installation of the library.
Activities other than copying, distribution and modification are not covered by this
License; they are outside its scope. The act of running a program using the Library is
not restricted, and output from such a program is covered only if its contents constitute
a work based on the Library (independent of the use of the Library in a tool for writing
it). Whether that is true depends on what the Library does and what the program
that uses the Library does.
1. You may copy and distribute verbatim copies of the Library’s complete source code
as you receive it, in any medium, provided that you conspicuously and appropriately
publish on each copy an appropriate copyright notice and disclaimer of warranty; keep
intact all the notices that refer to this License and to the absence of any warranty; and
distribute a copy of this License along with the Library.
You may charge a fee for the physical act of transferring a copy, and you may at your
option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Library or any portion of it, thus forming a
work based on the Library, and copy and distribute such modifications or work under
the terms of Section 1 above, provided that you also meet all of these conditions:
a. The modified work must itself be a software library.
b. You must cause the files modified to carry prominent notices stating that you
changed the files and the date of any change.
c. You must cause the whole of the work to be licensed at no charge to all third
parties under the terms of this License.
42 libconfig
3. You may opt to apply the terms of the ordinary GNU General Public License instead
of this License to a given copy of the Library. To do this, you must alter all the notices
that refer to this License, so that they refer to the ordinary GNU General Public
License, version 2, instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify that version
instead if you wish.) Do not make any other change in these notices.
Once this change is made in a given copy, it is irreversible for that copy, so the ordinary
GNU General Public License applies to all subsequent copies and derivative works made
from that copy.
This option is useful when you wish to copy part of the code of the Library into a
program that is not a library.
4. You may copy and distribute the Library (or a portion or derivative of it, under Section
2) in object code or executable form under the terms of Sections 1 and 2 above provided
that you accompany it with the complete corresponding machine-readable source code,
which must be distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange.
If distribution of object code is made by offering access to copy from a designated place,
then offering equivalent access to copy the source code from the same place satisfies the
Appendix A: License 43
requirement to distribute the source code, even though third parties are not compelled
to copy the source along with the object code.
5. A program that contains no derivative of any portion of the Library, but is designed
to work with the Library by being compiled or linked with it, is called a “work that
uses the Library”. Such a work, in isolation, is not a derivative work of the Library,
and therefore falls outside the scope of this License.
However, linking a “work that uses the Library” with the Library creates an executable
that is a derivative of the Library (because it contains portions of the Library), rather
than a “work that uses the library”. The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a “work that uses the Library” uses material from a header file that is part of
the Library, the object code for the work may be a derivative work of the Library even
though the source code is not. Whether this is true is especially significant if the work
can be linked without the Library, or if the work is itself a library. The threshold for
this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data structure layouts and ac-
cessors, and small macros and small inline functions (ten lines or less in length), then
the use of the object file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the Library will still
fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may distribute the object code
for the work under the terms of Section 6. Any executables containing that work also
fall under Section 6, whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or link a “work that
uses the Library” with the Library to produce a work containing portions of the Li-
brary, and distribute that work under terms of your choice, provided that the terms
permit modification of the work for the customer’s own use and reverse engineering for
debugging such modifications.
You must give prominent notice with each copy of the work that the Library is used
in it and that the Library and its use are covered by this License. You must supply
a copy of this License. If the work during execution displays copyright notices, you
must include the copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one of these things:
b. Use a suitable shared library mechanism for linking with the Library. A suitable
mechanism is one that (1) uses at run time a copy of the library already present
on the user’s computer system, rather than copying library functions into the
executable, and (2) will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is interface-compatible with
the version that the work was made with.
c. Accompany the work with a written offer, valid for at least three years, to give the
same user the materials specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
e. Verify that the user has already received a copy of these materials or that you have
already sent this user a copy.
For an executable, the required form of the “work that uses the Library” must include
any data and utility programs needed for reproducing the executable from it. However,
as a special exception, the materials to be distributed need not include anything that
is normally distributed (in either source or binary form) with the major components
(compiler, kernel, and so on) of the operating system on which the executable runs,
unless that component itself accompanies the executable.
It may happen that this requirement contradicts the license restrictions of other pro-
prietary libraries that do not normally accompany the operating system. Such a con-
tradiction means you cannot use both them and the Library together in an executable
that you distribute.
7. You may place library facilities that are a work based on the Library side-by-side in
a single library together with other library facilities not covered by this License, and
distribute such a combined library, provided that the separate distribution of the work
based on the Library and of the other library facilities is otherwise permitted, and
provided that you do these two things:
a. Accompany the combined library with a copy of the same work based on the
Library, uncombined with any other library facilities. This must be distributed
under the terms of the Sections above.
b. Give prominent notice with the combined library of the fact that part of it is a work
based on the Library, and explaining where to find the accompanying uncombined
form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute the Library except
as expressly provided under this License. Any attempt otherwise to copy, modify,
sublicense, link with, or distribute the Library is void, and will automatically terminate
your rights under this License. However, parties who have received copies, or rights,
Appendix A: License 45
from you under this License will not have their licenses terminated so long as such
parties remain in full compliance.
9. You are not required to accept this License, since you have not signed it. However,
nothing else grants you permission to modify or distribute the Library or its derivative
works. These actions are prohibited by law if you do not accept this License. Therefore,
by modifying or distributing the Library (or any work based on the Library), you
indicate your acceptance of this License to do so, and all its terms and conditions for
copying, distributing or modifying the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the Library), the recipient
automatically receives a license from the original licensor to copy, distribute, link with
or modify the Library subject to these terms and conditions. You may not impose any
further restrictions on the recipients’ exercise of the rights granted herein. You are not
responsible for enforcing compliance by third parties with this License.
11. If, as a consequence of a court judgment or allegation of patent infringement or for any
other reason (not limited to patent issues), conditions are imposed on you (whether by
court order, agreement or otherwise) that contradict the conditions of this License, they
do not excuse you from the conditions of this License. If you cannot distribute so as
to satisfy simultaneously your obligations under this License and any other pertinent
obligations, then as a consequence you may not distribute the Library at all. For
example, if a patent license would not permit royalty-free redistribution of the Library
by all those who receive copies directly or indirectly through you, then the only way
you could satisfy both it and this License would be to refrain entirely from distribution
of the Library.
If any portion of this section is held invalid or unenforceable under any particular
circumstance, the balance of the section is intended to apply, and the section as a
whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other
property right claims or to contest validity of any such claims; this section has the
sole purpose of protecting the integrity of the free software distribution system which
is implemented by public license practices. Many people have made generous contri-
butions to the wide range of software distributed through that system in reliance on
consistent application of that system; it is up to the author/donor to decide if he or
she is willing to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to be a consequence
of the rest of this License.
12. If the distribution and/or use of the Library is restricted in certain countries either
by patents or by copyrighted interfaces, the original copyright holder who places the
Library under this License may add an explicit geographical distribution limitation
excluding those countries, so that distribution is permitted only in or among countries
not thus excluded. In such case, this License incorporates the limitation as if written
in the body of this License.
46 libconfig
13. The Free Software Foundation may publish revised and/or new versions of the Lesser
General Public License from time to time. Such new versions will be similar in spirit
to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library specifies a version
number of this License which applies to it and “any later version”, you have the option of
following the terms and conditions either of that version or of any later version published
by the Free Software Foundation. If the Library does not specify a license version
number, you may choose any version ever published by the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free programs whose distribu-
tion conditions are incompatible with these, write to the author to ask for permission.
For software which is copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our decision will be
guided by the two goals of preserving the free status of all derivatives of our free soft-
ware and of promoting the sharing and reuse of software generally.
NO WARRANTY
<one line to give the library’s name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your school, if any,
to sign a “copyright disclaimer” for the library, if necessary. Here is a sample; alter the
names:
<configuration> ::=
<setting-list>
| <empty>
<setting-list> ::=
<setting>
| <setting-list> <setting>
<setting> ::=
<name> ( ":" | "=" ) <value> ( ";" | "," | <empty> )
<value> ::=
<scalar-value>
| <array>
| <list>
| <group>
<value-list> ::=
<value>
| <value-list> "," <value>
| <value-list> ","
<scalar-value> ::=
<boolean>
| <integer>
| <integer64>
| <hex>
| <hex64>
| <float>
| <string>
<scalar-value-list> ::=
<scalar-value>
| <scalar-value-list> "," <scalar-value>
| <scalar-value-list> ","
<array> ::=
"[" ( <scalar-value-list> | <empty> ) "]"
<list> ::=
"(" ( <value-list> | <empty> ) ")"
50 libconfig
<group> ::=
"{" ( <setting-list> | <empty> ) "}"
<empty> ::=
<boolean> ([Tt][Rr][Uu][Ee])|([Ff][Aa][Ll][Ss][Ee])
<string> \"([^\"\\]|\\.)*\"
<name> [A-Za-z\*][-A-Za-z0-9_\*]*
<integer> [-+]?[0-9]+
<integer64> [-+]?[0-9]+L(L)?
<hex> 0[Xx][0-9A-Fa-f]+
<hex64> 0[Xx][0-9A-Fa-f]+(L(L)?)?
<float> ([-+]?([0-9]*)?\.[0-9]*([eE][-+]?[0-9]+)?)|([-+]([0-
9]+)(\.[0-9]*)?[eE][-+]?[0-9]+)
Function Index
~ config_setting_get_bool . . . . . . . . . . . . . . . . . . . . . 16
~Config on Config . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 config_setting_get_bool_elem . . . . . . . . . . . . . . . 17
config_setting_get_elem . . . . . . . . . . . . . . . . . . . . . 17
config_setting_get_float . . . . . . . . . . . . . . . . . . . 16
A config_setting_get_float_elem . . . . . . . . . . . . . . 17
config_setting_get_format . . . . . . . . . . . . . . . . . . 17
add on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 config_setting_get_hook . . . . . . . . . . . . . . . . . . . . . 20
config_setting_get_int . . . . . . . . . . . . . . . . . . . . . . 16
config_setting_get_int_elem . . . . . . . . . . . . . . . . 17
B config_setting_get_int64 . . . . . . . . . . . . . . . . . . . 16
begin on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 config_setting_get_int64_elem . . . . . . . . . . . . . . 17
config_setting_get_member . . . . . . . . . . . . . . . . . . 17
config_setting_get_string . . . . . . . . . . . . . . . . . . 16
C config_setting_get_string_elem . . . . . . . . . . . . . 17
c_str on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 config_setting_index . . . . . . . . . . . . . . . . . . . . . . . . 19
clear on Config. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 config_setting_is_aggregate . . . . . . . . . . . . . . . . 19
Config on Config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 config_setting_is_array . . . . . . . . . . . . . . . . . . . . . 19
config_clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 config_setting_is_group . . . . . . . . . . . . . . . . . . . . . 19
config_destroy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 config_setting_is_list . . . . . . . . . . . . . . . . . . . . . . 19
config_error_file. . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 config_setting_is_number . . . . . . . . . . . . . . . . . . . 19
config_error_line. . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 config_setting_is_root . . . . . . . . . . . . . . . . . . . . . . 19
config_error_text. . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 config_setting_is_scalar . . . . . . . . . . . . . . . . . . . 19
config_error_type. . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 config_setting_length . . . . . . . . . . . . . . . . . . . . . . . 19
config_get_auto_convert . . . . . . . . . . . . . . . . . . . . . 15 config_setting_lookup . . . . . . . . . . . . . . . . . . . . . . . 16
config_get_default_format . . . . . . . . . . . . . . . . . . 15 config_setting_lookup_bool . . . . . . . . . . . . . . . . . 16
config_get_float_precision(config_t *config) config_setting_lookup_float . . . . . . . . . . . . . . . . 16
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 config_setting_lookup_int . . . . . . . . . . . . . . . . . . 16
config_get_hook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 config_setting_lookup_int64 . . . . . . . . . . . . . . . . 16
config_get_include_dir . . . . . . . . . . . . . . . . . . . . . . 12 config_setting_lookup_string . . . . . . . . . . . . . . . 16
config_get_option. . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 config_setting_name . . . . . . . . . . . . . . . . . . . . . . . . . 19
config_get_options . . . . . . . . . . . . . . . . . . . . . . . . . . 13 config_setting_parent . . . . . . . . . . . . . . . . . . . . . . . 19
config_get_tab_width . . . . . . . . . . . . . . . . . . . . . . . . 15 config_setting_remove . . . . . . . . . . . . . . . . . . . . . . . 18
config_init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 config_setting_remove_elem . . . . . . . . . . . . . . . . . 18
config_lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 config_setting_set_bool . . . . . . . . . . . . . . . . . . . . . 16
config_lookup_bool . . . . . . . . . . . . . . . . . . . . . . . . . . 15 config_setting_set_bool_elem . . . . . . . . . . . . . . . 18
config_lookup_float . . . . . . . . . . . . . . . . . . . . . . . . . 15 config_setting_set_float . . . . . . . . . . . . . . . . . . . 16
config_lookup_int. . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 config_setting_set_float_elem . . . . . . . . . . . . . . 18
config_lookup_int64 . . . . . . . . . . . . . . . . . . . . . . . . . 15 config_setting_set_format . . . . . . . . . . . . . . . . . . 17
config_lookup_string . . . . . . . . . . . . . . . . . . . . . . . . 15 config_setting_set_hook . . . . . . . . . . . . . . . . . . . . . 20
config_read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 config_setting_set_int . . . . . . . . . . . . . . . . . . . . . . 16
config_read_file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 config_setting_set_int_elem . . . . . . . . . . . . . . . . 18
config_read_string . . . . . . . . . . . . . . . . . . . . . . . . . . 11 config_setting_set_int64 . . . . . . . . . . . . . . . . . . . 16
config_root_setting . . . . . . . . . . . . . . . . . . . . . . . . . 19 config_setting_set_int64_elem . . . . . . . . . . . . . . 18
config_set_auto_convert . . . . . . . . . . . . . . . . . . . . . 15 config_setting_set_string . . . . . . . . . . . . . . . . . . 16
config_set_default_format . . . . . . . . . . . . . . . . . . 15 config_setting_set_string_elem . . . . . . . . . . . . . 18
config_set_destructor . . . . . . . . . . . . . . . . . . . . . . . 20 config_setting_source_file . . . . . . . . . . . . . . . . . 20
config_set_float_precision(config_t *config, config_setting_source_line . . . . . . . . . . . . . . . . . 20
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 config_setting_type . . . . . . . . . . . . . . . . . . . . . . . . . 19
config_set_hook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 config_write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
config_set_include_dir . . . . . . . . . . . . . . . . . . . . . . 12 config_write_file. . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
config_set_include_func . . . . . . . . . . . . . . . . . . . . . 12
config_set_option. . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
config_set_options . . . . . . . . . . . . . . . . . . . . . . . . . . 13 E
config_set_tab_width . . . . . . . . . . . . . . . . . . . . . . . . 15 end on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
config_setting_add . . . . . . . . . . . . . . . . . . . . . . . . . . 18 evaluateIncludePath on Config . . . . . . . . . . . . . . 23
52 libconfig
F O
func . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 operator bool () on Setting. . . . . . . . . . . . . . . . . . 27
operator const char * () on Setting . . . . . . . . . 27
operator double () on Setting . . . . . . . . . . . . . . . 27
G operator float () on Setting . . . . . . . . . . . . . . . . 27
getAutoConvert on Config . . . . . . . . . . . . . . . . . . . . 25 operator int () on Setting . . . . . . . . . . . . . . . . . . . 27
getDefaultFormat on Config . . . . . . . . . . . . . . . . . . 25 operator long () on Setting. . . . . . . . . . . . . . . . . . 27
getError on ParseException . . . . . . . . . . . . . . . . . . 22 operator long long () on Setting . . . . . . . . . . . . 27
getFile on ParseException . . . . . . . . . . . . . . . . . . . 22 operator std::string () on Setting . . . . . . . . . 27
getFloatPrecision on Config . . . . . . . . . . . . . . . . . 25 operator unsigned int () on Setting . . . . . . . . . 27
getFormat on Setting . . . . . . . . . . . . . . . . . . . . . . . . . 32 operator unsigned long () on Setting . . . . . . . . 27
getIncludeDir on Config . . . . . . . . . . . . . . . . . . . . . 23 operator unsigned long long () on Setting . . 27
getIndex on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . 32 operator= on Setting . . . . . . . . . . . . . . . . . . . . . . . . . 28
getLength on Setting . . . . . . . . . . . . . . . . . . . . . . . . . 33 operator[] on Setting . . . . . . . . . . . . . . . . . . . . . . . . 29
getLine on ParseException . . . . . . . . . . . . . . . . . . . 22
getName on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
getOption on Config . . . . . . . . . . . . . . . . . . . . . . . . . . 24 P
getOptions on Config . . . . . . . . . . . . . . . . . . . . . . . . . 23
ParseException on ParseException . . . . . . . . . . . 21
getParent on Setting . . . . . . . . . . . . . . . . . . . . . . . . . 32
getPath on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
getPath on SettingException . . . . . . . . . . . . . . . . . 22
getRoot on Config . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
R
getSourceFile on Setting . . . . . . . . . . . . . . . . . . . . 33 read on Config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
getSourceLine on Setting . . . . . . . . . . . . . . . . . . . . 33 readFile on Config . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
getTabWidth on Config . . . . . . . . . . . . . . . . . . . . . . . . 25 readString on Config . . . . . . . . . . . . . . . . . . . . . . . . . 22
getType on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 remove on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
I S
isAggregate on Setting . . . . . . . . . . . . . . . . . . . . . . 33 setAutoConvert on Config . . . . . . . . . . . . . . . . . . . . 25
isArray on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 setDefaultFormat on Config . . . . . . . . . . . . . . . . . . 25
isGroup on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 setFloatPrecision on Config . . . . . . . . . . . . . . . . . 25
isList on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 setFormat on Setting . . . . . . . . . . . . . . . . . . . . . . . . . 32
isNumber on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . 33 setIncludeDir on Config . . . . . . . . . . . . . . . . . . . . . 23
isRoot on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 setOption on Config . . . . . . . . . . . . . . . . . . . . . . . . . . 24
isScalar on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . 33 setOptions on Config . . . . . . . . . . . . . . . . . . . . . . . . . 23
isString on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . 33 setTabWidth on Config . . . . . . . . . . . . . . . . . . . . . . . . 25
SettingNameException on SettingNameException
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
L SettingNotFoundException on
LIBCONFIG_VER_MAJOR . . . . . . . . . . . . . . . . . . . . . . . . . . 3 SettingNotFoundException . . . . . . . . . . . . . . . 21
LIBCONFIG_VER_MINOR . . . . . . . . . . . . . . . . . . . . . . . . . . 3 SettingTypeException on SettingTypeException
LIBCONFIG_VER_REVISION . . . . . . . . . . . . . . . . . . . . . . . 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
LIBCONFIGXX_VER_MAJOR . . . . . . . . . . . . . . . . . . . . . . . . 3
LIBCONFIGXX_VER_MINOR . . . . . . . . . . . . . . . . . . . . . . . . 3
LIBCONFIGXX_VER_REVISION . . . . . . . . . . . . . . . . . . . . . 3 W
lookup on Config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 write on Config. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
lookup on Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 writeFile on Config . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Type Index 53
Type Index
C P
Config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 ParseException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Config::Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
config_error_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
config_include_fn_t . . . . . . . . . . . . . . . . . . . . . . . . . 12 S
config_setting_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
config_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Setting::Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
ConfigException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Setting::Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
SettingException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
SettingFormat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
F SettingNameException . . . . . . . . . . . . . . . . . . . . . . . . 21
FileIOException . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 SettingNotFoundException . . . . . . . . . . . . . . . . . . . 21
SettingTypeException . . . . . . . . . . . . . . . . . . . . . . . . 21
Concept Index 55
Concept Index
A I
aggregate value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 include directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 include function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
C L
comment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 locale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
D P
destructor function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
pkg-config . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
E
escape sequence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 S
scalar value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
F setting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
U
G Unicode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
group. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 UTF-8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
H V
hook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5