aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-04-18 02:28:42 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-04-18 02:28:42 +0800
commite87c3d5baaae937e0131095ae70ea8375c9b039c (patch)
treed0d7f3782e6fd2baf9c9a5ddda2e0620838ac2bd
parentc41e8bf959f68dc4c65fe542dd807e60456710bc (diff)
downloadgsoc2013-evolution-e87c3d5baaae937e0131095ae70ea8375c9b039c.tar.gz
gsoc2013-evolution-e87c3d5baaae937e0131095ae70ea8375c9b039c.tar.zst
gsoc2013-evolution-e87c3d5baaae937e0131095ae70ea8375c9b039c.zip
The perl script generated files changed between releases
2001-04-17 JP Rosevear <jpr@ximian.com> * The perl script generated files changed between releases svn path=/trunk/; revision=9426
-rw-r--r--libical/configure.in1
-rw-r--r--libical/src/libical/.cvsignore12
-rw-r--r--libical/src/libical/icalparameter.c382
-rw-r--r--libical/src/libical/icalparameter.c.in1246
-rw-r--r--libical/src/libical/icalparameter.h (renamed from libical/src/libical/icalparameter.h.in)24
-rw-r--r--libical/src/libical/icalproperty.c (renamed from libical/src/libical/icalproperty.c.in)246
-rw-r--r--libical/src/libical/icalproperty.h116
-rw-r--r--libical/src/libical/icalproperty.h.in57
-rw-r--r--libical/src/libical/icaltime.c11
-rw-r--r--libical/src/libical/icalvalue.c (renamed from libical/src/libical/icalvalue.c.in)584
-rw-r--r--libical/src/libical/icalvalue.h (renamed from libical/src/libical/icalvalue.h.in)23
11 files changed, 949 insertions, 1753 deletions
diff --git a/libical/configure.in b/libical/configure.in
index 112ac66ded..3b69f4d5ee 100644
--- a/libical/configure.in
+++ b/libical/configure.in
@@ -94,6 +94,7 @@ scripts/Makefile
src/Makefile
src/libical/Makefile
src/libical/icalversion.h
+src/libicalss/Makefile
src/libicalvcal/Makefile
src/python/Makefile
src/test/Makefile
diff --git a/libical/src/libical/.cvsignore b/libical/src/libical/.cvsignore
index fd83172a6b..ef04480fde 100644
--- a/libical/src/libical/.cvsignore
+++ b/libical/src/libical/.cvsignore
@@ -12,11 +12,11 @@ y.output
.libs
.deps
icalversion.h
-icalproperty.h
-icalvalue.h
-icalvalue.c
ical.h
-icalparameter.h
-icalparameter.c
-icalproperty.c
+icalderivedparameter.c
+icalderivedparameter.h
+icalderivedproperty.c
+icalderivedproperty.h
+icalderivedvalue.h
+icalderivedvalue.c
icalrestriction.c
diff --git a/libical/src/libical/icalparameter.c b/libical/src/libical/icalparameter.c
new file mode 100644
index 0000000000..156ecdb04b
--- /dev/null
+++ b/libical/src/libical/icalparameter.c
@@ -0,0 +1,382 @@
+/* -*- Mode: C -*-
+ ======================================================================
+ FILE: icalderivedparameters.{c,h}
+ CREATOR: eric 09 May 1999
+
+ $Id$
+ $Locker$
+
+
+ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+ The original code is icalderivedparameters.{c,h}
+
+ Contributions from:
+ Graham Davison (g.m.davison@computer.org)
+
+ ======================================================================*/
+/*#line 29 "icalparameter.c.in"*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include "icalparameter.h"
+#include "icalproperty.h"
+#include "icalerror.h"
+#include "icalmemory.h"
+#include "icalparameterimpl.h"
+
+#include <stdlib.h> /* for malloc() */
+#include <errno.h>
+#include <string.h> /* for memset() */
+
+/* In icalderivedparameter */
+icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind,const char* val);
+
+
+struct icalparameter_impl* icalparameter_new_impl(icalparameter_kind kind)
+{
+ struct icalparameter_impl* v;
+
+ if ( ( v = (struct icalparameter_impl*)
+ malloc(sizeof(struct icalparameter_impl))) == 0) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return 0;
+ }
+
+ strcpy(v->id,"para");
+
+ v->kind = kind;
+ v->size = 0;
+ v->string = 0;
+ v->x_name = 0;
+ v->parent = 0;
+ v->data = 0;
+
+ return v;
+}
+
+icalparameter*
+icalparameter_new (icalparameter_kind kind)
+{
+ struct icalparameter_impl* v = icalparameter_new_impl(kind);
+
+ return (icalparameter*) v;
+
+}
+
+void
+icalparameter_free (icalparameter* parameter)
+{
+ struct icalparameter_impl * impl;
+
+ impl = (struct icalparameter_impl*)parameter;
+
+/* HACK. This always triggers, even when parameter is non-zero
+ icalerror_check_arg_rv((parameter==0),"parameter");*/
+
+
+#ifdef ICAL_FREE_ON_LIST_IS_ERROR
+ icalerror_assert( (impl->parent ==0),"Tried to free a parameter that is still attached to a component. ");
+
+#else
+ if(impl->parent !=0){
+ return;
+ }
+#endif
+
+
+ if (impl->string != 0){
+ free ((void*)impl->string);
+ }
+
+ if (impl->x_name != 0){
+ free ((void*)impl->x_name);
+ }
+
+ memset(impl,0,sizeof(impl));
+
+ impl->parent = 0;
+ impl->id[0] = 'X';
+ free(impl);
+}
+
+
+
+icalparameter*
+icalparameter_new_clone(icalparameter* param)
+{
+ struct icalparameter_impl *old;
+ struct icalparameter_impl *new;
+
+ old = (struct icalparameter_impl *)param;
+ new = icalparameter_new_impl(old->kind);
+
+ icalerror_check_arg_rz((param!=0),"param");
+
+ if (new == 0){
+ return 0;
+ }
+
+ memcpy(new,old,sizeof(struct icalparameter_impl));
+
+ if (old->string != 0){
+ new->string = icalmemory_strdup(old->string);
+ if (new->string == 0){
+ icalparameter_free(new);
+ return 0;
+ }
+ }
+
+ if (old->x_name != 0){
+ new->x_name = icalmemory_strdup(old->x_name);
+ if (new->x_name == 0){
+ icalparameter_free(new);
+ return 0;
+ }
+ }
+
+ return new;
+}
+
+icalparameter* icalparameter_new_from_string(const char *str)
+{
+ char* eq;
+ char* cpy;
+ icalparameter_kind kind;
+ icalparameter *param;
+
+ icalerror_check_arg_rz(str != 0,"str");
+
+ cpy = icalmemory_strdup(str);
+
+ if (cpy == 0){
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return 0;
+ }
+
+ eq = strchr(cpy,'=');
+
+ if(eq == 0){
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return 0;
+ }
+
+ *eq = '\0';
+
+ eq++;
+
+ kind = icalparameter_string_to_kind(cpy);
+
+ if(kind == ICAL_NO_PARAMETER){
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return 0;
+ }
+
+ param = icalparameter_new_from_value_string(kind,eq);
+
+ if(kind == ICAL_X_PARAMETER){
+ icalparameter_set_xname(param,cpy);
+ }
+
+ free(cpy);
+
+ return param;
+
+}
+
+char*
+icalparameter_as_ical_string (icalparameter* parameter)
+{
+ struct icalparameter_impl* impl;
+ size_t buf_size = 1024;
+ char* buf;
+ char* buf_ptr;
+ char *out_buf;
+ const char *kind_string;
+
+ icalerror_check_arg_rz( (parameter!=0), "parameter");
+
+ /* Create new buffer that we can append names, parameters and a
+ value to, and reallocate as needed. Later, this buffer will be
+ copied to a icalmemory_tmp_buffer, which is managed internally
+ by libical, so it can be given to the caller without fear of
+ the caller forgetting to free it */
+
+ buf = icalmemory_new_buffer(buf_size);
+ buf_ptr = buf;
+ impl = (struct icalparameter_impl*)parameter;
+
+ if(impl->kind == ICAL_X_PARAMETER) {
+
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size,
+ icalparameter_get_xname(impl));
+
+ } else {
+
+ kind_string = icalparameter_kind_to_string(impl->kind);
+
+ if (impl->kind == ICAL_NO_PARAMETER ||
+ impl->kind == ICAL_ANY_PARAMETER ||
+ kind_string == 0)
+ {
+ icalerror_set_errno(ICAL_BADARG_ERROR);
+ return 0;
+ }
+
+
+ /* Put the parameter name into the string */
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
+
+ }
+
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, "=");
+
+ if(impl->string !=0){
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, impl->string);
+ } else if (impl->data != 0){
+ const char* str = icalparameter_enum_to_string(impl->data);
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);
+ } else {
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return 0;
+ }
+
+ /* Now, copy the buffer to a tmp_buffer, which is safe to give to
+ the caller without worring about de-allocating it. */
+
+ out_buf = icalmemory_tmp_buffer(strlen(buf));
+ strcpy(out_buf, buf);
+
+ icalmemory_free_buffer(buf);
+
+ return out_buf;
+
+}
+
+
+int
+icalparameter_is_valid (icalparameter* parameter);
+
+
+icalparameter_kind
+icalparameter_isa (icalparameter* parameter)
+{
+ if(parameter == 0){
+ return ICAL_NO_PARAMETER;
+ }
+
+ return ((struct icalparameter_impl *)parameter)->kind;
+}
+
+
+int
+icalparameter_isa_parameter (void* parameter)
+{
+ struct icalparameter_impl *impl = (struct icalparameter_impl *)parameter;
+
+ if (parameter == 0){
+ return 0;
+ }
+
+ if (strcmp(impl->id,"para") == 0) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+
+void
+icalparameter_set_xname (icalparameter* param, const char* v)
+{
+ struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
+ icalerror_check_arg_rv( (param!=0),"param");
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ if (impl->x_name != 0){
+ free((void*)impl->x_name);
+ }
+
+ impl->x_name = icalmemory_strdup(v);
+
+ if (impl->x_name == 0){
+ errno = ENOMEM;
+ }
+
+}
+
+const char*
+icalparameter_get_xname (icalparameter* param)
+{
+ struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
+ icalerror_check_arg_rz( (param!=0),"param");
+
+ return impl->x_name;
+}
+
+void
+icalparameter_set_xvalue (icalparameter* param, const char* v)
+{
+ struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
+
+ icalerror_check_arg_rv( (param!=0),"param");
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ if (impl->string != 0){
+ free((void*)impl->string);
+ }
+
+ impl->string = icalmemory_strdup(v);
+
+ if (impl->string == 0){
+ errno = ENOMEM;
+ }
+
+}
+
+const char*
+icalparameter_get_xvalue (icalparameter* param)
+{
+ struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
+
+ icalerror_check_arg_rz( (param!=0),"param");
+
+ return impl->string;
+
+}
+
+void icalparameter_set_parent(icalparameter* param,
+ icalproperty* property)
+{
+ struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
+
+ icalerror_check_arg_rv( (param!=0),"param");
+
+ impl->parent = property;
+}
+
+icalproperty* icalparameter_get_parent(icalparameter* param)
+{
+ struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
+
+ icalerror_check_arg_rz( (param!=0),"param");
+
+ return impl->parent;
+}
+
+
+/* Everything below this line is machine generated. Do not edit. */
+/* ALTREP */
diff --git a/libical/src/libical/icalparameter.c.in b/libical/src/libical/icalparameter.c.in
deleted file mode 100644
index 6ffb9b27eb..0000000000
--- a/libical/src/libical/icalparameter.c.in
+++ /dev/null
@@ -1,1246 +0,0 @@
-/* -*- Mode: C -*-
- ======================================================================
- FILE: icalderivedparameters.{c,h}
- CREATOR: eric 09 May 1999
-
- $Id: icalparameter.c.in,v 1.4 2001/02/09 07:09:46 jpr Exp $
- $Locker: $
-
-
- (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: http://www.fsf.org/copyleft/lesser.html
-
- Or:
-
- The Mozilla Public License Version 1.0. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
-
- The original code is icalderivedparameters.{c,h}
-
- Contributions from:
- Graham Davison (g.m.davison@computer.org)
-
- ======================================================================*/
-/*#line 29 "icalparameter.c.in"*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include "icalparameter.h"
-#include "icalproperty.h"
-#include "icalerror.h"
-#include "icalmemory.h"
-
-#include <stdlib.h> /* for malloc() */
-#include <errno.h>
-#include <string.h> /* for memset() */
-
-union icalparameter_impl_data {
- int v_int;
- int v_rsvp;
- icalparameter_cutype v_cutype;
- icalparameter_encoding v_encoding;
- icalparameter_fbtype v_fbtype;
- icalparameter_partstat v_partstat;
- icalparameter_range v_range;
- icalparameter_related v_related;
- icalparameter_reltype v_reltype;
- icalparameter_role v_role;
- icalparameter_value v_value;
- icalparameter_xlicerrortype v_xlicerrortype;
- icalparameter_xliccomparetype v_xliccomparetype;
-} data;
-
-struct icalparameter_impl
-{
- icalparameter_kind kind;
- char id[5];
- int size;
- const char* string;
- const char* x_name;
- icalproperty* parent;
-
- union icalparameter_impl_data data;
-};
-
-struct icalparameter_impl* icalparameter_new_impl(icalparameter_kind kind)
-{
- struct icalparameter_impl* v;
-
- if ( ( v = (struct icalparameter_impl*)
- malloc(sizeof(struct icalparameter_impl))) == 0) {
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- return 0;
- }
-
- strcpy(v->id,"para");
-
- v->kind = kind;
- v->size = 0;
- v->string = 0;
- v->x_name = 0;
- v->parent = 0;
- memset(&(v->data),0,sizeof(v->data));
-
- return v;
-}
-
-icalparameter*
-icalparameter_new (icalparameter_kind kind)
-{
- struct icalparameter_impl* v = icalparameter_new_impl(kind);
-
- return (icalparameter*) v;
-
-}
-
-icalparameter*
-icalparameter_new_clone(icalparameter* param)
-{
- struct icalparameter_impl *old;
- struct icalparameter_impl *new;
-
- old = (struct icalparameter_impl *)param;
- new = icalparameter_new_impl(old->kind);
-
- icalerror_check_arg_rz((param!=0),"param");
-
- if (new == 0){
- return 0;
- }
-
- memcpy(new,old,sizeof(struct icalparameter_impl));
-
- if (old->string != 0){
- new->string = icalmemory_strdup(old->string);
- if (new->string == 0){
- icalparameter_free(new);
- return 0;
- }
- }
-
- if (old->x_name != 0){
- new->x_name = icalmemory_strdup(old->x_name);
- if (new->x_name == 0){
- icalparameter_free(new);
- return 0;
- }
- }
-
- return new;
-}
-
-#if 1
-/* The following code is meant to replace most of the case-switch
- statements, but it is still a work in progress */
-struct param_string_map {
- icalparameter_kind kind;
- int val; /* Actually, union of several types of enums */
- const char* str;
-} param_string_map[] =
-{
- {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_INDIVIDUAL,"INDIVIDUAL"},
- {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_GROUP,"GROUP"},
- {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_RESOURCE,"RESOURCE"},
- {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_ROOM,"ROOM"},
- {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_UNKNOWN,"UNKNOWN"},
- {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_FREE,"FREE"},
- {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSY,"BUSY"},
- {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSYUNAVAILABLE,"BUSYUNAVAILABLE"},
- {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSYTENTATIVE,"BUSYTENTATIVE"},
- {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_NEEDSACTION,"NEEDS-ACTION"},
- {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_ACCEPTED,"ACCEPTED"},
- {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_DECLINED,"DECLINED"},
- {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_TENTATIVE,"TENTATIVE"},
- {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_DELEGATED,"DELEGATED"},
- {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_COMPLETED,"COMPLETED"},
- {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_INPROCESS,"INPROCESS"},
- {ICAL_RANGE_PARAMETER,ICAL_RANGE_THISANDPRIOR,"THISANDPRIOR"},
- {ICAL_RANGE_PARAMETER,ICAL_RANGE_THISANDFUTURE,"THISANDFUTURE"},
- {ICAL_RELATED_PARAMETER,ICAL_RELATED_START,"START"},
- {ICAL_RELATED_PARAMETER,ICAL_RELATED_END,"END"},
- {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_PARENT,"PARENT"},
- {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_CHILD,"CHILD"},
- {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_SIBLING,"SIBLING"},
- {ICAL_ROLE_PARAMETER,ICAL_ROLE_CHAIR,"CHAIR"},
- {ICAL_ROLE_PARAMETER,ICAL_ROLE_REQPARTICIPANT,"REQ-PARTICIPANT"},
- {ICAL_ROLE_PARAMETER,ICAL_ROLE_OPTPARTICIPANT,"OPT-PARTICIPANT"},
- {ICAL_ROLE_PARAMETER,ICAL_ROLE_NONPARTICIPANT,"NON-PARTICIPANT"},
- {ICAL_RSVP_PARAMETER,ICAL_RSVP_PARAMETER,"TRUE"},
- {ICAL_RSVP_PARAMETER,ICAL_RSVP_PARAMETER,"FALSE"},
- {ICAL_VALUE_PARAMETER,ICAL_VALUE_BINARY,"BINARY"},
- {ICAL_VALUE_PARAMETER,ICAL_VALUE_BOOLEAN,"BOOLEAN"},
- {ICAL_VALUE_PARAMETER,ICAL_VALUE_DATE,"DATE"},
- {ICAL_VALUE_PARAMETER,ICAL_VALUE_DURATION,"DURATION"},
- {ICAL_VALUE_PARAMETER,ICAL_VALUE_FLOAT,"FLOAT"},
- {ICAL_VALUE_PARAMETER,ICAL_VALUE_INTEGER,"INTEGER"},
- {ICAL_VALUE_PARAMETER,ICAL_VALUE_PERIOD,"PERIOD"},
- {ICAL_VALUE_PARAMETER,ICAL_VALUE_RECUR,"RECUR"},
- {ICAL_VALUE_PARAMETER,ICAL_VALUE_TEXT,"TEXT"},
- {ICAL_VALUE_PARAMETER,ICAL_VALUE_TIME,"TIME"},
- {ICAL_VALUE_PARAMETER,ICAL_VALUE_URI,"URI"},
- {ICAL_VALUE_PARAMETER,ICAL_VALUE_XNAME,"ERROR"},
- {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_COMPONENTPARSEERROR,"COMPONENT_PARSE_ERROR"},
- {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PROPERTYPARSEERROR,"PROPERTY_PARSE_ERROR"},
- {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR,"PARAMETER_NAME_PARSE_ERROR"},
- {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR,"PARAMETER_VALUE_PARSE_ERROR"},
- {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_VALUEPARSEERROR,"VALUE_PARSE_ERROR"},
- {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_INVALIDITIP,"INVALID_ITIP"},
- {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_UNKVCALPROP,"UNKNOWN_VCAL_PROP_ERROR"},
- {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_MIMEPARSEERROR,"MIME_PARSE_ERROR"},
- {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_EQUAL,"EQUAL"},
- {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_NOTEQUAL,"NOTEQUAL"},
- {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_LESS,"LESS"},
- {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_GREATER,"GREATER"},
- {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_LESSEQUAL,"LESSEQUAL"},
- {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_GREATEREQUAL,"GREATEREQUAL"},
- {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_REGEX,"REGEX"},
- {ICAL_NO_PARAMETER,0,""},
-
-};
-
-void icalparameter_set_impl_data(icalparameter_kind kind,
- union icalparameter_impl_data *data,
- int value)
-{
-
- switch (kind){
- case ICAL_CUTYPE_PARAMETER:
- data->v_cutype=value; break;
- case ICAL_FBTYPE_PARAMETER:
- data->v_fbtype=value; break;
- case ICAL_PARTSTAT_PARAMETER:
- data->v_partstat=value; break;
- case ICAL_RANGE_PARAMETER:
- data->v_range=value; break;
- case ICAL_RELATED_PARAMETER:
- data->v_related=value; break;
- case ICAL_RELTYPE_PARAMETER:
- data->v_reltype=value; break;
- case ICAL_ROLE_PARAMETER:
- data->v_role=value; break;
- case ICAL_RSVP_PARAMETER:
- data->v_rsvp=value; break;
- case ICAL_VALUE_PARAMETER:
- data->v_value=value; break;
- case ICAL_XLICERRORTYPE_PARAMETER:
- data->v_xlicerrortype=value; break;
- case ICAL_XLICCOMPARETYPE_PARAMETER:
- data->v_xliccomparetype=value; break;
- default:
- break;
- }
-}
-
-icalparameter* icalparameter_new_from_string_test(icalparameter_kind kind, char* val)
-{
- int i =0;
- icalparameter* param=0;
-
- icalerror_check_arg_rz((val!=0),"val");
-
- switch(kind){
-
- /* These are all string values parameters */
- case ICAL_SENTBY_PARAMETER:
- case ICAL_TZID_PARAMETER:
- case ICAL_X_PARAMETER:
- case ICAL_FMTTYPE_PARAMETER:
- case ICAL_LANGUAGE_PARAMETER:
- case ICAL_MEMBER_PARAMETER:
- case ICAL_DELEGATEDFROM_PARAMETER:
- case ICAL_DELEGATEDTO_PARAMETER:
- case ICAL_DIR_PARAMETER:
- case ICAL_ALTREP_PARAMETER:
- case ICAL_CN_PARAMETER:
- {
- struct icalparameter_impl *impl = icalparameter_new_impl(kind);
- if (impl == 0) {
- return 0;
- }
- ((struct icalparameter_impl*)param)->string =
- icalmemory_strdup(val);
-
- return (icalparameter*) impl;
-
- }
-
- case ICAL_NO_PARAMETER:
- case ICAL_ANY_PARAMETER:
- {
- }
-
- default: {
- int found = 0;
- /* All other types are enumerated */
- for(i = 0; param_string_map[i].kind != ICAL_NO_PARAMETER; i++){
-
- if(kind == param_string_map[i].kind &&
- strcmp(val,param_string_map[i].str) == 0){
-
- struct icalparameter_impl *impl =
- icalparameter_new_impl(kind);
- found = 1;
-
- icalparameter_set_impl_data(kind,&impl->data,
- param_string_map[i].val);
-
- return (icalparameter*)impl;
- }
- }
-
- /* Didn't find the standard enumerated type, so it must be
- an X parameter */
- if (found ==0) {
- icalparameter *param = icalparameter_new(kind);
-
- icalparameter_set_xvalue(param,val);
-
- return param;
-
- }
- }
- }
-
- return 0;
-}
-
-#endif
-
-
-icalparameter* icalparameter_new_from_string(icalparameter_kind kind, char* val)
-{
-
- icalparameter* param=0;
-
- icalerror_check_arg_rz((val!=0),"val");
-
- switch (kind) {
- case ICAL_ALTREP_PARAMETER:
- {
- param = icalparameter_new_altrep(val);
-
- break;
- }
- case ICAL_CN_PARAMETER:
- {
- param = icalparameter_new_cn(val);
-
- break;
- }
- case ICAL_CUTYPE_PARAMETER:
- {
- if(strcmp(val,"INDIVIDUAL") == 0){
- param = icalparameter_new_cutype(ICAL_CUTYPE_INDIVIDUAL);
- }
- else if(strcmp(val,"GROUP") == 0){
- param = icalparameter_new_cutype(ICAL_CUTYPE_GROUP);
- }
- else if(strcmp(val,"RESOURCE") == 0){
- param = icalparameter_new_cutype(ICAL_CUTYPE_RESOURCE);
- }
- else if(strcmp(val,"ROOM") == 0){
- param = icalparameter_new_cutype(ICAL_CUTYPE_ROOM);
- }
- else if(strcmp(val,"UNKNOWN") == 0){
- param = icalparameter_new_cutype(ICAL_CUTYPE_UNKNOWN);
- }
- else {
- param = icalparameter_new_cutype(ICAL_CUTYPE_XNAME);
- icalparameter_set_xvalue(param,val);
- }
- break;
- }
-
- case ICAL_DELEGATEDFROM_PARAMETER:
- {
- param = icalparameter_new_delegatedfrom(val);
-
- break;
- }
- case ICAL_DELEGATEDTO_PARAMETER:
- {
- param = icalparameter_new_delegatedto(val);
-
- break;
- }
- case ICAL_DIR_PARAMETER:
- {
- param = icalparameter_new_dir(val);
-
- break;
- }
- case ICAL_ENCODING_PARAMETER:
- {
- if(strcmp(val,"BIT8") == 0){
- param = icalparameter_new_encoding(ICAL_ENCODING_8BIT);
- }
- else if(strcmp(val,"BASE64") == 0){
- param = icalparameter_new_encoding(ICAL_ENCODING_BASE64);
- }
- else {
- param = icalparameter_new_encoding(ICAL_ENCODING_XNAME);
- icalparameter_set_xvalue(param,val);
- }
- break;
- }
- case ICAL_FBTYPE_PARAMETER:
- {
- if(strcmp(val,"FREE") == 0){
- param = icalparameter_new_fbtype(ICAL_FBTYPE_FREE);
- }
- else if(strcmp(val,"BUSY") == 0){
- param = icalparameter_new_fbtype(ICAL_FBTYPE_BUSY);
- }
- else if(strcmp(val,"BUSYUNAVAILABLE") == 0){
- param = icalparameter_new_fbtype(ICAL_FBTYPE_BUSYUNAVAILABLE);
- }
- else if(strcmp(val,"BUSYTENTATIVE") == 0){
- param = icalparameter_new_fbtype(ICAL_FBTYPE_BUSYTENTATIVE);
- }
- else {
- param = icalparameter_new_fbtype(ICAL_FBTYPE_XNAME);
- icalparameter_set_xvalue(param,val);
- }
- break;
- }
- case ICAL_FMTTYPE_PARAMETER:
- {
- param = icalparameter_new_fmttype(val);
- break;
- }
- case ICAL_LANGUAGE_PARAMETER:
- {
- param = icalparameter_new_language(val);
-
- break;
- }
- case ICAL_MEMBER_PARAMETER:
- {
- param = icalparameter_new_member(val);
-
- break;
- }
- case ICAL_PARTSTAT_PARAMETER:
- {
- if(strcmp(val,"NEEDS-ACTION") == 0){
- param = icalparameter_new_partstat(ICAL_PARTSTAT_NEEDSACTION);
- }
- else if(strcmp(val,"ACCEPTED") == 0){
- param = icalparameter_new_partstat(ICAL_PARTSTAT_ACCEPTED);
- }
- else if(strcmp(val,"DECLINED") == 0){
- param = icalparameter_new_partstat(ICAL_PARTSTAT_DECLINED);
- }
- else if(strcmp(val,"TENTATIVE") == 0){
- param = icalparameter_new_partstat(ICAL_PARTSTAT_TENTATIVE);
- }
- else if(strcmp(val,"DELEGATED") == 0){
- param = icalparameter_new_partstat(ICAL_PARTSTAT_DELEGATED);
- }
- else if(strcmp(val,"COMPLETED") == 0){
- param = icalparameter_new_partstat(ICAL_PARTSTAT_COMPLETED);
- }
- else if(strcmp(val,"INPROCESS") == 0){
- param = icalparameter_new_partstat(ICAL_PARTSTAT_INPROCESS);
- }
- else {
- param = icalparameter_new_partstat(ICAL_PARTSTAT_XNAME);
- icalparameter_set_xvalue(param,val);
- }
- break;
- }
- case ICAL_RANGE_PARAMETER:
- {
- if(strcmp(val,"THISANDFUTURE") == 0){
- param = icalparameter_new_range(ICAL_RANGE_THISANDFUTURE);
- }
- else if(strcmp(val,"THISANDPRIOR") == 0){
- param = icalparameter_new_range(ICAL_RANGE_THISANDPRIOR);
- }
-
- break;
- }
- case ICAL_RELATED_PARAMETER:
- {
- if(strcmp(val,"START") == 0){
- param = icalparameter_new_related(ICAL_RELATED_START);
- }
- else if(strcmp(val,"END") == 0){
- param = icalparameter_new_related(ICAL_RELATED_END);
- }
-
- break;
- }
- case ICAL_RELTYPE_PARAMETER:
- {
- if(strcmp(val,"PARENT") == 0){
- param = icalparameter_new_reltype(ICAL_RELTYPE_PARENT);
- }
- else if(strcmp(val,"CHILD") == 0){
- param = icalparameter_new_reltype(ICAL_RELTYPE_CHILD);
- }
- else if(strcmp(val,"SIBLING") == 0){
- param = icalparameter_new_reltype(ICAL_RELTYPE_SIBLING);
- }
- else {
- param = icalparameter_new_reltype(ICAL_RELTYPE_XNAME);
- icalparameter_set_xvalue(param,val);
- }
- break;
- }
- case ICAL_ROLE_PARAMETER:
- {
- if(strcmp(val,"CHAIR") == 0){
- param = icalparameter_new_role(ICAL_ROLE_CHAIR);
- }
- else if(strcmp(val,"REQ-PARTICIPANT") == 0){
- param = icalparameter_new_role(ICAL_ROLE_REQPARTICIPANT);
- }
- else if(strcmp(val,"OPT-PARTICIPANT") == 0){
- param = icalparameter_new_role(ICAL_ROLE_OPTPARTICIPANT);
- }
- else if(strcmp(val,"NON-PARTICIPANT") == 0){
- param = icalparameter_new_role(ICAL_ROLE_NONPARTICIPANT);
- }
- else {
- param = icalparameter_new_role(ICAL_ROLE_XNAME);
- icalparameter_set_xvalue(param,val);
- }
- break;
- }
- case ICAL_RSVP_PARAMETER:
- {
- if(strcmp(val,"TRUE") == 0){
- param = icalparameter_new_rsvp(1);
- }
- else if(strcmp(val,"FALSE") == 0){
- param = icalparameter_new_rsvp(0);
- }
-
- break;
- }
- case ICAL_SENTBY_PARAMETER:
- {
- param = icalparameter_new_sentby(val);
-
- break;
- }
- case ICAL_TZID_PARAMETER:
- {
- param = icalparameter_new_tzid(val);
-
- break;
- }
- case ICAL_VALUE_PARAMETER:
- {
- if(strcmp(val,"BINARY") == 0){
- param = icalparameter_new_value(ICAL_VALUE_BINARY);
- }
- else if(strcmp(val,"BOOLEAN") == 0){
- param = icalparameter_new_value(ICAL_VALUE_BOOLEAN);
- }
- else if(strcmp(val,"CAL-ADDRESS") == 0){
- param = icalparameter_new_value(ICAL_VALUE_CALADDRESS);
- }
- else if(strcmp(val,"DATE") == 0){
- param = icalparameter_new_value(ICAL_VALUE_DATE);
- }
- else if(strcmp(val,"DATE-TIME") == 0){
- param = icalparameter_new_value(ICAL_VALUE_DATETIME);
- }
- else if(strcmp(val,"DURATION") == 0){
- param = icalparameter_new_value(ICAL_VALUE_DURATION);
- }
- else if(strcmp(val,"FLOAT") == 0){
- param = icalparameter_new_value(ICAL_VALUE_FLOAT);
- }
- else if(strcmp(val,"INTEGER") == 0){
- param = icalparameter_new_value(ICAL_VALUE_INTEGER);
- }
- else if(strcmp(val,"PERIOD") == 0){
- param = icalparameter_new_value(ICAL_VALUE_PERIOD);
- }
- else if(strcmp(val,"RECUR") == 0){
- param = icalparameter_new_value(ICAL_VALUE_RECUR);
- }
- else if(strcmp(val,"TEXT") == 0){
- param = icalparameter_new_value(ICAL_VALUE_TEXT);
- }
- else if(strcmp(val,"TIME") == 0){
- param = icalparameter_new_value(ICAL_VALUE_TIME);
- }
- else if(strcmp(val,"URI") == 0){
- param = icalparameter_new_value(ICAL_VALUE_URI);
- }
- else if(strcmp(val,"UTC-OFFSET") == 0){
- param = icalparameter_new_value(ICAL_VALUE_UTCOFFSET);
- }
- else {
- param = 0;
- }
- break;
- }
- case ICAL_XLICERRORTYPE_PARAMETER:
- {
-
- if(strcmp(val,"COMPONENT_PARSE_ERROR") == 0){
- param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_COMPONENTPARSEERROR);
- }
- else if(strcmp(val,"PROPERTY_PARSE_ERROR") == 0){
- param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_PROPERTYPARSEERROR);
- }
- else if(strcmp(val,"PARAMETER_NAME_PARSE_ERROR") == 0){
- param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR);
- }
- else if(strcmp(val,"PARAMETER_VALUE_PARSE_ERROR") == 0){
- param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR);
- }
- else if(strcmp(val,"VALUE_PARSE_ERROR") == 0){
- param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_VALUEPARSEERROR);
- }
- else if(strcmp(val,"INVALID_ITIP") == 0){
- param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP);
- }
- else if(strcmp(val,"MIME_PARSE_ERROR") == 0){
- param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_MIMEPARSEERROR);
- }
- else if(strcmp(val,"UNKNOWN_VCAL_PROP_ERROR") == 0){
- param = icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_UNKVCALPROP);
- }
- break;
- }
-
- case ICAL_XLICCOMPARETYPE_PARAMETER:
- {
-
- if(strcmp(val,"EQUAL") == 0){
- param = icalparameter_new_xliccomparetype(ICAL_XLICCOMPARETYPE_EQUAL);
- }
- else if(strcmp(val,"NOTEQUAL") == 0){
- param = icalparameter_new_xliccomparetype(ICAL_XLICCOMPARETYPE_NOTEQUAL);
- }
- else if(strcmp(val,"LESS") == 0){
- param = icalparameter_new_xliccomparetype(ICAL_XLICCOMPARETYPE_LESS);
- }
- else if(strcmp(val,"GREATER") == 0){
- param = icalparameter_new_xliccomparetype(ICAL_XLICCOMPARETYPE_GREATER);
- }
- else if(strcmp(val,"LESSEQUAL") == 0){
- param = icalparameter_new_xliccomparetype(ICAL_XLICCOMPARETYPE_LESSEQUAL);
- }
- else if(strcmp(val,"GREATEREQUAL") == 0){
- param = icalparameter_new_xliccomparetype(ICAL_XLICCOMPARETYPE_GREATEREQUAL);
- }
- else if(strcmp(val,"REGEX") == 0){
- param = icalparameter_new_xliccomparetype(ICAL_XLICCOMPARETYPE_REGEX);
- } else {
- param = 0;
- }
- break;
- }
-
-
- case ICAL_X_PARAMETER:
- {
- param = icalparameter_new(ICAL_FBTYPE_PARAMETER);
- icalparameter_set_xvalue(param,val);
- break;
- }
-
- case ICAL_NO_PARAMETER:
- default:
- {
- return 0;
- }
-
-
- }
-
- return param;
-}
-
-void
-icalparameter_free (icalparameter* parameter)
-{
- struct icalparameter_impl * impl;
-
- impl = (struct icalparameter_impl*)parameter;
-
-/* HACK. This always triggers, even when parameter is non-zero
- icalerror_check_arg_rv((parameter==0),"parameter");*/
-
-
-#ifdef ICAL_FREE_ON_LIST_IS_ERROR
- icalerror_assert( (impl->parent ==0),"Tried to free a parameter that is still attached to a component. ");
-
-#else
- if(impl->parent !=0){
- return;
- }
-#endif
-
-
- if (impl->string != 0){
- free ((void*)impl->string);
- }
-
- if (impl->x_name != 0){
- free ((void*)impl->x_name);
- }
-
- memset(impl,0,sizeof(impl));
-
- impl->parent = 0;
- impl->id[0] = 'X';
- free(impl);
-}
-
-
-char no_parameter[]="Error: No Parameter";
-char*
-icalparameter_as_ical_string (icalparameter* parameter)
-{
- struct icalparameter_impl* impl;
- size_t buf_size = 1024;
- char* buf;
- char* buf_ptr;
- char *out_buf;
- const char *kind_string;
-
- char tend[1024]; /* HACK . Should be using memory buffer ring */
-
- icalerror_check_arg_rz( (parameter!=0), "parameter");
-
- /* Create new buffer that we can append names, parameters and a
- value to, and reallocate as needed. Later, this buffer will be
- copied to a icalmemory_tmp_buffer, which is managed internally
- by libical, so it can be given to the caller without fear of
- the caller forgetting to free it */
-
- buf = icalmemory_new_buffer(buf_size);
- buf_ptr = buf;
- impl = (struct icalparameter_impl*)parameter;
-
- if(impl->kind == ICAL_X_PARAMETER) {
-
- icalmemory_append_string(&buf, &buf_ptr, &buf_size,
- icalparameter_get_xname(impl));
-
- } else {
-
- kind_string = icalenum_parameter_kind_to_string(impl->kind);
-
- if (impl->kind == ICAL_NO_PARAMETER ||
- impl->kind == ICAL_ANY_PARAMETER ||
- kind_string == 0)
- {
- icalerror_set_errno(ICAL_BADARG_ERROR);
- return 0;
- }
-
-
- /* Put the parameter name into the string */
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
-
- }
-
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, "=");
-
- switch (impl->kind) {
- case ICAL_CUTYPE_PARAMETER:
- {
- switch (impl->data.v_cutype) {
- case ICAL_CUTYPE_INDIVIDUAL: {
- strcpy(tend,"INDIVIDUAL");break;
- }
- case ICAL_CUTYPE_GROUP:{
- strcpy(tend,"GROUP");break;
- }
- case ICAL_CUTYPE_RESOURCE: {
- strcpy(tend,"RESOURCE");break;
- }
- case ICAL_CUTYPE_ROOM:{
- strcpy(tend,"ROOM");break;
- }
- case ICAL_CUTYPE_UNKNOWN:{
- strcpy(tend,"UNKNOWN");break;
- }
- case ICAL_CUTYPE_XNAME:{
- if (impl->string == 0){ return no_parameter;}
- strcpy(tend,impl->string);break;
- }
- default:{
- icalerror_set_errno(ICAL_BADARG_ERROR);break;
- }
- }
- break;
-
- }
- case ICAL_ENCODING_PARAMETER:
- {
- switch (impl->data.v_encoding) {
- case ICAL_ENCODING_8BIT: {
- strcpy(tend,"8BIT");break;
- }
- case ICAL_ENCODING_BASE64:{
- strcpy(tend,"BASE64");break;
- }
- default:{
- icalerror_set_errno(ICAL_BADARG_ERROR);break;
- }
- }
- break;
- }
-
- case ICAL_FBTYPE_PARAMETER:
- {
- switch (impl->data.v_fbtype) {
- case ICAL_FBTYPE_FREE:{
- strcpy(tend,"FREE");break;
- }
- case ICAL_FBTYPE_BUSY: {
- strcpy(tend,"BUSY");break;
- }
- case ICAL_FBTYPE_BUSYUNAVAILABLE:{
- strcpy(tend,"BUSYUNAVAILABLE");break;
- }
- case ICAL_FBTYPE_BUSYTENTATIVE:{
- strcpy(tend,"BUSYTENTATIVE");break;
- }
- case ICAL_FBTYPE_XNAME:{
- if (impl->string == 0){ return no_parameter;}
- strcpy(tend,impl->string);break;
- }
- default:{
- icalerror_set_errno(ICAL_BADARG_ERROR);break;
- }
- }
- break;
-
- }
- case ICAL_PARTSTAT_PARAMETER:
- {
- switch (impl->data.v_partstat) {
- case ICAL_PARTSTAT_NEEDSACTION: {
- strcpy(tend,"NEEDS-ACTION");break;
- }
- case ICAL_PARTSTAT_ACCEPTED: {
- strcpy(tend,"ACCEPTED");break;
- }
- case ICAL_PARTSTAT_DECLINED:{
- strcpy(tend,"DECLINED");break;
- }
- case ICAL_PARTSTAT_TENTATIVE:{
- strcpy(tend,"TENTATIVE");break;
- }
- case ICAL_PARTSTAT_DELEGATED:{
- strcpy(tend,"DELEGATED");break;
- }
- case ICAL_PARTSTAT_COMPLETED:{
- strcpy(tend,"COMPLETED");break;
- }
- case ICAL_PARTSTAT_INPROCESS:{
- strcpy(tend,"INPROCESS");break;
- }
- case ICAL_PARTSTAT_XNAME:{
- if (impl->string == 0){ return no_parameter;}
- strcpy(tend,impl->string);break;
- }
- default:{
- icalerror_set_errno(ICAL_BADARG_ERROR);break;
- }
- }
- break;
-
- }
- case ICAL_RANGE_PARAMETER:
- {
- switch (impl->data.v_range) {
- case ICAL_RANGE_THISANDPRIOR: {
- strcpy(tend,"THISANDPRIOR");break;
- }
- case ICAL_RANGE_THISANDFUTURE: {
- strcpy(tend,"THISANDFUTURE");break;
- }
- default:{
- icalerror_set_errno(ICAL_BADARG_ERROR);break;
- }
- }
- break;
- }
- case ICAL_RELATED_PARAMETER:
- {
- switch (impl->data.v_related) {
- case ICAL_RELATED_START: {
- strcpy(tend,"START");break;
- }
- case ICAL_RELATED_END: {
- strcpy(tend,"END");break;
- }
- default:{
- icalerror_set_errno(ICAL_BADARG_ERROR);break;
- }
- }
- break;
- }
- case ICAL_RELTYPE_PARAMETER:
- {
- switch (impl->data.v_reltype) {
- case ICAL_RELTYPE_PARENT: {
- strcpy(tend,"PARENT");break;
- }
- case ICAL_RELTYPE_CHILD:{
- strcpy(tend,"CHILD");break;
- }
- case ICAL_RELTYPE_SIBLING:{
- strcpy(tend,"SIBLING");break;
- }
- case ICAL_RELTYPE_XNAME:{
- if (impl->string == 0){ return no_parameter;}
- strcpy(tend,impl->string);break;
- }
- default:{
- icalerror_set_errno(ICAL_BADARG_ERROR);break;
- }
- }
- break;
- }
- case ICAL_ROLE_PARAMETER:
- {
- switch (impl->data.v_role) {
- case ICAL_ROLE_CHAIR: {
- strcpy(tend,"CHAIR");break;
- }
- case ICAL_ROLE_REQPARTICIPANT: {
- strcpy(tend,"REQ-PARTICIPANT");break;
- }
- case ICAL_ROLE_OPTPARTICIPANT: {
- strcpy(tend,"OPT-PARTICIPANT");break;
- }
- case ICAL_ROLE_NONPARTICIPANT: {
- strcpy(tend,"NON-PARTICIPANT");break;
- }
- case ICAL_ROLE_XNAME:{
- if (impl->string == 0){ return no_parameter;}
- strcpy(tend,impl->string);break;
- }
- default:{
- icalerror_set_errno(ICAL_BADARG_ERROR);break;
- }
- }
- break;
- }
- case ICAL_RSVP_PARAMETER:
- {
- switch (impl->data.v_rsvp) {
- case 1: {
- strcpy(tend,"TRUE");break;
- }
- case 0: {
- strcpy(tend,"FALSE");break;
- }
- default:{
- icalerror_set_errno(ICAL_BADARG_ERROR);break;
- }
- }
- break;
- }
- case ICAL_VALUE_PARAMETER:
- {
- switch (impl->data.v_value) {
- case ICAL_VALUE_BINARY: {
- strcpy(tend,"BINARY");break;
- }
- case ICAL_VALUE_BOOLEAN: {
- strcpy(tend,"BOOLEAN");break;
- }
- case ICAL_VALUE_CALADDRESS: {
- strcpy(tend,"CAL-ADDRESS");break;
- }
- case ICAL_VALUE_DATE: {
- strcpy(tend,"DATE");break;
- }
- case ICAL_VALUE_DATETIME: {
- strcpy(tend,"DATE-TIME");break;
- }
- case ICAL_VALUE_DURATION: {
- strcpy(tend,"DURATION");break;
- }
- case ICAL_VALUE_FLOAT: {
- strcpy(tend,"FLOAT");break;
- }
- case ICAL_VALUE_INTEGER: {
- strcpy(tend,"INTEGER");break;
- }
- case ICAL_VALUE_PERIOD: {
- strcpy(tend,"PERIOD");break;
- }
- case ICAL_VALUE_RECUR: {
- strcpy(tend,"RECUR");break;
- }
- case ICAL_VALUE_TEXT: {
- strcpy(tend,"TEXT");break;
- }
- case ICAL_VALUE_TIME: {
- strcpy(tend,"TIME");break;
- }
- case ICAL_VALUE_URI: {
- strcpy(tend,"URI");break;
- }
- case ICAL_VALUE_UTCOFFSET: {
- strcpy(tend,"UTC-OFFSET");break;
- }
- case ICAL_VALUE_XNAME: {
- if (impl->string == 0){ return no_parameter;}
- strcpy(tend,impl->string);break;
- }
- default:{
- strcpy(tend,"ERROR");
- icalerror_set_errno(ICAL_BADARG_ERROR);break;
- }
- }
- break;
- }
-
-
- case ICAL_XLICERRORTYPE_PARAMETER:
- {
- switch (impl->data.v_xlicerrortype) {
- case ICAL_XLICERRORTYPE_COMPONENTPARSEERROR:
- {
- strcpy(tend,"COMPONENT_PARSE_ERROR");break;
- }
- case ICAL_XLICERRORTYPE_PROPERTYPARSEERROR:
- {
- strcpy(tend,"PROPERTY_PARSE_ERROR");break;
- }
- case ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR:
- {
- strcpy(tend,"PARAMETER_NAME_PARSE_ERROR");break;
- }
- case ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR:
- {
- strcpy(tend,"PARAMETER_VALUE_PARSE_ERROR");break;
- }
- case ICAL_XLICERRORTYPE_VALUEPARSEERROR:
- {
- strcpy(tend,"VALUE_PARSE_ERROR");break;
- }
- case ICAL_XLICERRORTYPE_INVALIDITIP:
- {
- strcpy(tend,"INVALID_ITIP");break;
- }
- case ICAL_XLICERRORTYPE_UNKVCALPROP:
- {
- strcpy(tend,"UNKNOWN_VCAL_PROP_ERROR");break;
- }
- case ICAL_XLICERRORTYPE_MIMEPARSEERROR:
- {
- strcpy(tend,"MIME_PARSE_ERROR");break;
- }
- }
- break;
- }
-
- case ICAL_XLICCOMPARETYPE_PARAMETER:
- {
- switch (impl->data.v_xliccomparetype) {
- case ICAL_XLICCOMPARETYPE_EQUAL:
- {
- strcpy(tend,"EQUAL");break;
- }
- case ICAL_XLICCOMPARETYPE_NOTEQUAL:
- {
- strcpy(tend,"NOTEQUAL");break;
- }
- case ICAL_XLICCOMPARETYPE_LESS:
- {
- strcpy(tend,"LESS");break;
- }
- case ICAL_XLICCOMPARETYPE_GREATER:
- {
- strcpy(tend,"GREATER");break;
- }
- case ICAL_XLICCOMPARETYPE_LESSEQUAL:
- {
- strcpy(tend,"LESSEQUAL");break;
- }
- case ICAL_XLICCOMPARETYPE_GREATEREQUAL:
- {
- strcpy(tend,"GREATEREQUAL");break;
- }
- case ICAL_XLICCOMPARETYPE_REGEX:
- {
- strcpy(tend,"REGEX");break;
- }
- default:{
- icalerror_set_errno(ICAL_BADARG_ERROR);break;
- }
- break;
- }
-
- break;
- }
-
-
- case ICAL_SENTBY_PARAMETER:
- case ICAL_TZID_PARAMETER:
- case ICAL_X_PARAMETER:
- case ICAL_FMTTYPE_PARAMETER:
- case ICAL_LANGUAGE_PARAMETER:
- case ICAL_MEMBER_PARAMETER:
- case ICAL_DELEGATEDFROM_PARAMETER:
- case ICAL_DELEGATEDTO_PARAMETER:
- case ICAL_DIR_PARAMETER:
- case ICAL_ALTREP_PARAMETER:
- case ICAL_CN_PARAMETER:
- {
- if (impl->string == 0){ return no_parameter;}
- strcpy(tend,impl->string);break;
- break;
- }
-
- case ICAL_NO_PARAMETER:
- case ICAL_ANY_PARAMETER:
- {
- /* These are actually handled before the case/switch
- clause */
- }
-
- }
-
- icalmemory_append_string(&buf, &buf_ptr, &buf_size, tend);
-
- /* Now, copy the buffer to a tmp_buffer, which is safe to give to
- the caller without worring about de-allocating it. */
-
-
- out_buf = icalmemory_tmp_buffer(strlen(buf));
- strcpy(out_buf, buf);
-
- icalmemory_free_buffer(buf);
-
- return out_buf;
-
-}
-
-
-int
-icalparameter_is_valid (icalparameter* parameter);
-
-
-icalparameter_kind
-icalparameter_isa (icalparameter* parameter)
-{
- if(parameter == 0){
- return ICAL_NO_PARAMETER;
- }
-
- return ((struct icalparameter_impl *)parameter)->kind;
-}
-
-
-int
-icalparameter_isa_parameter (void* parameter)
-{
- struct icalparameter_impl *impl = (struct icalparameter_impl *)parameter;
-
- if (parameter == 0){
- return 0;
- }
-
- if (strcmp(impl->id,"para") == 0) {
- return 1;
- } else {
- return 0;
- }
-}
-
-
-void
-icalparameter_set_xname (icalparameter* param, const char* v)
-{
- struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
- icalerror_check_arg_rv( (param!=0),"param");
- icalerror_check_arg_rv( (v!=0),"v");
-
- if (impl->x_name != 0){
- free((void*)impl->x_name);
- }
-
- impl->x_name = icalmemory_strdup(v);
-
- if (impl->x_name == 0){
- errno = ENOMEM;
- }
-
-}
-
-const char*
-icalparameter_get_xname (icalparameter* param)
-{
- struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
- icalerror_check_arg_rz( (param!=0),"param");
-
- return impl->x_name;
-}
-
-void
-icalparameter_set_xvalue (icalparameter* param, const char* v)
-{
- struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
-
- icalerror_check_arg_rv( (param!=0),"param");
- icalerror_check_arg_rv( (v!=0),"v");
-
- if (impl->string != 0){
- free((void*)impl->string);
- }
-
- impl->string = icalmemory_strdup(v);
-
- if (impl->string == 0){
- errno = ENOMEM;
- }
-
-}
-
-const char*
-icalparameter_get_xvalue (icalparameter* param)
-{
- struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
-
- icalerror_check_arg_rz( (param!=0),"param");
-
- return impl->string;
-
-}
-
-void icalparameter_set_parent(icalparameter* param,
- icalproperty* property)
-{
- struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
-
- icalerror_check_arg_rv( (param!=0),"param");
-
- impl->parent = property;
-}
-
-icalproperty* icalparameter_get_parent(icalparameter* param)
-{
- struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
-
- icalerror_check_arg_rz( (param!=0),"param");
-
- return impl->parent;
-}
-
-
-/* Everything below this line is machine generated. Do not edit. */
diff --git a/libical/src/libical/icalparameter.h.in b/libical/src/libical/icalparameter.h
index c215fa0fdc..3f3b59f049 100644
--- a/libical/src/libical/icalparameter.h.in
+++ b/libical/src/libical/icalparameter.h
@@ -4,8 +4,8 @@
CREATOR: eric 20 March 1999
- $Id: icalparameter.h.in,v 1.1.1.2 2001/01/23 19:20:40 jpr Exp $
- $Locker: $
+ $Id$
+ $Locker$
@@ -29,13 +29,19 @@
#ifndef ICALPARAM_H
#define ICALPARAM_H
-#include "icalenums.h"
+#include "icalderivedparameter.h"
-typedef void icalparameter;
+/* Declared in icalderivedparameter.h */
+/*typedef void icalparameter;*/
icalparameter* icalparameter_new(icalparameter_kind kind);
icalparameter* icalparameter_new_clone(icalparameter* p);
-icalparameter* icalparameter_new_from_string(icalparameter_kind kind, char* value);
+
+/* Create from string of form "PARAMNAME=VALUE" */
+icalparameter* icalparameter_new_from_string(const char* value);
+
+/* Create from just the value, the part after the "=" */
+icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind, const char* value);
void icalparameter_free(icalparameter* parameter);
@@ -53,5 +59,11 @@ const char* icalparameter_get_xname(icalparameter* param);
void icalparameter_set_xvalue (icalparameter* param, const char* v);
const char* icalparameter_get_xvalue(icalparameter* param);
+/* Convert enumerations */
+
+const char* icalparameter_kind_to_string(icalparameter_kind kind);
+icalparameter_kind icalparameter_string_to_kind(const char* string);
+
+
-/* Everything below this line is machine generated. Do not edit. */
+#endif
diff --git a/libical/src/libical/icalproperty.c.in b/libical/src/libical/icalproperty.c
index 936db3f728..c5638827e5 100644
--- a/libical/src/libical/icalproperty.c.in
+++ b/libical/src/libical/icalproperty.c
@@ -4,7 +4,7 @@
FILE: icalproperty.c
CREATOR: eric 28 April 1999
- $Id: icalproperty.c.in,v 1.4 2001/02/05 19:43:57 jpr Exp $
+ $Id$
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
@@ -30,11 +30,13 @@
#endif
#include "icalproperty.h"
+#include "icalparameter.h"
#include "icalcomponent.h"
#include "pvl.h"
#include "icalenums.h"
#include "icalerror.h"
#include "icalmemory.h"
+#include "icalparser.h"
#include <string.h> /* For icalmemory_strdup, rindex */
#include <assert.h>
@@ -68,11 +70,13 @@ struct icalproperty_impl
icalcomponent *parent;
};
-void icalproperty_add_parameters(struct icalproperty_impl *impl,va_list args)
+void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args)
{
void* vp;
-
+
+ struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
+
while((vp = va_arg(args, void*)) != 0) {
if (icalvalue_isa_value(vp) != 0 ){
@@ -117,9 +121,11 @@ icalproperty_new_impl (icalproperty_kind kind)
icalproperty*
icalproperty_new (icalproperty_kind kind)
{
- icalproperty *prop = (icalproperty*)icalproperty_new_impl(kind);
+ if(kind == ICAL_NO_PROPERTY){
+ return 0;
+ }
- return prop;
+ return (icalproperty*)icalproperty_new_impl(kind);
}
@@ -166,30 +172,48 @@ icalproperty_new_clone(icalproperty* prop)
}
-/* This one works a little differently from the other *_from_string
- routines; the string input is the name of the property, not the
- data associated with the property, as it is in
- icalvalue_from_string. All of the parsing associated with
- properties is driven by routines in icalparse.c */
-
icalproperty* icalproperty_new_from_string(char* str)
{
- icalproperty_kind kind;
+
+ size_t buf_size = 1024;
+ char* buf = icalmemory_new_buffer(buf_size);
+ char* buf_ptr = buf;
+ icalproperty *prop;
+ icalcomponent *comp;
+ int errors = 0;
icalerror_check_arg_rz( (str!=0),"str");
- kind = icalenum_string_to_property_kind(str);
+ /* Is this a HACK or a crafty reuse of code? */
- if(kind == ICAL_X_PROPERTY){
- icalproperty *p = icalproperty_new(ICAL_X_PROPERTY);
- icalproperty_set_x_name(p,str);
- return p;
- } else if (kind == ICAL_NO_PROPERTY){
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return 0;
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, "BEGIN:VCALENDAR\n");
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, "\n");
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:VCALENDAR\n");
+
+ comp = icalparser_parse_string(buf);
+
+ if(comp == 0){
+ icalerror_set_errno(ICAL_PARSE_ERROR);
+ return 0;
+ }
+
+ errors = icalcomponent_count_errors(comp);
+
+ prop = icalcomponent_get_first_property(comp,ICAL_ANY_PROPERTY);
+
+ icalcomponent_remove_property(comp,prop);
+
+ icalcomponent_free(comp);
+ free(buf);
+
+ if(errors > 0){
+ icalproperty_free(prop);
+ return 0;
} else {
- return icalproperty_new(kind);
+ return prop;
}
+
}
void
@@ -269,7 +293,7 @@ icalproperty_as_ical_string (icalproperty* prop)
if (impl->kind == ICAL_X_PROPERTY && impl->x_name != 0){
property_name = impl->x_name;
} else {
- property_name = icalenum_property_kind_to_string(impl->kind);
+ property_name = icalproperty_kind_to_string(impl->kind);
}
if (property_name == 0 ) {
@@ -301,7 +325,7 @@ icalproperty_as_ical_string (icalproperty* prop)
icalvalue_kind this_kind = ICAL_NO_VALUE;
icalvalue_kind default_kind
- = icalenum_property_kind_to_value_kind(impl->kind);
+ = icalproperty_kind_to_value_kind(impl->kind);
if(orig_val_param){
orig_kind = (icalvalue_kind)icalparameter_get_value(orig_val_param);
@@ -319,11 +343,11 @@ icalproperty_as_ical_string (icalproperty* prop)
the property. But, use the default, not the one
specified in the property */
- kind_string = icalenum_value_kind_to_string(default_kind);
+ kind_string = icalvalue_kind_to_string(default_kind);
} else if (this_kind != default_kind && this_kind != ICAL_NO_VALUE){
/* Not the default, so it must be specified */
- kind_string = icalenum_value_kind_to_string(this_kind);
+ kind_string = icalvalue_kind_to_string(this_kind);
} else {
/* Don'tinclude the VALUE parameter at all */
}
@@ -437,6 +461,9 @@ void
icalproperty_set_parameter (icalproperty* prop,icalparameter* parameter)
{
icalparameter_kind kind;
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalerror_check_arg_rv( (parameter!=0),"parameter");
kind = icalparameter_isa(parameter);
@@ -445,6 +472,71 @@ icalproperty_set_parameter (icalproperty* prop,icalparameter* parameter)
icalproperty_add_parameter(prop,parameter);
}
+void icalproperty_set_parameter_from_string(icalproperty* prop,
+ const char* name, const char* value)
+{
+
+ icalparameter_kind kind;
+ icalparameter *param;
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalerror_check_arg_rv( (name!=0),"name");
+ icalerror_check_arg_rv( (value!=0),"value");
+
+ kind = icalparameter_string_to_kind(name);
+
+ if(kind == ICAL_NO_PARAMETER){
+ icalerror_set_errno(ICAL_BADARG_ERROR);
+ return;
+ }
+
+ param = icalparameter_new_from_value_string(kind,value);
+
+ if (param == 0){
+ icalerror_set_errno(ICAL_BADARG_ERROR);
+ return;
+ }
+
+ icalproperty_set_parameter(prop,param);
+
+}
+
+const char* icalproperty_get_parameter_as_string(icalproperty* prop,
+ const char* name)
+{
+ icalparameter_kind kind;
+ icalparameter *param;
+ char* str;
+ char* pv;
+
+ icalerror_check_arg_rz( (prop!=0),"prop");
+ icalerror_check_arg_rz( (name!=0),"name");
+
+ kind = icalparameter_string_to_kind(name);
+
+ if(kind == ICAL_NO_PROPERTY){
+ /* icalenum_string_to_parameter_kind will set icalerrno */
+ return 0;
+ }
+
+ param = icalproperty_get_first_parameter(prop,kind);
+
+ if (param == 0){
+ return 0;
+ }
+
+ str = icalparameter_as_ical_string(param);
+
+ pv = strchr(str,'=');
+
+ if(pv == 0){
+ icalerror_set_errno(ICAL_INTERNAL_ERROR);
+ return 0;
+ }
+
+ return pv+1;
+
+}
void
icalproperty_remove_parameter (icalproperty* prop, icalparameter_kind kind)
@@ -553,6 +645,49 @@ icalproperty_set_value (icalproperty* prop, icalvalue* value)
}
+void icalproperty_set_value_from_string(icalproperty* prop,const char* str,
+ const char* type)
+{
+ icalvalue *oval,*nval;
+ icalvalue_kind kind = ICAL_NO_VALUE;
+
+ icalerror_check_arg_rv( (prop!=0),"prop");
+ icalerror_check_arg_rv( (str!=0),"str");
+ icalerror_check_arg_rv( (type!=0),"type");
+
+ if(strcmp(type,"NO")==0){
+ /* Get the type from the value the property already has, if it exists */
+ oval = icalproperty_get_value(prop);
+ if(oval != 0){
+ /* Use the existing value kind */
+ kind = icalvalue_isa(oval);
+ } else {
+ /* Use the default kind for the property */
+ kind = icalproperty_kind_to_value_kind(icalproperty_isa(prop));
+ }
+ } else {
+ /* Use the given kind string */
+ kind = icalvalue_string_to_kind(type);
+ }
+
+ if(kind == ICAL_NO_VALUE){
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return;
+ }
+
+ nval = icalvalue_new_from_string(kind, str);
+
+ if(nval == 0){
+ /* icalvalue_new_from_string sets errno */
+ assert(icalerrno != ICAL_NO_ERROR);
+ return;
+ }
+
+ icalproperty_set_value(prop,nval);
+
+
+}
+
icalvalue*
icalproperty_get_value (icalproperty* prop)
{
@@ -563,6 +698,19 @@ icalproperty_get_value (icalproperty* prop)
return p->value;
}
+const char* icalproperty_get_value_as_string(icalproperty* prop)
+{
+ icalvalue *value;
+
+ struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
+
+ icalerror_check_arg_rz( (prop!=0),"prop");
+
+ value = impl->value;
+
+ return icalvalue_as_ical_string(value);
+}
+
void icalproperty_set_x_name(icalproperty* prop, char* name)
{
@@ -578,7 +726,7 @@ void icalproperty_set_x_name(icalproperty* prop, char* name)
impl->x_name = icalmemory_strdup(name);
if(impl->x_name == 0){
- icalerror_set_errno(ICAL_ALLOCATION_ERROR);
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
}
}
@@ -593,6 +741,45 @@ char* icalproperty_get_x_name(icalproperty* prop){
}
+/* From Jonathan Yue <jonathan.yue@cp.net> */
+char* icalproperty_get_name (icalproperty* prop)
+{
+
+ const char* property_name = 0;
+ size_t buf_size = 256;
+ char* buf = icalmemory_new_buffer(buf_size);
+ char* buf_ptr = buf;
+
+ struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
+
+ icalerror_check_arg_rz( (prop!=0),"prop");
+
+ if (impl->kind == ICAL_X_PROPERTY && impl->x_name != 0){
+ property_name = impl->x_name;
+ } else {
+ property_name = icalproperty_kind_to_string(impl->kind);
+ }
+
+ if (property_name == 0 ) {
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return 0;
+
+ } else {
+ /* _append_string will automatically grow the buffer if
+ property_name is longer than the initial buffer size */
+ icalmemory_append_string(&buf, &buf_ptr, &buf_size, property_name);
+ }
+
+ /* Add the buffer to the temporary buffer ring -- the caller will
+ not have to free the memory. */
+ icalmemory_add_tmp_buffer(buf);
+
+ return buf;
+}
+
+
+
+
void icalproperty_set_parent(icalproperty* property,
icalcomponent* component)
{
@@ -607,10 +794,15 @@ icalcomponent* icalproperty_get_parent(icalproperty* property)
{
struct icalproperty_impl *impl = (struct icalproperty_impl*)property;
- icalerror_check_arg_rv( (property!=0),"property");
+ icalerror_check_arg_rz( (property!=0),"property");
return impl->parent;
}
+
+
+
+
+
/* Everything below this line is machine generated. Do not edit. */
diff --git a/libical/src/libical/icalproperty.h b/libical/src/libical/icalproperty.h
new file mode 100644
index 0000000000..6f5f1bfaef
--- /dev/null
+++ b/libical/src/libical/icalproperty.h
@@ -0,0 +1,116 @@
+/* -*- Mode: C -*- */
+/*======================================================================
+ FILE: icalproperty.h
+ CREATOR: eric 20 March 1999
+
+
+ $Id$
+ $Locker$
+
+
+
+ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+ The original code is icalparam.h
+
+ ======================================================================*/
+
+
+#ifndef ICALPROPERTY_H
+#define ICALPROPERTY_H
+
+#include <time.h>
+
+
+#include "icalderivedparameter.h"
+
+#include "icalvalue.h"
+#include "icalrecur.h"
+
+/* Actually in icalderivedproperty.h:
+ typedef void icalproperty; */
+
+#include "icalderivedproperty.h" /* To get icalproperty_kind enumerations */
+
+icalproperty* icalproperty_new(icalproperty_kind kind);
+
+icalproperty* icalproperty_new_clone(icalproperty * prop);
+
+icalproperty* icalproperty_new_from_string(char* str);
+
+char* icalproperty_as_ical_string(icalproperty* prop);
+
+void icalproperty_free(icalproperty* prop);
+
+icalproperty_kind icalproperty_isa(icalproperty* property);
+int icalproperty_isa_property(void* property);
+
+void icalproperty_add_parameter(icalproperty* prop,icalparameter* parameter);
+void icalproperty_set_parameter(icalproperty* prop,icalparameter* parameter);
+void icalproperty_set_parameter_from_string(icalproperty* prop,
+ const char* name, const char* value);
+const char* icalproperty_get_parameter_as_string(icalproperty* prop,
+ const char* name);
+
+void icalproperty_remove_parameter(icalproperty* prop,
+ icalparameter_kind kind);
+
+int icalproperty_count_parameters(icalproperty* prop);
+
+/* Iterate through the parameters */
+icalparameter* icalproperty_get_first_parameter(icalproperty* prop,
+ icalparameter_kind kind);
+icalparameter* icalproperty_get_next_parameter(icalproperty* prop,
+ icalparameter_kind kind);
+/* Access the value of the property */
+void icalproperty_set_value(icalproperty* prop, icalvalue* value);
+void icalproperty_set_value_from_string(icalproperty* prop,const char* value, const char* kind);
+
+icalvalue* icalproperty_get_value(icalproperty* prop);
+const char* icalproperty_get_value_as_string(icalproperty* prop);
+
+/* Deal with X properties */
+
+void icalproperty_set_x_name(icalproperty* prop, char* name);
+char* icalproperty_get_x_name(icalproperty* prop);
+
+/* Return the name of the property -- the type name converted to a
+ string, or the value of _get_x_name if the type is and X property */
+char* icalproperty_get_name (icalproperty* prop);
+
+icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value);
+
+/* Convert kinds to string and get default value type */
+
+icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind);
+icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind);
+const char* icalproperty_kind_to_string(icalproperty_kind kind);
+icalproperty_kind icalproperty_string_to_kind(const char* string);
+
+icalproperty_method icalproperty_string_to_method(const char* str);
+const char* icalproperty_method_to_string(icalproperty_method method);
+
+
+const char* icalproperty_enum_to_string(int e);
+int icalproperty_string_to_enum(const char* str);
+
+const char* icalproperty_status_to_string(icalproperty_status);
+icalproperty_status icalproperty_string_to_status(const char* string);
+
+int icalproperty_enum_belongs_to_property(icalproperty_kind kind, int e);
+
+
+
+
+#endif /*ICALPROPERTY_H*/
diff --git a/libical/src/libical/icalproperty.h.in b/libical/src/libical/icalproperty.h.in
deleted file mode 100644
index be74b38d43..0000000000
--- a/libical/src/libical/icalproperty.h.in
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C -*-
- ======================================================================
- FILE: icalderivedproperties.{c,h}
- CREATOR: eric 09 May 1999
-
- $Id: icalproperty.h.in,v 1.1.1.2 2001/01/23 19:20:40 jpr Exp $
-
- (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
- ======================================================================*/
-
-
-#ifndef ICALPROPERTY_H
-#define ICALPROPERTY_H
-
-#include <time.h>
-#include "icalparameter.h"
-#include "icalvalue.h"
-#include "icalrecur.h"
-
-typedef void icalproperty;
-
-icalproperty* icalproperty_new(icalproperty_kind kind);
-
-icalproperty* icalproperty_new_clone(icalproperty * prop);
-
-icalproperty* icalproperty_new_from_string(char* str);
-
-char* icalproperty_as_ical_string(icalproperty* prop);
-
-void icalproperty_free(icalproperty* prop);
-
-icalproperty_kind icalproperty_isa(icalproperty* property);
-int icalproperty_isa_property(void* property);
-
-void icalproperty_add_parameter(icalproperty* prop,icalparameter* parameter);
-void icalproperty_set_parameter(icalproperty* prop,icalparameter* parameter);
-
-void icalproperty_remove_parameter(icalproperty* prop,
- icalparameter_kind kind);
-
-int icalproperty_count_parameters(icalproperty* prop);
-
-/* Iterate through the parameters */
-icalparameter* icalproperty_get_first_parameter(icalproperty* prop,
- icalparameter_kind kind);
-icalparameter* icalproperty_get_next_parameter(icalproperty* prop,
- icalparameter_kind kind);
-/* Access the value of the property */
-void icalproperty_set_value(icalproperty* prop, icalvalue* value);
-icalvalue* icalproperty_get_value(icalproperty* prop);
-
-/* Deal with X properties */
-
-void icalproperty_set_x_name(icalproperty* prop, char* name);
-char* icalproperty_get_x_name(icalproperty* prop);
-
-/* Everything below this line is machine generated. Do not edit. */
diff --git a/libical/src/libical/icaltime.c b/libical/src/libical/icaltime.c
index 37ae194bd0..d29833f03f 100644
--- a/libical/src/libical/icaltime.c
+++ b/libical/src/libical/icaltime.c
@@ -170,7 +170,7 @@ time_t icaltime_as_timet(struct icaltimetype tt)
stm.tm_isdst = -1;
if(tt.is_utc == 1 || tt.is_date == 1){
- char* old_tz = set_tz("UTC");
+ struct set_tz_save old_tz = set_tz("UTC");
t = mktime(&stm);
unset_tz(old_tz);
} else {
@@ -248,20 +248,19 @@ int icaltime_utc_offset(struct icaltimetype ictt, const char* tzid)
time_t tt = icaltime_as_timet(ictt);
time_t offset_tt;
struct tm gtm;
-
- char *tzstr = 0;
+ struct set_tz_save old_tz;
if(tzid != 0){
- tzstr = set_tz(tzid);
+ old_tz = set_tz(tzid);
}
-
+
/* Mis-interpret a UTC broken out time as local time */
gtm = *(gmtime(&tt));
gtm.tm_isdst = localtime(&tt)->tm_isdst;
offset_tt = mktime(&gtm);
if(tzid != 0){
- unset_tz(tzstr);
+ unset_tz(old_tz);
}
return tt-offset_tt;
diff --git a/libical/src/libical/icalvalue.c.in b/libical/src/libical/icalvalue.c
index 0bbf7cd934..e7054bb80d 100644
--- a/libical/src/libical/icalvalue.c.in
+++ b/libical/src/libical/icalvalue.c
@@ -3,7 +3,7 @@
FILE: icalvalue.c
CREATOR: eric 02 May 1999
- $Id: icalvalue.c.in,v 1.4 2001/02/05 19:43:57 jpr Exp $
+ $Id$
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
@@ -35,6 +35,7 @@
#include "icalmemory.h"
#include "icalparser.h"
#include "icalenums.h"
+#include "icalvalueimpl.h"
#include <stdlib.h> /* for malloc */
#include <stdio.h> /* for sprintf */
@@ -56,48 +57,6 @@ void print_date_to_string(char* str, struct icaltimetype *data);
void print_time_to_string(char* str, struct icaltimetype *data);
void print_recur_to_string(char* str, struct icaltimetype *data);
-struct icalvalue_impl {
- icalvalue_kind kind; /*this is the kind that is visible from the outside*/
-
- char id[5];
- int size;
- icalproperty* parent;
-
- union data {
- struct icalattachtype v_attach;
- /* void *v_binary; */ /* use v_attach */
- const char *v_string;
- /*char *v_text;*/
- /*char *v_caladdress;*/
- /*char *v_uri;*/
- float v_float;
- int v_int;
- /*int v_boolean;*/
- /*int v_integer;*/
- struct icaldurationtype v_duration;
- /*int v_utcoffset;*/
-
- struct icalperiodtype v_period;
- /*struct icalperiodtype v_datetimeperiod;*/
- struct icalgeotype v_geo;
- /*time_t v_time;*/
- struct icaltimetype v_time;
- /*struct icaltimetype v_date;*/
- /*struct icaltimetype v_datetime;*/
- /*struct icaltimetype v_datetimedate;*/
-
- /* struct icalrecurrencetype was once included
- directly ( not referenced ) in this union, but it
- contributes 2000 bytes to every value, so now it is
- a reference*/
-
- struct icalrecurrencetype *v_recur;
- struct icaltriggertype v_trigger;
- icalproperty_method v_method;
- icalproperty_status v_status;
-
- } data;
-};
struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind){
@@ -114,6 +73,7 @@ struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind){
v->kind = kind;
v->size = 0;
v->parent = 0;
+ v->x_value = 0;
memset(&(v->data),0,sizeof(v->data));
return v;
@@ -255,10 +215,31 @@ char* icalmemory_strdup_and_dequote(const char* str)
return out;
}
+icalvalue* icalvalue_new_enum(icalvalue_kind kind, int x_type, const char* str)
+{
+ int e = icalproperty_string_to_enum(str);
+ struct icalvalue_impl *value;
+
+ if(e != 0 && icalproperty_enum_belongs_to_property(
+ icalproperty_value_kind_to_kind(kind),e)) {
+
+ value = icalvalue_new_impl(kind);
+ value->data.v_enum = e;
+ } else {
+ /* Make it an X value */
+ value = icalvalue_new_impl(kind);
+ value->data.v_enum = x_type;
+ icalvalue_set_x(value,str);
+ }
+
+ return value;
+}
+
+
icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* str,icalproperty** error)
{
- icalvalue *value = 0;
+ struct icalvalue_impl *value = 0;
icalerror_check_arg_rz(str!=0,"str");
@@ -268,141 +249,95 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char*
switch (kind){
- case ICAL_ATTACH_VALUE:
- {
- /* HACK */
- value = 0;
-
- if (error != 0){
- char temp[TMP_BUF_SIZE];
- sprintf(temp,"ATTACH Values are not implemented");
- *error = icalproperty_vanew_xlicerror(
- temp,
- icalparameter_new_xlicerrortype(
- ICAL_XLICERRORTYPE_VALUEPARSEERROR),
- 0);
- }
-
- icalerror_warn("Parsing ATTACH properties is unimplmeneted");
- break;
- }
-
- case ICAL_BINARY_VALUE:
- {
- /* HACK */
- value = 0;
-
- if (error != 0){
- char temp[TMP_BUF_SIZE];
- sprintf(temp,"BINARY Values are not implemented");
- *error = icalproperty_vanew_xlicerror(
- temp,
- icalparameter_new_xlicerrortype(
- ICAL_XLICERRORTYPE_VALUEPARSEERROR),
- 0);
- }
-
- icalerror_warn("Parsing BINARY values is unimplmeneted");
- break;
- }
-
- case ICAL_BOOLEAN_VALUE:
- {
- /* HACK */
- value = 0;
-
+ case ICAL_ATTACH_VALUE:
+ case ICAL_BINARY_VALUE:
+ case ICAL_BOOLEAN_VALUE:
+ {
+ /* HACK */
+ value = 0;
+
if (error != 0){
char temp[TMP_BUF_SIZE];
- sprintf(temp,"BOOLEAN Values are not implemented");
+ sprintf(temp,"%s Values are not implemented",
+ icalparameter_kind_to_string(kind));
*error = icalproperty_vanew_xlicerror(
- temp,
- icalparameter_new_xlicerrortype(
- ICAL_XLICERRORTYPE_VALUEPARSEERROR),
- 0);
+ temp,
+ icalparameter_new_xlicerrortype(
+ ICAL_XLICERRORTYPE_VALUEPARSEERROR),
+ 0);
}
-
- icalerror_warn("Parsing BOOLEAN values is unimplmeneted");
break;
}
-
- case ICAL_INTEGER_VALUE:
+
+
+ case ICAL_TRANSP_VALUE:
+ value = icalvalue_new_enum(kind, ICAL_TRANSP_X,str);
+ break;
+ case ICAL_METHOD_VALUE:
+ value = icalvalue_new_enum(kind, ICAL_METHOD_X,str);
+ break;
+ case ICAL_STATUS_VALUE:
+ value = icalvalue_new_enum(kind, ICAL_STATUS_X,str);
+ break;
+ case ICAL_ACTION_VALUE:
+ value = icalvalue_new_enum(kind, ICAL_ACTION_X,str);
+ break;
+ case ICAL_CLASS_VALUE:
+ value = icalvalue_new_enum(kind, ICAL_CLASS_X,str);
+ break;
+
+
+ case ICAL_INTEGER_VALUE:
{
value = icalvalue_new_integer(atoi(str));
break;
}
- case ICAL_FLOAT_VALUE:
- {
+ case ICAL_FLOAT_VALUE:
+ {
value = icalvalue_new_float(atof(str));
break;
}
-
- case ICAL_UTCOFFSET_VALUE:
+
+ case ICAL_UTCOFFSET_VALUE:
{
value = icalparser_parse_value(kind,str,(icalcomponent*)0);
break;
}
-
- case ICAL_TEXT_VALUE:
+
+ case ICAL_TEXT_VALUE:
{
char* dequoted_str = icalmemory_strdup_and_dequote(str);
value = icalvalue_new_text(dequoted_str);
free(dequoted_str);
break;
}
-
-
- case ICAL_STRING_VALUE:
+
+
+ case ICAL_STRING_VALUE:
{
value = icalvalue_new_string(str);
break;
}
-
- case ICAL_CALADDRESS_VALUE:
+
+ case ICAL_CALADDRESS_VALUE:
{
value = icalvalue_new_caladdress(str);
break;
}
-
- case ICAL_URI_VALUE:
+
+ case ICAL_URI_VALUE:
{
value = icalvalue_new_uri(str);
break;
}
+
- case ICAL_METHOD_VALUE:
- {
- icalproperty_method method = icalenum_string_to_method(str);
-
- if(method == ICAL_METHOD_NONE){
- value = 0;
- } else {
- value = icalvalue_new_method(method);
- }
-
- break;
-
- }
-
-
- case ICAL_STATUS_VALUE:
- {
- icalproperty_status status = icalenum_string_to_status(str);
-
- if(status == ICAL_STATUS_NONE){
- value = 0;
- } else {
- value = icalvalue_new_status(status);
- }
-
- break;
-
- }
- case ICAL_GEO_VALUE:
+ case ICAL_GEO_VALUE:
{
value = 0;
/* HACK */
-
+
if (error != 0){
char temp[TMP_BUF_SIZE];
sprintf(temp,"GEO Values are not implemented");
@@ -427,40 +362,57 @@ icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char*
}
case ICAL_TIME_VALUE:
- {
- struct icaltimetype tt;
- tt = icaltime_from_string(str);
- value = icalvalue_new_time(tt);
- break;
- }
case ICAL_DATE_VALUE:
+ case ICAL_DATETIME_VALUE:
+ case ICAL_DATETIMEDATE_VALUE:
{
struct icaltimetype tt;
tt = icaltime_from_string(str);
- value = icalvalue_new_date(tt);
+ if(!icaltime_is_null_time(tt)){
+ value = icalvalue_new_impl(kind);
+ value->data.v_time = tt;
+ }
break;
}
- case ICAL_DATETIME_VALUE:
+
+ case ICAL_DATETIMEPERIOD_VALUE:
{
struct icaltimetype tt;
- tt = icaltime_from_string(str);
- value = icalvalue_new_datetime(tt);
- break;
+ struct icalperiodtype p;
+ tt = icaltime_from_string(str);
+ p = icalperiodtype_from_string(str);
+
+ if(!icaltime_is_null_time(tt)){
+ value = icalvalue_new_datetime(tt);
+ } else if (!icalperiodtype_is_null_period(p)){
+ value = icalvalue_new_period(p);
+ }
+
+ break;
}
- case ICAL_DATETIMEDATE_VALUE:
+
+ case ICAL_DURATION_VALUE:
{
- struct icaltimetype tt;
- tt = icaltime_from_string(str);
- value = icalvalue_new_datetimedate(tt);
+ struct icaldurationtype dur = icaldurationtype_from_string(str);
+
+ if(icaldurationtype_is_null_duration(dur)){
+ value = 0;
+ } else {
+ value = icalvalue_new_duration(dur);
+ }
+
break;
}
- case ICAL_DATETIMEPERIOD_VALUE:
- case ICAL_DURATION_VALUE:
case ICAL_PERIOD_VALUE:
{
- value = icalparser_parse_value(kind,str,error);
- break;
+ struct icalperiodtype p;
+ p = icalperiodtype_from_string(str);
+
+ if(!icalperiodtype_is_null_period(p)){
+ value = icalvalue_new_period(p);
+ }
+ break;
}
case ICAL_TRIGGER_VALUE:
@@ -531,6 +483,9 @@ icalvalue_free (icalvalue* value)
}
#endif
+ if(v->x_value != 0){
+ free(v->x_value);
+ }
switch (v->kind){
case ICAL_BINARY_VALUE:
@@ -782,8 +737,7 @@ char* icalvalue_attach_as_ical_string(icalvalue* value) {
}
-char* icalvalue_duration_as_ical_string(icalvalue* value)
-{
+char* icalvalue_duration_as_ical_string(icalvalue* value) {
struct icaldurationtype data;
@@ -791,7 +745,6 @@ char* icalvalue_duration_as_ical_string(icalvalue* value)
data = icalvalue_get_duration(value);
return icaldurationtype_as_ical_string(data);
-
}
void print_time_to_string(char* str, struct icaltimetype *data)
@@ -855,7 +808,7 @@ void print_datetime_to_string(char* str, struct icaltimetype *data)
}
-char* icalvalue_datetime_as_ical_string(icalvalue* value) {
+const char* icalvalue_datetime_as_ical_string(icalvalue* value) {
struct icaltimetype data;
char* str;
@@ -886,7 +839,7 @@ char* icalvalue_datetime_as_ical_string(icalvalue* value) {
}
-char* icalvalue_datetimedate_as_ical_string(icalvalue* value) {
+const char* icalvalue_datetimedate_as_ical_string(icalvalue* value) {
struct icaltimetype data;
icalerror_check_arg_rz( (value!=0),"value");
@@ -929,8 +882,7 @@ char* icalvalue_geo_as_ical_string(icalvalue* value) {
return str;
}
-char* icalvalue_datetimeperiod_as_ical_string(icalvalue* value) {
- struct icalvalue_impl* impl = (struct icalvalue_impl*)value;
+const char* icalvalue_datetimeperiod_as_ical_string(icalvalue* value) {
struct icaldatetimeperiodtype dtp = icalvalue_get_datetimeperiod(value);
icalerror_check_arg_rz( (value!=0),"value");
@@ -942,24 +894,21 @@ char* icalvalue_datetimeperiod_as_ical_string(icalvalue* value) {
}
}
-char* icalvalue_period_as_ical_string(icalvalue* value) {
+const char* icalvalue_period_as_ical_string(icalvalue* value) {
struct icalperiodtype data;
icalerror_check_arg_rz( (value!=0),"value");
data = icalvalue_get_period(value);
return icalperiodtype_as_ical_string(data);
+
}
-char* icalvalue_trigger_as_ical_string(icalvalue* value)
-{
+char* icalvalue_trigger_as_ical_string(icalvalue* value) {
struct icaltriggertype data;
- char* str;
icalerror_check_arg_rz( (value!=0),"value");
data = icalvalue_get_trigger(value);
-
- str = (char*)icalmemory_tmp_buffer(60);
if(!icaltime_is_null_time(data.time)){
return icaltime_as_ical_string(data.time);
@@ -982,64 +931,71 @@ icalvalue_as_ical_string (icalvalue* value)
switch (v->kind){
- case ICAL_ATTACH_VALUE:
- return icalvalue_attach_as_ical_string(value);
-
- case ICAL_BINARY_VALUE:
- return icalvalue_binary_as_ical_string(value);
-
- case ICAL_BOOLEAN_VALUE:
- case ICAL_INTEGER_VALUE:
- return icalvalue_int_as_ical_string(value);
-
- case ICAL_UTCOFFSET_VALUE:
- return icalvalue_utcoffset_as_ical_string(value);
-
- case ICAL_TEXT_VALUE:
- return icalvalue_text_as_ical_string(value);
-
- case ICAL_STRING_VALUE:
- case ICAL_URI_VALUE:
- case ICAL_CALADDRESS_VALUE:
- return icalvalue_string_as_ical_string(value);
-
- case ICAL_DATE_VALUE:
- return icalvalue_date_as_ical_string(value);
- case ICAL_DATETIME_VALUE:
- return icalvalue_datetime_as_ical_string(value);
- case ICAL_DATETIMEDATE_VALUE:
- return icalvalue_datetimedate_as_ical_string(value);
- case ICAL_DURATION_VALUE:
- return icalvalue_duration_as_ical_string(value);
- case ICAL_TIME_VALUE:
- return icalvalue_time_as_ical_string(value);
-
- case ICAL_PERIOD_VALUE:
- return icalvalue_period_as_ical_string(value);
- case ICAL_DATETIMEPERIOD_VALUE:
- return icalvalue_datetimeperiod_as_ical_string(value);
-
- case ICAL_FLOAT_VALUE:
- return icalvalue_float_as_ical_string(value);
-
- case ICAL_GEO_VALUE:
- return icalvalue_geo_as_ical_string(value);
-
- case ICAL_RECUR_VALUE:
- return icalvalue_recur_as_ical_string(value);
-
- case ICAL_TRIGGER_VALUE:
- return icalvalue_trigger_as_ical_string(value);
-
- case ICAL_METHOD_VALUE:
- return icalenum_method_to_string(v->data.v_method);
-
- case ICAL_STATUS_VALUE:
- return icalenum_status_to_string(v->data.v_status);
-
-
- case ICAL_NO_VALUE:
- default:
+ case ICAL_ATTACH_VALUE:
+ return icalvalue_attach_as_ical_string(value);
+
+ case ICAL_BINARY_VALUE:
+ return icalvalue_binary_as_ical_string(value);
+
+ case ICAL_BOOLEAN_VALUE:
+ case ICAL_INTEGER_VALUE:
+ return icalvalue_int_as_ical_string(value);
+
+ case ICAL_UTCOFFSET_VALUE:
+ return icalvalue_utcoffset_as_ical_string(value);
+
+ case ICAL_TEXT_VALUE:
+ return icalvalue_text_as_ical_string(value);
+
+ case ICAL_STRING_VALUE:
+ case ICAL_URI_VALUE:
+ case ICAL_CALADDRESS_VALUE:
+ return icalvalue_string_as_ical_string(value);
+
+ case ICAL_DATE_VALUE:
+ return icalvalue_date_as_ical_string(value);
+ case ICAL_DATETIME_VALUE:
+ return icalvalue_datetime_as_ical_string(value);
+ case ICAL_DATETIMEDATE_VALUE:
+ return icalvalue_datetimedate_as_ical_string(value);
+ case ICAL_DURATION_VALUE:
+ return icalvalue_duration_as_ical_string(value);
+ case ICAL_TIME_VALUE:
+ return icalvalue_time_as_ical_string(value);
+
+ case ICAL_PERIOD_VALUE:
+ return icalvalue_period_as_ical_string(value);
+ case ICAL_DATETIMEPERIOD_VALUE:
+ return icalvalue_datetimeperiod_as_ical_string(value);
+
+ case ICAL_FLOAT_VALUE:
+ return icalvalue_float_as_ical_string(value);
+
+ case ICAL_GEO_VALUE:
+ return icalvalue_geo_as_ical_string(value);
+
+ case ICAL_RECUR_VALUE:
+ return icalvalue_recur_as_ical_string(value);
+
+ case ICAL_TRIGGER_VALUE:
+ return icalvalue_trigger_as_ical_string(value);
+
+ case ICAL_ACTION_VALUE:
+ case ICAL_METHOD_VALUE:
+ case ICAL_STATUS_VALUE:
+ case ICAL_TRANSP_VALUE:
+ case ICAL_CLASS_VALUE:
+ if(v->x_value !=0){
+ return icalmemory_tmp_copy(v->x_value);
+ }
+
+ return icalproperty_enum_to_string(v->data.v_enum);
+
+ case ICAL_X_VALUE:
+ return icalmemory_tmp_copy(v->x_value);
+
+ case ICAL_NO_VALUE:
+ default:
{
return 0;
}
@@ -1234,176 +1190,6 @@ icalproperty* icalvalue_get_parent(icalvalue* value)
-/* Recur is a special case, so it is not auto generated. */
-icalvalue*
-icalvalue_new_recur (struct icalrecurrencetype v)
-{
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_RECUR_VALUE);
-
- icalvalue_set_recur((icalvalue*)impl,v);
-
- return (icalvalue*)impl;
-}
-
-void
-icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v)
-{
- struct icalvalue_impl* impl;
-
- icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_RECUR_VALUE);
-
- impl = (struct icalvalue_impl*)value;
-
- if (impl->data.v_recur != 0){
- free(impl->data.v_recur);
- impl->data.v_recur = 0;
- }
-
- impl->data.v_recur = malloc(sizeof(struct icalrecurrencetype));
-
- if (impl->data.v_recur == 0){
- icalerror_set_errno(ICAL_ALLOCATION_ERROR);
- return;
- } else {
- memcpy(impl->data.v_recur, &v, sizeof(struct icalrecurrencetype));
- }
-
-}
-
-struct icalrecurrencetype
-icalvalue_get_recur(icalvalue* value)
-{
- icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_RECUR_VALUE);
-
- return *(((struct icalvalue_impl*)value)->data.v_recur);
-}
-
-
-
-
-icalvalue*
-icalvalue_new_trigger (struct icaltriggertype v)
-{
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRIGGER_VALUE);
-
- icalvalue_set_trigger((icalvalue*)impl,v);
-
- return (icalvalue*)impl;
-}
-
-void
-icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v)
-{
- struct icalvalue_impl* impl;
-
- icalerror_check_arg_rv( (value!=0),"value");
-
- impl = (struct icalvalue_impl*)value;
-
- if(!icaltime_is_null_time(v.time)){
- icalvalue_set_datetime((icalvalue*)impl,v.time);
- impl->kind = ICAL_DATETIME_VALUE;
- } else {
- icalvalue_set_duration((icalvalue*)impl,v.duration);
- impl->kind = ICAL_DURATION_VALUE;
- }
-
-}
-
-struct icaltriggertype
-icalvalue_get_trigger(icalvalue* value)
-{
- struct icalvalue_impl *impl = (struct icalvalue_impl*)value;
- struct icaltriggertype tr;
-
- icalerror_check_arg( (value!=0),"value");
- icalerror_check_arg( (value!=0),"value");
-
- if(impl->kind == ICAL_DATETIME_VALUE){
- tr.duration = icaldurationtype_from_int(0);
- tr.time = impl->data.v_time;
- } else if(impl->kind == ICAL_DURATION_VALUE){
- tr.time = icaltime_null_time();
- tr.duration = impl->data.v_duration;
- } else {
- tr.duration = icaldurationtype_from_int(0);
- tr.time = icaltime_null_time();
- icalerror_set_errno(ICAL_BADARG_ERROR);
- }
-
- return tr;
-}
-
-/* DATE-TIME-PERIOD is a special case, and is not auto generated */
-
-icalvalue*
-icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v)
-{
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIMEPERIOD_VALUE);
-
- icalvalue_set_datetimeperiod((icalvalue*)impl,v);
-
- return (icalvalue*)impl;
-}
-
-void
-icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v)
-{
- struct icalvalue_impl* impl = (struct icalvalue_impl*)value;
-
- icalerror_check_arg_rv( (value!=0),"value");
-
- icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
-
- if(!icaltime_is_null_time(v.time)){
- if(!icaltime_is_valid_time(v.time)){
- icalerror_set_errno(ICAL_BADARG_ERROR);
- return;
- }
- impl->kind = ICAL_DATETIME_VALUE;
- icalvalue_set_datetime(impl,v.time);
- } else if (!icalperiodtype_is_null_period(v.period)) {
- if(!icalperiodtype_is_valid_period(v.period)){
- icalerror_set_errno(ICAL_BADARG_ERROR);
- return;
- }
- impl->kind = ICAL_PERIOD_VALUE;
- icalvalue_set_period(impl,v.period);
- } else {
- icalerror_set_errno(ICAL_BADARG_ERROR);
- }
-}
-
-struct icaldatetimeperiodtype
-icalvalue_get_datetimeperiod(icalvalue* value)
-{
- struct icaldatetimeperiodtype dtp;
-
- struct icalvalue_impl* impl = (struct icalvalue_impl*)value;
- icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
-
- if(impl->kind == ICAL_DATETIME_VALUE){
- dtp.period = icalperiodtype_null_period();
- dtp.time = impl->data.v_time;
- } else if(impl->kind == ICAL_PERIOD_VALUE) {
- dtp.period = impl->data.v_period;
- dtp.time = icaltime_null_time();
- } else {
- dtp.period = icalperiodtype_null_period();
- dtp.time = icaltime_null_time();
- icalerror_set_errno(ICAL_BADARG_ERROR);
- }
-
- return dtp;
-}
-
-
-
-
-
/* The remaining interfaces are 'new', 'set' and 'get' for each of the value
types */
diff --git a/libical/src/libical/icalvalue.h.in b/libical/src/libical/icalvalue.h
index 90daa49f79..6983c23275 100644
--- a/libical/src/libical/icalvalue.h.in
+++ b/libical/src/libical/icalvalue.h
@@ -4,8 +4,8 @@
CREATOR: eric 20 March 1999
- $Id: icalvalue.h.in,v 1.1.1.3 2001/02/05 19:16:24 jpr Exp $
- $Locker: $
+ $Id$
+ $Locker$
@@ -33,8 +33,14 @@
#include "icalenums.h"
#include "icaltypes.h"
#include "icalrecur.h"
+#include "icalduration.h"
+#include "icalperiod.h"
+#include "icalderivedproperty.h" /* For icalproperty_method, etc. */
+#include "icalderivedparameter.h"
+#include "icalderivedvalue.h"
-typedef void icalvalue;
+/* Defined in icalderivedvalue.h */
+/*typedef void icalvalue;*/
icalvalue* icalvalue_new(icalvalue_kind kind);
@@ -52,8 +58,7 @@ icalvalue_kind icalvalue_isa(icalvalue* value);
int icalvalue_isa_value(void*);
-icalparameter_xliccomparetype
-icalvalue_compare(icalvalue* a, icalvalue *b);
+icalparameter_xliccomparetype icalvalue_compare(icalvalue* a, icalvalue *b);
/* Special, non autogenerated value accessors */
@@ -71,4 +76,10 @@ void icalvalue_set_datetimeperiod(icalvalue* value,
struct icaldatetimeperiodtype v);
struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value);
-/* Everything below this line is machine generated. Do not edit. */
+/* Convert enumerations */
+
+icalvalue_kind icalvalue_string_to_kind(const char* str);
+const char* icalvalue_kind_to_string(icalvalue_kind kind);
+
+
+#endif /*ICALVALUE_H*/