summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/Makefile.am23
-rwxr-xr-xexamples/Makefile.in417
-rwxr-xr-xexamples/exfilter.cpp77
-rwxr-xr-xexamples/makebcc.bat17
-rwxr-xr-xexamples/sample1.cpp120
-rwxr-xr-xexamples/sample2.cpp226
-rwxr-xr-xexamples/sample3.cpp137
-rwxr-xr-xexamples/sample4.cpp135
-rwxr-xr-xexamples/sample5.cpp135
-rwxr-xr-xexamples/xbstring.cpp84
10 files changed, 1371 insertions, 0 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100755
index 0000000..248b1ec
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,23 @@
+
+INCLUDES= -I$(topdir) $(all_includes)
+LDADD = -L$(topdir)/xbase64 -lxbase64
+
+# for shadow passwords override the value
+INSTALL_PROGRAM = @INSTALL@
+
+noinst_PROGRAMS = sample1 sample2 sample3 sample4 sample5 \
+ exfilter xbstring
+
+exfilter_SOURCES = exfilter.cpp
+sample1_SOURCES = sample1.cpp
+sample2_SOURCES = sample2.cpp
+sample3_SOURCES = sample3.cpp
+sample4_SOURCES = sample4.cpp
+sample5_SOURCES = sample5.cpp
+xbstring_SOURCES = xbstring.cpp
+
+noinst_HEADERS =
+
+EXTRA_DIST = makebcc.bat
+
+CLEANFILES = Makefile.in *.obj *.exe *.dbf *.dbt *.ndx *.ntx compout *.tds *.bak
diff --git a/examples/Makefile.in b/examples/Makefile.in
new file mode 100755
index 0000000..36e9f79
--- /dev/null
+++ b/examples/Makefile.in
@@ -0,0 +1,417 @@
+# Makefile.in generated by automake 1.6.3 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# 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@
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+
+EXEEXT = @EXEEXT@
+OBJEXT = @OBJEXT@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+
+# for shadow passwords override the value
+INSTALL_PROGRAM = @INSTALL@
+AMTAR = @AMTAR@
+AS = @AS@
+AWK = @AWK@
+CC = @CC@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+GXXVER = @GXXVER@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+OBJDUMP = @OBJDUMP@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+RELEASE = @RELEASE@
+RHREL = @RHREL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XSUBDIRS = @XSUBDIRS@
+am__include = @am__include@
+am__quote = @am__quote@
+doxygen = @doxygen@
+install_sh = @install_sh@
+topdir = @topdir@
+
+INCLUDES = -I$(topdir) $(all_includes)
+LDADD = -L$(topdir)/xbase64 -lxbase64
+
+noinst_PROGRAMS = sample1 sample2 sample3 sample4 sample5 \
+ exfilter xbstring
+
+
+exfilter_SOURCES = exfilter.cpp
+sample1_SOURCES = sample1.cpp
+sample2_SOURCES = sample2.cpp
+sample3_SOURCES = sample3.cpp
+sample4_SOURCES = sample4.cpp
+sample5_SOURCES = sample5.cpp
+xbstring_SOURCES = xbstring.cpp
+
+noinst_HEADERS =
+
+EXTRA_DIST = makebcc.bat
+
+CLEANFILES = Makefile.in *.obj *.exe *.dbf *.dbt *.ndx *.ntx compout *.tds *.bak
+subdir = examples
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/xbase64/xbconfig.h
+CONFIG_CLEAN_FILES =
+noinst_PROGRAMS = sample1$(EXEEXT) sample2$(EXEEXT) sample3$(EXEEXT) \
+ sample4$(EXEEXT) sample5$(EXEEXT) exfilter$(EXEEXT) \
+ xbstring$(EXEEXT)
+PROGRAMS = $(noinst_PROGRAMS)
+
+am_exfilter_OBJECTS = exfilter.$(OBJEXT)
+exfilter_OBJECTS = $(am_exfilter_OBJECTS)
+exfilter_LDADD = $(LDADD)
+exfilter_DEPENDENCIES =
+exfilter_LDFLAGS =
+am_sample1_OBJECTS = sample1.$(OBJEXT)
+sample1_OBJECTS = $(am_sample1_OBJECTS)
+sample1_LDADD = $(LDADD)
+sample1_DEPENDENCIES =
+sample1_LDFLAGS =
+am_sample2_OBJECTS = sample2.$(OBJEXT)
+sample2_OBJECTS = $(am_sample2_OBJECTS)
+sample2_LDADD = $(LDADD)
+sample2_DEPENDENCIES =
+sample2_LDFLAGS =
+am_sample3_OBJECTS = sample3.$(OBJEXT)
+sample3_OBJECTS = $(am_sample3_OBJECTS)
+sample3_LDADD = $(LDADD)
+sample3_DEPENDENCIES =
+sample3_LDFLAGS =
+am_sample4_OBJECTS = sample4.$(OBJEXT)
+sample4_OBJECTS = $(am_sample4_OBJECTS)
+sample4_LDADD = $(LDADD)
+sample4_DEPENDENCIES =
+sample4_LDFLAGS =
+am_sample5_OBJECTS = sample5.$(OBJEXT)
+sample5_OBJECTS = $(am_sample5_OBJECTS)
+sample5_LDADD = $(LDADD)
+sample5_DEPENDENCIES =
+sample5_LDFLAGS =
+am_xbstring_OBJECTS = xbstring.$(OBJEXT)
+xbstring_OBJECTS = $(am_xbstring_OBJECTS)
+xbstring_LDADD = $(LDADD)
+xbstring_DEPENDENCIES =
+xbstring_LDFLAGS =
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/xbase64
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/exfilter.Po ./$(DEPDIR)/sample1.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/sample2.Po ./$(DEPDIR)/sample3.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/sample4.Po ./$(DEPDIR)/sample5.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/xbstring.Po
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CXXFLAGS = @CXXFLAGS@
+DIST_SOURCES = $(exfilter_SOURCES) $(sample1_SOURCES) $(sample2_SOURCES) \
+ $(sample3_SOURCES) $(sample4_SOURCES) $(sample5_SOURCES) \
+ $(xbstring_SOURCES)
+HEADERS = $(noinst_HEADERS)
+
+DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
+SOURCES = $(exfilter_SOURCES) $(sample1_SOURCES) $(sample2_SOURCES) $(sample3_SOURCES) $(sample4_SOURCES) $(sample5_SOURCES) $(xbstring_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu examples/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+exfilter$(EXEEXT): $(exfilter_OBJECTS) $(exfilter_DEPENDENCIES)
+ @rm -f exfilter$(EXEEXT)
+ $(CXXLINK) $(exfilter_LDFLAGS) $(exfilter_OBJECTS) $(exfilter_LDADD) $(LIBS)
+sample1$(EXEEXT): $(sample1_OBJECTS) $(sample1_DEPENDENCIES)
+ @rm -f sample1$(EXEEXT)
+ $(CXXLINK) $(sample1_LDFLAGS) $(sample1_OBJECTS) $(sample1_LDADD) $(LIBS)
+sample2$(EXEEXT): $(sample2_OBJECTS) $(sample2_DEPENDENCIES)
+ @rm -f sample2$(EXEEXT)
+ $(CXXLINK) $(sample2_LDFLAGS) $(sample2_OBJECTS) $(sample2_LDADD) $(LIBS)
+sample3$(EXEEXT): $(sample3_OBJECTS) $(sample3_DEPENDENCIES)
+ @rm -f sample3$(EXEEXT)
+ $(CXXLINK) $(sample3_LDFLAGS) $(sample3_OBJECTS) $(sample3_LDADD) $(LIBS)
+sample4$(EXEEXT): $(sample4_OBJECTS) $(sample4_DEPENDENCIES)
+ @rm -f sample4$(EXEEXT)
+ $(CXXLINK) $(sample4_LDFLAGS) $(sample4_OBJECTS) $(sample4_LDADD) $(LIBS)
+sample5$(EXEEXT): $(sample5_OBJECTS) $(sample5_DEPENDENCIES)
+ @rm -f sample5$(EXEEXT)
+ $(CXXLINK) $(sample5_LDFLAGS) $(sample5_OBJECTS) $(sample5_LDADD) $(LIBS)
+xbstring$(EXEEXT): $(xbstring_OBJECTS) $(xbstring_DEPENDENCIES)
+ @rm -f xbstring$(EXEEXT)
+ $(CXXLINK) $(xbstring_LDFLAGS) $(xbstring_OBJECTS) $(xbstring_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exfilter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample3.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample4.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample5.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbstring.Po@am__quote@
+
+distclean-depend:
+ -rm -rf ./$(DEPDIR)
+
+.cpp.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+.cpp.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(CXXCOMPILE) -c -o $@ `cygpath -w $<`
+
+.cpp.lo:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+CXXDEPMODE = @CXXDEPMODE@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ETAGS = etags
+ETAGSFLAGS =
+
+tags: TAGS
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @list='$(DISTFILES)'; for file in $$list; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$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) $(HEADERS)
+
+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_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_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
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstPROGRAMS distclean distclean-compile \
+ distclean-depend distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ tags uninstall uninstall-am uninstall-info-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/exfilter.cpp b/examples/exfilter.cpp
new file mode 100755
index 0000000..0dc6c0a
--- /dev/null
+++ b/examples/exfilter.cpp
@@ -0,0 +1,77 @@
+/* exfilter.cpp
+
+ Xbase project source code
+
+ This program demonstrates the usage of the xbFilter class
+
+ Copyright (C) 1997,2003 Gary A. Kunkel
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Contact:
+
+ Email:
+
+ xbase64-dev@lists.sourceforge.net
+
+
+*/
+
+
+#include <xbase64/xbase64.h>
+
+int main()
+{
+#if defined(XB_FILTERS)
+ xbShort rc;
+ xbXBase x;
+ xbDbf d( &x );
+ xbNdx i( &d );
+
+ std::cout << "exfilter program executing" << std::endl;
+
+ if(( rc = d.OpenDatabase( "MYFILE.DBF" )) != XB_NO_ERROR ){
+ std::cout << "Error opening database" << std::endl;
+ return 1;
+ }
+
+ if(( rc = i.OpenIndex( "MYINDEX1.NDX" )) != XB_NO_ERROR ){
+ std::cout << "Error opening index" << std::endl;
+ return 2;
+ }
+
+ xbFilter f1( &d, 0, "FLOAT1>1" );
+ /* use filter 1 w/o index */
+ rc = f1.GetFirstFilterRec();
+ while( rc == XB_NO_ERROR ){
+ std::cout << "Filter 1 Found Record " << d.GetCurRecNo() << std::endl;
+ rc = f1.GetNextFilterRec();
+ }
+ xbFilter f2( &d, &i, "FLOAT1>1" );
+ /* use filter 2 w/ index */
+ rc = f2.GetLastFilterRec();
+
+ while( rc == XB_NO_ERROR ){
+ std::cout << "Filter 2 Found Record " << d.GetCurRecNo() << std::endl;
+ rc = f2.GetPrevFilterRec();
+ }
+ d.CloseDatabase();
+#else
+ std::cout << "XB_FILTERS not compiled into library" << std::endl;
+#endif
+
+ return 0;
+}
+
diff --git a/examples/makebcc.bat b/examples/makebcc.bat
new file mode 100755
index 0000000..2facb73
--- /dev/null
+++ b/examples/makebcc.bat
@@ -0,0 +1,17 @@
+
+rem This batch file builds the xbase sample programs
+rem using the borland 5.5 compiler
+
+del *.bak
+del *.tds
+del *.exe
+del *.obj
+
+bcc32 -I.. -I/borland/bcc55/include -L../xbase64 -L/borland/bcc55/lib sample1.cpp xbase64.lib > compout
+bcc32 -v -I.. -I/borland/bcc55/include -L../xbase64 -L/borland/bcc55/lib sample2.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L../xbase64 -L/borland/bcc55/lib sample3.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L../xbase64 -L/borland/bcc55/lib sample4.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L../xbase64 -L/borland/bcc55/lib sample5.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L../xbase64 -L/borland/bcc55/lib exfilter.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L../xbase64 -L/borland/bcc55/lib xbstring.cpp xbase64.lib >> compout
+
diff --git a/examples/sample1.cpp b/examples/sample1.cpp
new file mode 100755
index 0000000..8d89d96
--- /dev/null
+++ b/examples/sample1.cpp
@@ -0,0 +1,120 @@
+/* sample1.cpp
+
+ Xbase project source code
+
+ This program creates a sample database and four indexes
+
+ Copyright (C) 1997,2003 Gary A. Kunkel
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Contact:
+
+ Email:
+
+ xbase64-devel@lists.sourceforge.net
+ xbase64-users@lists.sourceforge.net
+
+
+ Regular Mail:
+
+ XBase Support
+ 149C South Main St
+ Keller Texas, 76248
+ USA
+
+*/
+
+#include <xbase64/xbase64.h>
+
+int main()
+{
+
+ xbSchema MyRecord[] =
+ {
+ { "FIRSTNAME", XB_CHAR_FLD, 15, 0 },
+ { "LASTNAME", XB_CHAR_FLD, 20, 0 },
+ { "BIRTHDATE", XB_DATE_FLD, 8, 0 },
+ { "STARTDATE", XB_DATE_FLD, 8, 0 },
+ { "AMOUNT", XB_NUMERIC_FLD, 9, 2 },
+ { "SWITCH", XB_LOGICAL_FLD, 1, 0 },
+ { "FLOAT1", XB_FLOAT_FLD, 9, 2 },
+ { "FLOAT2", XB_FLOAT_FLD, 9, 1 },
+ { "FLOAT3", XB_FLOAT_FLD, 9, 2 },
+ { "FLOAT4", XB_FLOAT_FLD, 9, 3 },
+ { "ZIPCODE", XB_NUMERIC_FLD, 5, 0 },
+#ifdef XB_MEMO_FIELDS
+ { "MEMO1", XB_MEMO_FLD, 10, 0 },
+#endif
+ { "",0,0,0 }
+ };
+
+ /* define the classes */
+ xbXBase x; /* initialize xbase */
+ xbDbf MyFile( &x ); /* class for table */
+
+// Create Dbase style indices
+#ifdef XB_INDEX_NDX
+ xbNdx MyIndex1( &MyFile ); /* class for index 1 */
+ xbNdx MyIndex2( &MyFile ); /* class for index 2 */
+ xbNdx MyIndex3( &MyFile ); /* class for index 3 */
+#endif
+
+// Create Clipper style indices
+#ifdef XB_INDEX_NTX
+ xbNtx MyIndex4( &MyFile ); /* class for index 4 */
+ xbNtx MyIndex5( &MyFile ); /* class for index 5 */
+#endif
+
+ xbShort rc;
+ MyFile.SetVersion( 4 ); /* create dbase IV style files */
+
+ if(( rc = MyFile.CreateDatabase( "MYFILE.DBF", MyRecord, XB_OVERLAY ))
+ != XB_NO_ERROR )
+ x.DisplayError( rc );
+ else
+ {
+
+#ifdef XB_INDEX_NDX
+ /* define a simple index */
+ if(( rc = MyIndex1.CreateIndex(
+ "MYINDEX1.NDX", "LASTNAME", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR )
+ x.DisplayError( rc );
+ /* define a multi-field index "LASTNAME FIRSTNAME" */
+ if(( rc = MyIndex2.CreateIndex(
+ "MYINDEX2.NDX", "LASTNAME+FIRSTNAME", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR )
+ x.DisplayError( rc );
+ /* define a numeric index "ZIPCODE" */
+ if(( rc = MyIndex3.CreateIndex(
+ "MYINDEX3.NDX", "ZIPCODE", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR )
+ x.DisplayError( rc );
+
+
+#endif
+#ifdef XB_INDEX_NTX
+ /* define a multi-field index "LASTNAMEFIRSTNAME" */
+ if(( rc = MyIndex4.CreateIndex(
+ "MYINDEX4.NTX", "LASTNAME-FIRSTNAME", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR )
+ x.DisplayError( rc );
+ /* define a numeric index "ZIPCODE" */
+ if(( rc = MyIndex5.CreateIndex(
+ "MYINDEX5.NTX", "ZIPCODE", XB_NOT_UNIQUE, XB_OVERLAY )) != XB_NO_ERROR )
+ x.DisplayError( rc );
+#endif
+ }
+
+ MyFile.CloseDatabase(); /* Close database and associated indexes */
+ return 0;
+}
diff --git a/examples/sample2.cpp b/examples/sample2.cpp
new file mode 100755
index 0000000..c755b39
--- /dev/null
+++ b/examples/sample2.cpp
@@ -0,0 +1,226 @@
+/* sample2.cpp
+
+ Xbase64 project source code
+
+ This sample program updates the database created by the sample1
+ program
+
+ This program demonstrates the use of the following functions/methods
+ OpenDatabase, GetFieldNo, BlankRecord, AppendRecord,
+ PutField and CloseDatabase
+
+ Copyright (C) 1997,2003 Gary A. Kunkel
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+
+ Contact:
+
+ Email:
+
+ xbase64-devel@lists.sourceforge.net
+ xbase64-users@lists.sourceforge.net
+
+
+ Regular Mail:
+
+ XBase Support
+ 149C South Main St
+ Keller Texas, 76248
+ USA
+
+*/
+
+
+#include <xbase64/xbase64.h>
+#include <xbase64/xbdbf.cpp>
+#include <xbase64/xbexp.cpp>
+#include <xbase64/xbexpprc.cpp>
+#include <xbase64/xbexpfnc.cpp>
+#include <xbase64/xbfields.cpp>
+#include <xbase64/xbindex.cpp>
+#include <xbase64/xbmemo.cpp>
+#include <xbase64/xbndx.cpp>
+#include <xbase64/xbntx.cpp>
+#include <xbase64/xbase64.cpp>
+#include <xbase64/xbdate.cpp>
+#include <xbase64/xbfilter.cpp>
+#include <xbase64/xblock.cpp>
+#include <xbase64/xbstring.cpp>
+#include <xbase64/xbfile.cpp>
+
+
+
+int main()
+{
+ xbShort lname, fname, birthdate, startdate;
+ xbShort amount, sw, f1, f2, f3, f4, m1, rc, z;
+ xbFloat f;
+
+ xbXBase x;
+ xbDbf MyFile( &x );
+ MyFile.AutoLockOff(); // turn off locking
+
+ char bigBuf[4096];
+
+#undef XB_INDEX_NTX
+
+#ifdef XB_INDEX_NDX
+ xbNdx MyIndex1( &MyFile );
+ xbNdx MyIndex2( &MyFile );
+ xbNdx MyIndex3( &MyFile );
+#endif
+
+#ifdef XB_INDEX_NTX
+ xbNtx MyIndex4( &MyFile );
+ xbNtx MyIndex5( &MyFile );
+#endif
+
+ xbDate d;
+
+ if(( rc = MyFile.OpenDatabase( "MYFILE.DBF" )) != XB_NO_ERROR )
+ x.DisplayError( rc );
+
+#ifdef XB_INDEX_NDX
+ if(( rc = MyIndex1.OpenIndex( "MYINDEX1.NDX" )) != XB_NO_ERROR )
+ x.DisplayError( rc );
+ if(( rc = MyIndex2.OpenIndex( "MYINDEX2.NDX" )) != XB_NO_ERROR )
+ x.DisplayError( rc );
+ if(( rc = MyIndex3.OpenIndex( "MYINDEX3.NDX" )) != XB_NO_ERROR )
+ x.DisplayError( rc );
+#endif
+
+#ifdef XB_INDEX_NTX
+ if(( rc = MyIndex4.OpenIndex( "MYINDEX4.NTX" )) != XB_NO_ERROR )
+ x.DisplayError( rc );
+ if(( rc = MyIndex5.OpenIndex( "MYINDEX5.NTX" )) != XB_NO_ERROR )
+ x.DisplayError( rc );
+#endif
+
+ fname = MyFile.GetFieldNo( "FIRSTNAME" );
+ lname = MyFile.GetFieldNo( "LASTNAME" );
+ birthdate = MyFile.GetFieldNo( "BIRTHDATE" );
+ startdate = MyFile.GetFieldNo( "STARTDATE" );
+ amount = MyFile.GetFieldNo( "AMOUNT" );
+ sw = MyFile.GetFieldNo( "SWITCH" );
+ f1 = MyFile.GetFieldNo( "FLOAT1" );
+ f2 = MyFile.GetFieldNo( "FLOAT2" );
+ f3 = MyFile.GetFieldNo( "FLOAT3" );
+ f4 = MyFile.GetFieldNo( "FLOAT4" );
+ m1 = MyFile.GetFieldNo( "MEMO1" );
+ z = MyFile.GetFieldNo( "ZIPCODE" );
+
+ std::cout << "First Name Id = " << fname << std::endl;
+ std::cout << "Last Name Id = " << lname << std::endl;
+ std::cout << "Birthdate Id = " << birthdate << std::endl;
+ std::cout << "Startdate Id = " << startdate << std::endl;
+ std::cout << "Amount Id = " << amount << std::endl;
+ std::cout << "Switch Id = " << sw << std::endl;
+ std::cout << "Float 1 Id = " << f1 << std::endl;
+ std::cout << "Float 2 Id = " << f2 << std::endl;
+ std::cout << "Float 3 Id = " << f3 << std::endl;
+ std::cout << "Float 4 Id = " << f4 << std::endl;
+ std::cout << "Zipcode Id = " << z << std::endl;
+#ifdef XB_MEMO_FIELDS
+ std::cout << "Memo1 Id = " << m1 << std::endl << std::endl;;
+#endif
+
+ /* build record one */
+ MyFile.BlankRecord(); /* blank out the record buffer */
+ MyFile.PutField( lname, "Queue" ); /* a name */
+ MyFile.PutField( fname, "Suzy" ); /* a name */
+ MyFile.PutField( birthdate, d.Sysdate()); /* a date */
+ MyFile.PutField( startdate, "20040506" );
+ MyFile.PutField( amount, "99.99" ); /* an amount */
+ MyFile.PutField( sw, "Y" ); /* a switch */
+ f = 1.466f;
+ MyFile.PutFloatField( f1, f );
+ MyFile.PutFloatField( "FLOAT2", f );
+ MyFile.PutField( f3, "1" );
+ MyFile.PutField( f4, "1" );
+ MyFile.PutField( z, "76262" );
+
+ if(( rc = MyFile.AppendRecord()) != XB_NO_ERROR ) /* write it */
+ x.DisplayError( rc );
+
+ /* build record two */
+ MyFile.BlankRecord(); /* blank out the record buffer */
+ MyFile.PutField( lname, "Bob" ); /* a name */
+ MyFile.PutField( fname, "Billy" ); /* a name */
+ MyFile.PutField( birthdate, "19970304" ); /* a date */
+ MyFile.PutField( startdate, "19970310" ); /* a date */
+ MyFile.PutField( amount, "88.88" ); /* an amount */
+ MyFile.PutField( sw, "N" ); /* a switch */
+ f = -2.1f;
+ MyFile.PutFloatField( f1, f );
+ MyFile.PutFloatField( "FLOAT2", -2.1f );
+ MyFile.PutField( f1, "-2.1" );
+ MyFile.PutField( f2, "-2.1" );
+ MyFile.PutField( f3, "-2.1" );
+ MyFile.PutField( f4, "-2.1" );
+ MyFile.PutField( z, "76261" );
+#ifdef XB_MEMO_FIELDS
+ memset( bigBuf, 0x00, 4096 );
+ memset( bigBuf, 'a', 596 );
+ bigBuf[0] = '[';
+ strcat( bigBuf, "EOD]" );
+ MyFile.UpdateMemoData( m1, strlen( bigBuf ), bigBuf, XB_LOCK );
+#endif
+ if(( rc = MyFile.AppendRecord()) != XB_NO_ERROR ) /* write it */
+ x.DisplayError( rc );
+ /* build record three */
+ MyFile.BlankRecord(); /* blank out the record buffer */
+ MyFile.PutField( lname, "Slippery" ); /* a name */
+ MyFile.PutField( fname, "Sam" ); /* a name */
+ MyFile.PutField( birthdate, "19970406" ); /* a date */
+ MyFile.PutField( startdate, "19990101" ); /* a date */
+ MyFile.PutField( amount, "77.77" ); /* an amount */
+ MyFile.PutField( sw, "T" ); /* a switch */
+ f = 3.21f;
+ MyFile.PutFloatField( f1, f );
+ MyFile.PutFloatField( "FLOAT2", 3.21f );
+ MyFile.PutField( f1, "3.21" );
+ MyFile.PutField( f2, "3.21" );
+ MyFile.PutField( f3, "3.21" );
+ MyFile.PutField( f4, "3.21" );
+ MyFile.PutField( z, "76263" );
+#ifdef XB_MEMO_FIELDS
+ MyFile.UpdateMemoData( m1, 20, "Sample memo field 3", XB_LOCK );
+#endif
+
+ if(( rc = MyFile.AppendRecord()) != XB_NO_ERROR ) /* write it */
+ x.DisplayError( rc );
+
+ /* build record four */
+ MyFile.BlankRecord(); /* blank out the record buffer */
+ MyFile.PutField( lname, "Lucas" ); /* a name */
+ MyFile.PutField( fname, "George" ); /* a name */
+ MyFile.PutField( birthdate, "19470406" ); /* a date */
+ MyFile.PutField( amount, "77.77" ); /* an amount */
+ MyFile.PutField( sw, "T" ); /* a switch */
+ f = 4.321f;
+ MyFile.PutFloatField( f1, f );
+ MyFile.PutFloatField( "FLOAT2", 4.321f );
+ MyFile.PutField( f1, "4.321" );
+ MyFile.PutField( f2, "4.321" );
+ MyFile.PutField( f3, "4.321" );
+ MyFile.PutField( f4, "4.321" );
+ MyFile.PutField( z, "76260" );
+#ifdef XB_MEMO_FIELDS
+ MyFile.UpdateMemoData( m1, 20, "Sample memo field 4", XB_LOCK );
+#endif
+ if(( rc = MyFile.AppendRecord()) != XB_NO_ERROR ) /* write it */
+ x.DisplayError( rc );
+
+ MyFile.CloseDatabase(); /* close database */
+ return 0;
+}
diff --git a/examples/sample3.cpp b/examples/sample3.cpp
new file mode 100755
index 0000000..137ee54
--- /dev/null
+++ b/examples/sample3.cpp
@@ -0,0 +1,137 @@
+/* sample3.cpp
+
+ Xbase64 project source code
+
+ This sample program reads the database created and updated by the sample1
+ and sample2 program
+
+ This program demonstrates the use of the following functions/methods
+ OpenDatabase, GetFieldNo, GetRecord, GetLastRecord, GetFirstRecord,
+ GetNextRecord, GetPrevRecord, NoOfRecords and CloseDatabase, FieldCount
+
+ Copyright (C) 1997,2003 Gary A. Kunkel
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Contact:
+
+ Email:
+
+ xbase64-devel@lists.sourceforge.net
+ xbase64-users@lists.sourceforge.net
+
+
+ Regular Mail:
+
+ XBase Support
+ 149C South Main St
+ Keller Texas, 76248
+ USA
+
+*/
+
+#include <xbase64/xbase64.h>
+
+int main()
+{
+ char buf[40];
+ xbShort rc,i;
+ xbShort lname, fname, birthdate, amount, sw, f1, memo;
+ char *p;
+ xbFloat f;
+
+ xbXBase x;
+ xbDbf MyFile( &x );
+ MyFile.OpenDatabase( "MYFILE.DBF" );
+ MyFile.AutoLockOff();
+
+ lname = MyFile.GetFieldNo( "LASTNAME" );
+ fname = MyFile.GetFieldNo( "FIRSTNAME" );
+ birthdate = MyFile.GetFieldNo( "BIRTHDATE" );
+ amount = MyFile.GetFieldNo( "AMOUNT" );
+ sw = MyFile.GetFieldNo( "SWITCH" );
+ f1 = MyFile.GetFieldNo( "FLOAT1" );
+ memo = MyFile.GetFieldNo( "MEMO1" );
+
+ std::cout << "There are " << MyFile.FieldCount()
+ << " fields in the file" << std::endl;
+ std::cout << "There are " << MyFile.NoOfRecords()
+ << " records in the file." << std::endl;
+ std::cout << "LASTNAME is type: " << MyFile.GetFieldType( lname )
+ << " length: " << MyFile.GetFieldLen( lname )
+ << std::endl;
+ std::cout << "FIRSTNAME is type: " << MyFile.GetFieldType( fname )
+ << " length: " << MyFile.GetFieldLen( fname )
+ << std::endl;
+ std::cout << "BIRTHDATE is type: " << MyFile.GetFieldType( birthdate )
+ << " length: " << MyFile.GetFieldLen( birthdate )
+ << std::endl;
+ std::cout << "AMOUNT is type: " << MyFile.GetFieldType( amount )
+ << " length: " << MyFile.GetFieldLen( amount )
+ << std::endl;
+ std::cout << "SWITCH is type: " << MyFile.GetFieldType( sw )
+ << " length: " << MyFile.GetFieldLen( sw )
+ << std::endl;
+ std::cout << "MEMO1 is type: " << MyFile.GetFieldType( memo )
+ << " length: " << MyFile.GetFieldLen( memo )
+ << std::endl << std::endl;
+
+ std::cout << "Sample GetRecord" << std::endl;
+ MyFile.GetRecord( 1L );
+ MyFile.GetField( lname, buf );
+ std::cout << "Name 1 = " << buf << std::endl;
+ std::cout << "Name 1 = " << MyFile.GetStringField( lname ) << std::endl;
+
+ f = MyFile.GetFloatField( f1 );
+ std::cout << "FLOAT1 = " << f << std::endl;
+ f = MyFile.GetFloatField( "FLOAT2" );
+ std::cout << "FLOAT2 = " << f << std::endl;
+
+ std::cout << "Sample GetRecordBuf" << std::endl;
+ p = MyFile.GetRecordBuf(); /* pointer to record buffer */
+ for( i = 0; i < 49; i++ ) std::cout << *p++; /* display the buffer */
+
+ std::cout << std::endl << "Loop through forwards..." << std::endl;
+ rc = MyFile.GetFirstRecord();
+ while( rc == XB_NO_ERROR ) {
+ MyFile.GetField( lname, buf );
+ std::cout << MyFile.GetCurRecNo();
+ std::cout << " Name = " << buf << std::endl;
+ rc = MyFile.GetNextRecord();
+#ifdef XB_MEMO_FIELDS
+ if( MyFile.MemoFieldExists( memo ))
+ std::cout << "Memo field MEMO1 len = " << MyFile.GetMemoFieldLen(memo)
+ << std::endl;
+#endif
+ }
+
+ std::cout << "Sample PutRecord" << std::endl;
+ MyFile.PutField( lname, "Stantonbob" );
+ MyFile.PutField( lname, "Sally" );
+ MyFile.PutRecord( MyFile.GetCurRecNo() );
+
+ std::cout << "Loop through backwards.." << std::endl;
+ rc = MyFile.GetLastRecord();
+ while( rc == XB_NO_ERROR ){
+ std::cout << "Last Name = " << MyFile.GetStringField( lname ) << std::endl;
+ std::cout << "Logical Field = " << MyFile.GetLogicalField( "SWITCH" )
+ << std::endl;
+ rc = MyFile.GetPrevRecord();
+ }
+
+ std::cout << std::endl;
+ MyFile.CloseDatabase(); /* close database */
+ return 0;
+}
diff --git a/examples/sample4.cpp b/examples/sample4.cpp
new file mode 100755
index 0000000..16acada
--- /dev/null
+++ b/examples/sample4.cpp
@@ -0,0 +1,135 @@
+/* sample4.cpp
+
+ Xbase64 project source code
+
+ This sample program reads the database created and updated by the sample1
+ and sample2 program
+
+ This program demonstrates the use of the following functions/methods
+ DeleteRecord, UndeleteRecord, RecordDeleted
+
+ Copyright (C) 1997,2003 Gary A. Kunkel
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Contact:
+
+ Email:
+
+ xbase64-devel@lists.sourceforge.net
+ xbase64-users@lists.sourceforge.net
+
+
+ Regular Mail:
+
+ XBase Support
+ 149C South Main St
+ Keller Texas, 76248
+ USA
+
+*/
+
+#include <xbase64/xbase64.h>
+
+int main()
+{
+ xbShort rc;
+ xbXBase x;
+ xbDbf MyFile( &x );
+ MyFile.AutoLockOff();
+
+#ifdef XB_INDEX_NDX
+ xbNdx MyIndex1( &MyFile );
+ xbNdx MyIndex2( &MyFile );
+ xbNdx MyIndex3( &MyFile );
+#endif
+#ifdef XB_INDEX_NTX
+ xbNtx MyIndex4( &MyFile );
+ xbNtx MyIndex5( &MyFile );
+#endif
+
+ if(( rc = MyFile.OpenDatabase( "MYFILE.DBF" )) != XB_NO_ERROR ){
+ std::cout << "Error opening file" << std::endl;
+ x.DisplayError( rc );
+ exit(1);
+ }
+
+#ifdef XB_INDEX_NDX
+ if(( rc = MyIndex1.OpenIndex( "MYINDEX1.NDX" )) != XB_NO_ERROR ){
+ std::cout << "\nError opening index1" << std::endl;
+ x.DisplayError( rc );
+ exit(1);
+ }
+
+ if(( rc = MyIndex2.OpenIndex( "MYINDEX2.NDX" )) != XB_NO_ERROR ){
+ std::cout << "\nError opening index2" << std::endl;
+ x.DisplayError( rc );
+ exit(1);
+ }
+
+ if(( rc = MyIndex3.OpenIndex( "MYINDEX3.NDX" )) != XB_NO_ERROR ){
+ std::cout << "\nError opening index3" << std::endl;
+ x.DisplayError( rc );
+ exit(1);
+ }
+
+#endif
+#ifdef XB_INDEX_NTX
+ if(( rc = MyIndex4.OpenIndex( "MYINDEX4.NTX" )) != XB_NO_ERROR ){
+ std::cout << "\nError opening index4" << std::endl;
+ x.DisplayError( rc );
+ exit(1);
+ }
+ if(( rc = MyIndex5.OpenIndex( "MYINDEX5.NTX" )) != XB_NO_ERROR ){
+ std::cout << "\nError opening index5" << std::endl;
+ x.DisplayError( rc );
+ exit(1);
+ }
+#endif
+
+ std::cout << "Sample GetRecord\n";
+
+// MyFile.ExclusiveLock( XB_LOCK ); /* lock the files for our exclusive use */
+
+ MyFile.GetRecord( 2L ); /* get the second record */
+
+ MyFile.DeleteRecord(); /* delete it */
+
+ if( MyFile.RecordDeleted() )
+ std::cout << "Record is deleted..." << std::endl;
+ else
+ std::cout << "Record is not deleted..." << std::endl;
+
+/* to undelete a record the following commented code could be used
+ MyFile.UndeleteRecord();
+ if( MyFile.RecordDeleted() )
+ std::cout << "Record is deleted...\n";
+ else
+ std::cout << "Record is not deleted...\n";
+*/
+
+/* to permanently remove deleted records from the file, pack the database */
+
+ if(( rc = MyFile.PackDatabase( XB_LOCK )) != XB_NO_ERROR ){
+ std::cout << "Error packing database" << std::endl;
+ x.DisplayError( rc );
+ }
+ else
+ std::cout << "Database packed." << std::endl;
+
+// MyFile.ExclusiveUnlock(); /* unlock the files */
+ MyFile.CloseDatabase(); /* close database */
+ return 0;
+}
diff --git a/examples/sample5.cpp b/examples/sample5.cpp
new file mode 100755
index 0000000..a0071bd
--- /dev/null
+++ b/examples/sample5.cpp
@@ -0,0 +1,135 @@
+/* sample5.cpp
+
+ Xbase64 project source code
+
+ This program demonstrates NDX index usage. It is not very useful
+ if NDX index logic has been disabled
+
+ Copyright (C) 1997,2003 Gary A. Kunkel
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Contact:
+
+ Email:
+
+ xbase64-devel@lists.sourceforge.net
+ xbase64-users@lists.sourceforge.net
+
+
+ Regular Mail:
+
+ XBase Support
+ 149C South Main St
+ Keller Texas, 76248
+ USA
+
+*/
+
+#include <xbase64/xbase64.h>
+
+int main()
+{
+ xbShort rc; /* return code */
+ xbXBase x;
+ xbDbf d( &x );
+ d.AutoLockOff();
+
+// dbase indices
+#ifdef XB_INDEX_NDX
+ xbNdx i1( &d );
+ xbNdx i2( &d );
+ xbNdx i3( &d );
+#endif
+
+// clipper indices
+#ifdef XB_INDEX_NTX
+ xbNtx i4( &d );
+ xbNtx i5( &d );
+#endif
+
+ rc = d.OpenDatabase( "MYFILE" );
+ x.DisplayError( rc );
+
+#ifdef XB_INDEX_NDX
+ rc = i1.OpenIndex( "MYINDEX1" );
+ std::cout << "OpenIndex 1 - ";
+ x.DisplayError( rc );
+
+ rc = i2.OpenIndex( "MYINDEX2" );
+ std::cout << "OpenIndex 2 - ";
+ x.DisplayError( rc );
+
+ rc = i3.OpenIndex( "MYINDEX3" );
+ std::cout << "OpenIndex 3 - ";
+ x.DisplayError( rc );
+
+
+#endif
+
+#ifdef XB_INDEX_NTX
+ rc = i4.OpenIndex( "MYINDEX4" );
+ std::cout << "OpenIndex 4 - ";
+ x.DisplayError( rc );
+
+ rc = i5.OpenIndex( "MYINDEX5" );
+ std::cout << "OpenIndex 5 - ";
+ x.DisplayError( rc );
+#endif
+
+#ifdef XB_INDEX_NDX
+ rc = i1.FindKey( "Queue" ); /* alpha search */
+ std::cout << "NDX Find alpha key - ";
+ x.DisplayError( rc );
+
+ rc = i3.FindKey( (xbDouble) 76262 );
+ std::cout << "NDX Find numeric key - ";
+ x.DisplayError( rc );
+#endif
+
+
+#ifdef XB_INDEX_NTX
+ rc = i4.FindKey( "Queue" ); /* alpha search */
+ std::cout << "NTX Find alpha key - ";
+ x.DisplayError( rc );
+
+// looks like ntx doesn't support numeric keys
+ rc = i5.FindKey( (xbDouble) 76262 ); /* numeric search */
+ std::cout << "NTX Find numeric key - ";
+ x.DisplayError( rc );
+#endif
+
+#ifdef XB_INDEX_NDX
+
+ rc = i1.GetFirstKey();
+ std::cout << "Get first key - ";
+ x.DisplayError( rc );
+
+ rc = i1.GetNextKey();
+ std::cout << "Get next key - ";
+ x.DisplayError( rc );
+
+ rc = i1.GetLastKey();
+ std::cout << "Get last key - ";
+ x.DisplayError( rc );
+
+ rc = i1.GetPrevKey();
+ std::cout << "Get prev key - ";
+ x.DisplayError( rc );
+#endif
+
+ d.CloseDatabase();
+ return 0;
+}
diff --git a/examples/xbstring.cpp b/examples/xbstring.cpp
new file mode 100755
index 0000000..fb4f843
--- /dev/null
+++ b/examples/xbstring.cpp
@@ -0,0 +1,84 @@
+/* xbstring.cpp
+
+ Xbase64 project source code
+
+ This program demonstrates the usage of the xbString class
+
+ Copyright (C) 1997,2003 Gary A. Kunkel
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ Contact:
+
+ Email:
+
+ xbase64-devel@lists.sourceforge.net
+ xbase64-users@lists.sourceforge.net
+
+
+ Regular Mail:
+
+ XBase Support
+ 149C South Main St
+ Keller Texas, 76248
+ USA
+
+*/
+
+
+#include <xbase64/xbase64.h>
+
+int main()
+{
+ xbString s1;
+ xbString s2;
+
+ std::cout << "Xbstring sample program" << std::endl;
+ std::cout << "This program demonstrates xbString class usage" << std::endl;
+
+ s1 = "Some string data";
+ s2 = "some more string data";
+
+ std::cout << "s1 => " << s1 << std::endl;
+ std::cout << "s2 => " << s2 << std::endl;
+
+
+ s1 = "s1 ";
+ s2 = "s2";
+ s1 -= s2;
+
+ std::cout << "-= operator => " << s1 << std::endl;
+
+ s1 = "s1 ";
+ s2 = "s2";
+ s1 += s2;
+
+ std::cout << "+= operator => " << s1 << std::endl;
+
+ s1 = "some data";
+ s2 = s1.mid( 2, 3 );
+ std::cout << "mid() = " << s2 << std::endl;
+
+
+ s1.setNum( (xbLong ) 123456789 );
+ std::cout << "setNum(xbLong) = " << s1 << std::endl;
+
+ s1.setNum( "4.4", (xbDouble ) 1234.56789 );
+ std::cout << "setNum(xbDouble) = " << s1 << std::endl;
+
+
+ return 0;
+}
+