summaryrefslogtreecommitdiffabout
path: root/libical/src/libical/icalderivedvalue.c
Side-by-side diff
Diffstat (limited to 'libical/src/libical/icalderivedvalue.c') (more/less context) (ignore whitespace changes)
-rw-r--r--libical/src/libical/icalderivedvalue.c892
1 files changed, 459 insertions, 433 deletions
diff --git a/libical/src/libical/icalderivedvalue.c b/libical/src/libical/icalderivedvalue.c
index db762ea..8dbbe9e 100644
--- a/libical/src/libical/icalderivedvalue.c
+++ b/libical/src/libical/icalderivedvalue.c
@@ -47,10 +47,6 @@
#include <stdlib.h> /* for atoi and atof */
#include <limits.h> /* for SHRT_MAX */
-
-
-#define TMP_BUF_SIZE 1024
-
struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind);
/* This map associates each of the value types with its string
@@ -60,326 +56,194 @@ struct icalvalue_kind_map {
char name[20];
};
-extern struct icalvalue_kind_map value_map[];
-
-const char* icalvalue_kind_to_string(icalvalue_kind kind)
-{
- int i;
-
- for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) {
- if (value_map[i].kind == kind) {
- return value_map[i].name;
- }
- }
-
- return 0;
-}
-
-icalvalue_kind icalvalue_string_to_kind(const char* str)
-{
- int i;
-
- for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) {
- if (strcmp(value_map[i].name,str) == 0) {
- return value_map[i].kind;
- }
- }
-
- return value_map[i].kind;
+static struct icalvalue_kind_map value_map[28]={
+ {ICAL_QUERY_VALUE,"QUERY"},
+ {ICAL_DATE_VALUE,"DATE"},
+ {ICAL_ATTACH_VALUE,"ATTACH"},
+ {ICAL_GEO_VALUE,"GEO"},
+ {ICAL_STATUS_VALUE,"STATUS"},
+ {ICAL_TRANSP_VALUE,"TRANSP"},
+ {ICAL_STRING_VALUE,"STRING"},
+ {ICAL_TEXT_VALUE,"TEXT"},
+ {ICAL_REQUESTSTATUS_VALUE,"REQUEST-STATUS"},
+ {ICAL_BINARY_VALUE,"BINARY"},
+ {ICAL_PERIOD_VALUE,"PERIOD"},
+ {ICAL_FLOAT_VALUE,"FLOAT"},
+ {ICAL_DATETIMEPERIOD_VALUE,"DATE-TIME-PERIOD"},
+ {ICAL_INTEGER_VALUE,"INTEGER"},
+ {ICAL_CLASS_VALUE,"CLASS"},
+ {ICAL_URI_VALUE,"URI"},
+ {ICAL_DURATION_VALUE,"DURATION"},
+ {ICAL_BOOLEAN_VALUE,"BOOLEAN"},
+ {ICAL_X_VALUE,"X"},
+ {ICAL_CALADDRESS_VALUE,"CAL-ADDRESS"},
+ {ICAL_TRIGGER_VALUE,"TRIGGER"},
+ {ICAL_XLICCLASS_VALUE,"X-LIC-CLASS"},
+ {ICAL_RECUR_VALUE,"RECUR"},
+ {ICAL_ACTION_VALUE,"ACTION"},
+ {ICAL_DATETIME_VALUE,"DATE-TIME"},
+ {ICAL_UTCOFFSET_VALUE,"UTC-OFFSET"},
+ {ICAL_METHOD_VALUE,"METHOD"},
+ {ICAL_NO_VALUE,""}
+};
-}
-icalvalue* icalvalue_new_x (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_X_VALUE);
+icalvalue* icalvalue_new_query (const char* v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_QUERY_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
- icalvalue_set_x((icalvalue*)impl,v);
+ icalvalue_set_query((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_x(icalvalue* value, const char* v) {
+void icalvalue_set_query(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_arg_rv( (v!=0),"v");
+ icalerror_check_value_type(value, ICAL_QUERY_VALUE);
impl = (struct icalvalue_impl*)value;
- if(impl->x_value!=0) {free((void*)impl->x_value);}
+ if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
- impl->x_value = icalmemory_strdup(v);
- if (impl->x_value == 0){
+ impl->data.v_string = icalmemory_strdup(v);
+
+ if (impl->data.v_string == 0){
errno = ENOMEM;
}
- }
-const char* icalvalue_get_x(icalvalue* value) {
+
+ icalvalue_reset_kind(impl);
+}
+const char* icalvalue_get_query(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_X_VALUE);
- return ((struct icalvalue_impl*)value)->x_value;
+ icalerror_check_value_type(value, ICAL_QUERY_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_string;
}
-/* Attachment is a special case, so it is not auto generated. */
-icalvalue*
-icalvalue_new_attach (struct icalattachtype *v)
-{
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_ATTACH_VALUE);
-
- icalvalue_set_attach((icalvalue*)impl,v);
+
+icalvalue* icalvalue_new_date (struct icaltimetype v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATE_VALUE);
+
+ icalvalue_set_date((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-
-void
-icalvalue_set_attach(icalvalue* value, struct icalattachtype *v)
-{
+void icalvalue_set_date(icalvalue* value, struct icaltimetype v) {
struct icalvalue_impl* impl;
-
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_ATTACH_VALUE);
-
+
+ icalerror_check_value_type(value, ICAL_DATE_VALUE);
impl = (struct icalvalue_impl*)value;
- if (impl->data.v_attach != 0){
- icalattachtype_free(impl->data.v_attach);
- }
- impl->data.v_attach = v;
- icalattachtype_add_reference(v);
+ impl->data.v_time = v;
+
+ icalvalue_reset_kind(impl);
}
+struct icaltimetype icalvalue_get_date(const icalvalue* value) {
-struct icalattachtype*
-icalvalue_get_attach(icalvalue* value)
-{
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_ATTACH_VALUE);
-
- return ((struct icalvalue_impl*)value)->data.v_attach;
+ icalerror_check_value_type(value, ICAL_DATE_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_time;
}
-/* 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);
+icalvalue* icalvalue_new_geo (struct icalgeotype v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_GEO_VALUE);
+
+ icalvalue_set_geo((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-
-void
-icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v)
-{
+void icalvalue_set_geo(icalvalue* value, struct icalgeotype v) {
struct icalvalue_impl* impl;
-
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_RECUR_VALUE);
-
+
+ icalerror_check_value_type(value, ICAL_GEO_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));
+ impl->data.v_geo = v;
- if (impl->data.v_recur == 0){
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- return;
- } else {
- memcpy(impl->data.v_recur, &v, sizeof(struct icalrecurrencetype));
- }
-
+ icalvalue_reset_kind(impl);
}
+struct icalgeotype icalvalue_get_geo(const icalvalue* value) {
-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);
+ icalerror_check_value_type(value, ICAL_GEO_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_geo;
}
-
-icalvalue*
-icalvalue_new_trigger (struct icaltriggertype v)
-{
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRIGGER_VALUE);
-
- icalvalue_set_trigger((icalvalue*)impl,v);
-
+icalvalue* icalvalue_new_status (enum icalproperty_status v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STATUS_VALUE);
+
+ icalvalue_set_status((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-
-void
-icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v)
-{
+void icalvalue_set_status(icalvalue* value, enum icalproperty_status v) {
struct icalvalue_impl* impl;
-
icalerror_check_arg_rv( (value!=0),"value");
+ icalerror_check_value_type(value, ICAL_STATUS_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;
- }
-}
+ impl->data.v_enum = v;
-struct icaltriggertype
-icalvalue_get_trigger(icalvalue* value)
-{
- struct icalvalue_impl *impl = (struct icalvalue_impl*)value;
- struct icaltriggertype tr;
+ icalvalue_reset_kind(impl);
+}
+enum icalproperty_status icalvalue_get_status(const icalvalue* value) {
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;
+ icalerror_check_value_type(value, ICAL_STATUS_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_enum;
}
-/* 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);
+icalvalue* icalvalue_new_transp (enum icalproperty_transp v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRANSP_VALUE);
+
+ icalvalue_set_transp((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-
-void
-icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v)
-{
- struct icalvalue_impl* impl = (struct icalvalue_impl*)value;
-
+void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v) {
+ struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
+ icalerror_check_value_type(value, ICAL_TRANSP_VALUE);
+ impl = (struct icalvalue_impl*)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);
- }
+ impl->data.v_enum = v;
- return dtp;
+ icalvalue_reset_kind(impl);
}
+enum icalproperty_transp icalvalue_get_transp(const icalvalue* value) {
+ icalerror_check_arg( (value!=0),"value");
+ icalerror_check_value_type(value, ICAL_TRANSP_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_enum;
+}
-
-
-
-
-
-/* The remaining interfaces are 'new', 'set' and 'get' for each of the value
- types */
-
-
-/* Everything below this line is machine generated. Do not edit. */
-static struct icalvalue_kind_map value_map[]={
- {ICAL_QUERY_VALUE,"QUERY"},
- {ICAL_TRIGGER_VALUE,"TRIGGER"},
- {ICAL_STATUS_VALUE,"STATUS"},
- {ICAL_TRANSP_VALUE,"TRANSP"},
- {ICAL_CLASS_VALUE,"CLASS"},
- {ICAL_DATE_VALUE,"DATE"},
- {ICAL_STRING_VALUE,"STRING"},
- {ICAL_INTEGER_VALUE,"INTEGER"},
- {ICAL_PERIOD_VALUE,"PERIOD"},
- {ICAL_TEXT_VALUE,"TEXT"},
- {ICAL_DURATION_VALUE,"DURATION"},
- {ICAL_BOOLEAN_VALUE,"BOOLEAN"},
- {ICAL_URI_VALUE,"URI"},
- {ICAL_DATETIMEPERIOD_VALUE,"DATE-TIME-PERIOD"},
- {ICAL_GEO_VALUE,"GEO"},
- {ICAL_DATETIME_VALUE,"DATE-TIME"},
- {ICAL_UTCOFFSET_VALUE,"UTC-OFFSET"},
- {ICAL_ATTACH_VALUE,"ATTACH"},
- {ICAL_ACTION_VALUE,"ACTION"},
- {ICAL_CALADDRESS_VALUE,"CAL-ADDRESS"},
- {ICAL_X_VALUE,"X"},
- {ICAL_FLOAT_VALUE,"FLOAT"},
- {ICAL_REQUESTSTATUS_VALUE,"REQUEST-STATUS"},
- {ICAL_METHOD_VALUE,"METHOD"},
- {ICAL_BINARY_VALUE,"BINARY"},
- {ICAL_RECUR_VALUE,"RECUR"},
- {ICAL_NO_VALUE,""}
-};
-
-
-icalvalue* icalvalue_new_query (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_QUERY_VALUE);
+icalvalue* icalvalue_new_string (const char* v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STRING_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
- icalvalue_set_query((icalvalue*)impl,v);
+ icalvalue_set_string((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_query(icalvalue* value, const char* v) {
+void icalvalue_set_string(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_arg_rv( (v!=0),"v");
- icalerror_check_value_type(value, ICAL_QUERY_VALUE);
+ icalerror_check_value_type(value, ICAL_STRING_VALUE);
impl = (struct icalvalue_impl*)value;
if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
@@ -393,154 +257,162 @@ void icalvalue_set_query(icalvalue* value, const char* v) {
icalvalue_reset_kind(impl);
}
-const char* icalvalue_get_query(icalvalue* value) {
+const char* icalvalue_get_string(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_QUERY_VALUE);
+ icalerror_check_value_type(value, ICAL_STRING_VALUE);
return ((struct icalvalue_impl*)value)->data.v_string;
}
-icalvalue* icalvalue_new_status (enum icalproperty_status v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STATUS_VALUE);
-
- icalvalue_set_status((icalvalue*)impl,v);
+icalvalue* icalvalue_new_text (const char* v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TEXT_VALUE);
+ icalerror_check_arg_rz( (v!=0),"v");
+
+ icalvalue_set_text((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_status(icalvalue* value, enum icalproperty_status v) {
+void icalvalue_set_text(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
-
- icalerror_check_value_type(value, ICAL_STATUS_VALUE);
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ icalerror_check_value_type(value, ICAL_TEXT_VALUE);
impl = (struct icalvalue_impl*)value;
+ if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
- impl->data.v_enum = v;
+ impl->data.v_string = icalmemory_strdup(v);
+
+ if (impl->data.v_string == 0){
+ errno = ENOMEM;
+ }
+
icalvalue_reset_kind(impl);
}
-enum icalproperty_status icalvalue_get_status(icalvalue* value) {
+const char* icalvalue_get_text(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_STATUS_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_enum;
+ icalerror_check_value_type(value, ICAL_TEXT_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_string;
}
-icalvalue* icalvalue_new_transp (enum icalproperty_transp v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRANSP_VALUE);
+icalvalue* icalvalue_new_requeststatus (struct icalreqstattype v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_REQUESTSTATUS_VALUE);
- icalvalue_set_transp((icalvalue*)impl,v);
+ icalvalue_set_requeststatus((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v) {
+void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_TRANSP_VALUE);
+ icalerror_check_value_type(value, ICAL_REQUESTSTATUS_VALUE);
impl = (struct icalvalue_impl*)value;
- impl->data.v_enum = v;
+ impl->data.v_requeststatus = v;
icalvalue_reset_kind(impl);
}
-enum icalproperty_transp icalvalue_get_transp(icalvalue* value) {
+struct icalreqstattype icalvalue_get_requeststatus(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_TRANSP_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_enum;
+ icalerror_check_value_type(value, ICAL_REQUESTSTATUS_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_requeststatus;
}
-icalvalue* icalvalue_new_class (enum icalproperty_class v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CLASS_VALUE);
-
- icalvalue_set_class((icalvalue*)impl,v);
+icalvalue* icalvalue_new_binary (const char* v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_BINARY_VALUE);
+ icalerror_check_arg_rz( (v!=0),"v");
+
+ icalvalue_set_binary((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_class(icalvalue* value, enum icalproperty_class v) {
+void icalvalue_set_binary(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
-
- icalerror_check_value_type(value, ICAL_CLASS_VALUE);
+ icalerror_check_arg_rv( (v!=0),"v");
+
+ icalerror_check_value_type(value, ICAL_BINARY_VALUE);
impl = (struct icalvalue_impl*)value;
+ if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
- impl->data.v_enum = v;
+ impl->data.v_string = icalmemory_strdup(v);
+
+ if (impl->data.v_string == 0){
+ errno = ENOMEM;
+ }
+
icalvalue_reset_kind(impl);
}
-enum icalproperty_class icalvalue_get_class(icalvalue* value) {
+const char* icalvalue_get_binary(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_CLASS_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_enum;
+ icalerror_check_value_type(value, ICAL_BINARY_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_string;
}
-icalvalue* icalvalue_new_date (struct icaltimetype v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATE_VALUE);
+icalvalue* icalvalue_new_period (struct icalperiodtype v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_PERIOD_VALUE);
- icalvalue_set_date((icalvalue*)impl,v);
+ icalvalue_set_period((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_date(icalvalue* value, struct icaltimetype v) {
+void icalvalue_set_period(icalvalue* value, struct icalperiodtype v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_DATE_VALUE);
+ icalerror_check_value_type(value, ICAL_PERIOD_VALUE);
impl = (struct icalvalue_impl*)value;
- impl->data.v_time = v;
+ impl->data.v_period = v;
icalvalue_reset_kind(impl);
}
-struct icaltimetype icalvalue_get_date(icalvalue* value) {
+struct icalperiodtype icalvalue_get_period(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_DATE_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_time;
+ icalerror_check_value_type(value, ICAL_PERIOD_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_period;
}
-icalvalue* icalvalue_new_string (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STRING_VALUE);
- icalerror_check_arg_rz( (v!=0),"v");
-
- icalvalue_set_string((icalvalue*)impl,v);
+icalvalue* icalvalue_new_float (float v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_FLOAT_VALUE);
+
+ icalvalue_set_float((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_string(icalvalue* value, const char* v) {
+void icalvalue_set_float(icalvalue* value, float v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_arg_rv( (v!=0),"v");
-
- icalerror_check_value_type(value, ICAL_STRING_VALUE);
+
+ icalerror_check_value_type(value, ICAL_FLOAT_VALUE);
impl = (struct icalvalue_impl*)value;
- if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
- impl->data.v_string = icalmemory_strdup(v);
-
- if (impl->data.v_string == 0){
- errno = ENOMEM;
- }
-
+ impl->data.v_float = v;
icalvalue_reset_kind(impl);
}
-const char* icalvalue_get_string(icalvalue* value) {
+float icalvalue_get_float(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_STRING_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_string;
+ icalerror_check_value_type(value, ICAL_FLOAT_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_float;
}
@@ -563,7 +435,7 @@ void icalvalue_set_integer(icalvalue* value, int v) {
icalvalue_reset_kind(impl);
}
-int icalvalue_get_integer(icalvalue* value) {
+int icalvalue_get_integer(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_INTEGER_VALUE);
@@ -572,46 +444,46 @@ int icalvalue_get_integer(icalvalue* value) {
-icalvalue* icalvalue_new_period (struct icalperiodtype v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_PERIOD_VALUE);
+icalvalue* icalvalue_new_class (enum icalproperty_class v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CLASS_VALUE);
- icalvalue_set_period((icalvalue*)impl,v);
+ icalvalue_set_class((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_period(icalvalue* value, struct icalperiodtype v) {
+void icalvalue_set_class(icalvalue* value, enum icalproperty_class v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_PERIOD_VALUE);
+ icalerror_check_value_type(value, ICAL_CLASS_VALUE);
impl = (struct icalvalue_impl*)value;
- impl->data.v_period = v;
+ impl->data.v_enum = v;
icalvalue_reset_kind(impl);
}
-struct icalperiodtype icalvalue_get_period(icalvalue* value) {
+enum icalproperty_class icalvalue_get_class(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_PERIOD_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_period;
+ icalerror_check_value_type(value, ICAL_CLASS_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_enum;
}
-icalvalue* icalvalue_new_text (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TEXT_VALUE);
+icalvalue* icalvalue_new_uri (const char* v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_URI_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
- icalvalue_set_text((icalvalue*)impl,v);
+ icalvalue_set_uri((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_text(icalvalue* value, const char* v) {
+void icalvalue_set_uri(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_arg_rv( (v!=0),"v");
- icalerror_check_value_type(value, ICAL_TEXT_VALUE);
+ icalerror_check_value_type(value, ICAL_URI_VALUE);
impl = (struct icalvalue_impl*)value;
if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
@@ -625,10 +497,10 @@ void icalvalue_set_text(icalvalue* value, const char* v) {
icalvalue_reset_kind(impl);
}
-const char* icalvalue_get_text(icalvalue* value) {
+const char* icalvalue_get_uri(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_TEXT_VALUE);
+ icalerror_check_value_type(value, ICAL_URI_VALUE);
return ((struct icalvalue_impl*)value)->data.v_string;
}
@@ -652,7 +524,7 @@ void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v) {
icalvalue_reset_kind(impl);
}
-struct icaldurationtype icalvalue_get_duration(icalvalue* value) {
+struct icaldurationtype icalvalue_get_duration(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_DURATION_VALUE);
@@ -679,7 +551,7 @@ void icalvalue_set_boolean(icalvalue* value, int v) {
icalvalue_reset_kind(impl);
}
-int icalvalue_get_boolean(icalvalue* value) {
+int icalvalue_get_boolean(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_BOOLEAN_VALUE);
@@ -688,19 +560,19 @@ int icalvalue_get_boolean(icalvalue* value) {
-icalvalue* icalvalue_new_uri (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_URI_VALUE);
+icalvalue* icalvalue_new_caladdress (const char* v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CALADDRESS_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
- icalvalue_set_uri((icalvalue*)impl,v);
+ icalvalue_set_caladdress((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_uri(icalvalue* value, const char* v) {
+void icalvalue_set_caladdress(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_arg_rv( (v!=0),"v");
- icalerror_check_value_type(value, ICAL_URI_VALUE);
+ icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE);
impl = (struct icalvalue_impl*)value;
if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
@@ -714,38 +586,65 @@ void icalvalue_set_uri(icalvalue* value, const char* v) {
icalvalue_reset_kind(impl);
}
-const char* icalvalue_get_uri(icalvalue* value) {
+const char* icalvalue_get_caladdress(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_URI_VALUE);
+ icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE);
return ((struct icalvalue_impl*)value)->data.v_string;
}
-icalvalue* icalvalue_new_geo (struct icalgeotype v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_GEO_VALUE);
+icalvalue* icalvalue_new_xlicclass (enum icalproperty_xlicclass v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_XLICCLASS_VALUE);
- icalvalue_set_geo((icalvalue*)impl,v);
+ icalvalue_set_xlicclass((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_geo(icalvalue* value, struct icalgeotype v) {
+void icalvalue_set_xlicclass(icalvalue* value, enum icalproperty_xlicclass v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_GEO_VALUE);
+ icalerror_check_value_type(value, ICAL_XLICCLASS_VALUE);
impl = (struct icalvalue_impl*)value;
- impl->data.v_geo = v;
+ impl->data.v_enum = v;
icalvalue_reset_kind(impl);
}
-struct icalgeotype icalvalue_get_geo(icalvalue* value) {
+enum icalproperty_xlicclass icalvalue_get_xlicclass(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_GEO_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_geo;
+ icalerror_check_value_type(value, ICAL_XLICCLASS_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_enum;
+}
+
+
+
+icalvalue* icalvalue_new_action (enum icalproperty_action v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_ACTION_VALUE);
+
+ icalvalue_set_action((icalvalue*)impl,v);
+ return (icalvalue*)impl;
+}
+void icalvalue_set_action(icalvalue* value, enum icalproperty_action v) {
+ struct icalvalue_impl* impl;
+ icalerror_check_arg_rv( (value!=0),"value");
+
+ icalerror_check_value_type(value, ICAL_ACTION_VALUE);
+ impl = (struct icalvalue_impl*)value;
+
+
+ impl->data.v_enum = v;
+
+ icalvalue_reset_kind(impl);
+}
+enum icalproperty_action icalvalue_get_action(const icalvalue* value) {
+
+ icalerror_check_arg( (value!=0),"value");
+ icalerror_check_value_type(value, ICAL_ACTION_VALUE);
+ return ((struct icalvalue_impl*)value)->data.v_enum;
}
@@ -768,7 +667,7 @@ void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v) {
icalvalue_reset_kind(impl);
}
-struct icaltimetype icalvalue_get_datetime(icalvalue* value) {
+struct icaltimetype icalvalue_get_datetime(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_DATETIME_VALUE);
@@ -795,7 +694,7 @@ void icalvalue_set_utcoffset(icalvalue* value, int v) {
icalvalue_reset_kind(impl);
}
-int icalvalue_get_utcoffset(icalvalue* value) {
+int icalvalue_get_utcoffset(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_UTCOFFSET_VALUE);
@@ -804,17 +703,17 @@ int icalvalue_get_utcoffset(icalvalue* value) {
-icalvalue* icalvalue_new_action (enum icalproperty_action v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_ACTION_VALUE);
+icalvalue* icalvalue_new_method (enum icalproperty_method v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_METHOD_VALUE);
- icalvalue_set_action((icalvalue*)impl,v);
+ icalvalue_set_method((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_action(icalvalue* value, enum icalproperty_action v) {
+void icalvalue_set_method(icalvalue* value, enum icalproperty_method v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_ACTION_VALUE);
+ icalerror_check_value_type(value, ICAL_METHOD_VALUE);
impl = (struct icalvalue_impl*)value;
@@ -822,160 +721,287 @@ void icalvalue_set_action(icalvalue* value, enum icalproperty_action v) {
icalvalue_reset_kind(impl);
}
-enum icalproperty_action icalvalue_get_action(icalvalue* value) {
+enum icalproperty_method icalvalue_get_method(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_ACTION_VALUE);
+ icalerror_check_value_type(value, ICAL_METHOD_VALUE);
return ((struct icalvalue_impl*)value)->data.v_enum;
}
+int icalvalue_kind_is_valid(const icalvalue_kind kind)
+{
+ int i = 0;
+ do {
+ if (value_map[i].kind == kind)
+ return 1;
+ } while (value_map[i++].kind != ICAL_NO_VALUE);
-icalvalue* icalvalue_new_caladdress (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CALADDRESS_VALUE);
+ return 0;
+}
+
+const char* icalvalue_kind_to_string(const icalvalue_kind kind)
+{
+ int i;
+
+ for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) {
+ if (value_map[i].kind == kind) {
+ return value_map[i].name;
+ }
+ }
+
+ return 0;
+}
+
+icalvalue_kind icalvalue_string_to_kind(const char* str)
+{
+ int i;
+
+ for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) {
+ if (strcmp(value_map[i].name,str) == 0) {
+ return value_map[i].kind;
+ }
+ }
+
+ return value_map[i].kind;
+
+}
+
+icalvalue* icalvalue_new_x (const char* v){
+ struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_X_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
- icalvalue_set_caladdress((icalvalue*)impl,v);
+ icalvalue_set_x((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_caladdress(icalvalue* value, const char* v) {
- struct icalvalue_impl* impl;
- icalerror_check_arg_rv( (value!=0),"value");
+void icalvalue_set_x(icalvalue* impl, const char* v) {
+ icalerror_check_arg_rv( (impl!=0),"value");
icalerror_check_arg_rv( (v!=0),"v");
- icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE);
- impl = (struct icalvalue_impl*)value;
- if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
-
+ if(impl->x_value!=0) {free((void*)impl->x_value);}
- impl->data.v_string = icalmemory_strdup(v);
+ impl->x_value = icalmemory_strdup(v);
- if (impl->data.v_string == 0){
+ if (impl->x_value == 0){
errno = ENOMEM;
}
-
- icalvalue_reset_kind(impl);
-}
-const char* icalvalue_get_caladdress(icalvalue* value) {
+ }
+const char* icalvalue_get_x(const icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_string;
+ icalerror_check_value_type(value, ICAL_X_VALUE);
+ return value->x_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);
-
-icalvalue* icalvalue_new_float (float v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_FLOAT_VALUE);
-
- icalvalue_set_float((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_float(icalvalue* value, float v) {
- struct icalvalue_impl* impl;
- icalerror_check_arg_rv( (value!=0),"value");
-
- icalerror_check_value_type(value, ICAL_FLOAT_VALUE);
- impl = (struct icalvalue_impl*)value;
+void
+icalvalue_set_recur(icalvalue* impl, struct icalrecurrencetype v)
+{
+ icalerror_check_arg_rv( (impl!=0),"value");
+ icalerror_check_value_type(value, ICAL_RECUR_VALUE);
- impl->data.v_float = v;
+ if (impl->data.v_recur != 0){
+ free(impl->data.v_recur);
+ impl->data.v_recur = 0;
+ }
- icalvalue_reset_kind(impl);
+ impl->data.v_recur = malloc(sizeof(struct icalrecurrencetype));
+
+ if (impl->data.v_recur == 0){
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return;
+ } else {
+ memcpy(impl->data.v_recur, &v, sizeof(struct icalrecurrencetype));
+ }
+
}
-float icalvalue_get_float(icalvalue* value) {
+struct icalrecurrencetype
+icalvalue_get_recur(const icalvalue* value)
+{
icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_FLOAT_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_float;
+ icalerror_check_value_type(value, ICAL_RECUR_VALUE);
+
+ return *(value->data.v_recur);
}
-icalvalue* icalvalue_new_requeststatus (struct icalreqstattype v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_REQUESTSTATUS_VALUE);
-
- icalvalue_set_requeststatus((icalvalue*)impl,v);
+
+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_requeststatus(icalvalue* value, struct icalreqstattype v) {
- struct icalvalue_impl* impl;
+
+void
+icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v)
+{
icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_REQUESTSTATUS_VALUE);
- impl = (struct icalvalue_impl*)value;
+ if(!icaltime_is_null_time(v.time)){
+ icalvalue_set_datetime(value,v.time);
+ value->kind = ICAL_DATETIME_VALUE;
+ } else {
+ icalvalue_set_duration(value,v.duration);
+ value->kind = ICAL_DURATION_VALUE;
+ }
+}
+struct icaltriggertype
+icalvalue_get_trigger(const icalvalue* impl)
+{
+ struct icaltriggertype tr;
- impl->data.v_requeststatus = v;
+ icalerror_check_arg( (impl!=0),"value");
+ icalerror_check_arg( (impl!=0),"value");
- icalvalue_reset_kind(impl);
-}
-struct icalreqstattype icalvalue_get_requeststatus(icalvalue* 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);
+ }
- icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_REQUESTSTATUS_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_requeststatus;
+ 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(impl,v);
-icalvalue* icalvalue_new_method (enum icalproperty_method v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_METHOD_VALUE);
-
- icalvalue_set_method((icalvalue*)impl,v);
return (icalvalue*)impl;
}
-void icalvalue_set_method(icalvalue* value, enum icalproperty_method v) {
- struct icalvalue_impl* impl;
- icalerror_check_arg_rv( (value!=0),"value");
-
- icalerror_check_value_type(value, ICAL_METHOD_VALUE);
- impl = (struct icalvalue_impl*)value;
-
- impl->data.v_enum = v;
+void
+icalvalue_set_datetimeperiod(icalvalue* impl, struct icaldatetimeperiodtype v)
+{
+ icalerror_check_arg_rv( (impl!=0),"value");
+
+ icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
- icalvalue_reset_kind(impl);
+ 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);
+ }
}
-enum icalproperty_method icalvalue_get_method(icalvalue* value) {
- icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_METHOD_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_enum;
-}
+struct icaldatetimeperiodtype
+icalvalue_get_datetimeperiod(const icalvalue* impl)
+{
+ struct icaldatetimeperiodtype dtp;
+
+ icalerror_check_arg( (impl!=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;
+}
-icalvalue* icalvalue_new_binary (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_BINARY_VALUE);
- icalerror_check_arg_rz( (v!=0),"v");
- icalvalue_set_binary((icalvalue*)impl,v);
- return (icalvalue*)impl;
-}
-void icalvalue_set_binary(icalvalue* value, const char* v) {
- struct icalvalue_impl* impl;
- icalerror_check_arg_rv( (value!=0),"value");
- icalerror_check_arg_rv( (v!=0),"v");
+icalvalue *
+icalvalue_new_attach (icalattach *attach)
+{
+ struct icalvalue_impl *impl;
- icalerror_check_value_type(value, ICAL_BINARY_VALUE);
- impl = (struct icalvalue_impl*)value;
- if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
+ icalerror_check_arg_rz ((attach != NULL), "attach");
+ impl = icalvalue_new_impl (ICAL_ATTACH_VALUE);
+ if (!impl) {
+ errno = ENOMEM;
+ return NULL;
+ }
- impl->data.v_string = icalmemory_strdup(v);
+ icalvalue_set_attach ((icalvalue *) impl, attach);
+ return (icalvalue *) impl;
+}
- if (impl->data.v_string == 0){
- errno = ENOMEM;
- }
+void
+icalvalue_set_attach (icalvalue *value, icalattach *attach)
+{
+ struct icalvalue_impl *impl;
+
+ icalerror_check_arg_rv ((value != NULL), "value");
+ icalerror_check_value_type (value, ICAL_ATTACH_VALUE);
+ icalerror_check_arg_rv ((attach != NULL), "attach");
+
+ impl = (struct icalvalue_impl *) value;
+ icalattach_ref (attach);
- icalvalue_reset_kind(impl);
+ if (impl->data.v_attach)
+ icalattach_unref (impl->data.v_attach);
+
+ impl->data.v_attach = attach;
}
-const char* icalvalue_get_binary(icalvalue* value) {
- icalerror_check_arg( (value!=0),"value");
- icalerror_check_value_type(value, ICAL_BINARY_VALUE);
- return ((struct icalvalue_impl*)value)->data.v_string;
+icalattach *
+icalvalue_get_attach (const icalvalue *value)
+{
+ icalerror_check_arg_rz ((value != NULL), "value");
+ icalerror_check_value_type (value, ICAL_ATTACH_VALUE);
+
+ return value->data.v_attach;
}
+
+
+
+
+
+
+
+/* The remaining interfaces are 'new', 'set' and 'get' for each of the value
+ types */
+
+
+/* Everything below this line is machine generated. Do not edit. */