Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
icalperiod.h File Reference
#include "icaltime.h"
#include "icalduration.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  icalperiodtype

Functions

struct icalperiodtype icalperiodtype_from_string (const char *str)
const char * icalperiodtype_as_ical_string (struct icalperiodtype p)
struct icalperiodtype icalperiodtype_null_period (void)
int icalperiodtype_is_null_period (struct icalperiodtype p)
int icalperiodtype_is_valid_period (struct icalperiodtype p)

Class Documentation

struct icalperiodtype

Definition at line 453 of file ical.h.


Function Documentation

Definition at line 107 of file icalperiod.c.

{

    const char* start;
    const char* end;

    char *buf;
    size_t buf_size = 40;
    char* buf_ptr = 0;

    buf = (char*)icalmemory_new_buffer(buf_size);
    buf_ptr = buf;
    

    start = icaltime_as_ical_string(p.start);

    icalmemory_append_string(&buf, &buf_ptr, &buf_size, start); 

    if(!icaltime_is_null_time(p.end)){
       end = icaltime_as_ical_string(p.end);
    } else {
       end = icaldurationtype_as_ical_string(p.duration);
    }

    icalmemory_append_char(&buf, &buf_ptr, &buf_size, '/'); 

    icalmemory_append_string(&buf, &buf_ptr, &buf_size, end); 
    
       icalmemory_add_tmp_buffer(buf);

    return buf;
}

Here is the call graph for this function:

struct icalperiodtype icalperiodtype_from_string ( const char *  str) [read]

Definition at line 45 of file icalperiod.c.

{
    
    struct icalperiodtype p, null_p;
    char *s = icalmemory_strdup(str);
    char *start, *end = s;
    icalerrorstate es;

    /* Errors are normally generated in the following code, so save
       the error state for resoration later */

    icalerrorenum e = icalerrno;

    p.start = p.end = icaltime_null_time();
    p.duration = icaldurationtype_from_int(0);

    null_p = p;

    if(s == 0) goto error;

    start = s;
    end = strchr(s, '/');

    if(end == 0) goto error;

    *end = 0;
    end++;

    p.start = icaltime_from_string(start);

    if (icaltime_is_null_time(p.start)) goto error;

    es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR);
    icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_NONFATAL);

    p.end = icaltime_from_string(end);

    icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es);
    

    if (icaltime_is_null_time(p.end)){

       p.duration = icaldurationtype_from_string(end);

       if(icaldurationtype_as_int(p.duration) == 0) goto error;
    } 

    icalerrno = e;

    icalmemory_free_buffer(s);

    return p;

 error:
    icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);

    if (s)
       icalmemory_free_buffer (s);
    return null_p;
}

Here is the call graph for this function:

Definition at line 150 of file icalperiod.c.

                                                          {
    
    if(icaltime_is_null_time(p.start) && 
       icaltime_is_null_time(p.end) && 
       icaldurationtype_is_null_duration(p.duration)){
       return 1;
    } else {
       return 0;
    }
}

Here is the call graph for this function:

Definition at line 161 of file icalperiod.c.

                                                           {
    if(icaltime_is_valid_time(p.start) && 
       (icaltime_is_valid_time(p.end) || icaltime_is_null_time(p.end)) )
       {
           return 1;
       }

    return 0;
}

Here is the call graph for this function:

Definition at line 142 of file icalperiod.c.

                                                       {
    struct icalperiodtype p;
    p.start = icaltime_null_time();
    p.end = icaltime_null_time();
    p.duration = icaldurationtype_null_duration();

    return p;
}

Here is the call graph for this function: