Back to index

lightning-sunbird  0.9+nobinonly
Functions
icalproperty.h File Reference
#include <time.h>
#include <stdarg.h>
#include "icalderivedparameter.h"
#include "icalvalue.h"
#include "icalrecur.h"
#include "icalderivedproperty.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

icalproperty * icalproperty_new (icalproperty_kind kind)
icalproperty * icalproperty_new_x_name (const char *name, const char *value)
icalproperty * icalproperty_new_clone (icalproperty *prop)
icalproperty * icalproperty_new_from_string (const char *str)
const 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_parameters (struct icalproperty_impl *prop, va_list args)
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)
void icalproperty_remove_parameter_by_kind (icalproperty *prop, icalparameter_kind kind)
 Remove all parameters with the specified kind.
void icalproperty_remove_parameter_by_name (icalproperty *prop, const char *name)
 Remove all parameters with the specified name.
void icalproperty_remove_parameter_by_ref (icalproperty *prop, icalparameter *param)
 Remove the specified parameter reference from the property.
int icalproperty_count_parameters (const icalproperty *prop)
icalparameter * icalproperty_get_first_parameter (icalproperty *prop, icalparameter_kind kind)
icalparameter * icalproperty_get_next_parameter (icalproperty *prop, icalparameter_kind kind)
icalparameter * icalproperty_get_first_x_parameter (icalproperty *prop, const char *name)
icalparameter * icalproperty_get_next_x_parameter (icalproperty *prop, const char *name)
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 (const icalproperty *prop)
const char * icalproperty_get_value_as_string (const icalproperty *prop)
void icalproperty_set_x_name (icalproperty *prop, const char *name)
const char * icalproperty_get_x_name (icalproperty *prop)
const char * icalproperty_get_property_name (const 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.
icalvalue_kind icalparameter_value_to_value_kind (icalparameter_value value)
icalvalue_kind icalproperty_kind_to_value_kind (icalproperty_kind kind)
icalproperty_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)
int icalproperty_kind_is_valid (const icalproperty_kind kind)
 Check validity of a specific icalproperty_kind.
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)
int icalproperty_kind_and_string_to_enum (const int kind, 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)

Function Documentation

Definition at line 1111 of file icalderivedparameter.c.

{
    int i;

    for (i=0; value_kind_map[i].kind  != ICAL_NO_VALUE; i++) {

       if (value_kind_map[i].value == value) {
           return value_kind_map[i].kind;
       }
    }

    return ICAL_NO_VALUE;
}
void icalproperty_add_parameter ( icalproperty *  prop,
icalparameter *  parameter 
)

Definition at line 582 of file icalproperty.c.

{
   icalerror_check_arg_rv( (p!=0),"prop");
   icalerror_check_arg_rv( (parameter!=0),"parameter");
    
   pvl_push(p->parameters, parameter);

}

Here is the call graph for this function:

void icalproperty_add_parameters ( struct icalproperty_impl prop,
va_list  args 
)
const char* icalproperty_as_ical_string ( icalproperty *  prop)

Definition at line 453 of file icalproperty.c.

