diff options
author | Jonathan McCrohan <jmccrohan@gmail.com> | 2015-07-08 23:43:03 +0100 |
---|---|---|
committer | Jonathan McCrohan <jmccrohan@gmail.com> | 2015-07-08 23:53:24 +0100 |
commit | 6c7ac8dc769435ea0231db550799d73cb479a773 (patch) | |
tree | e5de3e6642d6669a17b2afd8341ea5b82655461c /doc | |
parent | 695702e323759d158366d33c24c1ff47141056e9 (diff) | |
download | libconfig-6c7ac8dc769435ea0231db550799d73cb479a773.tar.gz |
Imported Upstream version 1.5upstream/1.5
Diffstat (limited to 'doc')
-rw-r--r-- | doc/Makefile.in | 235 | ||||
-rw-r--r-- | doc/libconfig.info | 1897 | ||||
-rw-r--r-- | doc/libconfig.texi | 183 |
3 files changed, 1381 insertions, 934 deletions
diff --git a/doc/Makefile.in b/doc/Makefile.in index 49fa6e9..18faf88 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,6 +14,51 @@ @SET_MAKE@ VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -35,18 +79,62 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = doc -DIST_COMMON = $(libconfig_TEXINFOS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/aux-build/mkinstalldirs $(libconfig_TEXINFOS) \ + $(top_srcdir)/aux-build/texinfo.tex ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/aux-build/mkinstalldirs CONFIG_HEADER = $(top_builddir)/ac_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = SOURCES = DIST_SOURCES = +AM_V_DVIPS = $(am__v_DVIPS_@AM_V@) +am__v_DVIPS_ = $(am__v_DVIPS_@AM_DEFAULT_V@) +am__v_DVIPS_0 = @echo " DVIPS " $@; +am__v_DVIPS_1 = +AM_V_MAKEINFO = $(am__v_MAKEINFO_@AM_V@) +am__v_MAKEINFO_ = $(am__v_MAKEINFO_@AM_DEFAULT_V@) +am__v_MAKEINFO_0 = @echo " MAKEINFO" $@; +am__v_MAKEINFO_1 = +AM_V_INFOHTML = $(am__v_INFOHTML_@AM_V@) +am__v_INFOHTML_ = $(am__v_INFOHTML_@AM_DEFAULT_V@) +am__v_INFOHTML_0 = @echo " INFOHTML" $@; +am__v_INFOHTML_1 = +AM_V_TEXI2DVI = $(am__v_TEXI2DVI_@AM_V@) +am__v_TEXI2DVI_ = $(am__v_TEXI2DVI_@AM_DEFAULT_V@) +am__v_TEXI2DVI_0 = @echo " TEXI2DVI" $@; +am__v_TEXI2DVI_1 = +AM_V_TEXI2PDF = $(am__v_TEXI2PDF_@AM_V@) +am__v_TEXI2PDF_ = $(am__v_TEXI2PDF_@AM_DEFAULT_V@) +am__v_TEXI2PDF_0 = @echo " TEXI2PDF" $@; +am__v_TEXI2PDF_1 = +AM_V_texinfo = $(am__v_texinfo_@AM_V@) +am__v_texinfo_ = $(am__v_texinfo_@AM_DEFAULT_V@) +am__v_texinfo_0 = -q +am__v_texinfo_1 = +AM_V_texidevnull = $(am__v_texidevnull_@AM_V@) +am__v_texidevnull_ = $(am__v_texidevnull_@AM_DEFAULT_V@) +am__v_texidevnull_0 = > /dev/null +am__v_texidevnull_1 = INFO_DEPS = $(srcdir)/libconfig.info TEXINFO_TEX = $(top_srcdir)/aux-build/texinfo.tex am__TEXINFO_TEX_DIR = $(top_srcdir)/aux-build @@ -60,6 +148,11 @@ TEXI2PDF = $(TEXI2DVI) --pdf --batch MAKEINFOHTML = $(MAKEINFO) --html AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) DVIPS = dvips +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac am__installdirs = "$(DESTDIR)$(infodir)" am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ @@ -82,9 +175,17 @@ am__nobase_list = $(am__nobase_strip_setup); \ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -255,7 +356,7 @@ clean-libtool: -rm -rf .libs _libs .texi.info: - restore=: && backupdir="$(am__leading_dot)am$$$$" && \ + $(AM_V_MAKEINFO)restore=: && backupdir="$(am__leading_dot)am$$$$" && \ am__cwd=`pwd` && $(am__cd) $(srcdir) && \ rm -rf $$backupdir && mkdir $$backupdir && \ if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ @@ -277,35 +378,33 @@ clean-libtool: rm -rf $$backupdir; exit $$rc .texi.dvi: - TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + $(AM_V_TEXI2DVI)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ - $(TEXI2DVI) $< + $(TEXI2DVI) $(AM_V_texinfo) --build-dir=$(@:.dvi=.t2d) -o $@ $(AM_V_texidevnull) \ + $< .texi.pdf: - TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + $(AM_V_TEXI2PDF)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ - $(TEXI2PDF) $< + $(TEXI2PDF) $(AM_V_texinfo) --build-dir=$(@:.pdf=.t2p) -o $@ $(AM_V_texidevnull) \ + $< .texi.html: - rm -rf $(@:.html=.htp) - if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ + $(AM_V_MAKEINFO)rm -rf $(@:.html=.htp) + $(AM_V_at)if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \ -o $(@:.html=.htp) $<; \ then \ - rm -rf $@; \ - if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ - mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ + rm -rf $@ && mv $(@:.html=.htp) $@; \ else \ - if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ - rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ - exit 1; \ + rm -rf $(@:.html=.htp); exit 1; \ fi $(srcdir)/libconfig.info: libconfig.texi $(libconfig_TEXINFOS) libconfig.dvi: libconfig.texi $(libconfig_TEXINFOS) libconfig.pdf: libconfig.texi $(libconfig_TEXINFOS) libconfig.html: libconfig.texi $(libconfig_TEXINFOS) .dvi.ps: - TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ - $(DVIPS) -o $@ $< + $(AM_V_DVIPS)TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + $(DVIPS) $(AM_V_texinfo) -o $@ $< uninstall-dvi-am: @$(NORMAL_UNINSTALL) @@ -327,9 +426,7 @@ uninstall-html-am: uninstall-info-am: @$(PRE_UNINSTALL) - @if test -d '$(DESTDIR)$(infodir)' && \ - (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ @@ -386,10 +483,7 @@ dist-info: $(INFO_DEPS) done mostlyclean-aminfo: - -rm -rf libconfig.aux libconfig.cp libconfig.cps libconfig.fn libconfig.fns \ - libconfig.ky libconfig.kys libconfig.log libconfig.pg \ - libconfig.pgs libconfig.tmp libconfig.toc libconfig.tp \ - libconfig.tps libconfig.vr libconfig.vrs + -rm -rf libconfig.t2d libconfig.t2p clean-aminfo: -test -z "libconfig.dvi libconfig.pdf libconfig.ps libconfig.html" \ @@ -401,11 +495,11 @@ maintainer-clean-aminfo: echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ done -tags: TAGS -TAGS: +tags TAGS: + +ctags CTAGS: -ctags: CTAGS -CTAGS: +cscope cscopelist: distdir: $(DISTFILES) @@ -458,10 +552,15 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: @@ -497,8 +596,11 @@ install-dvi: install-dvi-am install-dvi-am: $(DVIS) @$(NORMAL_INSTALL) - test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)" @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -513,18 +615,22 @@ install-html: install-html-am install-html-am: $(HTMLS) @$(NORMAL_INSTALL) - test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)" @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ $(am__strip_dir) \ - if test -d "$$d$$p"; then \ + d2=$$d$$p; \ + if test -d "$$d2"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ - echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ - $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ + echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ else \ - list2="$$list2 $$d$$p"; \ + list2="$$list2 $$d2"; \ fi; \ done; \ test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ @@ -536,9 +642,12 @@ install-info: install-info-am install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) - test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)" @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \ + fi; \ for file in $$list; do \ case $$file in \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ @@ -556,8 +665,7 @@ install-info-am: $(INFO_DEPS) echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done @$(POST_INSTALL) - @if (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + @if $(am__can_run_installinfo); then \ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ for file in $$list; do \ relfile=`echo "$$file" | sed 's|^.*/||'`; \ @@ -571,8 +679,11 @@ install-pdf: install-pdf-am install-pdf-am: $(PDFS) @$(NORMAL_INSTALL) - test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)" @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -584,8 +695,11 @@ install-ps: install-ps-am install-ps-am: $(PSS) @$(NORMAL_INSTALL) - test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)" @list='$(PSS)'; test -n "$(psdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \ + fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ @@ -619,18 +733,19 @@ uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-aminfo clean-generic \ - clean-libtool dist-info distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-aminfo \ - maintainer-clean-generic mostlyclean mostlyclean-aminfo \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - uninstall uninstall-am uninstall-dvi-am uninstall-html-am \ - uninstall-info-am uninstall-pdf-am uninstall-ps-am + clean-libtool cscopelist-am ctags-am dist-info distclean \ + distclean-generic distclean-libtool distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-aminfo maintainer-clean-generic mostlyclean \ + mostlyclean-aminfo mostlyclean-generic mostlyclean-libtool pdf \ + pdf-am ps ps-am tags-am uninstall uninstall-am \ + uninstall-dvi-am uninstall-html-am uninstall-info-am \ + uninstall-pdf-am uninstall-ps-am html: diff --git a/doc/libconfig.info b/doc/libconfig.info index 0a0e813..17ebca7 100644 --- a/doc/libconfig.info +++ b/doc/libconfig.info @@ -1,4 +1,4 @@ -This is libconfig.info, produced by makeinfo version 4.13 from +This is libconfig.info, produced by makeinfo version 5.1 from libconfig.texi. INFO-DIR-SECTION Software libraries @@ -41,15 +41,14 @@ File: libconfig.info, Node: Introduction, Next: Configuration Files, Prev: To 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. +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). +and later (with either Microsoft Visual Studio 2005 or later, or the GNU +toolchain via the MinGW environment). File: libconfig.info, Node: Why Another Configuration File Library?, Next: Using the Library from a C Program, Up: Introduction @@ -58,15 +57,15 @@ File: libconfig.info, Node: Why Another Configuration File Library?, Next: Usi =========================================== There are several open-source configuration file libraries available as -of this writing. This library was written because each of those -libraries falls short in one or more ways. The main features of +of this writing. This library was written because each of those +libraries falls short in one or more ways. The main features of libconfig that set it apart from the other libraries are: - * A fully reentrant parser. Independent configurations can be parsed + * A fully reentrant parser. Independent configurations can be parsed in concurrent threads at the same time. - * Both C and C++ bindings, as well as hooks to allow for the - creation of wrappers in other languages. + * Both C and C++ bindings, as well as hooks to allow for the creation + of wrappers in other languages. * A simple, structured configuration file format that is more readable and compact than XML and more flexible than the obsolete @@ -78,7 +77,6 @@ libconfig that set it apart from the other libraries are: * Proper documentation. - File: libconfig.info, Node: Using the Library from a C Program, Next: Using the Library from a C++ Program, Prev: Why Another Configuration File Library?, Up: Introduction @@ -91,8 +89,7 @@ directive in your source files: #include <libconfig.h> - - To link with the library, specify `-lconfig' as an argument to the + To link with the library, specify '-lconfig' as an argument to the linker. @@ -107,21 +104,18 @@ directive in your source files: #include <libconfig.h++> - Or, alternatively: #include <libconfig.hh> - - The C++ API classes are defined in the namespace `libconfig', hence + The C++ API classes are defined in the namespace 'libconfig', hence the following statement may optionally be used: using namespace libconfig; - - To link with the library, specify `-lconfig++' as an argument to the + To link with the library, specify '-lconfig++' as an argument to the linker. @@ -130,29 +124,29 @@ File: libconfig.info, Node: Multithreading Issues, Next: Internationalization 1.4 Multithreading Issues ========================= -Libconfig is fully "reentrant"; the functions in the library do not -make use of global variables and do not maintain state between -successive calls. Therefore two independent configurations may be safely +Libconfig is fully "reentrant"; the functions in the library do not make +use of global variables and do not maintain state between successive +calls. Therefore two independent configurations may be safely manipulated concurrently by two distinct threads. - Libconfig is not "thread-safe". The library is not aware of the + Libconfig is not "thread-safe". The library is not aware of the presence of threads and knows nothing about the host system's threading -model. Therefore, if an instance of a configuration is to be accessed +model. Therefore, if an instance of a configuration is to be accessed from multiple threads, it must be suitably protected by synchronization -mechanisms like read-write locks or mutexes; the standard rules for -safe multithreaded access to shared data must be observed. +mechanisms like read-write locks or mutexes; the standard rules for safe +multithreaded access to shared data must be observed. - Libconfig is not "async-safe". Calls should not be made into the + Libconfig is not "async-safe". Calls should not be made into the library from signal handlers, because some of the C library routines that it uses may not be async-safe. - Libconfig is not guaranteed to be "cancel-safe". Since it is not -aware of the host system's threading model, the library does not -contain any thread cancellation points. In most cases this will not be -an issue for multithreaded programs. However, be aware that some of the -routines in the library (namely those that read/write configurations -from/to files or streams) perform I/O using C library routines which -may potentially block; whether or not these C library routines are + Libconfig is not guaranteed to be "cancel-safe". Since it is not +aware of the host system's threading model, the library does not contain +any thread cancellation points. In most cases this will not be an issue +for multithreaded programs. However, be aware that some of the routines +in the library (namely those that read/write configurations from/to +files or streams) perform I/O using C library routines which may +potentially block; whether or not these C library routines are cancel-safe depends on the host system. @@ -163,23 +157,23 @@ File: libconfig.info, Node: Internationalization Issues, Next: Compiling Using Libconfig does not natively support Unicode configuration files, but string values may contain Unicode text encoded in UTF-8; such strings -will be treated as ordinary 8-bit ASCII text by the library. It is the +will be treated as ordinary 8-bit ASCII text by the library. It is the responsibility of the calling program to perform the necessary conversions to/from wide (wchar_t) strings using the wide string conversion functions such as mbsrtowcs() and wcsrtombs() or the iconv() function of the libiconv library. The textual representation of a floating point value varies by -locale. However, the libconfig grammar specifies that floating point -values are represented using a period (`.') as the radix symbol; this -is consistent with the grammar of most programming languages. When a +locale. However, the libconfig grammar specifies that floating point +values are represented using a period ('.') as the radix symbol; this +is consistent with the grammar of most programming languages. When a configuration is read in or written out, libconfig temporarily changes the LC_NUMERIC category of the locale of the calling thread to the "C" -locale to ensure consistent handling of floating point values -regardless of the locale(s) in use by the calling program. +locale to ensure consistent handling of floating point values regardless +of the locale(s) in use by the calling program. Note that the MinGW environment does not (as of this writing) provide -functions for changing the locale of the calling thread. Therefore, +functions for changing the locale of the calling thread. Therefore, when using libconfig in that environment, the calling program is responsible for changing the LC_NUMERIC category of the locale to the "C" locale before reading or writing a configuration. @@ -192,15 +186,14 @@ File: libconfig.info, Node: Compiling Using pkg-config, Next: Version Test Mac On UNIX systems you can use the pkg-config utility (version 0.20 or later) to automatically select the appropriate compiler and linker -switches for libconfig. Ensure that the environment variable -`PKG_CONFIG_PATH' contains the absolute path to the `lib/pkgconfig' -subdirectory of the libconfig installation. Then, you can compile and +switches for libconfig. Ensure that the environment variable +'PKG_CONFIG_PATH' contains the absolute path to the 'lib/pkgconfig' +subdirectory of the libconfig installation. Then, you can compile and link C programs with libconfig as follows: gcc `pkg-config --cflags libconfig` myprogram.c -o myprogram \ `pkg-config --libs libconfig` - And similarly, for C++ programs: g++ `pkg-config --cflags libconfig++` myprogram.cpp -o myprogram \ @@ -209,16 +202,16 @@ link C programs with libconfig as follows: Note the backticks in the above examples. - When using autoconf, the `PKG_CHECK_MODULES' m4 macro may be used to + When using autoconf, the 'PKG_CHECK_MODULES' m4 macro may be used to check for the presence of a given version of libconfig, and set the -appropriate Makefile variables automatically. For example: +appropriate Makefile variables automatically. For example: PKG_CHECK_MODULES([LIBCONFIGXX], [libconfig++ >= 1.4],, AC_MSG_ERROR([libconfig++ 1.4 or newer not found.]) ) In the above example, if libconfig++ version 1.4 or newer is found, -the Makefile variables `LIBCONFIGXX_LIBS' and `LIBCONFIGXX_CFLAGS' will +the Makefile variables 'LIBCONFIGXX_LIBS' and 'LIBCONFIGXX_CFLAGS' will be set to the appropriate compiler and linker flags for compiling with libconfig, and if it is not found, the configure script will abort with an error to that effect. @@ -229,16 +222,17 @@ File: libconfig.info, Node: Version Test Macros, Prev: Compiling Using pkg-con 1.7 Version Test Macros ======================= -The `libconfig.h' header declares the following macros: +The 'libconfig.h' header declares the following macros: -- Macro: LIBCONFIG_VER_MAJOR -- Macro: LIBCONFIG_VER_MINOR -- Macro: LIBCONFIG_VER_REVISION + 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: + 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)) @@ -247,16 +241,15 @@ The `libconfig.h' header declares the following macros: These macros were introduced in libconfig 1.4. - - Similarly, the `libconfig.h++' header declares the following macros: + Similarly, the 'libconfig.h++' header declares the following macros: -- Macro: LIBCONFIGXX_VER_MAJOR -- Macro: LIBCONFIGXX_VER_MINOR -- Macro: LIBCONFIGXX_VER_REVISION + These macros represent the major version, minor version, and revision of the libconfig++ library. - File: libconfig.info, Node: Configuration Files, Next: The C API, Prev: Introduction, Up: Top @@ -277,21 +270,18 @@ File: libconfig.info, Node: Configuration Files, Next: The C API, Prev: Intro 2 Configuration Files ********************* -Libconfig supports structured, hierarchical configurations. These +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: +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 - + * 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 @@ -333,39 +323,38 @@ file grammar. }; }; - 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 +"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 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'. +'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 +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 +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. + 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 types `int', `long long', `double', and `const -char *', respectively. The boolean type is mapped to `int' in C and -`bool' in C++. +values are mapped to the 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 additional detail. @@ -384,7 +373,7 @@ A setting has the form: name : value ; - The trailing semicolon is optional. Whitespace is not significant. + The trailing semicolon is optional. Whitespace is not significant. The value may be a scalar value, an array, a group, or a list. @@ -396,7 +385,7 @@ File: libconfig.info, Node: Groups, Next: Arrays, Prev: Settings, Up: Config A group has the form: - { settings ... } + { settings ... } Groups can contain any number of settings, but each setting must have a unique name within the group. @@ -409,7 +398,7 @@ File: libconfig.info, Node: Arrays, Next: Lists, Prev: Groups, Up: Configura An array has the form: - [ value, value ... ] + [ value, value ... ] An array may have zero or more elements, but the elements must all be scalar values of the same type. @@ -422,7 +411,7 @@ File: libconfig.info, Node: Lists, Next: Integer Values, Prev: Arrays, Up: C A list has the form: - ( value, value ... ) + ( 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. @@ -434,10 +423,10 @@ File: libconfig.info, Node: Integer Values, Next: 64-bit Integer Values, Prev ================== Integers can be represented in one of two ways: as a series of one or -more decimal digits (`0' - `9'), with an optional leading sign -character (`+' or `-'); or as a hexadecimal value consisting of the -characters `0x' followed by a series of one or more hexadecimal digits -(`0' - `9', `A' - `F', `a' - `f'). +more decimal digits ('0' - '9'), with an optional leading sign character +('+' or '-'); or as a hexadecimal value consisting of the characters +'0x' followed by a series of one or more hexadecimal digits ('0' - '9', +'A' - 'F', 'a' - 'f'). File: libconfig.info, Node: 64-bit Integer Values, Next: Floating Point Values, Prev: Integer Values, Up: Configuration Files @@ -447,7 +436,7 @@ File: libconfig.info, Node: 64-bit Integer Values, Next: Floating Point Values Long long (64-bit) integers are represented identically to integers, except that an 'L' character is appended to indicate a 64-bit value. -For example, `0L' indicates a 64-bit integer value 0. +For example, '0L' indicates a 64-bit integer value 0. File: libconfig.info, Node: Floating Point Values, Next: Boolean Values, Prev: 64-bit Integer Values, Up: Configuration Files @@ -456,8 +445,8 @@ File: libconfig.info, Node: Floating Point Values, Next: Boolean Values, Prev ========================= Floating point values consist of a series of one or more digits, one -decimal point, an optional leading sign character (`+' or `-'), and an -optional exponent. An exponent consists of the letter `E' or `e', an +decimal point, an optional leading sign character ('+' or '-'), and an +optional exponent. An exponent consists of the letter 'E' or 'e', an optional sign character, and a series of one or more digits. @@ -466,8 +455,8 @@ File: libconfig.info, Node: Boolean Values, Next: String Values, Prev: Floati 2.8 Boolean Values ================== -Boolean values may have one of the following values: `true', `false', -or any mixed-case variation thereof. +Boolean values may have one of the following values: 'true', 'false', or +any mixed-case variation thereof. File: libconfig.info, Node: String Values, Next: Comments, Prev: Boolean Values, Up: Configuration Files @@ -476,29 +465,28 @@ File: libconfig.info, Node: String Values, Next: Comments, Prev: Boolean Valu ================= String values consist of arbitrary text delimited by double quotes. -Literal double quotes can be escaped by preceding them with a -backslash: `\"'. The escape sequences `\\', `\f', `\n', `\r', and `\t' -are also recognized, and have the usual meaning. +Literal double quotes can be escaped by preceding them with a backslash: +'\"'. The escape sequences '\\', '\f', '\n', '\r', and '\t' are also +recognized, and have the usual meaning. - In addition, the `\x' escape sequence is supported; this sequence + 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 +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: +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 brown fox"' - `" jumped over the lazy dog."' - - * `"The quick" /* comment */ " brown fox " // another comment' - `"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."' File: libconfig.info, Node: Comments, Next: Include Directives, Prev: String Values, Up: Configuration Files @@ -508,21 +496,20 @@ File: libconfig.info, Node: Comments, Next: Include Directives, Prev: String Three types of comments are allowed within a configuration: - * Script-style comments. All text beginning with a `#' character to + * 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, including line breaks, between a + starting '/*' sequence and an ending '*/' sequence is ignored. - * C++-style comments. All text beginning with a `//' sequence to the + * 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 +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. @@ -532,17 +519,17 @@ File: libconfig.info, Node: Include Directives, Prev: Comments, Up: Configura 2.11 Include Directives ======================= -A configuration file may "include" the contents of another file using -an include directive. This directive has the effect of inlining the +A configuration file may "include" the contents of another file using an +include directive. This directive has the effect of inlining the contents of the named file at the point of inclusion. - An include directive must appear on its own line in the input. It has -the form: + An include directive must appear on its own line in the input. It +has the form: @include "filename" Any backslashes or double quotes in the filename must be escaped as -`\\' and `\"', respectively. +'\\' and '\"', respectively. For example, consider the following two configuration files: @@ -564,9 +551,9 @@ the form: limit results in a parse error. 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 +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. @@ -575,146 +562,182 @@ File: libconfig.info, Node: The C API, Next: The C++ API, Prev: Configuration 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. +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 boolean values 'CONFIG_TRUE' and 'CONFIG_FALSE' are macros +defined as '(1)' and '(0)', respectively. -- Function: void config_init (config_t * CONFIG) -- Function: void config_destroy (config_t * CONFIG) + These functions initialize and destroy the configuration object CONFIG. - `config_init()' initializes the config_t structure pointed to by + 'config_init()' initializes the config_t structure pointed to by CONFIG as a new, empty configuration. - `config_destroy()' destroys the configuration CONFIG, deallocating + 'config_destroy()' destroys the configuration CONFIG, deallocating all memory associated with the configuration, but does not attempt to deallocate the config_t structure itself. - -- Function: int config_read (config_t * CONFIG, FILE * STREAM) + This function reads and parses a configuration from the given - STREAM into the configuration object CONFIG. It returns - `CONFIG_TRUE' on success, or `CONFIG_FALSE' on failure; the - `config_error_text()', `config_error_file()', - `config_error_line()', and `config_error_type()' functions, + STREAM into the configuration object CONFIG. It returns + 'CONFIG_TRUE' on success, or 'CONFIG_FALSE' on failure; the + 'config_error_text()', 'config_error_file()', + 'config_error_line()', and 'config_error_type()' functions, described below, can be used to obtain information about the error. - -- Function: int config_read_file (config_t * CONFIG, const char * FILENAME) + This function reads and parses a configuration from the file named - FILENAME into the configuration object CONFIG. It returns - `CONFIG_TRUE' on success, or `CONFIG_FALSE' on failure; the - `config_error_text()' and `config_error_line()' functions, + FILENAME into the configuration object CONFIG. It returns + 'CONFIG_TRUE' on success, or 'CONFIG_FALSE' on failure; the + 'config_error_text()' and 'config_error_line()' functions, described below, can be used to obtain information about the error. - -- Function: int config_read_string (config_t * CONFIG, const char * STR) + This function reads and parses a configuration from the string STR - into the configuration object CONFIG. It returns `CONFIG_TRUE' on - success, or `CONFIG_FALSE' on failure; the `config_error_text()' - and `config_error_line()' functions, described below, can be used + into the configuration object CONFIG. It returns 'CONFIG_TRUE' on + success, or 'CONFIG_FALSE' on failure; the 'config_error_text()' + and 'config_error_line()' functions, described below, can be used to obtain information about the error. - -- Function: void config_write (const config_t * CONFIG, FILE * STREAM) - This function writes the configuration CONFIG to the given STREAM. + This function writes the configuration CONFIG to the given STREAM. -- Function: int config_write_file (config_t * CONFIG, const char * FILENAME) + This function writes the configuration CONFIG to the file named - FILENAME. It returns `CONFIG_TRUE' on success, or `CONFIG_FALSE' + FILENAME. It returns 'CONFIG_TRUE' on success, or 'CONFIG_FALSE' on failure. - -- Function: const char * config_error_text (const config_t * CONFIG) -- Function: const char * config_error_file (const config_t * CONFIG) -- Function: int config_error_line (const config_t * CONFIG) + These functions, which are implemented as macros, return the text, filename, and line number of the parse error, if one occurred - during a call to `config_read()', `config_read_string()', or - `config_read_file()'. Storage for the strings returned by - `config_error_text()' and `config_error_file()' are managed by the + during a call to 'config_read()', 'config_read_string()', or + 'config_read_file()'. Storage for the strings returned by + 'config_error_text()' and 'config_error_file()' are managed by the library and released automatically when the configuration is - destroyed; these strings must not be freed by the caller. If the + destroyed; these strings must not be freed by the caller. If the error occurred in text that was read from a string or stream, - `config_error_file()' will return NULL. - + 'config_error_file()' will return NULL. -- Function: config_error_t config_error_type (const config_t * CONFIG) This function, which is implemented as a macro, returns the type of error that occurred during the last call to one of the read or - write functions. The CONFIG_ERROR_T type is an enumeration with the - following values: `CONFIG_ERR_NONE', `CONFIG_ERR_FILE_IO', - `CONFIG_ERR_PARSE'. These represent success, a file I/O error, and + write functions. The CONFIG_ERROR_T type is an enumeration with + the following values: 'CONFIG_ERR_NONE', 'CONFIG_ERR_FILE_IO', + 'CONFIG_ERR_PARSE'. These represent success, a file I/O error, and a parsing error, respectively. - -- Function: void config_set_include_dir (config_t *CONFIG, const char *INCLUDE_DIR) -- Function: const char * config_get_include_dir (const config_t *CONFIG) - `config_set_include_dir()' specifies the include directory, - INCLUDE_DIR, relative to which the files specified in `@include' - directives will be located for the configuration CONFIG. By - default, there is no include directory, and all include files are - expected to be relative to the current working directory. If - INCLUDE_DIR is `NULL', the default behavior is reinstated. - - For example, if the include directory is set to `/usr/local/etc', - the include directive `@include "configs/extra.cfg"' would include - the file `/usr/local/etc/configs/extra.cfg'. - - `config_get_include_dir()' returns the current include directory - for the configuration CONFIG, or `NULL' if none is set. + 'config_set_include_dir()' specifies the include directory, + INCLUDE_DIR, relative to which the files specified in '@include' + directives will be located for the configuration CONFIG. By + default, there is no include directory, and all include files are + expected to be relative to the current working directory. If + INCLUDE_DIR is 'NULL', the default behavior is reinstated. + + For example, if the include directory is set to '/usr/local/etc', + the include directive '@include "configs/extra.cfg"' would include + the file '/usr/local/etc/configs/extra.cfg'. + + 'config_get_include_dir()' returns the current include directory + for the configuration CONFIG, or 'NULL' if none is set. + + -- Function: void config_set_options (config_t *CONFIG, int OPTIONS) + -- Function: int config_get_options (config_t *CONFIG) + + These functions set and get the options for the configuration + CONFIG. The options affect how configurations are read and + written. The following options are defined: + + 'CONFIG_OPTION_AUTOCONVERT' + Turning this option on enables number auto-conversion for the + configuration. When this feature is enabled, an attempt to + retrieve a floating point setting's value into an integer (or + vice versa), or store an integer to a floating point setting's + value (or vice versa) will cause the library to silently + perform the necessary conversion (possibly leading to loss of + data), rather than reporting failure. By default this option + is turned off. + + '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 separators 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. -- Function: void config_set_auto_convert (config_t *CONFIG, int FLAG) -- Function: int config_get_auto_convert (const config_t *CONFIG) - `config_set_auto_convert()' enables number auto-conversion for the - configuration CONFIG if FLAG is non-zero, and disables it - otherwise. When this feature is enabled, an attempt to retrieve a - floating point setting's value into an integer (or vice versa), or - store an integer to a floating point setting's value (or vice - versa) will cause the library to silently perform the necessary - conversion (possibly leading to loss of data), rather than - reporting failure. By default this feature is disabled. - - `config_get_auto_convert()' returns `CONFIG_TRUE' if number - auto-conversion is currently enabled for CONFIG; otherwise it - returns `CONFIG_FALSE'. + These functions get and set the 'CONFIG_OPTION_AUTO_CONVERT' + option. They are obsoleted by the 'config_set_options()' and + 'config_get_options()' functions described above. -- Function: void config_set_default_format (config_t * CONFIG, short FORMAT) -- Function: short config_get_default_format (config_t * CONFIG) + These functions, which are implemented as macros, set and get the default external format for settings in the configuration CONFIG. If a non-default format has not been set for a setting with - `config_setting_set_format()', this configuration-wide default + 'config_setting_set_format()', this configuration-wide default format will be used instead when that setting is written to a file or stream. - -- Function: void config_set_tab_width (config_t * CONFIG, unsigned short WIDTH) -- Function: unsigned short config_get_tab_width (const config_t * CONFIG) + These functions, which are implemented as macros, set and get the - tab width for the configuration CONFIG. The tab width affects the + tab width for the configuration CONFIG. The tab width affects the formatting of the configuration when it is written to a file or stream: each level of nesting is indented by WIDTH spaces, or by a - single tab character if WIDTH is 0. The tab width has no effect on + single tab character if WIDTH is 0. The tab width has no effect on parsing. - Valid tab widths range from 0 to 15. The default tab width is 2. - + Valid tab widths range from 0 to 15. The default tab width is 2. -- Function: int config_lookup_int (const config_t * CONFIG, const char * PATH, int * VALUE) @@ -726,26 +749,33 @@ defined as `(1)' and `(0)', respectively. const char * PATH, int * VALUE) -- Function: int config_lookup_string (const config_t * CONFIG, const char * PATH, const char ** VALUE) + These functions look up the value of the setting in the - configuration CONFIG specified by the path PATH. They store the - value of the setting at VALUE and return `CONFIG_TRUE' on success. + configuration CONFIG specified by the path PATH. They store the + value of the setting at VALUE and return 'CONFIG_TRUE' on success. If the 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'. + unmodified and return 'CONFIG_FALSE'. - Storage for the string returned by `config_lookup_string()' is + Storage for the string returned by 'config_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. + -- Function: config_setting_t * config_lookup (const config_t * CONFIG, + const char * PATH) - -- Function: config_setting_t * config_lookup - (const config_t * CONFIG, const char * PATH) This function locates the setting in the configuration CONFIG - specified by the path PATH. It returns a pointer to the - `config_setting_t' structure on success, or `NULL' if the setting + specified by the path PATH. It returns a pointer to the + 'config_setting_t' structure on success, or 'NULL' if the setting was not found. + -- Function: config_setting_t * config_setting_lookup + (const config_setting_t * SETTING, const char * PATH) + + This function locates a setting by a path PATH relative to the + setting SETTING. It returns a pointer to the 'config_setting_t' + structure on success, or 'NULL' if the setting was not found. -- Function: int config_setting_get_int (const config_setting_t * SETTING) @@ -757,15 +787,15 @@ defined as `(1)' and `(0)', respectively. (const config_setting_t * SETTING) -- Function: const char * config_setting_get_string (const config_setting_t * SETTING) - These functions return the value of the given SETTING. If the type - of the setting does not match the type requested, a 0 or `NULL' - value is returned. Storage for the string returned by - `config_setting_get_string()' is managed by the library and + + These functions return the value of the given SETTING. If the type + of the setting does not match the type requested, a 0 or 'NULL' + value is returned. Storage for the string returned by + 'config_setting_get_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. - -- Function: int config_setting_set_int (config_setting_t * SETTING, int VALUE) -- Function: int config_setting_set_int64 (config_setting_t * SETTING, @@ -774,16 +804,16 @@ defined as `(1)' and `(0)', respectively. double VALUE) -- Function: int config_setting_set_bool (config_setting_t * SETTING, int VALUE) - -- Function: int config_setting_set_string - (config_setting_t * SETTING, const char * VALUE) - These functions set the value of the given SETTING to VALUE. On - success, they return `CONFIG_TRUE'. If the setting does not match - the type of the value, they return `CONFIG_FALSE'. - `config_setting_set_string()' makes a copy of the passed string + -- Function: int config_setting_set_string (config_setting_t * SETTING, + const char * VALUE) + + These functions set the value of the given SETTING to VALUE. On + success, they return 'CONFIG_TRUE'. If the setting does not match + the type of the value, they return 'CONFIG_FALSE'. + 'config_setting_set_string()' 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. - -- Function: int config_setting_lookup_int (const config_setting_t * SETTING, const char * NAME, int * VALUE) @@ -799,56 +829,55 @@ defined as `(1)' and `(0)', respectively. -- Function: int config_setting_lookup_string (const config_setting_t * SETTING, const char * NAME, const char ** VALUE) + These functions look up the value of the child setting named NAME - of the setting SETTING. They store the value at VALUE and return - `CONFIG_TRUE' on success. If the setting was not found or if the + of the setting SETTING. They store the value at VALUE and return + 'CONFIG_TRUE' on success. If the 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. + 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. -- Function: short config_setting_get_format (config_setting_t * SETTING) - -- Function: int config_setting_set_format - (config_setting_t * SETTING, short FORMAT) + -- Function: int config_setting_set_format (config_setting_t * SETTING, + short FORMAT) + These functions get and set the external format for the setting SETTING. - The FORMAT must be one of the constants `CONFIG_FORMAT_DEFAULT' or - `CONFIG_FORMAT_HEX'. All settings support the - `CONFIG_FORMAT_DEFAULT' format. The `CONFIG_FORMAT_HEX' format - specifies hexadecimal formatting for integer values, and hence - only applies to settings of type `CONFIG_TYPE_INT' and - `CONFIG_TYPE_INT64'. If FORMAT is invalid for the given setting, + The FORMAT must be one of the constants 'CONFIG_FORMAT_DEFAULT' or + 'CONFIG_FORMAT_HEX'. All settings support the + 'CONFIG_FORMAT_DEFAULT' format. The 'CONFIG_FORMAT_HEX' format + specifies hexadecimal formatting for integer values, and hence only + applies to settings of type 'CONFIG_TYPE_INT' and + 'CONFIG_TYPE_INT64'. If FORMAT is invalid for the given setting, it is ignored. If a non-default format has not been set for the setting, - `config_setting_get_format()' returns the default format for the - configuration, as set by `config_set_default_format()'. - - `config_setting_set_format()' returns `CONFIG_TRUE' on success and - `CONFIG_FALSE' on failure. + 'config_setting_get_format()' returns the default format for the + configuration, as set by 'config_set_default_format()'. + 'config_setting_set_format()' returns 'CONFIG_TRUE' on success and + 'CONFIG_FALSE' on failure. -- Function: config_setting_t * config_setting_get_member (config_setting_t * SETTING, const char * NAME) + This function fetches the child setting named NAME from the group - SETTING. It returns the requested setting on success, or `NULL' if + SETTING. It returns the requested setting on success, or 'NULL' if the setting was not found or if SETTING is not a group. - -- Function: config_setting_t * config_setting_get_elem (const config_setting_t * SETTING, unsigned int INDEX) - This function fetches the element at the given index INDEX in the - setting SETTING, which must be an array, list, or group. It - returns the requested setting on success, or `NULL' if INDEX is - out of range or if SETTING is not an array, list, or group. + This function fetches the element at the given index INDEX in the + setting SETTING, which must be an array, list, or group. It + returns the requested setting on success, or 'NULL' if INDEX is out + of range or if SETTING is not an array, list, or group. -- Function: int config_setting_get_int_elem (const config_setting_t * SETTING, int INDEX) @@ -860,12 +889,13 @@ defined as `(1)' and `(0)', respectively. (const config_setting_t * SETTING, int INDEX) -- Function: const char * config_setting_get_string_elem (const config_setting_t * SETTING, int INDEX) + These functions return the value at the specified index INDEX in - the setting SETTING. If the setting is not an array or list, or if + the setting SETTING. If the setting is not an array or list, or if the type of the element does not match the type requested, or if - INDEX is out of range, they return 0 or `NULL'. Storage for the - string returned by `config_setting_get_string_elem()' is managed - by the library and released automatically when the setting is + INDEX is out of range, they return 0 or 'NULL'. Storage for the + string returned by 'config_setting_get_string_elem()' 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. @@ -879,99 +909,101 @@ defined as `(1)' and `(0)', respectively. (config_setting_t * SETTING, int INDEX, int VALUE) -- Function: config_setting_t * config_setting_set_string_elem (config_setting_t * SETTING, int INDEX, const char * VALUE) + These functions set the value at the specified index INDEX in the - setting SETTING to VALUE. If INDEX is negative, a new element is - added to the end of the array or list. On success, these functions - return a pointer to the setting representing the element. If the + setting SETTING to VALUE. If INDEX is negative, a new element is + added to the end of the array or list. On success, these functions + return a pointer to the setting representing the element. If the setting is not an array or list, or if the setting is an array and the type of the array does not match the type of the value, or if - INDEX is out of range, they return `NULL'. - `config_setting_set_string_elem()' makes a copy of the passed + INDEX is out of range, they return 'NULL'. + 'config_setting_set_string_elem()' 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. -- Function: config_setting_t * config_setting_add (config_setting_t * PARENT, const char * NAME, int TYPE) + This function adds a new child setting or element to the setting - PARENT, which must be a group, array, or list. If PARENT is an - array or list, the NAME parameter is ignored and may be `NULL'. + PARENT, which must be a group, array, or list. If PARENT is an + array or list, the NAME parameter is ignored and may be 'NULL'. - The function returns the new setting on success, or `NULL' if + The function returns the new setting on success, or 'NULL' if PARENT is not a group, array, or list; or if there is already a - child setting of PARENT named NAME; or if TYPE is invalid. If TYPE + child setting of PARENT named NAME; or if TYPE is invalid. If TYPE is a scalar type, the new setting will have a default value of 0, - 0.0, `false', or `NULL', as appropriate. + 0.0, 'false', or 'NULL', as appropriate. -- Function: int config_setting_remove (config_setting_t * PARENT, const char * NAME) + This function removes and destroys the setting named NAME from the - parent setting PARENT, which must be a group. Any child settings + parent setting PARENT, which must be a group. Any child settings of the setting are recursively destroyed as well. - The function returns `CONFIG_TRUE' on success. If PARENT is not a + The function returns 'CONFIG_TRUE' on success. If PARENT is not a group, or if it has no setting with the given name, it returns - `CONFIG_FALSE'. + 'CONFIG_FALSE'. + -- Function: int config_setting_remove_elem (config_setting_t * PARENT, + unsigned int INDEX) - -- Function: int config_setting_remove_elem - (config_setting_t * PARENT, unsigned int INDEX) This function removes the child setting at the given index INDEX - from the setting PARENT, which must be a group, list, or array. Any - child settings of the removed setting are recursively destroyed as - well. + from the setting PARENT, which must be a group, list, or array. + Any child settings of the removed setting are recursively destroyed + as well. - The function returns `CONFIG_TRUE' on success. If PARENT is not a + 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_FALSE'. -- Function: config_setting_t * config_root_setting (const config_t * CONFIG) - This function returns the root setting for the configuration - CONFIG. The root setting is a group. + This function returns the root setting for the configuration + CONFIG. The root setting is a group. -- Function: const char * config_setting_name (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 + + 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. - -- Function: config_setting_t * config_setting_parent (const config_setting_t * SETTING) - This function returns the parent setting of the given SETTING, or - `NULL' if SETTING is the root setting. + This function returns the parent setting of the given SETTING, or + 'NULL' if SETTING is the root setting. -- Function: int config_setting_is_root (const config_setting_t * SETTING) - This function returns `CONFIG_TRUE' if the given SETTING is the - root setting, and `CONFIG_FALSE' otherwise. + This function returns 'CONFIG_TRUE' if the given SETTING is the + root setting, and 'CONFIG_FALSE' otherwise. -- Function: int config_setting_index (const config_setting_t * SETTING) + This function returns the index of the given SETTING within its - parent setting. If SETTING is the root setting, this function + parent setting. If SETTING is the root setting, this function returns -1. - -- Function: int config_setting_length (const config_setting_t * SETTING) + This function returns the number of settings in a group, or the - number of elements in a list or array. For other types of + number of elements in a list or array. For other types of settings, it returns 0. - -- Function: int config_setting_type (const config_setting_t * SETTING) - This function returns the type of the given SETTING. The return - value is one of the constants `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'. + This function returns the type of the given SETTING. The return + value is one of the constants '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'. -- Function: int config_setting_is_group (const config_setting_t * SETTING) @@ -979,10 +1011,10 @@ defined as `(1)' and `(0)', respectively. (const config_setting_t * SETTING) -- Function: int config_setting_is_list (const config_setting_t * SETTING) - 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'. + 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'. -- Function: int config_setting_is_aggregate (const config_setting_t * SETTING) @@ -990,16 +1022,17 @@ defined as `(1)' and `(0)', respectively. (const config_setting_t * SETTING) -- Function: int config_setting_is_number (const config_setting_t * SETTING) + These convenience functions, 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'. - + floating point), respectively. They return 'CONFIG_TRUE' or + 'CONFIG_FALSE'. -- Function: const char * config_setting_source_file (const config_setting_t * SETTING) + This function returns the name of the file from which the setting SETTING was read, or NULL if the setting was not read from a file. This information is useful for reporting application-level errors. @@ -1007,235 +1040,311 @@ defined as `(1)' and `(0)', respectively. released automatically when the configuration is destroyed; the string must not be freed by the caller. - -- Function: unsigned int config_setting_source_line (const config_setting_t * SETTING) + This function returns the line number of the configuration file or stream at which the setting SETTING was read, or 0 if no line - number is available. This information is useful for reporting + number is available. This information is useful for reporting application-level errors. - -- Function: void config_setting_set_hook (config_setting_t * SETTING, void * HOOK) -- Function: void * config_setting_get_hook (const config_setting_t * SETTING) + These functions make it possible to attach arbitrary data to each setting structure, for instance a "wrapper" or "peer" object - written in another programming language. The destructor function, - if one has been supplied via a call to `config_set_destructor()', + written in another programming language. The destructor function, + if one has been supplied via a call to 'config_set_destructor()', will be called by the library to dispose of this data when the - setting itself is destroyed. There is no default destructor. - + setting itself is destroyed. There is no default destructor. -- Function: void config_set_destructor (config_t * CONFIG, void (* DESTRUCTOR)(void *)) + This function assigns the destructor function DESTRUCTOR for the - configuration CONFIG. This function accepts a single `void *' - argument and has no return value. See `config_setting_set_hook()' + configuration CONFIG. This function accepts a single 'void *' + argument and has no return value. See 'config_setting_set_hook()' above for more information. - File: libconfig.info, Node: The C++ API, Next: Example Programs, Prev: The C API, Up: Top 4 The C++ API ************* -This chapter describes the C++ library API. The class `Config' -represents a configuration, and the class `Setting' represents a -configuration setting. Note that by design, neither of these classes -provides a public copy constructor or assignment operator. Therefore, +This chapter describes the C++ library API. The class 'Config' +represents a configuration, and the class 'Setting' represents a +configuration setting. Note that by design, neither of these classes +provides a public copy constructor or assignment operator. Therefore, instances of these classes may only be passed between functions via references or pointers. The library defines a group of exceptions, all of which extend the -common base exception `ConfigException'. +common base exception 'ConfigException'. - A `SettingTypeException' is thrown when the type of a setting's -value does not match the type requested. + A 'SettingTypeException' is thrown when the type of a setting's value +does not match the type requested. - A `SettingNotFoundException' is thrown when a setting is not found. + -- Method on SettingTypeException: SettingTypeException + (const Setting &SETTING) + -- Method on SettingTypeException: SettingTypeException + (const Setting &SETTING, int INDEX) + -- Method on SettingTypeException: SettingTypeException + (const Setting &SETTING, const char *NAME) - A `SettingNameException' is thrown when an attempt is made to add a + These methods construct 'SettingTypeException' objects for the + given SETTING and/or member INDEX or NAME. + + A 'SettingNotFoundException' is thrown when a setting is not found. + + -- Method on SettingNotFoundException: SettingNotFoundException + (const Setting &SETTING, int INDEX) + -- Method on SettingNotFoundException: SettingNotFoundException + (const Setting &SETTING, const char *NAME) + -- Method on SettingNotFoundException: SettingNotFoundException + (const char *PATH) + + These methods construct 'SettingTypeException' objects for the + given SETTING and member INDEX or NAME, or path PATH. + + A 'SettingNameException' is thrown when an attempt is made to add a new setting with a non-unique or invalid name. - A `ParseException' is thrown when a parse error occurs while reading + -- Method on SettingNameException: SettingNameException + (const Setting &SETTING, const char *NAME) + + This method constructs a 'SettingNameExcpetion' object for the + given SETTING and member name NAME. + + A 'ParseException' is thrown when a parse error occurs while reading a configuration from a stream. - A `FileIOException' is thrown when an I/O error occurs while + -- Method on ParseException: ParseException (const char *FILE, + int LINE, const char *ERROR) + + This method constructs a 'ParseException' object with the given + filename FILE, line number LINE, and error message ERROR. + + A 'FileIOException' is thrown when an I/O error occurs while reading/writing a configuration from/to a file. - `SettingTypeException', `SettingNotFoundException', and -`SettingNameException' all extend the common base exception -`SettingException', which provides the following method: + 'SettingTypeException', 'SettingNotFoundException', and +'SettingNameException' all extend the common base exception +'SettingException', which provides the following method: -- Method on SettingException: const char * getPath () - Returns the path to the setting associated with the exception, or - `NULL' if there is no applicable path. + Returns the path to the setting associated with the exception, or + 'NULL' if there is no applicable path. The remainder of this chapter describes the methods for manipulating configurations and configuration settings. - -- Method on Config: Config () - -- Method on Config: ~Config () - These methods create and destroy `Config' objects. + -- Method on Config: Config () + -- Method on Config: ~Config () + These methods create and destroy 'Config' objects. -- Method on Config: void read (FILE * STREAM) -- Method on Config: void write (FILE * STREAM) - The `read()' method reads and parses a configuration from the given - STREAM. A `ParseException' is thrown if a parse error occurs. - The `write()' method writes the configuration to the given STREAM. + The 'read()' method reads and parses a configuration from the given + STREAM. A 'ParseException' is thrown if a parse error occurs. + The 'write()' method writes the configuration to the given STREAM. -- Method on Config: void readFile (const char * FILENAME) -- Method on Config: void writeFile (const char * FILENAME) - The `readFile()' method reads and parses a configuration from the - file named FILENAME. A `ParseException' is thrown if a parse error - occurs. A `FileIOException' is thrown if the file cannot be read. - The `writeFile()' method writes the configuration to the file - named FILENAME. A `FileIOException' is thrown if the file cannot - be written. + The 'readFile()' method reads and parses a configuration from the + file named FILENAME. A 'ParseException' is thrown if a parse error + occurs. A 'FileIOException' is thrown if the file cannot be read. + The 'writeFile()' method writes the configuration to the file named + FILENAME. A 'FileIOException' is thrown if the file cannot be + written. -- Method on Config: void readString (const char * STR) -- Method on Config: void readString (const std::string &STR) - These methods read and parse a configuration from the string STR. - A `ParseException' is thrown if a parse error occurs. + These methods read and parse a configuration from the string STR. + A 'ParseException' is thrown if a parse error occurs. -- Method on ParseException: const char * getError () -- Method on ParseException: const char * getFile () -- Method on ParseException: int getLine () - If a call to `readFile()', `readString()', or `read()' resulted in - a `ParseException', these methods can be called on the exception + + If a call to 'readFile()', 'readString()', or 'read()' resulted in + a 'ParseException', these methods can be called on the exception object to obtain the text, filename, and line number of the parse - error. Storage for the strings returned by `getError()' and - `getFile()' are managed by the library; the strings must not be + error. Storage for the strings returned by 'getError()' and + 'getFile()' are managed by the library; the strings must not be freed by the caller. - -- Method on Config: void setIncludeDir (const char *INCLUDEDIR) -- Method on Config: const char * getIncludeDir () - `setIncludeDir()' specifies the include directory, INCLUDEDIR, - relative to which the files specified in `@include' directives - will be located for the configuration. By default, there is no - include directory, and all include files are expected to be - relative to the current working directory. If INCLUDEDIR is - `NULL', the default behavior is reinstated. - - For example, if the include directory is set to `/usr/local/etc', - the include directive `@include "configs/extra.cfg"' would include - the file `/usr/local/etc/configs/extra.cfg'. - - `getIncludeDir()' returns the current include directory for the - configuration, or `NULL' if none is set. + 'setIncludeDir()' specifies the include directory, INCLUDEDIR, + relative to which the files specified in '@include' directives will + be located for the configuration. By default, there is no include + directory, and all include files are expected to be relative to the + current working directory. If INCLUDEDIR is 'NULL', the default + behavior is reinstated. + + For example, if the include directory is set to '/usr/local/etc', + the include directive '@include "configs/extra.cfg"' would include + the file '/usr/local/etc/configs/extra.cfg'. + + 'getIncludeDir()' returns the current include directory for the + configuration, or 'NULL' if none is set. + + -- Method on Config: void setOptions (int OPTIONS) + -- Method on Config: int getOptions () + + These methods set and get the options for the configuration. The + options affect how configurations are read and written. The + following options are defined: + + 'OptionAutoConvert' + Turning this option on enables number auto-conversion for the + configuration. When this feature is enabled, an attempt to + retrieve a floating point setting's value into an integer (or + vice versa), or store an integer to a floating point setting's + value (or vice versa) will cause the library to silently + perform the necessary conversion (possibly leading to loss of + data), rather than reporting failure. By default this option + is turned off. + + 'OptionSemicolonSeparators' + This option controls whether a semicolon (';') is output after + each setting when the configuration is written to a file or + stream. (The semicolon separators are optional in the + configuration syntax.) By default this option is turned on. + + '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. + + '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. + + '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. -- Method on Config: void setAutoConvert (bool FLAG) -- Method on Config: bool getAutoConvert () - `setAutoConvert()' enables number auto-conversion for the - configuration if FLAG is `true', and disables it otherwise. When - this feature is enabled, an attempt to assign a floating point - setting to an integer (or vice versa), or assign an integer to a - floating point setting (or vice versa) will cause the library to - silently perform the necessary conversion (possibly leading to - loss of data), rather than throwing a `SettingTypeException'. By - default this feature is disabled. - - `getAutoConvert()' returns `true' if number auto-conversion is - currently enabled for the configuration; otherwise it returns - `false'. + These methods get and set the 'OptionAutoConvert' option. They are + obsoleted by the 'setOptions()' and 'getOptions()' methods + described above. -- Method on Config: void setDefaultFormat (Setting::Format FORMAT) -- Method on Config: Setting::Format getDefaultFormat () - These methods set and get the default external format for settings - in the configuration. If a non-default format has not been set for - a setting with `Setting::setFormat()', this configuration-wide - default format will be used instead when that setting is written - to a file or stream. + These methods set and get the default external format for settings + in the configuration. If a non-default format has not been set for + a setting with 'Setting::setFormat()', this configuration-wide + default format will be used instead when that setting is written to + a file or stream. -- Method on Config: void setTabWidth (unsigned short WIDTH) -- Method on Config: unsigned short getTabWidth () - These methods set and get the tab width for the configuration. The + + These methods set and get the tab width for the configuration. The tab width affects the formatting of the configuration when it is written to a file or stream: each level of nesting is indented by - WIDTH spaces, or by a single tab character if WIDTH is 0. The tab + WIDTH spaces, or by a single tab character if WIDTH is 0. The tab width has no effect on parsing. - Valid tab widths range from 0 to 15. The default tab width is 2. - + Valid tab widths range from 0 to 15. The default tab width is 2. -- Method on Config: Setting & getRoot () + This method returns the root setting for the configuration, which is a group. - -- Method on Config: Setting & lookup (const std::string &PATH) -- Method on Config: Setting & lookup (const char * PATH) - These methods locate the setting specified by the path PATH. If - the requested setting is not found, a `SettingNotFoundException' is - thrown. + These methods locate the setting specified by the path PATH. If + the requested setting is not found, a 'SettingNotFoundException' is + thrown. -- Method on Config: bool exists (const std::string &PATH) -- Method on Config: bool exists (const char *PATH) - These methods test if a setting with the given PATH exists in the - configuration. They return `true' if the setting exists, and - `false' otherwise. These methods do not throw exceptions. + These methods test if a setting with the given PATH exists in the + configuration. They return 'true' if the setting exists, and + 'false' otherwise. These methods do not throw exceptions. -- Method on Config: bool lookupValue (const char *PATH, bool &VALUE) -- Method on Config: bool lookupValue (const std::string &PATH, bool &VALUE) + -- Method on Config: bool lookupValue (const char *PATH, int &VALUE) -- Method on Config: bool lookupValue (const std::string &PATH, int &VALUE) + -- Method on Config: bool lookupValue (const char *PATH, unsigned int &VALUE) -- Method on Config: bool lookupValue (const std::string &PATH, unsigned int &VALUE) + -- Method on Config: bool lookupValue (const char *PATH, long long &VALUE) -- Method on Config: bool lookupValue (const std::string &PATH, long long &VALUE) + -- Method on Config: bool lookupValue (const char *PATH, float &VALUE) -- Method on Config: bool lookupValue (const std::string &PATH, float &VALUE) + -- Method on Config: bool lookupValue (const char *PATH, double &VALUE) -- Method on Config: bool lookupValue (const std::string &PATH, double &VALUE) + -- Method on Config: bool lookupValue (const char *PATH, const char *&VALUE) -- Method on Config: bool lookupValue (const std::string &PATH, const char *&VALUE) + -- Method on Config: bool lookupValue (const char *PATH, std::string &VALUE) -- Method on Config: bool lookupValue (const std::string &PATH, std::string &VALUE) + 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 + 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. + 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 + 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. + '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: + 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; @@ -1254,37 +1363,37 @@ configurations and configuration settings. } This approach also takes advantage of the short-circuit evaluation - rules of C++, e.g., if the first lookup fails (returning `false'), + rules of C++, e.g., if the first lookup fails (returning 'false'), the remaining lookups are skipped entirely. - - -- Method on Setting: operator bool () - -- Method on Setting: operator int () - -- Method on Setting: operator unsigned int () - -- Method on Setting: operator long () - -- Method on Setting: operator unsigned long () - -- Method on Setting: operator long long () - -- Method on Setting: operator unsigned long long () - -- Method on Setting: operator float () - -- Method on Setting: operator double () - -- Method on Setting: operator const char * () - -- Method on Setting: operator std::string () + -- Method on Setting: operator bool () + -- Method on Setting: operator int () + -- Method on Setting: operator unsigned int () + -- Method on Setting: operator long () + -- Method on Setting: operator unsigned long () + -- Method on Setting: operator long long () + -- Method on Setting: operator unsigned long long () + -- Method on Setting: operator float () + -- Method on Setting: operator double () + -- Method on Setting: operator const char * () + -- Method on Setting: operator std::string () -- Method on Setting: const char * c_str () - These cast operators allow a `Setting' object to be assigned to a - variable of type bool if it is of type `TypeBoolean'; int, - unsigned int; `long long' or `unsigned long long' if it is of type - `TypeInt64', float or double if it is of type `TypeFloat'; or - const char * or std::string if it is of type `TypeString'. - Values of type `TypeInt' or `TypeInt64' may be assigned to - variables of type long, or unsigned long, depending on the sizes - of those types on the host system. + These cast operators allow a 'Setting' object to be assigned to a + variable of type bool if it is of type 'TypeBoolean'; int, unsigned + int; 'long long' or 'unsigned long long' if it is of type + 'TypeInt64', float or double if it is of type 'TypeFloat'; or const char * + or std::string if it is of type 'TypeString'. + + Values of type 'TypeInt' or 'TypeInt64' may be assigned to + variables of type long, or unsigned long, depending on the sizes of + those types on the host system. Storage for const char * return 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 return values - to a `std::string' is suggested. + to a 'std::string' is suggested. The following examples demonstrate this usage: @@ -1297,7 +1406,7 @@ configurations and configuration settings. Note that certain conversions can lead to loss of precision or clipping of values, e.g., assigning a negative value to an unsigned int (in which case the value will be treated as 0), or a - double-precision value to a float. The library does not treat + 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 @@ -1309,20 +1418,20 @@ configurations and configuration settings. . 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 + 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 construction of an intermediate `std::string' object, - as follows: + avoids the construction of an intermediate 'std::string' object, as + follows: std::string title; . @@ -1330,7 +1439,7 @@ configurations and configuration settings. . title = (const char *)config.lookup("application.window.title"); - Or, alternatively, use the `c_str()' method, which has the same + Or, alternatively, use the 'c_str()' method, which has the same effect: std::string title; @@ -1340,8 +1449,7 @@ configurations and configuration settings. title = config.lookup("application.window.title").c_str(); If the assignment is invalid due to a type mismatch, a - `SettingTypeException' is thrown. - + 'SettingTypeException' is thrown. -- Method on Setting: Setting & operator= (bool VALUE) -- Method on Setting: Setting & operator= (int VALUE) @@ -1351,12 +1459,12 @@ configurations and configuration settings. -- 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) + 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. + 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. The following example code looks up a (presumably) integer setting and changes its value: @@ -1365,81 +1473,96 @@ configurations and configuration settings. setting = 1024; If the assignment is invalid due to a type mismatch, a - `SettingTypeException' is thrown. - + 'SettingTypeException' is thrown. -- Method on Setting: Setting & operator[] (int INDEX) -- Method on Setting: Setting & operator[] (const std::string &NAME) -- Method on Setting: Setting & operator[] (const char *NAME) - A `Setting' object may be subscripted with an integer index INDEX + + A 'Setting' object may be subscripted with an integer index INDEX if it is an array or list, or with either a string NAME or an - integer index INDEX if it is a group. For example, the following - code would produce the string `Last Name' when applied to the + integer index INDEX if it is a group. For example, the following + code would produce the string 'Last Name' when applied to the example configuration in *note Configuration Files::. Setting& setting = config.lookup("application.misc"); const char *s = setting["columns"][0]; If the setting is not an array, list, or group, a - `SettingTypeException' is thrown. If the subscript (INDEX or NAME) - does not refer to a valid element, a `SettingNotFoundException' is + 'SettingTypeException' is thrown. If the subscript (INDEX or NAME) + does not refer to a valid element, a 'SettingNotFoundException' is thrown. Iterating over a group's child settings with an integer index will return the settings in the same order that they appear in the configuration. + -- Method on Setting: Setting & lookup (const char * PATH) + -- Method on Setting: Setting & lookup (const std::string &PATH) + + This function locates a setting by a path PATH relative to this + setting. If requested setting is not found, a + 'SettingNotFoundException' is thrown. -- Method on Setting: bool lookupValue (const char *NAME, bool &VALUE) -- Method on Setting: bool lookupValue (const std::string &NAME, bool &VALUE) + -- Method on Setting: bool lookupValue (const char *NAME, int &VALUE) -- Method on Setting: bool lookupValue (const std::string &NAME, int &VALUE) + -- Method on Setting: bool lookupValue (const char *NAME, unsigned int &VALUE) -- Method on Setting: bool lookupValue (const std::string &NAME, unsigned int &VALUE) + -- Method on Setting: bool lookupValue (const char *NAME, long long &VALUE) -- Method on Setting: bool lookupValue (const std::string &NAME, long long &VALUE) + -- Method on Setting: bool lookupValue (const char *NAME, unsigned long long &VALUE) -- Method on Setting: bool lookupValue (const std::string &NAME, unsigned long long &VALUE) + -- Method on Setting: bool lookupValue (const char *NAME, float &VALUE) -- Method on Setting: bool lookupValue (const std::string &NAME, float &VALUE) + -- Method on Setting: bool lookupValue (const char *NAME, double &VALUE) -- Method on Setting: bool lookupValue (const std::string &NAME, double &VALUE) + -- Method on Setting: bool lookupValue (const char *NAME, const char *&VALUE) -- Method on Setting: bool lookupValue (const std::string &NAME, const char *&VALUE) + -- Method on Setting: bool lookupValue (const char *NAME, std::string &VALUE) -- Method on Setting: bool lookupValue (const std::string &NAME, std::string &VALUE) + These are convenience methods for looking up the value of a child - setting with the given NAME. If the setting is found and is of an + setting with the given NAME. 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. + 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 + 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. + '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: + 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; @@ -1458,156 +1581,164 @@ configurations and configuration settings. } This approach also takes advantage of the short-circuit evaluation - rules of C++, e.g., if the first lookup fails (returning `false'), + rules of C++, e.g., if the first lookup fails (returning 'false'), the remaining lookups are skipped entirely. - -- Method on Setting: Setting & add (const std::string &NAME, Setting::Type TYPE) -- Method on Setting: Setting & add (const char *NAME, Setting::Type TYPE) + 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. + 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. - -- Method on Setting: Setting & add (Setting::Type TYPE) + This method adds a new element to the setting, which must be of - type `TypeArray' or `TypeList'. If the setting is an array which + type 'TypeArray' or 'TypeList'. If the setting is an array which currently has zero elements, the TYPE parameter (which must be - `TypeInt', `TypeInt64', `TypeFloat', `TypeBool', or `TypeString') - determines the type for the array; otherwise it must match the - type of the existing elements in the array. + 'TypeInt', 'TypeInt64', 'TypeFloat', 'TypeBool', or 'TypeString') + determines the type for the array; otherwise it must match the type + of the existing elements in the array. - The method returns the new setting on success. If TYPE is a scalar - type, the new setting will have a default value of 0, 0.0, - `false', or `NULL', as appropriate. - - The method throws a `SettingTypeException' if the setting is not - an array or list, or if TYPE is invalid. + The method returns the new setting on success. If TYPE is a scalar + type, the new setting will have a default value of 0, 0.0, 'false', + or 'NULL', as appropriate. + The method throws a 'SettingTypeException' if the setting is not an + array or list, or if TYPE is invalid. -- Method on Setting: void remove (const std::string &NAME) -- Method on Setting: void remove (const char *NAME) - These methods remove the child setting with the given NAME from - the setting, which must be a group. Any child settings of the - removed setting are recursively destroyed as well. - If the setting is not a group, a `SettingTypeException' is thrown. - If the setting does not have a child setting with the given name, - a `SettingNotFoundException' is thrown. + These methods remove the child setting with the given NAME from the + setting, which must be a group. Any child settings of the removed + setting are recursively destroyed as well. + If the setting is not a group, a 'SettingTypeException' is thrown. + If the setting does not have a child setting with the given name, a + 'SettingNotFoundException' is thrown. -- Method on Setting: void remove (unsigned int INDEX) + This method removes the child setting at the given index INDEX from - the setting, which must be a group, list, or array. Any child + the setting, which must be a group, list, or array. Any child settings of the removed setting are recursively destroyed as well. If the setting is not a group, list, or array, a - `SettingTypeException' is thrown. If INDEX is out of range, a - `SettingNotFoundException' is thrown. - + 'SettingTypeException' is thrown. If INDEX is out of range, a + 'SettingNotFoundException' is thrown. -- Method on Setting: const char * getName () - This method returns the name of the setting, or `NULL' if the - setting has no name. Storage for the returned string is managed by + + This method returns the name of the 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. For safety + destroyed; the string must not be freed by the caller. For safety and convenience, consider assigning the return value to a - `std::string'. - + 'std::string'. -- Method on Setting: std::string getPath () - This method returns the complete dot-separated path to the - setting. Settings which do not have a name (list and array - elements) are represented by their index in square brackets. + This method returns the complete dot-separated path to the setting. + Settings which do not have a name (list and array elements) are + represented by their index in square brackets. -- Method on Setting: Setting & getParent () - This method returns the parent setting of the setting. If the - setting is the root setting, a `SettingNotFoundException' is - thrown. + This method returns the parent setting of the setting. If the + setting is the root setting, a 'SettingNotFoundException' is + thrown. -- Method on Setting: bool isRoot () - This method returns `true' if the setting is the root setting, and - `false' otherwise. + This method returns 'true' if the setting is the root setting, and + 'false' otherwise. -- Method on Setting: int getIndex () - This method returns the index of the setting within its parent - setting. When applied to the root setting, this method returns -1. + This method returns the index of the setting within its parent + setting. When applied to the root setting, this method returns -1. -- Method on Setting: Setting::Type getType () - This method returns the type of the setting. The `Setting::Type' - enumeration consists of the following constants: `TypeInt', - `TypeInt64', `TypeFloat', `TypeString', `TypeBoolean', - `TypeArray', `TypeList', and `TypeGroup'. + This method returns the type of the setting. The 'Setting::Type' + enumeration consists of the following constants: 'TypeInt', + 'TypeInt64', 'TypeFloat', 'TypeString', 'TypeBoolean', 'TypeArray', + 'TypeList', and 'TypeGroup'. -- Method on Setting: Setting::Format getFormat () -- Method on Setting: void setFormat (Setting::Format FORMAT) + These methods get and set the external format for the setting. The SETTING::FORMAT enumeration consists of the following - constants: `FormatDefault' and `FormatHex'. All settings support - the `FormatDefault' format. The `FormatHex' format specifies + constants: 'FormatDefault' and 'FormatHex'. All settings support + the 'FormatDefault' format. The 'FormatHex' format specifies hexadecimal formatting for integer values, and hence only applies - to settings of type `TypeInt' and `TypeInt64'. If FORMAT is + to settings of type 'TypeInt' and 'TypeInt64'. If FORMAT is invalid for the given setting, it is ignored. - -- Method on Setting: bool exists (const std::string &NAME) -- Method on Setting: bool exists (const char *NAME) + These methods test if the setting has a child setting with the - given NAME. They return `true' if the setting exists, and `false' - otherwise. These methods do not throw exceptions. + given NAME. They return 'true' if the setting exists, and 'false' + otherwise. These methods do not throw exceptions. + + -- Method on Setting: iterator begin () + -- Method on Setting: iterator end () + -- Method on Setting: const_iterator begin () + -- Method on Setting: const_iterator end () + These methods return STL-style iterators that can be used to + enumerate the child settings of a given setting. If the setting is + not an array, list, or group, they throw a 'SettingTypeException'. -- Method on Setting: int getLength () + This method returns the number of settings in a group, or the - number of elements in a list or array. For other types of + number of elements in a list or array. For other types of settings, it returns 0. - -- Method on Setting: bool isGroup () -- Method on Setting: bool isArray () -- Method on Setting: bool isList () - These convenience methods test if a setting is of a given type. + These convenience methods test if a setting is of a given type. -- Method on Setting: bool isAggregate () -- Method on Setting: bool isScalar () -- Method on Setting: bool isNumber () - These convenience methods test if a setting is of an aggregate - type (a group, array, or list), of a scalar type (integer, 64-bit + + These convenience methods test if a 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. - -- Method on Setting: const char * getSourceFile () + This function returns the name of the file from which the setting - was read, or NULL if the setting was not read from a file. This + was read, or NULL if the setting was not read from a file. This information is useful for reporting application-level errors. Storage for the returned string is managed by the library and released automatically when the configuration is destroyed; the string must not be freed by the caller. - -- Method on Setting: unsigned int getSourceLine () + This function returns the line number of the configuration file or stream at which the setting SETTING was read, or 0 if no line - number is available. This information is useful for reporting + number is available. This information is useful for reporting application-level errors. - File: libconfig.info, Node: Example Programs, Next: Configuration File Grammar, Prev: The C++ API, Up: Top @@ -1615,33 +1746,32 @@ File: libconfig.info, Node: Example Programs, Next: Configuration File Grammar ****************** 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: +both C and C++ are included in the 'examples' subdirectory of the +distribution. These examples include: -`examples/c/example1.c' +'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. + 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++/example1.cpp' + The C++ equivalent of 'example1.c'. -`examples/c/example2.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. + 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++/example2.cpp' + The C++ equivalent of 'example2.c' -`examples/c/example3.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++/example3.cpp' + The C++ equivalent of 'example3.c' File: libconfig.info, Node: Configuration File Grammar, Next: License, Prev: Example Programs, Up: Top @@ -1649,7 +1779,7 @@ File: libconfig.info, Node: Configuration File Grammar, Next: License, Prev: 6 Configuration File Grammar **************************** -Below is the BNF grammar for configuration files. Comments and include +Below is the BNF grammar for configuration files. Comments and include directives are not part of the grammar, so they are not included here. @@ -1680,14 +1810,14 @@ directives are not part of the grammar, so they are not included here. Terminals are defined below as regular expressions: -`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]+)' +'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]+)' File: libconfig.info, Node: License, Next: Function Index, Prev: Configuration File Grammar, Up: Top @@ -1700,22 +1830,22 @@ Appendix A License Copyright (C) 1991, 1999 Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA +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.] + [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. + 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 @@ -1728,8 +1858,8 @@ use in any particular case, based on the explanations below. 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 +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 @@ -1742,33 +1872,33 @@ 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. +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. + 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 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. +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. +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 @@ -1788,11 +1918,11 @@ 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. +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 @@ -1817,17 +1947,17 @@ be combined with the library in order to run. 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". + 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 + 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, @@ -1846,8 +1976,8 @@ be combined with the library in order to run. 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. + 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 @@ -1863,8 +1993,8 @@ be combined with the library in order to run. 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 + 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: @@ -1882,29 +2012,28 @@ be combined with the library in order to run. d. If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the - facility is invoked, then you must make a good faith effort - to ensure that, in the event an application does not supply - such function or table, the facility still operates, and - performs whatever part of its purpose remains meaningful. + facility is invoked, then you must make a good faith effort to + ensure that, in the event an application does not supply such + function or table, the facility still operates, and performs + whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots - has a purpose that is entirely well-defined independent of - the application. Therefore, Subsection 2d requires that any + has a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) - These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate - works in themselves, then this License, and its terms, do not - apply to those sections when you distribute them as separate - works. But when you distribute the same sections as part of a - whole which is a work based on the Library, the distribution of - the whole must be on the terms of this License, whose permissions - for other licensees extend to the entire whole, and thus to each - and every part regardless of who wrote it. + works in themselves, then this License, and its terms, do not apply + to those sections when you distribute them as separate works. But + when you distribute the same sections as part of a whole which is a + work based on the Library, the distribution of the whole must be on + the terms of this License, whose permissions for other licensees + extend to the entire whole, and thus to each and every part + regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the @@ -1912,19 +2041,19 @@ be combined with the library in order to run. derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the - Library with the Library (or with a work based on the Library) on - a volume of a storage or distribution medium does not bring the - other work under the scope of this License. + Library with the Library (or with a work based on the Library) on a + volume of a storage or distribution medium does not bring the other + work under the scope of this License. 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. + 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 @@ -1934,13 +2063,12 @@ be combined with the library in order to run. 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. + 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 @@ -1950,17 +2078,16 @@ be combined with the library in order to run. 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. + 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. + 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 @@ -1972,23 +2099,23 @@ be combined with the library in order to run. If such an object file uses only numerical parameters, data structure layouts and accessors, 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 + 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. 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 Library, 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. + 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 Library, 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 @@ -2002,8 +2129,8 @@ be combined with the library in order to run. a. Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be - distributed under Sections 1 and 2 above); and, if the work - is an executable linked with the Library, with the complete + distributed under Sections 1 and 2 above); and, if the work is + an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing @@ -2029,15 +2156,14 @@ be combined with the library in order to run. performing this distribution. - d. If distribution of the work is made by offering access to - copy from a designated place, offer equivalent access to copy - the above specified materials from the same place. + d. If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the + above specified materials from the same place. 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 @@ -2050,17 +2176,16 @@ be combined with the library in order to run. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you - cannot use both them and the Library together in an executable - that you distribute. + 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: + 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 @@ -2070,20 +2195,19 @@ be combined with the library in order to run. 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. - + 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, from you under this License will not - have their licenses terminated so long as such parties remain in - full compliance. + your rights under this License. However, parties who have received + copies, or rights, 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 @@ -2091,12 +2215,12 @@ be combined with the library in order to run. 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, + 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 + 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 @@ -2105,7 +2229,7 @@ be combined with the library in order to run. by third parties with this License. - 11. If, as a consequence of a court judgment or allegation of patent + 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 @@ -2114,10 +2238,10 @@ be combined with the library in order to run. 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. + 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 @@ -2139,7 +2263,7 @@ be combined with the library in order to run. to be a consequence of the rest of this License. - 12. If the distribution and/or use of the Library is restricted in + 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 @@ -2149,46 +2273,45 @@ be combined with the library in order to run. this License. - 13. The Free Software Foundation may publish revised and/or new + 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. + 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. + 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 distribution 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 software and of - promoting the sharing and reuse of software generally. + 14. If you wish to incorporate parts of the Library into other free + programs whose distribution 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 software and of promoting the + sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE - LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT - HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT - WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT - NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE - QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE - LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY - SERVICING, REPAIR OR CORRECTION. + LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS + AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY + OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE + DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR + OR CORRECTION. - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, @@ -2200,7 +2323,6 @@ be combined with the library in order to run. ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries @@ -2235,6 +2357,7 @@ 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. @@ -2249,6 +2372,7 @@ library `Frob' (a library for tweaking knobs) written by James Random Hacker. <signature of Ty Coon>, 1 April 1990 Ty Coon, President of Vice + That's all there is to it! @@ -2260,145 +2384,218 @@ Function Index * Menu: -* add on Setting: The C++ API. (line 428) -* c_str on Setting: The C++ API. (line 234) -* Config on Config: The C++ API. (line 43) -* config_destroy: The C API. (line 15) -* config_error_file: The C API. (line 66) -* config_error_line: The C API. (line 67) -* config_error_text: The C API. (line 65) -* config_error_type: The C API. (line 79) -* config_get_auto_convert: The C API. (line 108) -* config_get_default_format: The C API. (line 125) -* config_get_include_dir: The C API. (line 91) -* config_get_tab_width: The C API. (line 137) -* config_init: The C API. (line 14) -* config_lookup: The C API. (line 172) -* config_lookup_bool: The C API. (line 155) -* config_lookup_float: The C API. (line 153) -* config_lookup_int: The C API. (line 149) -* config_lookup_int64: The C API. (line 151) -* config_lookup_string: The C API. (line 157) -* config_read: The C API. (line 27) -* config_read_file: The C API. (line 37) -* config_read_string: The C API. (line 46) -* config_root_setting: The C API. (line 358) -* config_set_auto_convert: The C API. (line 107) -* config_set_default_format: The C API. (line 124) -* config_set_destructor: The C API. (line 461) -* config_set_include_dir: The C API. (line 89) -* config_set_tab_width: The C API. (line 135) -* config_setting_add: The C API. (line 323) -* config_setting_get_bool: The C API. (line 186) -* config_setting_get_bool_elem: The C API. (line 289) -* config_setting_get_elem: The C API. (line 275) -* config_setting_get_float: The C API. (line 184) -* config_setting_get_float_elem: The C API. (line 287) -* config_setting_get_format: The C API. (line 245) -* config_setting_get_hook: The C API. (line 451) -* config_setting_get_int: The C API. (line 180) -* config_setting_get_int64: The C API. (line 182) -* config_setting_get_int64_elem: The C API. (line 285) -* config_setting_get_int_elem: The C API. (line 283) -* config_setting_get_member: The C API. (line 268) -* config_setting_get_string: The C API. (line 188) -* config_setting_get_string_elem: The C API. (line 291) -* config_setting_index: The C API. (line 384) -* config_setting_is_aggregate: The C API. (line 417) -* config_setting_is_array: The C API. (line 408) -* config_setting_is_group: The C API. (line 406) -* config_setting_is_list: The C API. (line 410) -* config_setting_is_number: The C API. (line 421) -* config_setting_is_root: The C API. (line 378) -* config_setting_is_scalar: The C API. (line 419) -* config_setting_length: The C API. (line 391) -* config_setting_lookup_bool: The C API. (line 227) -* config_setting_lookup_float: The C API. (line 224) -* config_setting_lookup_int: The C API. (line 218) -* config_setting_lookup_int64: The C API. (line 221) -* config_setting_lookup_string: The C API. (line 230) -* config_setting_name: The C API. (line 364) -* config_setting_parent: The C API. (line 372) -* config_setting_remove: The C API. (line 335) -* config_setting_remove_elem: The C API. (line 346) -* config_setting_set_bool: The C API. (line 205) -* config_setting_set_bool_elem: The C API. (line 308) -* config_setting_set_float: The C API. (line 203) -* config_setting_set_float_elem: The C API. (line 306) -* config_setting_set_format: The C API. (line 247) -* config_setting_set_hook: The C API. (line 449) -* config_setting_set_int: The C API. (line 199) -* config_setting_set_int64: The C API. (line 201) -* config_setting_set_int64_elem: The C API. (line 304) -* config_setting_set_int_elem: The C API. (line 302) -* config_setting_set_string: The C API. (line 207) -* config_setting_set_string_elem: The C API. (line 310) -* config_setting_source_file: The C API. (line 431) -* config_setting_source_line: The C API. (line 441) -* config_setting_type: The C API. (line 397) -* config_write: The C API. (line 54) -* config_write_file: The C API. (line 59) -* exists on Config: The C++ API. (line 149) -* exists on Setting: The C++ API. (line 529) -* getAutoConvert on Config: The C++ API. (line 102) -* getDefaultFormat on Config: The C++ API. (line 118) -* getError on ParseException: The C++ API. (line 73) -* getFile on ParseException: The C++ API. (line 74) -* getFormat on Setting: The C++ API. (line 517) -* getIncludeDir on Config: The C++ API. (line 85) -* getIndex on Setting: The C++ API. (line 505) -* getLength on Setting: The C++ API. (line 536) -* getLine on ParseException: The C++ API. (line 75) -* getName on Setting: The C++ API. (line 479) -* getParent on Setting: The C++ API. (line 494) -* getPath on Setting: The C++ API. (line 488) -* getPath on SettingException: The C++ API. (line 35) -* getRoot on Config: The C++ API. (line 137) -* getSourceFile on Setting: The C++ API. (line 557) -* getSourceLine on Setting: The C++ API. (line 566) -* getTabWidth on Config: The C++ API. (line 127) -* getType on Setting: The C++ API. (line 510) -* isAggregate on Setting: The C++ API. (line 548) -* isArray on Setting: The C++ API. (line 543) -* isGroup on Setting: The C++ API. (line 542) -* isList on Setting: The C++ API. (line 544) -* isNumber on Setting: The C++ API. (line 550) -* isRoot on Setting: The C++ API. (line 500) -* isScalar on Setting: The C++ API. (line 549) -* LIBCONFIG_VER_MAJOR: Version Test Macros. (line 9) -* LIBCONFIG_VER_MINOR: Version Test Macros. (line 10) -* LIBCONFIG_VER_REVISION: Version Test Macros. (line 11) -* LIBCONFIGXX_VER_MAJOR: Version Test Macros. (line 28) -* LIBCONFIGXX_VER_MINOR: Version Test Macros. (line 29) -* LIBCONFIGXX_VER_REVISION: Version Test Macros. (line 30) -* lookup on Config: The C++ API. (line 142) -* lookupValue on Config: The C++ API. (line 156) -* lookupValue on Setting: The C++ API. (line 355) -* operator bool () on Setting: The C++ API. (line 223) -* operator const char * () on Setting: The C++ API. (line 232) -* operator double () on Setting: The C++ API. (line 231) -* operator float () on Setting: The C++ API. (line 230) -* operator int () on Setting: The C++ API. (line 224) -* operator long () on Setting: The C++ API. (line 226) -* operator long long () on Setting: The C++ API. (line 228) -* operator std::string () on Setting: The C++ API. (line 233) -* operator unsigned int () on Setting: The C++ API. (line 225) -* operator unsigned long () on Setting: The C++ API. (line 227) -* operator unsigned long long () on Setting: The C++ API. (line 229) -* operator= on Setting: The C++ API. (line 308) -* operator[] on Setting: The C++ API. (line 333) -* read on Config: The C++ API. (line 48) -* readFile on Config: The C++ API. (line 56) -* readString on Config: The C++ API. (line 67) -* remove on Setting: The C++ API. (line 458) -* setAutoConvert on Config: The C++ API. (line 101) -* setDefaultFormat on Config: The C++ API. (line 117) -* setFormat on Setting: The C++ API. (line 518) -* setIncludeDir on Config: The C++ API. (line 84) -* setTabWidth on Config: The C++ API. (line 126) -* write on Config: The C++ API. (line 49) -* writeFile on Config: The C++ API. (line 57) -* ~Config on Config: The C++ API. (line 44) +* ~Config on Config: The C++ API. (line 75) +* add on Setting: The C++ API. (line 516) +* add on Setting <1>: The C++ API. (line 518) +* add on Setting <2>: The C++ API. (line 531) +* begin on Setting: The C++ API. (line 625) +* begin on Setting <1>: The C++ API. (line 627) +* Config on Config: The C++ API. (line 74) +* config_destroy: The C API. (line 14) +* config_error_file: The C API. (line 65) +* config_error_line: The C API. (line 66) +* config_error_text: The C API. (line 64) +* config_error_type: The C API. (line 78) +* config_get_auto_convert: The C API. (line 152) +* config_get_default_format: The C API. (line 160) +* config_get_include_dir: The C API. (line 88) +* config_get_options: The C API. (line 106) +* config_get_tab_width: The C API. (line 171) +* config_init: The C API. (line 13) +* config_lookup: The C API. (line 206) +* config_lookup_bool: The C API. (line 189) +* config_lookup_float: The C API. (line 187) +* config_lookup_int: The C API. (line 183) +* config_lookup_int64: The C API. (line 185) +* config_lookup_string: The C API. (line 191) +* config_read: The C API. (line 26) +* config_read_file: The C API. (line 35) +* config_read_string: The C API. (line 44) +* config_root_setting: The C API. (line 405) +* config_setting_add: The C API. (line 368) +* config_setting_get_bool: The C API. (line 228) +* config_setting_get_bool_elem: The C API. (line 332) +* config_setting_get_elem: The C API. (line 318) +* config_setting_get_float: The C API. (line 226) +* config_setting_get_float_elem: The C API. (line 330) +* config_setting_get_format: The C API. (line 287) +* config_setting_get_hook: The C API. (line 498) +* config_setting_get_int: The C API. (line 222) +* config_setting_get_int64: The C API. (line 224) +* config_setting_get_int64_elem: The C API. (line 328) +* config_setting_get_int_elem: The C API. (line 326) +* config_setting_get_member: The C API. (line 311) +* config_setting_get_string: The C API. (line 230) +* config_setting_get_string_elem: The C API. (line 334) +* config_setting_index: The C API. (line 431) +* config_setting_is_aggregate: The C API. (line 464) +* config_setting_is_array: The C API. (line 455) +* config_setting_is_group: The C API. (line 453) +* config_setting_is_list: The C API. (line 457) +* config_setting_is_number: The C API. (line 468) +* config_setting_is_root: The C API. (line 425) +* config_setting_is_scalar: The C API. (line 466) +* config_setting_length: The C API. (line 438) +* config_setting_lookup: The C API. (line 215) +* config_setting_lookup_bool: The C API. (line 269) +* config_setting_lookup_float: The C API. (line 266) +* config_setting_lookup_int: The C API. (line 260) +* config_setting_lookup_int64: The C API. (line 263) +* config_setting_lookup_string: The C API. (line 272) +* config_setting_name: The C API. (line 411) +* config_setting_parent: The C API. (line 419) +* config_setting_remove: The C API. (line 381) +* config_setting_remove_elem: The C API. (line 392) +* config_setting_set_bool: The C API. (line 247) +* config_setting_set_bool_elem: The C API. (line 352) +* config_setting_set_float: The C API. (line 245) +* config_setting_set_float_elem: The C API. (line 350) +* config_setting_set_format: The C API. (line 289) +* config_setting_set_hook: The C API. (line 496) +* config_setting_set_int: The C API. (line 241) +* config_setting_set_int64: The C API. (line 243) +* config_setting_set_int64_elem: The C API. (line 348) +* config_setting_set_int_elem: The C API. (line 346) +* config_setting_set_string: The C API. (line 249) +* config_setting_set_string_elem: The C API. (line 354) +* config_setting_source_file: The C API. (line 478) +* config_setting_source_line: The C API. (line 488) +* config_setting_type: The C API. (line 445) +* config_set_auto_convert: The C API. (line 151) +* config_set_default_format: The C API. (line 158) +* config_set_destructor: The C API. (line 508) +* config_set_include_dir: The C API. (line 86) +* config_set_options: The C API. (line 105) +* config_set_tab_width: The C API. (line 169) +* config_write: The C API. (line 53) +* config_write_file: The C API. (line 57) +* c_str on Setting: The C++ API. (line 309) +* end on Setting: The C++ API. (line 626) +* end on Setting <1>: The C++ API. (line 628) +* exists on Config: The C++ API. (line 217) +* exists on Config <1>: The C++ API. (line 218) +* exists on Setting: The C++ API. (line 618) +* exists on Setting <1>: The C++ API. (line 619) +* getAutoConvert on Config: The C++ API. (line 179) +* getDefaultFormat on Config: The C++ API. (line 186) +* getError on ParseException: The C++ API. (line 104) +* getFile on ParseException: The C++ API. (line 105) +* getFormat on Setting: The C++ API. (line 606) +* getIncludeDir on Config: The C++ API. (line 116) +* getIndex on Setting: The C++ API. (line 594) +* getLength on Setting: The C++ API. (line 634) +* getLine on ParseException: The C++ API. (line 106) +* getName on Setting: The C++ API. (line 568) +* getOptions on Config: The C++ API. (line 133) +* getParent on Setting: The C++ API. (line 583) +* getPath on Setting: The C++ API. (line 577) +* getPath on SettingException: The C++ API. (line 66) +* getRoot on Config: The C++ API. (line 205) +* getSourceFile on Setting: The C++ API. (line 655) +* getSourceLine on Setting: The C++ API. (line 664) +* getTabWidth on Config: The C++ API. (line 195) +* getType on Setting: The C++ API. (line 599) +* isAggregate on Setting: The C++ API. (line 646) +* isArray on Setting: The C++ API. (line 641) +* isGroup on Setting: The C++ API. (line 640) +* isList on Setting: The C++ API. (line 642) +* isNumber on Setting: The C++ API. (line 648) +* isRoot on Setting: The C++ API. (line 589) +* isScalar on Setting: The C++ API. (line 647) +* LIBCONFIGXX_VER_MAJOR: Version Test Macros. (line 27) +* LIBCONFIGXX_VER_MINOR: Version Test Macros. (line 28) +* LIBCONFIGXX_VER_REVISION: Version Test Macros. (line 29) +* LIBCONFIG_VER_MAJOR: Version Test Macros. (line 8) +* LIBCONFIG_VER_MINOR: Version Test Macros. (line 9) +* LIBCONFIG_VER_REVISION: Version Test Macros. (line 10) +* lookup on Config: The C++ API. (line 210) +* lookup on Config <1>: The C++ API. (line 211) +* lookup on Setting: The C++ API. (line 429) +* lookup on Setting <1>: The C++ API. (line 430) +* lookupValue on Config: The C++ API. (line 224) +* lookupValue on Config <1>: The C++ API. (line 225) +* lookupValue on Config <2>: The C++ API. (line 228) +* lookupValue on Config <3>: The C++ API. (line 229) +* lookupValue on Config <4>: The C++ API. (line 232) +* lookupValue on Config <5>: The C++ API. (line 234) +* lookupValue on Config <6>: The C++ API. (line 237) +* lookupValue on Config <7>: The C++ API. (line 239) +* lookupValue on Config <8>: The C++ API. (line 242) +* lookupValue on Config <9>: The C++ API. (line 243) +* lookupValue on Config <10>: The C++ API. (line 246) +* lookupValue on Config <11>: The C++ API. (line 247) +* lookupValue on Config <12>: The C++ API. (line 250) +* lookupValue on Config <13>: The C++ API. (line 252) +* lookupValue on Config <14>: The C++ API. (line 255) +* lookupValue on Config <15>: The C++ API. (line 257) +* lookupValue on Setting: The C++ API. (line 436) +* lookupValue on Setting <1>: The C++ API. (line 437) +* lookupValue on Setting <2>: The C++ API. (line 440) +* lookupValue on Setting <3>: The C++ API. (line 441) +* lookupValue on Setting <4>: The C++ API. (line 444) +* lookupValue on Setting <5>: The C++ API. (line 446) +* lookupValue on Setting <6>: The C++ API. (line 449) +* lookupValue on Setting <7>: The C++ API. (line 451) +* lookupValue on Setting <8>: The C++ API. (line 454) +* lookupValue on Setting <9>: The C++ API. (line 456) +* lookupValue on Setting <10>: The C++ API. (line 459) +* lookupValue on Setting <11>: The C++ API. (line 460) +* lookupValue on Setting <12>: The C++ API. (line 463) +* lookupValue on Setting <13>: The C++ API. (line 465) +* lookupValue on Setting <14>: The C++ API. (line 468) +* lookupValue on Setting <15>: The C++ API. (line 470) +* lookupValue on Setting <16>: The C++ API. (line 473) +* lookupValue on Setting <17>: The C++ API. (line 475) +* operator bool () on Setting: The C++ API. (line 298) +* operator const char * () on Setting: The C++ API. (line 307) +* operator double () on Setting: The C++ API. (line 306) +* operator float () on Setting: The C++ API. (line 305) +* operator int () on Setting: The C++ API. (line 299) +* operator long () on Setting: The C++ API. (line 301) +* operator long long () on Setting: The C++ API. (line 303) +* operator std::string () on Setting: The C++ API. (line 308) +* operator unsigned int () on Setting: The C++ API. (line 300) +* operator unsigned long () on Setting: The C++ API. (line 302) +* operator unsigned long long () on Setting: The C++ API. (line 304) +* operator= on Setting: The C++ API. (line 383) +* operator= on Setting <1>: The C++ API. (line 384) +* operator= on Setting <2>: The C++ API. (line 385) +* operator= on Setting <3>: The C++ API. (line 386) +* operator= on Setting <4>: The C++ API. (line 387) +* operator= on Setting <5>: The C++ API. (line 388) +* operator= on Setting <6>: The C++ API. (line 389) +* operator= on Setting <7>: The C++ API. (line 390) +* operator[] on Setting: The C++ API. (line 407) +* operator[] on Setting <1>: The C++ API. (line 408) +* operator[] on Setting <2>: The C++ API. (line 409) +* ParseException on ParseException: The C++ API. (line 53) +* read on Config: The C++ API. (line 79) +* readFile on Config: The C++ API. (line 87) +* readString on Config: The C++ API. (line 98) +* readString on Config <1>: The C++ API. (line 99) +* remove on Setting: The C++ API. (line 547) +* remove on Setting <1>: The C++ API. (line 548) +* remove on Setting <2>: The C++ API. (line 558) +* setAutoConvert on Config: The C++ API. (line 178) +* setDefaultFormat on Config: The C++ API. (line 185) +* setFormat on Setting: The C++ API. (line 607) +* setIncludeDir on Config: The C++ API. (line 115) +* setOptions on Config: The C++ API. (line 132) +* setTabWidth on Config: The C++ API. (line 194) +* SettingNameException on SettingNameException: The C++ API. (line 44) +* SettingNotFoundException on SettingNotFoundException: The C++ API. + (line 31) +* SettingNotFoundException on SettingNotFoundException <1>: The C++ API. + (line 33) +* SettingNotFoundException on SettingNotFoundException <2>: The C++ API. + (line 35) +* SettingTypeException on SettingTypeException: The C++ API. (line 19) +* SettingTypeException on SettingTypeException <1>: The C++ API. + (line 21) +* SettingTypeException on SettingTypeException <2>: The C++ API. + (line 23) +* write on Config: The C++ API. (line 80) +* writeFile on Config: The C++ API. (line 88) File: libconfig.info, Node: Type Index, Next: Concept Index, Prev: Function Index, Up: Top @@ -2410,19 +2607,19 @@ Type Index * Menu: * Config: The C++ API. (line 6) +* ConfigException: The C++ API. (line 13) * config_error_t: The C API. (line 79) * config_setting_t: The C API. (line 6) * config_t: The C API. (line 6) -* ConfigException: The C++ API. (line 13) -* FileIOException: The C++ API. (line 27) -* ParseException: The C++ API. (line 24) +* FileIOException: The C++ API. (line 59) +* ParseException: The C++ API. (line 50) * Setting: The C++ API. (line 6) -* Setting::Format: The C++ API. (line 520) -* Setting::Type: The C++ API. (line 510) -* SettingException: The C++ API. (line 30) -* SettingFormat: The C API. (line 250) -* SettingNameException: The C++ API. (line 21) -* SettingNotFoundException: The C++ API. (line 19) +* Setting::Format: The C++ API. (line 611) +* Setting::Type: The C++ API. (line 601) +* SettingException: The C++ API. (line 62) +* SettingFormat: The C API. (line 296) +* SettingNameException: The C++ API. (line 41) +* SettingNotFoundException: The C++ API. (line 29) * SettingTypeException: The C++ API. (line 16) @@ -2434,18 +2631,18 @@ Concept Index * Menu: -* aggregate value: The C API. (line 421) +* aggregate value: The C API. (line 471) * array: Configuration Files. (line 24) * comment: Comments. (line 6) * configuration: Configuration Files. (line 24) * escape sequence: String Values. (line 6) -* format: The C API. (line 250) +* format: The C API. (line 296) * group: Configuration Files. (line 24) * include directive: Include Directives. (line 6) * list: Configuration Files. (line 24) * locale: Internationalization Issues. (line 14) -* path: Configuration Files. (line 77) +* path: Configuration Files. (line 73) * scalar value: Configuration Files. (line 24) * setting: Configuration Files. (line 24) * Unicode: Internationalization Issues. @@ -2457,34 +2654,34 @@ Concept Index Tag Table: -Node: Top245 -Node: Introduction532 +Node: Top244 +Node: Introduction531 Node: Why Another Configuration File Library?1368 -Node: Using the Library from a C Program2444 -Node: Using the Library from a C++ Program2912 -Node: Multithreading Issues3577 -Node: Internationalization Issues5144 -Node: Compiling Using pkg-config6667 -Node: Version Test Macros8197 -Node: Configuration Files9383 -Node: Settings13232 -Node: Groups13550 -Node: Arrays13824 -Node: Lists14096 -Node: Integer Values14382 -Node: 64-bit Integer Values14846 -Node: Floating Point Values15225 -Node: Boolean Values15682 -Node: String Values15954 -Node: Comments17074 -Node: Include Directives17981 -Node: The C API19454 -Node: The C++ API41050 -Node: Example Programs65375 -Node: Configuration File Grammar66483 -Node: License67822 -Node: Function Index95916 -Node: Type Index106208 -Node: Concept Index107446 +Node: Using the Library from a C Program2446 +Node: Using the Library from a C++ Program2913 +Node: Multithreading Issues3575 +Node: Internationalization Issues5149 +Node: Compiling Using pkg-config6677 +Node: Version Test Macros8209 +Node: Configuration Files9398 +Node: Settings13256 +Node: Groups13575 +Node: Arrays13846 +Node: Lists14119 +Node: Integer Values14406 +Node: 64-bit Integer Values14870 +Node: Floating Point Values15249 +Node: Boolean Values15707 +Node: String Values15979 +Node: Comments17102 +Node: Include Directives18012 +Node: The C API19490 +Node: The C++ API43382 +Node: Example Programs71602 +Node: Configuration File Grammar72710 +Node: License74042 +Node: Function Index102104 +Node: Type Index117705 +Node: Concept Index118943 End Tag Table diff --git a/doc/libconfig.texi b/doc/libconfig.texi index 52dca20..f6f89eb 100644 --- a/doc/libconfig.texi +++ b/doc/libconfig.texi @@ -6,8 +6,8 @@ @setfilename libconfig.info @settitle libconfig -@set edition 1.4.9 -@set update-date 28 September 2012 +@set edition 1.5 +@set update-date 21 Sep 2014 @set subtitle-text A Library For Processing Structured Configuration Files @set author-text Mark A.@: Lindner @@ -36,7 +36,7 @@ @page @vskip 0pt plus 1filll -Copyright @copyright{} 2005-2012 Mark A Lindner +Copyright @copyright{} 2005-2014 Mark A Lindner Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -766,21 +766,60 @@ configuration @var{config}, or @code{NULL} if none is set. @end deftypefun -@deftypefun void config_set_auto_convert (@w{config_t *@var{config}}, @w{int @var{flag}}) -@deftypefunx int config_get_auto_convert (@w{const config_t *@var{config}}) +@deftypefun void config_set_options (@w{config_t *@var{config}}, @w{int @var{options}}) +@deftypefunx int config_get_options (@w{config_t *@var{config}}) + +These functions set and get the options for the configuration +@var{config}. The options affect how configurations are read and +written. The following options are defined: + +@table @code -@code{config_set_auto_convert()} enables number auto-conversion for -the configuration @var{config} if @var{flag} is non-zero, and disables -it otherwise. When this feature is enabled, an attempt to retrieve a +@item CONFIG_OPTION_AUTOCONVERT +Turning this option on enables number auto-conversion for +the configuration. When this feature is enabled, an attempt to retrieve a floating point setting's value into an integer (or vice versa), or store an integer to a floating point setting's value (or vice versa) will cause the library to silently perform the necessary conversion (possibly leading to loss of data), rather than reporting failure. By -default this feature is disabled. +default this option is turned off. + +@item 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 +separators are optional in the configuration syntax.) By default this +option is turned on. + +@item 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. + +@item 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. + +@item 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. + +@end table + +@end deftypefun + +@deftypefun void config_set_auto_convert (@w{config_t *@var{config}}, @w{int @var{flag}}) +@deftypefunx int config_get_auto_convert (@w{const config_t *@var{config}}) -@code{config_get_auto_convert()} returns @code{CONFIG_TRUE} if number -auto-conversion is currently enabled for @var{config}; otherwise it -returns @code{CONFIG_FALSE}. +These functions get and set the @code{CONFIG_OPTION_AUTO_CONVERT} +option. They are obsoleted by the @code{config_set_options()} and +@code{config_get_options()} functions described above. @end deftypefun @@ -839,6 +878,15 @@ setting was not found. @end deftypefun +@deftypefun {config_setting_t *} config_setting_lookup (@w{const config_setting_t * @var{setting}}, @w{const char * @var{path}}) + +This function locates a setting by a path @var{path} relative to +the setting @var{setting}. It returns a pointer to the +@code{config_setting_t} structure on success, or @code{NULL} if the +setting was not found. + +@end deftypefun + @deftypefun int config_setting_get_int (@w{const config_setting_t * @var{setting}}) @deftypefunx {long long} config_setting_get_int64 (@w{const config_setting_t * @var{setting}}) @deftypefunx double config_setting_get_float (@w{const config_setting_t * @var{setting}}) @@ -1146,17 +1194,45 @@ common base exception @code{ConfigException}. A @code{SettingTypeException} is thrown when the type of a setting's value does not match the type requested. +@deftypemethod SettingTypeException {} SettingTypeException (@w{const Setting &@var{setting}}) +@deftypemethodx SettingTypeException {} SettingTypeException (@w{const Setting &@var{setting}}, @w{int @var{index}}) +@deftypemethodx SettingTypeException {} SettingTypeException (@w{const Setting &@var{setting}}, @w{const char *@var{name}}) + +These methods construct @code{SettingTypeException} objects for the given @var{setting} and/or member @var{index} or @var{name}. + +@end deftypemethod + @tindex SettingNotFoundException A @code{SettingNotFoundException} is thrown when a setting is not found. +@deftypemethod SettingNotFoundException {} SettingNotFoundException (@w{const Setting &@var{setting}}, @w{int @var{index}}) +@deftypemethodx SettingNotFoundException {} SettingNotFoundException (@w{const Setting &@var{setting}}, @w{const char *@var{name}}) +@deftypemethodx SettingNotFoundException {} SettingNotFoundException (@w{const char *@var{path}}) + +These methods construct @code{SettingTypeException} objects for the given @var{setting} and member @var{index} or @var{name}, or path @var{path}. + +@end deftypemethod + @tindex SettingNameException A @code{SettingNameException} is thrown when an attempt is made to add a new setting with a non-unique or invalid name. +@deftypemethod SettingNameException {} SettingNameException (@w{const Setting &@var{setting}}, @w{const char *@var{name}}) + +This method constructs a @code{SettingNameExcpetion} object for the given @var{setting} and member name @var{name}. + +@end deftypemethod + @tindex ParseException A @code{ParseException} is thrown when a parse error occurs while reading a configuration from a stream. +@deftypemethod ParseException {} ParseException (@w{const char *@var{file}}, @w{int @var{line}}, @w{const char *@var{error}}) + +This method constructs a @code{ParseException} object with the given filename @var{file}, line number @var{line}, and error message @var{error}. + +@end deftypemethod + @tindex FileIOException A @code{FileIOException} is thrown when an I/O error occurs while reading/writing a configuration from/to a file. @@ -1247,21 +1323,60 @@ configuration, or @code{NULL} if none is set. @end deftypemethod +@deftypemethod Config void setOptions (int @var{options}) +@deftypemethodx Config int getOptions () + +These methods set and get the options for the configuration. The +options affect how configurations are read and written. The following +options are defined: + +@table @code + +@item OptionAutoConvert +Turning this option on enables number auto-conversion for +the configuration. When this feature is enabled, an attempt to retrieve a +floating point setting's value into an integer (or vice versa), or +store an integer to a floating point setting's value (or vice versa) +will cause the library to silently perform the necessary conversion +(possibly leading to loss of data), rather than reporting failure. By +default this option is turned off. + +@item OptionSemicolonSeparators +This option controls whether a semicolon (`;') is output after each setting +when the configuration is written to a file or stream. (The semicolon +separators are optional in the configuration syntax.) By default this +option is turned on. + +@item 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. + +@item 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. + +@item 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. + +@end table + +@end deftypemethod + @deftypemethod Config void setAutoConvert (bool @var{flag}) @deftypemethodx Config bool getAutoConvert () -@code{setAutoConvert()} enables number auto-conversion for the -configuration if @var{flag} is @code{true}, and disables it -otherwise. When this feature is enabled, an attempt to assign a -floating point setting to an integer (or vice versa), or -assign an integer to a floating point setting (or vice versa) will -cause the library to silently perform the necessary conversion -(possibly leading to loss of data), rather than throwing a -@code{SettingTypeException}. By default this feature is disabled. - -@code{getAutoConvert()} returns @code{true} if number auto-conversion -is currently enabled for the configuration; otherwise it returns -@code{false}. +These methods get and set the @code{OptionAutoConvert} option. They +are obsoleted by the @code{setOptions()} and @code{getOptions()} +methods described above. @end deftypemethod @@ -1542,6 +1657,15 @@ configuration. @end deftypemethod +@deftypemethod Setting {Setting &} lookup (@w{const char * @var{path}}) +@deftypemethodx Setting {Setting &} lookup (@w{const std::string &@var{path}}) + +This function locates a setting by a path @var{path} relative to +this setting. If requested setting is not found, a +@code{SettingNotFoundException} is thrown. + +@end deftypemethod + @deftypemethod Setting bool lookupValue (@w{const char *@var{name}}, @w{bool &@var{value}}) @deftypemethodx Setting bool lookupValue (@w{const std::string &@var{name}}, @w{bool &@var{value}}) @@ -1744,6 +1868,17 @@ These methods test if the setting has a child setting with the given @code{false} otherwise. These methods do not throw exceptions. @end deftypemethod +@page +@deftypemethod Setting iterator begin () +@deftypemethodx Setting iterator end () +@deftypemethodx Setting const_iterator begin () +@deftypemethodx Setting const_iterator end () + +These methods return STL-style iterators that can be used to enumerate +the child settings of a given setting. If the setting is not an array, list, +or group, they throw a @code{SettingTypeException}. + +@end deftypemethod @deftypemethod Setting int getLength () |