summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorLorry <lorry@roadtrain.codethink.co.uk>2012-07-18 20:41:42 +0100
committerLorry <lorry@roadtrain.codethink.co.uk>2012-07-18 20:41:42 +0100
commit5bb10cf303762530d847b2d9879e6b0fdf32603f (patch)
tree028b559e572d030bf98c541306819c4248985576 /examples
downloadlibical-5bb10cf303762530d847b2d9879e6b0fdf32603f.tar.gz
Tarball conversion
Diffstat (limited to 'examples')
-rw-r--r--examples/CMakeLists.txt49
-rw-r--r--examples/Makefile.am20
-rw-r--r--examples/Makefile.in483
-rw-r--r--examples/access-usecases.txt60
-rw-r--r--examples/access_components.c318
-rw-r--r--examples/access_properties_and_parameters.c150
-rw-r--r--examples/access_store.c210
-rw-r--r--examples/changenames.pl4
-rw-r--r--examples/errors.c70
-rw-r--r--examples/main.c12
-rw-r--r--examples/parse_text.c70
-rw-r--r--examples/usecases.c97
12 files changed, 1543 insertions, 0 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644
index 0000000..441d387
--- /dev/null
+++ b/examples/CMakeLists.txt
@@ -0,0 +1,49 @@
+include_directories(
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src
+ ${CMAKE_SOURCE_DIR}/src/libical ${CMAKE_BINARY_DIR}/src/libical
+ ${CMAKE_SOURCE_DIR}/src/libicalss ${CMAKE_BINARY_DIR}/src/libicalss
+)
+
+########### next target ###############
+
+SET(doesnothing_SRCS
+ access_components.c
+ access_properties_and_parameters.c
+ errors.c
+ main.c
+ parse_text.c
+)
+
+add_executable(doesnothing ${doesnothing_SRCS})
+
+target_link_libraries(doesnothing ical icalss icalvcal ical icalss icalvcal)
+
+
+########### install files ###############
+
+
+
+
+#original Makefile.am contents follow:
+
+#
+#noinst_PROGRAMS = doesnothing
+#
+#if WITH_BDB4
+#doesnothing_LDADD = ../src/libical/libical.la ../src/libicalss/libicalss.la ../src/libicalvcal/libicalvcal.la @BDB_DIR_LIB@/@BDB_LIB@
+#else
+#doesnothing_LDADD = ../src/libical/libical.la ../src/libicalss/libicalss.la ../src/libicalvcal/libicalvcal.la
+#endif
+#
+#LIBS = @PTHREAD_LIBS@
+#
+#INCLUDES = -I. -I../src -I../src/libical -I$(srcdir)/../src/libical -I../src/libicalss -I../src/libicalvcal
+#
+#doesnothing_SOURCES = \
+# access_components.c \
+# access_properties_and_parameters.c \
+# errors.c \
+# main.c \
+# parse_text.c
+#
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 0000000..461ad8a
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,20 @@
+
+noinst_PROGRAMS = doesnothing
+
+if WITH_BDB4
+doesnothing_LDADD = ../src/libical/libical.la ../src/libicalss/libicalss.la ../src/libicalvcal/libicalvcal.la @BDB_DIR_LIB@/@BDB_LIB@
+else
+doesnothing_LDADD = ../src/libical/libical.la ../src/libicalss/libicalss.la ../src/libicalvcal/libicalvcal.la
+endif
+
+LIBS = @PTHREAD_LIBS@
+
+INCLUDES = -I. -I../src -I../src/libical -I$(srcdir)/../src/libical -I../src/libicalss -I../src/libicalvcal
+
+doesnothing_SOURCES = \
+ access_components.c \
+ access_properties_and_parameters.c \
+ errors.c \
+ main.c \
+ parse_text.c
+
diff --git a/examples/Makefile.in b/examples/Makefile.in
new file mode 100644
index 0000000..07d664b
--- /dev/null
+++ b/examples/Makefile.in
@@ -0,0 +1,483 @@
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 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@
+
+SOURCES = $(doesnothing_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+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 = doesnothing$(EXEEXT)
+subdir = examples
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+PROGRAMS = $(noinst_PROGRAMS)
+am_doesnothing_OBJECTS = access_components.$(OBJEXT) \
+ access_properties_and_parameters.$(OBJEXT) errors.$(OBJEXT) \
+ main.$(OBJEXT) parse_text.$(OBJEXT)
+doesnothing_OBJECTS = $(am_doesnothing_OBJECTS)
+@WITH_BDB4_FALSE@doesnothing_DEPENDENCIES = ../src/libical/libical.la \
+@WITH_BDB4_FALSE@ ../src/libicalss/libicalss.la \
+@WITH_BDB4_FALSE@ ../src/libicalvcal/libicalvcal.la
+@WITH_BDB4_TRUE@doesnothing_DEPENDENCIES = ../src/libical/libical.la \
+@WITH_BDB4_TRUE@ ../src/libicalss/libicalss.la \
+@WITH_BDB4_TRUE@ ../src/libicalvcal/libicalvcal.la
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(doesnothing_SOURCES)
+DIST_SOURCES = $(doesnothing_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BDB_DIR = @BDB_DIR@
+BDB_DIR_INCLUDE = @BDB_DIR_INCLUDE@
+BDB_DIR_LIB = @BDB_DIR_LIB@
+BDB_LIB = @BDB_LIB@
+BDB_VERSION = @BDB_VERSION@
+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@
+DEV_FALSE = @DEV_FALSE@
+DEV_TRUE = @DEV_TRUE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+HAVE_PTHREAD_FALSE = @HAVE_PTHREAD_FALSE@
+HAVE_PTHREAD_TRUE = @HAVE_PTHREAD_TRUE@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
+JAVAH = @JAVAH@
+JAVA_PLATFORM = @JAVA_PLATFORM@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @PTHREAD_LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+OS_WIN32_FALSE = @OS_WIN32_FALSE@
+OS_WIN32_TRUE = @OS_WIN32_TRUE@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+PY_CFLAGS = @PY_CFLAGS@
+PY_EXTRA_LIBS = @PY_EXTRA_LIBS@
+PY_LIBS = @PY_LIBS@
+PY_LIB_LOC = @PY_LIB_LOC@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WITH_BDB4_FALSE = @WITH_BDB4_FALSE@
+WITH_BDB4_TRUE = @WITH_BDB4_TRUE@
+WITH_CXX_BINDINGS_FALSE = @WITH_CXX_BINDINGS_FALSE@
+WITH_CXX_BINDINGS_TRUE = @WITH_CXX_BINDINGS_TRUE@
+WITH_JAVA_FALSE = @WITH_JAVA_FALSE@
+WITH_JAVA_TRUE = @WITH_JAVA_TRUE@
+WITH_PYTHON_FALSE = @WITH_PYTHON_FALSE@
+WITH_PYTHON_TRUE = @WITH_PYTHON_TRUE@
+YACC = @YACC@
+ZONE_INFO = @ZONE_INFO@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+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@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+python_val = @python_val@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+@WITH_BDB4_FALSE@doesnothing_LDADD = ../src/libical/libical.la ../src/libicalss/libicalss.la ../src/libicalvcal/libicalvcal.la
+@WITH_BDB4_TRUE@doesnothing_LDADD = ../src/libical/libical.la ../src/libicalss/libicalss.la ../src/libicalvcal/libicalvcal.la @BDB_DIR_LIB@/@BDB_LIB@
+INCLUDES = -I. -I../src -I../src/libical -I$(srcdir)/../src/libical -I../src/libicalss -I../src/libicalvcal
+doesnothing_SOURCES = \
+ access_components.c \
+ access_properties_and_parameters.c \
+ errors.c \
+ main.c \
+ parse_text.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu examples/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+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
+doesnothing$(EXEEXT): $(doesnothing_OBJECTS) $(doesnothing_DEPENDENCIES)
+ @rm -f doesnothing$(EXEEXT)
+ $(LINK) $(doesnothing_LDFLAGS) $(doesnothing_OBJECTS) $(doesnothing_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/access_components.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/access_properties_and_parameters.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/errors.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse_text.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+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: TAGS
+
+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; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(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 "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_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 tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ 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"; \
+ $(mkdir_p) "$(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)
+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)
+
+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-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-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
+ -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: uninstall-info-am
+
+.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-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 \
+ pdf pdf-am ps ps-am 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/access-usecases.txt b/examples/access-usecases.txt
new file mode 100644
index 0000000..9bcb754
--- /dev/null
+++ b/examples/access-usecases.txt
@@ -0,0 +1,60 @@
+
+
+Usecases
+---------
+
+1) iMIP based CUA uses a local, file-based store
+
+2) CAP based CUA uses one or more remote CAP servers
+
+3) CAP based CUA uses a local cache that synchronizes with one or more
+CAP servers.
+
+4) CUA imports and exports from a file
+
+Scenarios.
+---------
+
+1 Open a connection to a store.
+
+2 Create a new calendar for which user Bob can read and user Alice can
+read an write.
+
+3 Create several new calendars
+
+4 Delete a calendar
+
+5 Change the calid of a calendar
+
+6 Delete all calendars belonging to user bob
+
+7 Get three new UIDs from the store
+
+8 Store a new VEVENT in the store.
+
+9 Find all components for which the LOCATION is "West Conference Room"
+and change them to "East Conference Room"
+
+10 Find the component with UID X and add a GEO property to it.
+
+11 Delete all VEVENTS which have a METHOD that is not CREATED
+
+12 Retrieve all VEVENTS which have a METHOD that is not CREATED
+
+13 Retrieve the capabilities of the store
+
+14 Retrieve/Modify/Add/Delete properties of a store
+
+15 Retrieve/Modify/Add/Delete VCARs of a store
+
+16 Retrieve/Modify/Add/Delete VTIMEZONEs of a store
+
+17 Retrieve/Modify/Add/Delete properties of a calendar
+
+18 Retrieve/Modify/Add/Delete VCARs of a calendar
+
+19 Retrieve/Modify/Add/Delete VTIMEZONEs of a calendar
+
+20 Translate a CALID into one or more UPNs
+
+21 Expand a group UPN into all of the members of the group \ No newline at end of file
diff --git a/examples/access_components.c b/examples/access_components.c
new file mode 100644
index 0000000..796ce47
--- /dev/null
+++ b/examples/access_components.c
@@ -0,0 +1,318 @@
+/* Access_component.c */
+
+#include <libical/ical.h>
+
+#include <assert.h>
+#include <string.h> /* for strdup */
+#include <stdlib.h> /* for malloc */
+#include <stdio.h> /* for printf */
+#include <time.h> /* for time() */
+
+void do_something(icalcomponent *c);
+
+/* Creating iCal Components
+
+ There are two ways to create new component in libical. You can
+ build the component from primitive parts, or you can create it
+ from a string.
+
+ There are two variations of the API for building the component from
+ primitive parts. In the first variation, you add each parameter and
+ value to a property, and then add each property to a
+ component. This results in a long series of function calls. This
+ style is show in create_new_component()
+
+ The second variation uses vargs lists to nest many primitive part
+ constructors, resulting in a compact, neatly formated way to create
+ components. This style is shown in create_new_component_with_va_args()
+
+
+
+*/
+
+icalcomponent* create_new_component()
+{
+
+ /* variable definitions */
+ icalcomponent* calendar;
+ icalcomponent* event;
+ struct icaltimetype atime = icaltime_from_timet( time(0),0);
+ struct icalperiodtype rtime;
+ icalproperty* property;
+
+ /* Define a time type that will use as data later. */
+ rtime.start = icaltime_from_timet( time(0),0);
+ rtime.end = icaltime_from_timet( time(0),0);
+ rtime.end.hour++;
+
+ /* Create calendar and add properties */
+
+ calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT);
+
+ /* Nearly every libical function call has the same general
+ form. The first part of the name defines the 'class' for the
+ function, and the first argument will be a pointer to a struct
+ of that class. So, icalcomponent_ functions will all take
+ icalcomponent* as their first argument. */
+
+ /* The next call creates a new proeprty and immediately adds it to the
+ 'calendar' component. */
+
+ icalcomponent_add_property(
+ calendar,
+ icalproperty_new_version("2.0")
+ );
+
+
+ /* Here is the short version of the memory rules:
+
+ If the routine name has "new" in it:
+ Caller owns the returned memory.
+ If you pass in a string, the routine takes the memory.
+
+ If the routine name has "add" in it:
+ The routine takes control of the component, property,
+ parameter or value memory.
+
+ If the routine returns a string ( "get" and "as_ical_string" )
+ The library owns the returned memory.
+
+ There are more rules, so refer to the documentation for more
+ details.
+
+ */
+
+ icalcomponent_add_property(
+ calendar,
+ icalproperty_new_prodid("-//RDU Software//NONSGML HandCal//EN")
+ );
+
+ /* Add an event */
+
+ event = icalcomponent_new(ICAL_VEVENT_COMPONENT);
+
+ icalcomponent_add_property(
+ event,
+ icalproperty_new_dtstamp(atime)
+ );
+
+ /* In the previous call, atime is a struct, and it is passed in by value.
+ This is how all compound types of values are handled. */
+
+ icalcomponent_add_property(
+ event,
+ icalproperty_new_uid("guid-1.host1.com")
+ );
+
+ /* add a property that has parameters */
+ property = icalproperty_new_organizer("mailto:mrbig@host.com");
+
+ icalproperty_add_parameter(
+ property,
+ icalparameter_new_role(ICAL_ROLE_CHAIR)
+ );
+
+ icalcomponent_add_property(event,property);
+
+ /* In this style of component creation, you need to use an extra
+ call to add parameters to properties, but the form of this
+ operation is the same as adding a property to a component */
+
+ /* add another property that has parameters */
+ property = icalproperty_new_attendee("mailto:employee-A@host.com");
+
+ icalproperty_add_parameter(
+ property,
+ icalparameter_new_role(ICAL_ROLE_REQPARTICIPANT)
+ );
+
+ icalproperty_add_parameter(
+ property,
+ icalparameter_new_rsvp(1)
+ );
+
+ icalproperty_add_parameter(
+ property,
+ icalparameter_new_cutype(ICAL_CUTYPE_GROUP)
+ );
+
+ icalcomponent_add_property(event,property);
+
+
+ /* more properties */
+
+ icalcomponent_add_property(
+ event,
+ icalproperty_new_description("Project XYZ Review Meeting")
+ );
+
+ icalcomponent_add_property(
+ event,
+ icalproperty_new_categories("MEETING")
+ );
+
+ icalcomponent_add_property(
+ event,
+ icalproperty_new_class(ICAL_CLASS_PUBLIC)
+ );
+
+ icalcomponent_add_property(
+ event,
+ icalproperty_new_created(atime)
+ );
+
+ icalcomponent_add_property(
+ event,
+ icalproperty_new_summary("XYZ Project Review")
+ );
+
+ property = icalproperty_new_dtstart(atime);
+
+ icalproperty_add_parameter(
+ property,
+ icalparameter_new_tzid("US-Eastern")
+ );
+
+ icalcomponent_add_property(event,property);
+
+
+ property = icalproperty_new_dtend(atime);
+
+ icalproperty_add_parameter(
+ property,
+ icalparameter_new_tzid("US-Eastern")
+ );
+
+ icalcomponent_add_property(event,property);
+
+ icalcomponent_add_property(
+ event,
+ icalproperty_new_location("1CP Conference Room 4350")
+ );
+
+ icalcomponent_add_component(calendar,event);
+
+ return calendar;
+}
+
+
+/* Now, create the same component as in the previous routine, but use
+the constructor style. */
+
+icalcomponent* create_new_component_with_va_args()
+{
+
+ /* This is a similar set up to the last routine */
+ icalcomponent* calendar;
+ struct icaltimetype atime = icaltime_from_timet( time(0),0);
+ struct icalperiodtype rtime;
+
+ rtime.start = icaltime_from_timet( time(0),0);
+ rtime.end = icaltime_from_timet( time(0),0);
+ rtime.end.hour++;
+
+ /* Some of these routines are the same as those in the previous
+ routine, but we've also added several 'vanew' routines. These
+ 'vanew' routines take a list of properties, parameters or
+ values and add each of them to the parent property or
+ component. */
+
+ calendar =
+ icalcomponent_vanew(
+ ICAL_VCALENDAR_COMPONENT,
+ icalproperty_new_version("2.0"),
+ icalproperty_new_prodid("-//RDU Software//NONSGML HandCal//EN"),
+ icalcomponent_vanew(
+ ICAL_VEVENT_COMPONENT,
+ icalproperty_new_dtstamp(atime),
+ icalproperty_new_uid("guid-1.host1.com"),
+ icalproperty_vanew_organizer(
+ "mailto:mrbig@host.com",
+ icalparameter_new_role(ICAL_ROLE_CHAIR),
+ 0
+ ),
+ icalproperty_vanew_attendee(
+ "mailto:employee-A@host.com",
+ icalparameter_new_role(ICAL_ROLE_REQPARTICIPANT),
+ icalparameter_new_rsvp(1),
+ icalparameter_new_cutype(ICAL_CUTYPE_GROUP),
+ 0
+ ),
+ icalproperty_new_description("Project XYZ Review Meeting"),
+
+ icalproperty_new_categories("MEETING"),
+ icalproperty_new_class(ICAL_CLASS_PUBLIC),
+ icalproperty_new_created(atime),
+ icalproperty_new_summary("XYZ Project Review"),
+ icalproperty_vanew_dtstart(
+ atime,
+ icalparameter_new_tzid("US-Eastern"),
+ 0
+ ),
+ icalproperty_vanew_dtend(
+ atime,
+ icalparameter_new_tzid("US-Eastern"),
+ 0
+ ),
+ icalproperty_new_location("1CP Conference Room 4350"),
+ 0
+ ),
+ 0
+ );
+
+
+ /* Note that properties with no parameters can use the regular
+ 'new' constructor, while those with parameters use the 'vanew'
+ constructor. And, be sure that the last argument in the 'vanew'
+ call is a zero. Without, your program will probably crash. */
+
+ return calendar;
+}
+
+
+void find_sub_components(icalcomponent* comp)
+{
+ icalcomponent *c;
+
+ /* The second parameter to icalcomponent_get_first_component
+ indicates the type of component to search for. This will
+ iterate through all sub-components */
+ for(c = icalcomponent_get_first_component(comp,ICAL_ANY_COMPONENT);
+ c != 0;
+ c = icalcomponent_get_next_component(comp,ICAL_ANY_COMPONENT)){
+
+ do_something(c);
+ }
+
+ /* This will iterate only though VEVENT sub-components */
+
+ for(c = icalcomponent_get_first_component(comp,ICAL_VEVENT_COMPONENT);
+ c != 0;
+ c = icalcomponent_get_next_component(comp,ICAL_VEVENT_COMPONENT)){
+
+ do_something(c);
+ }
+
+}
+
+/* Ical components only have one internal iterator, so removing the
+ object that the iterator points to can cause problems. Here is the
+ right way to remove components */
+
+void remove_vevent_sub_components(icalcomponent* comp){
+
+ icalcomponent *c, *next;
+
+ for( c = icalcomponent_get_first_component(comp,ICAL_VEVENT_COMPONENT);
+ c != 0;
+ c = next)
+ {
+ next = icalcomponent_get_next_component(comp,ICAL_VEVENT_COMPONENT);
+
+ icalcomponent_remove_component(comp,c);
+
+ do_something(c);
+ }
+
+}
+
diff --git a/examples/access_properties_and_parameters.c b/examples/access_properties_and_parameters.c
new file mode 100644
index 0000000..5b52217
--- /dev/null
+++ b/examples/access_properties_and_parameters.c
@@ -0,0 +1,150 @@
+/* access_properties_and_parameters.c */
+
+#include <libical/ical.h>
+#include <string.h>
+
+/* Get a particular parameter out of a component. This routine will
+ return a list of strings of all attendees who are required. Note
+ that this routine assumes that the component that we pass in is a
+ VEVENT. */
+
+void get_required_attendees(icalcomponent* event)
+{
+ icalproperty* p;
+ icalparameter* parameter;
+
+ assert(event != 0);
+ assert(icalcomponent_isa(event) == ICAL_VEVENT_COMPONENT);
+
+ /* This loop iterates over all of the ATTENDEE properties in the
+ event */
+
+ /* The iteration routines save their state in the event
+ struct, so the are not thread safe unless you lock the whole
+ component. */
+
+ for(
+ p = icalcomponent_get_first_property(event,ICAL_ATTENDEE_PROPERTY);
+ p != 0;
+ p = icalcomponent_get_next_property(event,ICAL_ATTENDEE_PROPERTY)
+ ) {
+
+ /* Get the first ROLE parameter in the property. There should
+ only be one, so we won't bother to iterate over them. But,
+ you can iterate over parameters just like with properties */
+
+ parameter = icalproperty_get_first_parameter(p,ICAL_ROLE_PARAMETER);
+
+ /* If the parameter indicates the participant is required, get
+ the attendees name and stick a copy of it into the output
+ array */
+
+ if ( icalparameter_get_role(parameter) == ICAL_ROLE_REQPARTICIPANT)
+ {
+ /* Remember, the caller does not own this string, so you
+ should strdup it if you want to change it. */
+ const char *attendee = icalproperty_get_attendee(p);
+ printf(attendee);
+ }
+ }
+
+}
+
+/* Here is a similar example. If an attendee has a PARTSTAT of
+ NEEDSACTION or has no PARTSTAT parameter, change it to
+ TENTATIVE. */
+
+void update_attendees(icalcomponent* event)
+{
+ icalproperty* p;
+ icalparameter* parameter;
+
+ assert(event != 0);
+ assert(icalcomponent_isa(event) == ICAL_VEVENT_COMPONENT);
+
+ for(
+ p = icalcomponent_get_first_property(event,ICAL_ATTENDEE_PROPERTY);
+ p != 0;
+ p = icalcomponent_get_next_property(event,ICAL_ATTENDEE_PROPERTY)
+ ) {
+
+ parameter = icalproperty_get_first_parameter(p,ICAL_PARTSTAT_PARAMETER);
+
+ if (parameter == 0) {
+
+ /* There was no PARTSTAT parameter, so add one. */
+ icalproperty_add_parameter(
+ p,
+ icalparameter_new_partstat(ICAL_PARTSTAT_TENTATIVE)
+ );
+
+ } else if (icalparameter_get_partstat(parameter) == ICAL_PARTSTAT_NEEDSACTION) {
+ /* Remove the NEEDSACTION parameter and replace it with
+ TENTATIVE */
+
+ icalproperty_remove_parameter(p,ICAL_PARTSTAT_PARAMETER);
+
+ /* Don't forget to free it */
+ icalparameter_free(parameter);
+
+ /* Add a new one */
+ icalproperty_add_parameter(
+ p,
+ icalparameter_new_partstat(ICAL_PARTSTAT_TENTATIVE)
+ );
+ }
+
+ }
+}
+
+/* Here are some examples of manipulating properties */
+
+void test_properties()
+{
+ icalproperty *prop;
+ icalparameter *param;
+ icalvalue *value;
+ char *str;
+
+ icalproperty *clone;
+
+ /* Create a new property */
+ prop = icalproperty_vanew_comment(
+ "Another Comment",
+ icalparameter_new_cn("A Common Name 1"),
+ icalparameter_new_cn("A Common Name 2"),
+ icalparameter_new_cn("A Common Name 3"),
+ icalparameter_new_cn("A Common Name 4"),
+ 0);
+
+ /* Iterate through all of the parameters in the property */
+ for(param = icalproperty_get_first_parameter(prop,ICAL_ANY_PARAMETER);
+ param != 0;
+ param = icalproperty_get_next_parameter(prop,ICAL_ANY_PARAMETER)) {
+
+ printf("Prop parameter: %s\n",icalparameter_get_cn(param));
+ }
+
+ /* Get a string representation of the property's value */
+ printf("Prop value: %s\n",icalproperty_get_comment(prop));
+
+ /* Spit out the property in its RFC 2445 representation */
+ str = icalproperty_as_ical_string_r(prop);
+ printf("As iCAL string:\n %s\n", str);
+ free(str);
+
+ /* Make a copy of the property. Caller owns the memory */
+ clone = icalproperty_new_clone(prop);
+
+ /* Get a reference to the value within the clone property */
+ value = icalproperty_get_value(clone);
+
+ str = icalvalue_as_ical_string_r(value);
+ printf("Value: %s", str);
+ free(str);
+
+ /* Free the original and the clone */
+ icalproperty_free(clone);
+ icalproperty_free(prop);
+
+}
diff --git a/examples/access_store.c b/examples/access_store.c
new file mode 100644
index 0000000..fc2f5b0
--- /dev/null
+++ b/examples/access_store.c
@@ -0,0 +1,210 @@
+
+
+void acess_cap(void) {
+
+ /* Note, all routines that are prefixed with "caller_" are
+ implemented by the caller of libical */
+
+/* 1 Open a connection to a store. */
+
+ /* The caller is responsible for getting a socket to the server
+ and negotiating the first stages of the CAP exchange. These can
+ be fairly complex and varied for different operating systems,
+ local vs remote usage, and for different authentication
+ schemes, so the API does not try to simplify them. */
+
+ int sock = caller_create_socket_to_server();
+ icalcstp *cstp = icalcstp_new(0,sock,sock);
+
+ caller_authenticate(cstp);
+
+ icalcsdb *csdb = icalcsdb_new(cstp);
+
+/* 2 Create a new calendar for which user Bill can read and user Mary can
+read and write. See CAP draft 7.2.1.1.1. for the text of this example*/
+
+ /* This case requires setting up a TARGET, multiple OWNERs and
+ multiple VCARs, so it creates a component and uses CSTP that
+ than the CSDB interface.
+
+ icalcomponent *create = icalcaputil_new_create();
+
+ icalcomponent_add_property(create,
+ icalproperty_new_target(
+ strdup("cap://cal.example.com/relcal8")
+ ));
+
+ icalcomponent *cal =
+ icalcomponent_vanew_vcalendar(
+ icalproperty_new_relcalid(strdup("relcalid")),
+ icalproperty_new_name(strdup("Bill & Mary's cal")),
+ icalproperty_new_owner(strdup("bill")),
+ icalproperty_new_owner(strdup("mary")),
+ icalproperty_new_calmaster(strdup("mailto:bill@example.com")),
+ icalcomponent_vanew_vcar(
+ icalproperty_new_grant(strdup("UPN=bill;ACTION=*;OBJECT=*")),
+ icalproperty_new_grant(strdup("UPN=bill;ACTION=*;OBJECT=*"))
+ 0)
+ 0);
+
+ error = icalcomponent_add_component(create,cal);
+
+ /* Send the data */
+ error = icalcstp_senddata(cstp,10,create);
+
+
+ /* Get the response */
+ icalcstp_response response = icalcstp_get_first_response(cstp);
+
+ /* Do something with the response*/
+
+ if(icalenum_reqstat_major(response.code) != 2){
+ /* do something with the error */
+ }
+
+ icalcomponent_free(create);
+
+
+/* 3 Create several new calendars */
+
+ /* Same as #2, but insert more TARGET properties and read more responses*/
+
+/* 4 Delete a calendar */
+
+ error = icalcsdb_delete(csdb,"uid12345-example.com");
+
+/* 5 Change the calid of a calendar */
+
+ erorr = icalcsdb_move(csdb,"uid12345-old-example.com",
+ "uid12345-new-example.com");
+
+
+/* 6 Delete all calendars belonging to user bob */
+
+ icalproperty *p;
+ /* First expand bob's UPN into a set of CALIDs */
+ icalcomponent *calids = icalcsdb_expand_upn("bob@example.com");
+
+ /* Then, create a message to delete all of them */
+ icalcomponent *delete = icalcaputil_new_create();
+
+
+ for(p = icalcomponent_get_first_property(calids,ICAL_CALID_PROPERTY);
+ p != 0;
+ p = icalcomponent_get_next_property(calids,ICAL_CALID_PROPERTY)){
+
+ char* = icalproperty_get_calid(p);
+
+ icalcomponent_add_target(delete,p);
+
+ }
+
+ /* Send the message */
+
+ error = icalcstp_senddata(cstp,10,delete);
+
+ /* Finally, read the responses */
+
+ for(response = icalcstp_get_first_response(cstp);
+ response.code != ICAL_UNKNOWN_STATUS;
+ response = icalcstp_get_next_response(cstp)){
+
+ if(icalenum_reqstat_major(response.code) != 2){
+ /* do something with the error */
+ }
+ }
+
+
+/* 7 Get three new UIDs from the store */
+
+ /* libical owns the returned memory. Copy before using */
+ char* uid1 = icalcsdb_generateuid(csdb);
+ char* uid2 = icalcsdb_generateuid(csdb);
+ char* uid3 = icalcsdb_generateuid(csdb);
+
+/* 8 Store a new VEVENT in the store. */
+
+ /* Very similar to case #2 */
+
+/* 9 Find all components for which the LOCATION is "West Conference
+Room" and change them to "East Conference Room" */
+
+ icalcomponent *modify = icalcaputil_new_modify();
+
+ icalcaputil_modify_add_old_prop(modify,
+ icalproperty_new_location(
+ strdup("West Conference Room")));
+
+ icalcaputil_modify_add_new_prop(modify,
+ icalproperty_new_location(
+ strdup("East Conference Room")));
+
+ icalcaputil_add_target(modify,"relcal2");
+
+ /* Send the component */
+ error = icalcstp_senddata(cstp,10,delete);
+
+ /* Get the response */
+ icalcstp_response response = icalcstp_get_first_response(cstp);
+
+ /* Do something with the response*/
+
+ if(icalenum_reqstat_major(response.code) != 2){
+ /* do something with the error */
+ }
+
+ icalcomponent_free(modify);
+
+/* 10 Find the component with UID X and add a GEO property to it. */
+
+
+ icalcomponent *modify = icalcaputil_new_modify();
+
+ icalcaputil_modify_add_query(modify,
+ "SELECT UID FROM VEVENT WHERE UID = 'X'");
+
+ icalcaputil_modify_add_new_prop(modify,
+ icalproperty_new_geo(
+ strdup("-117;32")));
+
+ icalcaputil_add_target(modify,"relcal2");
+
+ /* Send the component */
+ error = icalcstp_senddata(cstp,10,delete);
+
+ /* Get the response */
+ icalcstp_response response = icalcstp_get_first_response(cstp);
+
+ /* Do something with the response*/
+
+ if(icalenum_reqstat_major(response.code) != 2){
+ /* do something with the error */
+ }
+
+ icalcomponent_free(modify);
+
+
+/* 11 Delete all VEVENTS which have a METHOD that is not CREATED */
+
+
+/* 12 Retrieve all VEVENTS which have a METHOD that is not CREATED */
+
+ /* Nearly the same at #11 */
+
+/* 13 Retrieve the capabilities of the store */
+
+/* 14 Retrieve/Modify/Add/Delete properties of a store */
+
+/* 15 Retrieve/Modify/Add/Delete VCARs of a store */
+
+/* 16 Retrieve/Modify/Add/Delete VTIMEZONEs of a store */
+
+/* 17 Retrieve/Modify/Add/Delete properties of a calendar */
+
+/* 18 Retrieve/Modify/Add/Delete VCARs of a calendar */
+
+/* 19 Retrieve/Modify/Add/Delete VTIMEZONEs of a calendar */
+
+/* 20 Translate a CALID into one or more UPNs */
+
+/* 21 Expand a group UPN into all of the members of the group */
diff --git a/examples/changenames.pl b/examples/changenames.pl
new file mode 100644
index 0000000..4adf84b
--- /dev/null
+++ b/examples/changenames.pl
@@ -0,0 +1,4 @@
+s/icalcluster/icalfileset/g;
+s/ICALCLUSTER/ICALFILESET/g;
+s/icalstore/icaldirset/g;
+s/ICALSTORE/ICALDIRSET/g;
diff --git a/examples/errors.c b/examples/errors.c
new file mode 100644
index 0000000..2ff316d
--- /dev/null
+++ b/examples/errors.c
@@ -0,0 +1,70 @@
+/* errors.c */
+
+#include <libical/ical.h>
+#include <stdio.h>
+
+void program_errors()
+{
+ /*Most routines will set icalerrno on errors. This is an
+ enumeration defined in icalerror.h */
+
+ icalcomponent *c;
+
+ icalerror_clear_errno();
+
+ c = icalcomponent_new(ICAL_VEVENT_COMPONENT);
+
+ if (icalerrno != ICAL_NO_ERROR){
+
+ fprintf(stderr,"Horrible libical error: %s\n",
+ icalerror_strerror(icalerrno));
+
+ }
+
+}
+
+void component_errors(icalcomponent *comp)
+{
+ int errors;
+ icalproperty *p;
+
+ /* presume that we just got this component from the parser */
+
+ errors = icalcomponent_count_errors(comp);
+
+ printf("This component has %d parsing errors\n", errors);
+
+ /* Print out all of the parsing errors. This is not strictly
+ correct, because it does not descend into any sub-components,
+ as icalcomponent_count_errors() does. */
+
+ for(p = icalcomponent_get_first_property(comp,ICAL_XLICERROR_PROPERTY);
+ p != 0;
+ p = icalcomponent_get_next_property(comp,ICAL_XLICERROR_PROPERTY))
+ {
+
+ printf("-- The error is %s:\n",icalproperty_get_xlicerror(p));
+ }
+
+
+
+ /* Check the component for iTIP compilance, and add more
+ X-LIC-ERROR properties if it is non-compilant. */
+ icalrestriction_check(comp);
+
+
+ /* Count the new errors. */
+ if(errors != icalcomponent_count_errors(comp)){
+ printf(" -- The component also has iTIP restriction errors \n");
+ }
+
+ /* Since there are iTIP restriction errors, it may be impossible
+ to process this component as an iTIP request. In this case, the
+ X-LIC-ERROR proeprties should be expressed as REQUEST-STATUS
+ properties in the reply. This following routine makes this
+ conversion */
+
+
+ icalcomponent_convert_errors(comp);
+
+}
diff --git a/examples/main.c b/examples/main.c
new file mode 100644
index 0000000..3d8d777
--- /dev/null
+++ b/examples/main.c
@@ -0,0 +1,12 @@
+/* This is just to make the code in the example directory link properly. */
+#include <libical/ical.h>
+
+int main()
+{
+
+ return 1;
+}
+
+
+void do_something(icalcomponent* comp){
+}
diff --git a/examples/parse_text.c b/examples/parse_text.c
new file mode 100644
index 0000000..2fc9051
--- /dev/null
+++ b/examples/parse_text.c
@@ -0,0 +1,70 @@
+/* parse_text.c
+
+ */
+#include <stdio.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <libical/ical.h>
+
+#include <stdlib.h>
+
+/* The icalparser_get_line routine will create a single *content* line
+out of one or more input lines. The content line is all of the
+properties and values for a single property, and it can span several
+input lines. So, icalparser_get_line will need to be able to get more
+data on its own. Read_string is a routine that does this. You can
+write your own version of read stream to get data from other types of
+files, sockets, etc. */
+
+char* read_stream(char *s, size_t size, void *d)
+{
+ char *c = fgets(s,size, (FILE*)d);
+
+ return c;
+
+}
+
+void parse_text(int argc, char* argv[])
+{
+
+ char* line;
+ FILE* stream;
+ icalcomponent *c;
+
+ /* Create a new parser object */
+ icalparser *parser = icalparser_new();
+
+ stream = fopen(argv[1],"r");
+
+ assert(stream != 0);
+
+ /* Tell the parser what input routie it should use. */
+ icalparser_set_gen_data(parser,stream);
+
+ do{
+
+ /* Get a single content line by making one or more calls to
+ read_stream()*/
+ line = icalparser_get_line(parser,read_stream);
+
+ /* Now, add that line into the parser object. If that line
+ completes a component, c will be non-zero */
+ c = icalparser_add_line(parser,line);
+
+
+ if (c != 0){
+ char *temp = icalcomponent_as_ical_string_r(c);
+ printf("%s", temp);
+ free(temp);
+
+ printf("\n---------------\n");
+
+ icalcomponent_free(c);
+ }
+
+ } while ( line != 0);
+
+
+ icalparser_free(parser);
+}
diff --git a/examples/usecases.c b/examples/usecases.c
new file mode 100644
index 0000000..713d1a4
--- /dev/null
+++ b/examples/usecases.c
@@ -0,0 +1,97 @@
+/* -*- Mode: C -*-
+ ======================================================================
+ FILE: usecases.c
+ CREATOR: eric 03 April 1999
+
+ DESCRIPTION:
+
+ $Id: usecases.c,v 1.3 2008-01-02 20:07:29 dothebart Exp $
+ $Locker: $
+
+ (C) COPYRIGHT 1999 Eric Busboom
+ http://www.softwarestudio.org
+
+ The contents of this file are subject to the Mozilla Public License
+ Version 1.0 (the "License"); you may not use this file except in
+ compliance with the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and
+ limitations under the License.
+
+ The original author is Eric Busboom
+ The original code is usecases.c
+
+
+ ======================================================================*/
+
+#include <libical/ical.h>
+#include <assert.h>
+#include <string.h> /* for strdup */
+#include <stdlib.h> /* for malloc */
+#include <stdio.h> /* for printf */
+#include <time.h> /* for time() */
+
+char str[] = "BEGIN:VCALENDAR\
+PRODID:\"-//RDU Software//NONSGML HandCal//EN\"\
+VERSION:2.0\
+BEGIN:VEVENT\
+DTSTAMP:19980309T231000Z\
+UID:guid-1.host1.com\
+ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com\
+ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:MAILTO:employee-A@host.com\
+DESCRIPTION:Project XYZ Review Meeting\
+CATEGORIES:MEETING\
+CREATED:19980309T130000Z\
+SUMMARY:XYZ Project Review\
+DTSTART;TZID=US-Eastern:19980312T083000\
+DTEND;TZID=US-Eastern:19980312T093000\
+END:VEVENT\
+END:VCALENDAR";
+
+
+
+
+/* Here are some ways to work with values. */
+void test_values()
+{
+ icalvalue *v;
+ icalvalue *copy;
+ char *str;
+
+ v = icalvalue_new_caladdress("cap://value/1");
+ printf("caladdress 1: %s\n",icalvalue_get_caladdress(v));
+
+ icalvalue_set_caladdress(v,"cap://value/2");
+ printf("caladdress 2: %s\n",icalvalue_get_caladdress(v));
+ str = icalvalue_as_ical_string_r(v));
+ printf("String: %s\n", str);
+ free(str);
+
+ copy = icalvalue_new_clone(v);
+ str = icalvalue_as_ical_string_r(v);
+ printf("Clone: %s\n", str);
+ free(str);
+ icalvalue_free(v);
+ icalvalue_free(copy);
+
+
+}
+
+void test_parameters()
+{
+ icalparameter *p;
+ char *str;
+
+ p = icalparameter_new_cn("A Common Name");
+
+ printf("Common Name: %s\n",icalparameter_get_cn(p));
+
+ str = icalparameter_as_ical_string_r(p));
+ printf("As String: %s\n", str);
+ free(str);
+}
+
+