{   
    icalparameter *param;

    /* 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 */

    const char* property_name = 0; 
    size_t buf_size = 1024;
    char* buf = icalmemory_new_buffer(buf_size);
    char* buf_ptr = buf;
    icalvalue* value;
    char *out_buf;
    const char* kind_string = 0;

#ifdef ICAL_UNIX_NEWLINE
    char newline[] = "\n";
#else
    char newline[] = "\r\n";
#endif


    
    icalerror_check_arg_rz( (prop!=0),"prop");


    /* Append property name */

    if (prop->kind == ICAL_X_PROPERTY && prop->x_name != 0){
       property_name = prop->x_name;
    } else {
       property_name = icalproperty_kind_to_string(prop->kind);
    }

    if (property_name == 0 ) {
       icalerror_warn("Got a property of an unknown kind.");
       icalmemory_free_buffer(buf);
       return 0;
       
    }

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

    kind_string = icalproperty_get_value_kind(prop);
    if(kind_string!=0){
       icalmemory_append_string(&buf, &buf_ptr, &buf_size, ";VALUE=");
       icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
    }

    /* Append parameters */
    for(param = icalproperty_get_first_parameter(prop,ICAL_ANY_PARAMETER);
       param != 0; 
       param = icalproperty_get_next_parameter(prop,ICAL_ANY_PARAMETER)) {

       icalparameter_kind kind = icalparameter_isa(param);
       kind_string = icalparameter_as_ical_string(param); 

       if(kind==ICAL_VALUE_PARAMETER){
           continue;
       }

       if (kind_string == 0 ) {
         icalerror_warn("Got a parameter of unknown kind for the following property");

         icalerror_warn((property_name) ? property_name : "(NULL)");
           continue;
       }

       icalmemory_append_string(&buf, &buf_ptr, &buf_size, ";");
       icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
    }    

    /* Append value */

    icalmemory_append_string(&buf, &buf_ptr, &buf_size, ":");

    value = icalproperty_get_value(prop);

    if (value != 0){
       const char *str = icalvalue_as_ical_string(value);
       icalerror_assert((str !=0),"Could not get string representation of a value");
       icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);
    } else {
       icalmemory_append_string(&buf, &buf_ptr, &buf_size,"ERROR: No Value"); 
       
    }
    
    /* Now, copy the buffer to a tmp_buffer, which is safe to give to
       the caller without worring about de-allocating it. */

    /* We now use a function to fold the line properly every 75 characters.
       That function also adds the newline for us. */
    out_buf = fold_property_line (buf);

    icalmemory_free_buffer(buf);

    return out_buf;
}

Here is the call graph for this function:

int icalproperty_count_parameters ( const icalproperty *  prop)

Definition at line 827 of file icalproperty.c.

{
    if(prop != 0){
       return pvl_count(prop->parameters);
    }

    icalerror_set_errno(ICAL_USAGE_ERROR);
    return -1;
}

Here is the call graph for this function:

Definition at line 2440 of file icalderivedproperty.c.

{
    int i;


    for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) {
        if(enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum == e && 
           enum_map[i-ICALPROPERTY_FIRST_ENUM].prop == kind ){
            return 1;
        }
    }

    return 0;
}
void icalproperty_free ( icalproperty *  prop)

Definition at line 242 of file icalproperty.c.

{
    icalparameter* param;
    
    icalerror_check_arg_rv((p!=0),"prop");

#ifdef ICAL_FREE_ON_LIST_IS_ERROR
    icalerror_assert( (p->parent ==0),"Tried to free a property that is still attached to a component. ");
    
#else
    if(p->parent !=0){
       return;
    }
#endif

    if (p->value != 0){
        icalvalue_set_parent(p->value,0);
       icalvalue_free(p->value);
    }
    
    while( (param = pvl_pop(p->parameters)) != 0){
       icalparameter_free(param);
    }
    
    pvl_free(p->parameters);
    
    if (p->x_name != 0) {
       free(p->x_name);
    }
    
    p->kind = ICAL_NO_PROPERTY;
    p->parameters = 0;
    p->parameter_iterator = 0;
    p->value = 0;
    p->x_name = 0;
    p->id[0] = 'X';
    
    free(p);

}

Here is the call graph for this function:

icalparameter* icalproperty_get_first_parameter ( icalproperty *  prop,
icalparameter_kind  kind 
)

Definition at line 839 of file icalproperty.c.

{
   icalerror_check_arg_rz( (p!=0),"prop");
   
   p->parameter_iterator = pvl_head(p->parameters);

   if (p->parameter_iterator == 0) {
       return 0;
   }

   for( p->parameter_iterator = pvl_head(p->parameters);
       p->parameter_iterator !=0;
       p->parameter_iterator = pvl_next(p->parameter_iterator)){

       icalparameter *param = (icalparameter*)pvl_data(p->parameter_iterator);

       if(icalparameter_isa(param) == kind || kind == ICAL_ANY_PARAMETER){
          return param;
       }
   }

   return 0;
}

Here is the call graph for this function:

icalparameter* icalproperty_get_first_x_parameter ( icalproperty *  prop,
const char *  name 
)

Definition at line 889 of file icalproperty.c.

{
   icalerror_check_arg_rz( (p!=0),"prop");
   
   p->parameter_iterator = pvl_head(p->parameters);

   if (p->parameter_iterator == 0) {
       return 0;
   }

   for( p->parameter_iterator = pvl_head(p->parameters);
       p->parameter_iterator !=0;
       p->parameter_iterator = pvl_next(p->parameter_iterator)){

       icalparameter *param = (icalparameter*)pvl_data(p->parameter_iterator);

       if(icalparameter_isa(param) == ICAL_X_PARAMETER &&
         !strcmp(icalparameter_get_xname(param), name)){
          return param;
       }
   }

   return 0;
}

