From 429e46051dba814e7d6c74368eb1bba550222cbe Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Thu, 1 Dec 2011 22:56:23 +0000 Subject: Imported Upstream version 1.4.8 --- examples/c++/Makefile.am | 18 ++ examples/c++/Makefile.in | 517 +++++++++++++++++++++++++++++++++++++++ examples/c++/cxx_example1.vcproj | 185 ++++++++++++++ examples/c++/cxx_example2.vcproj | 185 ++++++++++++++ examples/c++/cxx_example3.vcproj | 185 ++++++++++++++ examples/c++/cxx_example4.vcproj | 181 ++++++++++++++ examples/c++/example.cfg | 46 ++++ examples/c++/example1.cpp | 151 ++++++++++++ examples/c++/example2.cpp | 97 ++++++++ examples/c++/example3.cpp | 71 ++++++ examples/c++/example4.cpp | 57 +++++ examples/c++/invalid.cfg | 8 + 12 files changed, 1701 insertions(+) create mode 100644 examples/c++/Makefile.am create mode 100644 examples/c++/Makefile.in create mode 100644 examples/c++/cxx_example1.vcproj create mode 100644 examples/c++/cxx_example2.vcproj create mode 100644 examples/c++/cxx_example3.vcproj create mode 100644 examples/c++/cxx_example4.vcproj create mode 100644 examples/c++/example.cfg create mode 100644 examples/c++/example1.cpp create mode 100644 examples/c++/example2.cpp create mode 100644 examples/c++/example3.cpp create mode 100644 examples/c++/example4.cpp create mode 100644 examples/c++/invalid.cfg (limited to 'examples/c++') diff --git a/examples/c++/Makefile.am b/examples/c++/Makefile.am new file mode 100644 index 0000000..5e0ae0d --- /dev/null +++ b/examples/c++/Makefile.am @@ -0,0 +1,18 @@ + +noinst_PROGRAMS = example1 example2 example3 example4 + +example1_SOURCES = example1.cpp + +example2_SOURCES = example2.cpp + +example3_SOURCES = example3.cpp + +example4_SOURCES = example4.cpp + +AM_CPPFLAGS = -I $(top_srcdir)/lib + +LDADD = $(top_builddir)/lib/libconfig++.la + +EXTRA_DIST = \ + example.cfg invalid.cfg \ + *.vcproj diff --git a/examples/c++/Makefile.in b/examples/c++/Makefile.in new file mode 100644 index 0000000..798c5db --- /dev/null +++ b/examples/c++/Makefile.in @@ -0,0 +1,517 @@ +# Makefile.in generated by automake 1.11.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. +# 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. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +noinst_PROGRAMS = example1$(EXEEXT) example2$(EXEEXT) \ + example3$(EXEEXT) example4$(EXEEXT) +subdir = examples/c++ +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(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 = +PROGRAMS = $(noinst_PROGRAMS) +am_example1_OBJECTS = example1.$(OBJEXT) +example1_OBJECTS = $(am_example1_OBJECTS) +example1_LDADD = $(LDADD) +example1_DEPENDENCIES = $(top_builddir)/lib/libconfig++.la +am_example2_OBJECTS = example2.$(OBJEXT) +example2_OBJECTS = $(am_example2_OBJECTS) +example2_LDADD = $(LDADD) +example2_DEPENDENCIES = $(top_builddir)/lib/libconfig++.la +am_example3_OBJECTS = example3.$(OBJEXT) +example3_OBJECTS = $(am_example3_OBJECTS) +example3_LDADD = $(LDADD) +example3_DEPENDENCIES = $(top_builddir)/lib/libconfig++.la +am_example4_OBJECTS = example4.$(OBJEXT) +example4_OBJECTS = $(am_example4_OBJECTS) +example4_LDADD = $(LDADD) +example4_DEPENDENCIES = $(top_builddir)/lib/libconfig++.la +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/aux-build/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(example1_SOURCES) $(example2_SOURCES) $(example3_SOURCES) \ + $(example4_SOURCES) +DIST_SOURCES = $(example1_SOURCES) $(example2_SOURCES) \ + $(example3_SOURCES) $(example4_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +example1_SOURCES = example1.cpp +example2_SOURCES = example2.cpp +example3_SOURCES = example3.cpp +example4_SOURCES = example4.cpp +AM_CPPFLAGS = -I $(top_srcdir)/lib +LDADD = $(top_builddir)/lib/libconfig++.la +EXTRA_DIST = \ + example.cfg invalid.cfg \ + *.vcproj + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/c++/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu examples/c++/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +example1$(EXEEXT): $(example1_OBJECTS) $(example1_DEPENDENCIES) + @rm -f example1$(EXEEXT) + $(CXXLINK) $(example1_OBJECTS) $(example1_LDADD) $(LIBS) +example2$(EXEEXT): $(example2_OBJECTS) $(example2_DEPENDENCIES) + @rm -f example2$(EXEEXT) + $(CXXLINK) $(example2_OBJECTS) $(example2_LDADD) $(LIBS) +example3$(EXEEXT): $(example3_OBJECTS) $(example3_DEPENDENCIES) + @rm -f example3$(EXEEXT) + $(CXXLINK) $(example3_OBJECTS) $(example3_LDADD) $(LIBS) +example4$(EXEEXT): $(example4_OBJECTS) $(example4_DEPENDENCIES) + @rm -f example4$(EXEEXT) + $(CXXLINK) $(example4_OBJECTS) $(example4_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example4.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-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 +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags 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-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/examples/c++/cxx_example1.vcproj b/examples/c++/cxx_example1.vcproj new file mode 100644 index 0000000..0a9207f --- /dev/null +++ b/examples/c++/cxx_example1.vcproj @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/c++/cxx_example2.vcproj b/examples/c++/cxx_example2.vcproj new file mode 100644 index 0000000..9b0f7fc --- /dev/null +++ b/examples/c++/cxx_example2.vcproj @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/c++/cxx_example3.vcproj b/examples/c++/cxx_example3.vcproj new file mode 100644 index 0000000..8c85b98 --- /dev/null +++ b/examples/c++/cxx_example3.vcproj @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/c++/cxx_example4.vcproj b/examples/c++/cxx_example4.vcproj new file mode 100644 index 0000000..ad452ae --- /dev/null +++ b/examples/c++/cxx_example4.vcproj @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/c++/example.cfg b/examples/c++/example.cfg new file mode 100644 index 0000000..8f11dc6 --- /dev/null +++ b/examples/c++/example.cfg @@ -0,0 +1,46 @@ +// An example configuration file that stores information about a store. + +// Basic store information: +name = "Books, Movies & More"; + +// Store inventory: +inventory = +{ + books = ( { title = "Treasure Island"; + author = "Robert Louis Stevenson"; + price = 29.99; + qty = 5; }, + { title = "Snow Crash"; + author = "Neal Stephenson"; + price = 9.99; + qty = 8; } + ); + + movies = ( { title = "Brazil"; + media = "DVD"; + price = 19.99; + qty = 11; }, + { title = "The City of Lost Children"; + media = "DVD"; + price = 18.99; + qty = 5; }, + { title = "Memento"; + media = "Blu-Ray"; + price = 24.99; + qty = 20; + }, + { title = "Howard the Duck"; } + ); +}; + +// Store hours: +hours = +{ + mon = { open = 9; close = 18; }; + tue = { open = 9; close = 18; }; + wed = { open = 9; close = 18; }; + thu = { open = 9; close = 18; }; + fri = { open = 9; close = 20; }; + sat = { open = 9; close = 20; }; + sun = { open = 11; close = 16; }; +}; diff --git a/examples/c++/example1.cpp b/examples/c++/example1.cpp new file mode 100644 index 0000000..1fb5ff6 --- /dev/null +++ b/examples/c++/example1.cpp @@ -0,0 +1,151 @@ +/* ---------------------------------------------------------------------------- + libconfig - A library for processing structured configuration files + Copyright (C) 2005-2010 Mark A Lindner + + This file is part of libconfig. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, see + . + ---------------------------------------------------------------------------- +*/ + +#include +#include +#include +#include + +using namespace std; +using namespace libconfig; + +// This example reads the configuration file 'example.cfg' and displays +// some of its contents. + +int main(int argc, char **argv) +{ + Config cfg; + + // Read the file. If there is an error, report it and exit. + try + { + cfg.readFile("example.cfg"); + } + catch(const FileIOException &fioex) + { + std::cerr << "I/O error while reading file." << std::endl; + return(EXIT_FAILURE); + } + catch(const ParseException &pex) + { + std::cerr << "Parse error at " << pex.getFile() << ":" << pex.getLine() + << " - " << pex.getError() << std::endl; + return(EXIT_FAILURE); + } + + // Get the store name. + try + { + string name = cfg.lookup("name"); + cout << "Store name: " << name << endl << endl; + } + catch(const SettingNotFoundException &nfex) + { + cerr << "No 'name' setting in configuration file." << endl; + } + + const Setting& root = cfg.getRoot(); + + // Output a list of all books in the inventory. + try + { + const Setting &books = root["inventory"]["books"]; + int count = books.getLength(); + + cout << setw(30) << left << "TITLE" << " " + << setw(30) << left << "AUTHOR" << " " + << setw(6) << left << "PRICE" << " " + << "QTY" + << endl; + + for(int i = 0; i < count; ++i) + { + const Setting &book = books[i]; + + // Only output the record if all of the expected fields are present. + string title, author; + double price; + int qty; + + if(!(book.lookupValue("title", title) + && book.lookupValue("author", author) + && book.lookupValue("price", price) + && book.lookupValue("qty", qty))) + continue; + + cout << setw(30) << left << title << " " + << setw(30) << left << author << " " + << '$' << setw(6) << right << price << " " + << qty + << endl; + } + cout << endl; + } + catch(const SettingNotFoundException &nfex) + { + // Ignore. + } + + // Output a list of all books in the inventory. + try + { + const Setting &movies = root["inventory"]["movies"]; + int count = movies.getLength(); + + cout << setw(30) << left << "TITLE" << " " + << setw(10) << left << "MEDIA" << " " + << setw(6) << left << "PRICE" << " " + << "QTY" + << endl; + + for(int i = 0; i < count; ++i) + { + const Setting &movie = movies[i]; + + // Only output the record if all of the expected fields are present. + string title, media; + double price; + int qty; + + if(!(movie.lookupValue("title", title) + && movie.lookupValue("media", media) + && movie.lookupValue("price", price) + && movie.lookupValue("qty", qty))) + continue; + + cout << setw(30) << left << title << " " + << setw(10) << left << media << " " + << '$' << setw(6) << right << price << " " + << qty + << endl; + } + cout << endl; + } + catch(const SettingNotFoundException &nfex) + { + // Ignore. + } + + return(EXIT_SUCCESS); +} + +// eof diff --git a/examples/c++/example2.cpp b/examples/c++/example2.cpp new file mode 100644 index 0000000..d0af0e8 --- /dev/null +++ b/examples/c++/example2.cpp @@ -0,0 +1,97 @@ +/* ---------------------------------------------------------------------------- + libconfig - A library for processing structured configuration files + Copyright (C) 2005-2010 Mark A Lindner + + This file is part of libconfig. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, see + . + ---------------------------------------------------------------------------- +*/ + +#include +#include +#include +#include + +using namespace std; +using namespace libconfig; + +// This example reads the configuration file 'example.cfg', adds a new +// movie record to the movies list, and writes the updated configuration to +// 'updated.cfg'. + +int main(int argc, char **argv) +{ + static const char *output_file = "updated.cfg"; + + Config cfg; + + // Read the file. If there is an error, report it and exit. + try + { + cfg.readFile("example.cfg"); + } + catch(const FileIOException &fioex) + { + std::cerr << "I/O error while reading file." << std::endl; + return(EXIT_FAILURE); + } + catch(const ParseException &pex) + { + std::cerr << "Parse error at " << pex.getFile() << ":" << pex.getLine() + << " - " << pex.getError() << std::endl; + return(EXIT_FAILURE); + } + + // Find the 'movies' setting. Add intermediate settings if they don't yet + // exist. + Setting &root = cfg.getRoot(); + + if(! root.exists("inventory")) + root.add("inventory", Setting::TypeGroup); + + Setting &inventory = root["inventory"]; + + if(! inventory.exists("movies")) + inventory.add("movies", Setting::TypeList); + + Setting &movies = inventory["movies"]; + + // Create the new movie entry. + Setting &movie = movies.add(Setting::TypeGroup); + + movie.add("title", Setting::TypeString) = "Buckaroo Banzai"; + movie.add("media", Setting::TypeString) = "DVD"; + movie.add("price", Setting::TypeFloat) = 12.99; + movie.add("qty", Setting::TypeInt) = 20; + + // Write out the updated configuration. + try + { + cfg.writeFile(output_file); + cerr << "Updated configuration successfully written to: " << output_file + << endl; + + } + catch(const FileIOException &fioex) + { + cerr << "I/O error while writing file: " << output_file << endl; + return(EXIT_FAILURE); + } + + return(EXIT_SUCCESS); +} + +// eof diff --git a/examples/c++/example3.cpp b/examples/c++/example3.cpp new file mode 100644 index 0000000..da5caf5 --- /dev/null +++ b/examples/c++/example3.cpp @@ -0,0 +1,71 @@ +/* ---------------------------------------------------------------------------- + libconfig - A library for processing structured configuration files + Copyright (C) 2005-2010 Mark A Lindner + + This file is part of libconfig. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, see + . + ---------------------------------------------------------------------------- +*/ + +#include +#include +#include +#include + +using namespace std; +using namespace libconfig; + +// This example constructs a new configuration in memory and writes it to +// 'newconfig.cfg'. + +int main(int argc, char **argv) +{ + static const char *output_file = "newconfig.cfg"; + Config cfg; + + Setting &root = cfg.getRoot(); + + // Add some settings to the configuration. + Setting &address = root.add("address", Setting::TypeGroup); + + address.add("street", Setting::TypeString) = "1 Woz Way"; + address.add("city", Setting::TypeString) = "San Jose"; + address.add("state", Setting::TypeString) = "CA"; + address.add("zip", Setting::TypeInt) = 95110; + + Setting &array = root.add("array", Setting::TypeArray); + + for(int i = 0; i < 10; ++i) + array.add(Setting::TypeInt) = 10 * i; + + // Write out the new configuration. + try + { + cfg.writeFile(output_file); + cerr << "New configuration successfully written to: " << output_file + << endl; + + } + catch(const FileIOException &fioex) + { + cerr << "I/O error while writing file: " << output_file << endl; + return(EXIT_FAILURE); + } + + return(EXIT_SUCCESS); +} + +// eof diff --git a/examples/c++/example4.cpp b/examples/c++/example4.cpp new file mode 100644 index 0000000..b23f4c5 --- /dev/null +++ b/examples/c++/example4.cpp @@ -0,0 +1,57 @@ +/* ---------------------------------------------------------------------------- + libconfig - A library for processing structured configuration files + Copyright (C) 2005-2010 Mark A Lindner + + This file is part of libconfig. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, see + . + ---------------------------------------------------------------------------- +*/ + +#include +#include +#include +#include + +using namespace std; +using namespace libconfig; + +// This example demonstrates the handling of parsing errors in +// 'invalid.cfg'. + +int main(int argc, char **argv) +{ + Config cfg; + + try + { + cfg.readFile("invalid.cfg"); + } + catch(const FileIOException &fioex) + { + std::cerr << "File I/O error" << std::endl; + return(EXIT_FAILURE); + } + catch(const ParseException &pex) + { + std::cerr << "Parse error at " << pex.getFile() << ":" << pex.getLine() + << " - " << pex.getError() << std::endl; + return(EXIT_FAILURE); + } + + return(EXIT_SUCCESS); +} + +// eof diff --git a/examples/c++/invalid.cfg b/examples/c++/invalid.cfg new file mode 100644 index 0000000..764b44d --- /dev/null +++ b/examples/c++/invalid.cfg @@ -0,0 +1,8 @@ +// An example configuration file with an invalid @include. + + +pi = 3.141592654; + +@include "missing.cfg" + +e = 2.718281828; -- cgit v1.2.3