Index: design-data/value-types.csv =================================================================== --- design-data/value-types.csv (revision 932) +++ design-data/value-types.csv (working copy) @@ -3,7 +3,7 @@ "BOOLEAN","(a)int","integer","unitary", "CAL-ADDRESS","(a)const char*","string","unitary", "DATE","(a)struct icaltimetype","Time","unitary", -"DATE-TIME","(a)struct icaltimetype","Time","unitary", +"DATE-TIME","(m)struct icaltimetype","Time","unitary", "DURATION","(a)struct icaldurationtype","Duration","unitary", "FLOAT","(a)float","float","unitary", "INTEGER","(a)int","integer","unitary", @@ -23,10 +23,10 @@ "ACTION","(a)enum icalproperty_action","string","unitary","AUDIO;DISPLAY;EMAIL;PROCEDURE" "STATUS","(a)enum icalproperty_status","string","unitary","TENTATIVE;CONFIRMED;COMPLETED;NEEDS-ACTION;CANCELLED;IN-PROCESS;DRAFT;FINAL" "TRANSP","(a)enum icalproperty_transp","string","unitary","OPAQUE;OPAQUE-NOCONFLICT;TRANSPARENT;TRANSPARENT-NOCONFLICT" -"CLASS","(a)enum icalproperty_class","string","unitary","PUBLIC;PRIVATE;CONFIDENTIAL" +"CLASS","(m)enum icalproperty_class","string","unitary","PUBLIC;PRIVATE;CONFIDENTIAL" "#Other non-standard",,,, "REQUEST-STATUS","(a)struct icalreqstattype","string","unitary" -"GEO","(a)struct icalgeotype","tuple","unitary", +"GEO","(m)struct icalgeotype","tuple","unitary", "STRING","(a)const char*","string","unitary", "X","(m)const char*","string","unitary", "#CAP enumeration types",,,, Index: src/libical/icalderivedvalue.h.in =================================================================== --- src/libical/icalderivedvalue.h.in (revision 932) +++ src/libical/icalderivedvalue.h.in (working copy) @@ -38,8 +38,6 @@ typedef struct icalvalue_impl icalvalue; - - void icalvalue_set_x(icalvalue* value, const char* v); icalvalue* icalvalue_new_x(const char* v); const char* icalvalue_get_x(const icalvalue* value); @@ -52,10 +50,19 @@ void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v); struct icaltriggertype icalvalue_get_trigger(const icalvalue* value); +icalvalue* icalvalue_new_datetime(struct icaltimetype v); +struct icaltimetype icalvalue_get_datetime(const icalvalue* value); +void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v); + icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v); void icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v); struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(const icalvalue* value); +/* GEO */ +icalvalue* icalvalue_new_geo(struct icalgeotype v); +struct icalgeotype icalvalue_get_geo(const icalvalue* value); +void icalvalue_set_geo(icalvalue* value, struct icalgeotype v); + icalvalue *icalvalue_new_attach (icalattach *attach); void icalvalue_set_attach (icalvalue *value, icalattach *attach); icalattach *icalvalue_get_attach (const icalvalue *value); @@ -63,3 +70,8 @@ void icalvalue_reset_kind(icalvalue* value); + + +icalvalue* icalvalue_new_class(enum icalproperty_class v); +enum icalproperty_class icalvalue_get_class(const icalvalue* value); +void icalvalue_set_class(icalvalue* value, enum icalproperty_class v); Index: src/libical/icalderivedvalue.c.in =================================================================== --- src/libical/icalderivedvalue.c.in (revision 932) +++ src/libical/icalderivedvalue.c.in (working copy) @@ -125,7 +125,7 @@ } const char* icalvalue_get_x(const icalvalue* value) { - icalerror_check_arg( (value!=0),"value"); + icalerror_check_arg_rz( (value!=0),"value"); icalerror_check_value_type(value, ICAL_X_VALUE); return value->x_value; } @@ -166,7 +166,10 @@ struct icalrecurrencetype icalvalue_get_recur(const icalvalue* value) { - icalerror_check_arg( (value!=0),"value"); + struct icalrecurrencetype rt; + icalrecurrencetype_clear(&rt); + + icalerror_check_arg_rx( (value!=0),"value", rt); icalerror_check_value_type(value, ICAL_RECUR_VALUE); return *(value->data.v_recur); @@ -204,9 +207,11 @@ { struct icaltriggertype tr; - icalerror_check_arg( (impl!=0),"value"); - icalerror_check_arg( (impl!=0),"value"); + tr.duration = icaldurationtype_from_int(0); + tr.time = icaltime_null_time(); + icalerror_check_arg_rx( (impl!=0),"value", tr); + if(impl) { if(impl->kind == ICAL_DATETIME_VALUE){ tr.duration = icaldurationtype_from_int(0); @@ -228,6 +233,38 @@ return tr; } +icalvalue* +icalvalue_new_datetime (struct icaltimetype v){ + + struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIME_VALUE); + icalvalue_set_datetime((icalvalue*)impl,v); + return (icalvalue*)impl; +} + +void +icalvalue_set_datetime(icalvalue* value, struct icaltimetype v) { + struct icalvalue_impl* impl; + icalerror_check_arg_rv( (value!=0),"value"); + + icalerror_check_value_type(value, ICAL_DATETIME_VALUE); + impl = (struct icalvalue_impl*)value; + + + impl->data.v_time = v; + + icalvalue_reset_kind(impl); +} + +struct icaltimetype +icalvalue_get_datetime (const icalvalue* value) { + struct icaltimetype dt; + dt = icaltime_null_time(); + + icalerror_check_arg_rx((value!=0),"value", dt); + icalerror_check_value_type (value, ICAL_DATETIME_VALUE); + return ((struct icalvalue_impl*)value)->data.v_time; +} + /* DATE-TIME-PERIOD is a special case, and is not auto generated */ icalvalue* @@ -270,8 +307,11 @@ icalvalue_get_datetimeperiod(const icalvalue* impl) { struct icaldatetimeperiodtype dtp; - - icalerror_check_arg( (impl!=0),"value"); + + dtp.period = icalperiodtype_null_period(); + dtp.time = icaltime_null_time(); + + icalerror_check_arg_rx( (impl!=0),"value", dtp); icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE); if(impl) { @@ -295,8 +335,72 @@ return dtp; } +icalvalue* +icalvalue_new_class (enum icalproperty_class v){ + struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CLASS_VALUE); + icalvalue_set_class((icalvalue*)impl,v); + return (icalvalue*)impl; +} +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_CLASS_VALUE); + impl = (struct icalvalue_impl*)value; + + impl->data.v_enum = v; + + icalvalue_reset_kind(impl); +} + +enum icalproperty_class +icalvalue_get_class (const icalvalue* value) { + + icalproperty_class pr; + pr = ICAL_CLASS_NONE; + + icalerror_check_arg_rx ((value!=NULL),"value", pr); + icalerror_check_arg ((value!=0),"value"); + icalerror_check_value_type (value, ICAL_CLASS_VALUE); + return ((struct icalvalue_impl*)value)->data.v_enum; +} + +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_geo(icalvalue* value, struct icalgeotype v) { + struct icalvalue_impl* impl; + icalerror_check_arg_rv( (value!=0),"value"); + + icalerror_check_value_type(value, ICAL_GEO_VALUE); + impl = (struct icalvalue_impl*)value; + + impl->data.v_geo = v; + + icalvalue_reset_kind(impl); +} + +struct icalgeotype +icalvalue_get_geo (const icalvalue* value) { + struct icalgeotype gt; + gt.lat = 255.0; + gt.lon = 255.0; + + icalerror_check_arg_rx((value!=0),"value", gt); + icalerror_check_value_type (value, ICAL_GEO_VALUE); + return ((struct icalvalue_impl*)value)->data.v_geo; +} + + icalvalue * icalvalue_new_attach (icalattach *attach) {