Here is the call graph for this function:

icalparameter* icalproperty_get_next_parameter ( icalproperty *  prop,
icalparameter_kind  kind 
)

Definition at line 865 of file icalproperty.c.

{
    icalerror_check_arg_rz( (p!=0),"prop");
    
    if (p->parameter_iterator == 0) {
       return 0;
    }
    
    for( p->parameter_iterator = pvl_next(p->parameter_iterator);
        p->parameter_iterator !=0;
        p->parameter_iterator = pvl_next(p->parameter_iterator)){
       
       icalparameter *param = (icalparameter*)pvl_data(p->parameter_iterator);
       
       if(icalparameter_isa(param) == kind || kind == ICAL_ANY_PARAMETER){
           return param;
       }
    }
    
    return 0;

}

Here is the call graph for this function:

icalparameter* icalproperty_get_next_x_parameter ( icalproperty *  prop,
const char *  name 
)

Definition at line 916 of file icalproperty.c.

{
    icalerror_check_arg_rz( (p!=0),"prop");
    
    if (p->parameter_iterator == 0) {
       return 0;
    }
    
    for( p->parameter_iterator = pvl_next(p->parameter_iterator);
        p->parameter_iterator !=0;
        p->parameter_iterator = pvl_next(p->parameter_iterator)){
       
       icalparameter *param = (icalparameter*)pvl_data(p->parameter_iterator);
       
       if(icalparameter_isa(param) == ICAL_X_PARAMETER &&
         !strcmp(icalparameter_get_xname(param), name)){
           return param;
       }
    }
    
    return 0;

}

Here is the call graph for this function:

const char* icalproperty_get_parameter_as_string ( icalproperty *  prop,
const char *  name 
)

Definition at line 642 of file icalproperty.c.

{
    icalparameter_kind kind;
    icalparameter *param;
    char* str;
    char* pv;
    char* pvql;
    char* pvqr;

    icalerror_check_arg_rz( (prop!=0),"prop");
    icalerror_check_arg_rz( (name!=0),"name");
    
    kind = icalparameter_string_to_kind(name);

    if(kind == ICAL_NO_PARAMETER){
        /* icalenum_string_to_parameter_kind will set icalerrno */
        return 0;
    }
    
    for(param = icalproperty_get_first_parameter(prop,kind); 
           param != 0; 
           param = icalproperty_get_next_parameter(prop,kind)) {
           if (kind != ICAL_X_PARAMETER) {
                  break;
           }

           if (strcmp(icalparameter_get_xname(param),name)==0) {
                  break;
           }         
    }

    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;
    }

    // see if this string is quoted, immediately return if not
    // otherwise removed the quotes from the string.
    ++pv;
    pvql = strchr(pv,'"');
    if(pvql == 0)
        return pv;
    pvqr = strrchr(pvql,'"');
    if(pvqr == 0){
        icalerror_set_errno(ICAL_INTERNAL_ERROR);
        return 0;
    }
    *pvqr = '\0';
    return pvql+1;
}

Here is the call graph for this function:

