rem: if(!icaltime_is_null_time(tt)) value = icalvalue_new_time(tt); break; } case ICAL_DATE_VALUE: { struct icaltimetype tt; tt = icaltime_from_string(str); if(!icaltime_is_null_time(tt)) value = icalvalue_new_date(tt); break; } case ICAL_DATETIME_VALUE: { struct icaltimetype tt; tt = icaltime_from_string(str); if(!icaltime_is_null_time(tt)) value = icalvalue_new_datetime(tt); break; } case ICAL_DATETIMEDATE_VALUE: { struct icaltimetype tt; tt = icaltime_from_string(str); if(!icaltime_is_null_time(tt)) value = icalvalue_new_datetimedate(tt); break; }  case ICAL_DATETIMEPERIOD_VALUE:
add: if(!icaltime_is_null_time(tt)){ value = icalvalue_new_impl(kind); value->data.v_time = tt;  icalvalue_reset_kind(value); } break; }  case ICAL_DATETIMEPERIOD_VALUE:
context: icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* str,icalproperty** error){    icalvalue *value = 0;        icalerror_check_arg_rz(str!=0,"str");    if (error != 0){	*error = 0;    }    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); 	    }	    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;	    if (error != 0){		char temp[TMP_BUF_SIZE];		sprintf(temp,"BOOLEAN Values are not implemented"); 		*error = icalproperty_vanew_xlicerror( 		    temp, 		    icalparameter_new_xlicerrortype( 			ICAL_XLICERRORTYPE_VALUEPARSEERROR), 		    0); 	    }	    icalerror_warn("Parsing BOOLEAN values is unimplmeneted");	    break;	}	case ICAL_INTEGER_VALUE:	{	    value = icalvalue_new_integer(atoi(str));	    break;	}	case ICAL_FLOAT_VALUE:	{	    value = icalvalue_new_float(atof(str));	    break;	}	case ICAL_UTCOFFSET_VALUE:	{	    value = icalparser_parse_value(kind,str,(icalcomponent*)0);	    break;	}	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:	{	    value = icalvalue_new_string(str);	    break;	}	case ICAL_CALADDRESS_VALUE:	{	    value = icalvalue_new_caladdress(str);	    break;	}	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:	{	    value = 0;	    /* HACK */	    if (error != 0){		char temp[TMP_BUF_SIZE];		sprintf(temp,"GEO Values are not implemented"); 		*error = icalproperty_vanew_xlicerror( 		    temp, 		    icalparameter_new_xlicerrortype( 			ICAL_XLICERRORTYPE_VALUEPARSEERROR), 		    0); 	    }	    /*icalerror_warn("Parsing GEO properties is unimplmeneted");*/	    break;	}	case ICAL_RECUR_VALUE:	{	    struct icalrecurrencetype rt;	    rt = icalrecurrencetype_from_string(str);	    value = icalvalue_new_recur(rt);	    break;	}	case ICAL_TIME_VALUE:	{	    struct icaltimetype tt;	    tt = icaltime_from_string(str);            if(!icaltime_is_null_time(tt))                value = icalvalue_new_time(tt);	    break;	}	case ICAL_DATE_VALUE:	{	    struct icaltimetype tt;	    tt = icaltime_from_string(str);            if(!icaltime_is_null_time(tt))                value = icalvalue_new_date(tt);	    break;	}	case ICAL_DATETIME_VALUE:	{	    struct icaltimetype tt;	    tt = icaltime_from_string(str);            if(!icaltime_is_null_time(tt))                value = icalvalue_new_datetime(tt);	    break;	}	case ICAL_DATETIMEDATE_VALUE:	{	    struct icaltimetype tt;	    tt = icaltime_from_string(str);            if(!icaltime_is_null_time(tt))                value = icalvalue_new_datetimedate(tt);	    break;	}	case ICAL_DATETIMEPERIOD_VALUE:	{	    struct icaltimetype tt;            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_DURATION_VALUE:	{            struct icaldurationtype dur = icaldurationtype_from_string(str);                        if(icaldurationtype_is_null_duration(dur)){                value = 0;            } else {                value = icalvalue_new_duration(dur);            }	    break;	}         case ICAL_PERIOD_VALUE:	{          struct icalperiodtype p;          p = icalperiodtype_from_string(str);            if(!icalperiodtype_is_null_period(p)){              value = icalvalue_new_period(p);          }          break; 	}	        case ICAL_TRIGGER_VALUE:	{	    struct icaltriggertype tr = icaltriggertype_from_string(str);	    value = icalvalue_new_trigger(tr);	    break;	}	default:	{	    if (error != 0 ){		char temp[TMP_BUF_SIZE];                snprintf(temp,TMP_BUF_SIZE,"Unknown type for \'%s\'",str);			    		*error = icalproperty_vanew_xlicerror( 		    temp, 		    icalparameter_new_xlicerrortype( 			ICAL_XLICERRORTYPE_VALUEPARSEERROR), 		    0); 	    }	    icalerror_warn("icalvalue_new_from_string got an unknown value type");            value=0;	}    }    if (error != 0 && *error == 0 && value == 0){	char temp[TMP_BUF_SIZE];	        snprintf(temp,TMP_BUF_SIZE,"Failed to parse value: \'%s\'",str);		*error = icalproperty_vanew_xlicerror( 	    temp, 	    icalparameter_new_xlicerrortype( 		ICAL_XLICERRORTYPE_VALUEPARSEERROR), 	    0);     }    return value;}