const char* icalproperty_get_property_name ( const 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.

Definition at line 1045 of file icalproperty.c.

{

    const char* property_name = 0;
    size_t buf_size = 256;
    char* buf = icalmemory_new_buffer(buf_size);
    char* buf_ptr = buf;  

    icalerror_check_arg_rz( (prop!=0),"prop");
 
    if (prop->kind == ICAL_X_PROPERTY && prop->x_name != 0){
        property_name = prop->x_name;
    } else {
        property_name = icalproperty_kind_to_string(prop->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;
}

Here is the call graph for this function:

icalvalue* icalproperty_get_value ( const icalproperty *  prop)

Definition at line 1002 of file icalproperty.c.

{
    icalerror_check_arg_rz( (prop!=0),"prop");
    
    return prop->value;
}
const char* icalproperty_get_value_as_string ( const icalproperty *  prop)

Definition at line 1009 of file icalproperty.c.

{
    icalvalue *value;
    
    icalerror_check_arg_rz( (prop!=0),"prop");

    value = prop->value; 

    return icalvalue_as_ical_string(value);
}

Here is the call graph for this function:

const char* icalproperty_get_x_name ( icalproperty *  prop)

Definition at line 1038 of file icalproperty.c.

                                                       {
    icalerror_check_arg_rz( (prop!=0),"prop");

    return prop->x_name;
}
icalproperty_kind icalproperty_isa ( icalproperty *  property)

Definition at line 558 of file icalproperty.c.

{
   if(p != 0){
       return p->kind;
   }

   return ICAL_NO_PROPERTY;
}

Definition at line 568 of file icalproperty.c.

{
    icalproperty *impl = (icalproperty *) property;

    icalerror_check_arg_rz( (property!=0), "property");
    if (strcmp(impl->id,"prop") == 0) {
       return 1;
    } else {
       return 0;
    }
}

Definition at line 2390 of file icalderivedproperty.c.

{
    icalproperty_kind pkind;
    int i;

    icalerror_check_arg_rz(str!=0,"str")

    if ((pkind = icalproperty_value_kind_to_kind(kind)) == ICAL_NO_VALUE)
       return 0;

    while(*str == ' '){
       str++;
    }

    for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) {
       if (enum_map[i-ICALPROPERTY_FIRST_ENUM].prop == pkind)
           break;
    }
    if (i == ICALPROPERTY_LAST_ENUM)
           return 0;

    for (; i != ICALPROPERTY_LAST_ENUM; i++) {
       if ( strcmp(enum_map[i-ICALPROPERTY_FIRST_ENUM].str, str) == 0) {
           return enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum;
       }
    }

    return 0;
}

Here is the call graph for this function:

Check validity of a specific icalproperty_kind.

Definition at line 2303 of file icalderivedproperty.c.

{
    int i = 0;
    do {
      if (property_map[i].kind == kind)
       return 1;
    } while (property_map[i++].kind != ICAL_NO_PROPERTY);

    return 0;
}  

Definition at line 2314 of file icalderivedproperty.c.

{
    int i;

    for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
       if (property_map[i].kind == kind) {
           return property_map[i].name;
       }
    }

    return 0;

}

Definition at line 2368 of file icalderivedproperty.c.

{
    int i;

    for (i=0; property_map[i].kind  != ICAL_NO_PROPERTY; i++) {
       if ( property_map[i].kind == kind ) {
           return property_map[i].value;
       }
    }

    return ICAL_NO_VALUE;
}

Definition at line 2456 of file icalderivedproperty.c.

icalproperty* icalproperty_new ( icalproperty_kind  kind)

Definition at line 121 of file icalproperty.c.

{
    if (kind == ICAL_NO_PROPERTY){
        return 0;
    }

    return (icalproperty*)icalproperty_new_impl(kind);
}

Here is the call graph for this function:

icalproperty* icalproperty_new_clone ( icalproperty *  prop)

Definition at line 149 of file icalproperty.c.

{
    icalproperty *new = icalproperty_new_impl(old->kind);
    pvl_elem p;

    icalerror_check_arg_rz((old!=0),"old");
    icalerror_check_arg_rz((new!=0),"new");

    if (old->value !=0) {
       new->value = icalvalue_new_clone(old->value);
    }

    if (old->x_name != 0) {

       new->x_name = icalmemory_strdup(old->x_name);
       
       if (new->x_name == 0) {
           icalproperty_free(new);
           icalerror_set_errno(ICAL_NEWFAILED_ERROR);
           return 0;
       }
    }

    for(p=pvl_head(old->parameters);p != 0; p = pvl_next(p)){
       icalparameter *param = icalparameter_new_clone(pvl_data(p));
       
       if (param == 0){
           icalproperty_free(new);
           icalerror_set_errno(ICAL_NEWFAILED_ERROR);
           return 0;
       }

       pvl_push(new->parameters,param);
    
    } 

    return new;

}

Here is the call graph for this function:

icalproperty* icalproperty_new_from_string ( const char *  str)

Definition at line 189 of file icalproperty.c.

{

    size_t buf_size = 1024;
    char* buf = icalmemory_new_buffer(buf_size);
    char* buf_ptr = buf;  
    icalproperty *prop;
    icalcomponent *comp;
    int errors  = 0;

#ifdef ICAL_UNIX_NEWLINE
    char newline[] = "\n";
#else
    char newline[] = "\r\n";
#endif

    icalerror_check_arg_rz( (str!=0),"str");

    /* Is this a HACK or a crafty reuse of code? */

    icalmemory_append_string(&buf, &buf_ptr, &buf_size, "BEGIN:VCALENDAR");
    icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
    icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);
    icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
    icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:VCALENDAR");
    icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);

    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 prop;
    }
    
}

Here is the call graph for this function:

icalproperty* icalproperty_new_x_name ( const char *  name,
const char *  value 
)

Definition at line 132 of file icalproperty.c.

                                                             {

       icalproperty   *ret;

       if (name == NULL || value == NULL)
              return NULL;

       ret = icalproperty_new_x(value);
       if (ret == NULL)
              return NULL;

       icalproperty_set_x_name(ret, name);

       return ret;   
}

Here is the call graph for this function:

void icalproperty_remove_parameter ( icalproperty *  prop,
icalparameter_kind  kind 
)
See also:
icalproperty_remove_parameter_by_kind()
Deprecated:
Please use icalproperty_remove_parameter_by_kind() instead.

Definition at line 710 of file icalproperty.c.

Here is the call graph for this function:

void icalproperty_remove_parameter_by_kind ( icalproperty *  prop,
icalparameter_kind  kind 
)

Remove all parameters with the specified kind.

Parameters:
propA valid icalproperty.
kindThe kind to remove (ex. ICAL_TZID_PARAMETER)

See icalproperty_remove_parameter_by_name() and icalproperty_remove_parameter_by_ref() for alternate ways of removing parameters

Definition at line 727 of file icalproperty.c.

{
    pvl_elem p;     

    icalerror_check_arg_rv((prop!=0),"prop");
    
    for(p=pvl_head(prop->parameters);p != 0; p = pvl_next(p)){
       icalparameter* param = (icalparameter *)pvl_data (p);
        if (icalparameter_isa(param) == kind) {
            pvl_remove (prop->parameters, p);
           icalparameter_free(param);
            break;
        }
    }                       
}

Here is the call graph for this function:

void icalproperty_remove_parameter_by_name ( icalproperty *  prop,
const char *  name 
)

Remove all parameters with the specified name.

Parameters:
propA valid icalproperty.
nameThe name of the parameter to remove

This function removes paramters with the given name. The name corresponds to either a built-in name (TZID, etc.) or the name of an extended parameter (X-FOO)

See icalproperty_remove_parameter_by_kind() and icalproperty_remove_parameter_by_ref() for alternate ways of removing parameters

Definition at line 760 of file icalproperty.c.

{
    pvl_elem p;     

    icalerror_check_arg_rv((prop!=0),"prop");
    
    for(p=pvl_head(prop->parameters);p != 0; p = pvl_next(p)){
       icalparameter* param = (icalparameter *)pvl_data (p);
       const char * kind_string;

       if (icalparameter_isa(param) == ICAL_X_PARAMETER)
         kind_string = icalparameter_get_xname(param);
       else
         kind_string = icalparameter_kind_to_string(icalparameter_isa(param));

       if (!kind_string)
         continue;

        if (0 == strcmp(kind_string, name)) {
            pvl_remove (prop->parameters, p);
            icalparameter_free(param);
            break;
        }
    }                       
}

Here is the call graph for this function:

void icalproperty_remove_parameter_by_ref ( icalproperty *  prop,
icalparameter *  parameter 
)

Remove the specified parameter reference from the property.

Parameters:
propA valid icalproperty.
parameterA reference to a specific icalparameter.

This function removes the specified parameter reference from the property.

Definition at line 797 of file icalproperty.c.

{
    pvl_elem p;
    icalparameter_kind kind;
    const char *name;

    icalerror_check_arg_rv((prop!=0),"prop");
    icalerror_check_arg_rv((parameter!=0),"parameter");

    kind = icalparameter_isa(parameter);
    name = icalparameter_get_xname(parameter);

    /*
     * FIXME If it's an X- parameter, also compare the names. It would be nice
     * to have a better abstraction like icalparameter_equals()
     */
    for(p=pvl_head(prop->parameters);p != 0; p = pvl_next(p)){
       icalparameter* p_param = (icalparameter *)pvl_data (p);
       if (icalparameter_isa(p_param) == kind &&
           (kind != ICAL_X_PARAMETER ||
           !strcmp(icalparameter_get_xname(p_param), name))) {
            pvl_remove (prop->parameters, p);
            icalparameter_free(p_param);
            break;
       } 
    }   
}

Here is the call graph for this function:

void icalproperty_set_parameter ( icalproperty *  prop,
icalparameter *  parameter 
)

Definition at line 592 of file icalproperty.c.

{
    icalparameter_kind kind;
    
    icalerror_check_arg_rv( (prop!=0),"prop");
    icalerror_check_arg_rv( (parameter!=0),"parameter");

    kind = icalparameter_isa(parameter);
    if (kind != ICAL_X_PARAMETER)
      icalproperty_remove_parameter_by_kind(prop,kind);
    else
      icalproperty_remove_parameter_by_name(prop, 
                                       icalparameter_get_xname(parameter));

    icalproperty_add_parameter(prop,parameter);
}

Here is the call graph for this function:

void icalproperty_set_parameter_from_string ( icalproperty *  prop,
const char *  name,
const char *  value 
)

Definition at line 609 of file icalproperty.c.

{

    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;
    }

    if(kind == ICAL_X_PARAMETER){
       icalparameter_set_xname(param, name);
    }

    icalproperty_set_parameter(prop,param);

}

Here is the call graph for this function:

void icalproperty_set_value ( icalproperty *  prop,
icalvalue *  value 
)

Definition at line 941 of file icalproperty.c.

{
    icalerror_check_arg_rv((p !=0),"prop");
    icalerror_check_arg_rv((value !=0),"value");
    
    if (p->value != 0){
       icalvalue_set_parent(p->value,0);
       icalvalue_free(p->value);
       p->value = 0;
    }

    p->value = value;
    
    icalvalue_set_parent(value,p);
}

Here is the call graph for this function:

void icalproperty_set_value_from_string ( icalproperty *  prop,
const char *  value,
const char *  kind 
)

Definition at line 958 of file icalproperty.c.

{
    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);


}

Here is the call graph for this function:

void icalproperty_set_x_name ( icalproperty *  prop,
const char *  name 
)

Definition at line 1021 of file icalproperty.c.

{
    icalerror_check_arg_rv( (name!=0),"name");
    icalerror_check_arg_rv( (prop!=0),"prop");

    if (prop->x_name != 0) {
        free(prop->x_name);
    }

    prop->x_name = icalmemory_strdup(name);

    if(prop->x_name == 0){
       icalerror_set_errno(ICAL_NEWFAILED_ERROR);
    }

}

Here is the call graph for this function:

Deprecated:
please use icalproperty_kind_and_string_to_enum instead

Definition at line 2421 of file icalderivedproperty.c.

{
    int i;

    icalerror_check_arg_rz(str!=0,"str")

    while(*str == ' '){
       str++;
    }

    for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) {
       if ( strcmp(enum_map[i-ICALPROPERTY_FIRST_ENUM].str, str) == 0) {
           return enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum;
       }
    }

    return 0;
}

Definition at line 2329 of file icalderivedproperty.c.

{
    int i;

    if (string ==0 ) { 
       return ICAL_NO_PROPERTY;
    }


    for (i=0; property_map[i].kind  != ICAL_NO_PROPERTY; i++) {
       if (strcmp(property_map[i].name, string) == 0) {
           return property_map[i].kind;
       }
    }

    if(strncmp(string,"X-",2)==0){
       return ICAL_X_PROPERTY;
    }


    return ICAL_NO_PROPERTY;
}

Definition at line 2464 of file icalderivedproperty.c.

{
    int i;

    icalerror_check_arg_rx(str!=0,"str",ICAL_METHOD_NONE)

    while(*str == ' '){
       str++;
    }

    for (i=ICAL_METHOD_X-ICALPROPERTY_FIRST_ENUM; 
         i != ICAL_METHOD_NONE-ICALPROPERTY_FIRST_ENUM;
         i++) {
       if ( strcmp(enum_map[i].str, str) == 0) {
           return (icalproperty_method)enum_map[i].prop_enum;
       }
    }

    return ICAL_METHOD_NONE;
}

Definition at line 2353 of file icalderivedproperty.c.

{
    int i;

    for (i=0; property_map[i].kind  != ICAL_NO_PROPERTY; i++) {
       if ( property_map[i].value == kind ) {
           return property_map[i].kind;
       }
    }

    return ICAL_NO_VALUE;
}