Back to index

lightning-sunbird  0.9+nobinonly
icalderivedparameter.c
Go to the documentation of this file.
00001 /* -*- Mode: C -*-
00002   ======================================================================
00003   FILE: icalderivedparameters.{c,h}
00004   CREATOR: eric 09 May 1999
00005   
00006   $Id: icalderivedparameter.c,v 1.5 2002/09/01 19:12:31 gray-john Exp $
00007   $Locker:  $
00008     
00009 
00010  (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
00011 
00012  This program is free software; you can redistribute it and/or modify
00013  it under the terms of either: 
00014 
00015     The LGPL as published by the Free Software Foundation, version
00016     2.1, available at: http://www.fsf.org/copyleft/lesser.html
00017 
00018   Or:
00019 
00020     The Mozilla Public License Version 1.0. You may obtain a copy of
00021     the License at http://www.mozilla.org/MPL/
00022 
00023   The original code is icalderivedparameters.{c,h}
00024 
00025   Contributions from:
00026      Graham Davison (g.m.davison@computer.org)
00027 
00028  ======================================================================*/
00029 /*#line 29 "icalparameter.c.in"*/
00030 #ifdef HAVE_CONFIG_H
00031 #include <config.h>
00032 #endif
00033 
00034 
00035 #include "icalparameter.h"
00036 #include "icalparameterimpl.h"
00037 
00038 #include "icalproperty.h"
00039 #include "icalerror.h"
00040 #include "icalmemory.h"
00041 
00042 #include <stdlib.h> /* for malloc() */
00043 #include <errno.h>
00044 #include <string.h> /* for memset() */
00045 
00046 icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value);
00047 
00048 struct icalparameter_impl* icalparameter_new_impl(icalparameter_kind kind);
00049 
00050 /* This map associates each of the parameters with the string
00051    representation of the paramter's name */
00052 struct icalparameter_kind_map {
00053     icalparameter_kind kind;
00054     char *name;
00055     
00056 };
00057 
00058 /* This map associates the enumerations for the VALUE parameter with
00059    the kinds of VALUEs. */
00060 
00061 struct icalparameter_value_kind_map {
00062     icalparameter_value value; 
00063     icalvalue_kind kind; 
00064 };
00065 
00066 /* This map associates the parameter enumerations with a specific parameter and the string representation of the enumeration */
00067 
00068 struct icalparameter_map {
00069     icalparameter_kind kind;
00070     int enumeration;
00071     const char* str;
00072 };
00073 
00074 
00075 
00076 static struct icalparameter_value_kind_map value_kind_map[15] = {
00077     {ICAL_VALUE_BINARY,ICAL_BINARY_VALUE},
00078     {ICAL_VALUE_BOOLEAN,ICAL_BOOLEAN_VALUE},
00079     {ICAL_VALUE_DATE,ICAL_DATE_VALUE},
00080     {ICAL_VALUE_DURATION,ICAL_DURATION_VALUE},
00081     {ICAL_VALUE_FLOAT,ICAL_FLOAT_VALUE},
00082     {ICAL_VALUE_INTEGER,ICAL_INTEGER_VALUE},
00083     {ICAL_VALUE_PERIOD,ICAL_PERIOD_VALUE},
00084     {ICAL_VALUE_RECUR,ICAL_RECUR_VALUE},
00085     {ICAL_VALUE_TEXT,ICAL_TEXT_VALUE},
00086     {ICAL_VALUE_URI,ICAL_URI_VALUE},
00087     {ICAL_VALUE_DATETIME,ICAL_DATETIME_VALUE},
00088     {ICAL_VALUE_UTCOFFSET,ICAL_UTCOFFSET_VALUE},
00089     {ICAL_VALUE_CALADDRESS,ICAL_CALADDRESS_VALUE},
00090     {ICAL_VALUE_X,ICAL_X_VALUE},
00091     {ICAL_VALUE_NONE,ICAL_NO_VALUE}
00092 };
00093 
00094 static struct icalparameter_kind_map parameter_map[24] = { 
00095     {ICAL_ALTREP_PARAMETER,"ALTREP"},
00096     {ICAL_CN_PARAMETER,"CN"},
00097     {ICAL_CUTYPE_PARAMETER,"CUTYPE"},
00098     {ICAL_DELEGATEDFROM_PARAMETER,"DELEGATED-FROM"},
00099     {ICAL_DELEGATEDTO_PARAMETER,"DELEGATED-TO"},
00100     {ICAL_DIR_PARAMETER,"DIR"},
00101     {ICAL_ENCODING_PARAMETER,"ENCODING"},
00102     {ICAL_FBTYPE_PARAMETER,"FBTYPE"},
00103     {ICAL_FMTTYPE_PARAMETER,"FMTTYPE"},
00104     {ICAL_LANGUAGE_PARAMETER,"LANGUAGE"},
00105     {ICAL_MEMBER_PARAMETER,"MEMBER"},
00106     {ICAL_PARTSTAT_PARAMETER,"PARTSTAT"},
00107     {ICAL_RANGE_PARAMETER,"RANGE"},
00108     {ICAL_RELATED_PARAMETER,"RELATED"},
00109     {ICAL_RELTYPE_PARAMETER,"RELTYPE"},
00110     {ICAL_ROLE_PARAMETER,"ROLE"},
00111     {ICAL_RSVP_PARAMETER,"RSVP"},
00112     {ICAL_SENTBY_PARAMETER,"SENT-BY"},
00113     {ICAL_TZID_PARAMETER,"TZID"},
00114     {ICAL_VALUE_PARAMETER,"VALUE"},
00115     {ICAL_X_PARAMETER,"X"},
00116     {ICAL_XLICCOMPARETYPE_PARAMETER,"X-LIC-COMPARETYPE"},
00117     {ICAL_XLICERRORTYPE_PARAMETER,"X-LIC-ERRORTYPE"},
00118     { ICAL_NO_PARAMETER, ""}
00119 };
00120 
00121 static struct icalparameter_map icalparameter_map[] = {
00122 {ICAL_ANY_PARAMETER,0,""},
00123     {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_INDIVIDUAL,"INDIVIDUAL"},
00124     {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_GROUP,"GROUP"},
00125     {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_RESOURCE,"RESOURCE"},
00126     {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_ROOM,"ROOM"},
00127     {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_UNKNOWN,"UNKNOWN"},
00128     {ICAL_ENCODING_PARAMETER,ICAL_ENCODING_8BIT,"8BIT"},
00129     {ICAL_ENCODING_PARAMETER,ICAL_ENCODING_BASE64,"BASE64"},
00130     {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_FREE,"FREE"},
00131     {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSY,"BUSY"},
00132     {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSYUNAVAILABLE,"BUSYUNAVAILABLE"},
00133     {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSYTENTATIVE,"BUSYTENTATIVE"},
00134     {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_NEEDSACTION,"NEEDS-ACTION"},
00135     {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_ACCEPTED,"ACCEPTED"},
00136     {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_DECLINED,"DECLINED"},
00137     {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_TENTATIVE,"TENTATIVE"},
00138     {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_DELEGATED,"DELEGATED"},
00139     {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_COMPLETED,"COMPLETED"},
00140     {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_INPROCESS,"INPROCESS"},
00141     {ICAL_RANGE_PARAMETER,ICAL_RANGE_THISANDPRIOR,"THISANDPRIOR"},
00142     {ICAL_RANGE_PARAMETER,ICAL_RANGE_THISANDFUTURE,"THISANDFUTURE"},
00143     {ICAL_RELATED_PARAMETER,ICAL_RELATED_START,"START"},
00144     {ICAL_RELATED_PARAMETER,ICAL_RELATED_END,"END"},
00145     {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_PARENT,"PARENT"},
00146     {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_CHILD,"CHILD"},
00147     {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_SIBLING,"SIBLING"},
00148     {ICAL_ROLE_PARAMETER,ICAL_ROLE_CHAIR,"CHAIR"},
00149     {ICAL_ROLE_PARAMETER,ICAL_ROLE_REQPARTICIPANT,"REQ-PARTICIPANT"},
00150     {ICAL_ROLE_PARAMETER,ICAL_ROLE_OPTPARTICIPANT,"OPT-PARTICIPANT"},
00151     {ICAL_ROLE_PARAMETER,ICAL_ROLE_NONPARTICIPANT,"NON-PARTICIPANT"},
00152     {ICAL_RSVP_PARAMETER,ICAL_RSVP_TRUE,"TRUE"},
00153     {ICAL_RSVP_PARAMETER,ICAL_RSVP_FALSE,"FALSE"},
00154     {ICAL_VALUE_PARAMETER,ICAL_VALUE_BINARY,"BINARY"},
00155     {ICAL_VALUE_PARAMETER,ICAL_VALUE_BOOLEAN,"BOOLEAN"},
00156     {ICAL_VALUE_PARAMETER,ICAL_VALUE_DATE,"DATE"},
00157     {ICAL_VALUE_PARAMETER,ICAL_VALUE_DURATION,"DURATION"},
00158     {ICAL_VALUE_PARAMETER,ICAL_VALUE_FLOAT,"FLOAT"},
00159     {ICAL_VALUE_PARAMETER,ICAL_VALUE_INTEGER,"INTEGER"},
00160     {ICAL_VALUE_PARAMETER,ICAL_VALUE_PERIOD,"PERIOD"},
00161     {ICAL_VALUE_PARAMETER,ICAL_VALUE_RECUR,"RECUR"},
00162     {ICAL_VALUE_PARAMETER,ICAL_VALUE_TEXT,"TEXT"},
00163     {ICAL_VALUE_PARAMETER,ICAL_VALUE_URI,"URI"},
00164     {ICAL_VALUE_PARAMETER,ICAL_VALUE_ERROR,"ERROR"},
00165     {ICAL_VALUE_PARAMETER,ICAL_VALUE_DATETIME,"DATE-TIME"},
00166     {ICAL_VALUE_PARAMETER,ICAL_VALUE_UTCOFFSET,"UTC-OFFSET"},
00167     {ICAL_VALUE_PARAMETER,ICAL_VALUE_CALADDRESS,"CAL-ADDRESS"},
00168     {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_EQUAL,"EQUAL"},
00169     {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_NOTEQUAL,"NOTEQUAL"},
00170     {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_LESS,"LESS"},
00171     {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_GREATER,"GREATER"},
00172     {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_LESSEQUAL,"LESSEQUAL"},
00173     {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_GREATEREQUAL,"GREATEREQUAL"},
00174     {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_REGEX,"REGEX"},
00175     {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_ISNULL,"ISNULL"},
00176     {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_ISNOTNULL,"ISNOTNULL"},
00177     {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_COMPONENTPARSEERROR,"COMPONENT-PARSE-ERROR"},
00178     {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PROPERTYPARSEERROR,"PROPERTY-PARSE-ERROR"},
00179     {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR,"PARAMETER-NAME-PARSE-ERROR"},
00180     {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR,"PARAMETER-VALUE-PARSE-ERROR"},
00181     {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_VALUEPARSEERROR,"VALUE-PARSE-ERROR"},
00182     {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_INVALIDITIP,"INVALID-ITIP"},
00183     {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR,"UNKNOWN-VCAL-PROP-ERROR"},
00184     {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_MIMEPARSEERROR,"MIME-PARSE-ERROR"},
00185     {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_VCALPROPPARSEERROR,"VCAL-PROP-PARSE-ERROR"},
00186     {ICAL_NO_PARAMETER,0,""}};
00187 
00188 /* DELEGATED-FROM */
00189 icalparameter* icalparameter_new_delegatedfrom(const char* v)
00190 {
00191    struct icalparameter_impl *impl;
00192    icalerror_clear_errno();
00193    icalerror_check_arg_rz( (v!=0),"v");
00194    impl = icalparameter_new_impl(ICAL_DELEGATEDFROM_PARAMETER);
00195    if (impl == 0) {
00196       return 0;
00197    }
00198 
00199    icalparameter_set_delegatedfrom((icalparameter*) impl,v);
00200    if (icalerrno != ICAL_NO_ERROR) {
00201       icalparameter_free((icalparameter*) impl);
00202       return 0;
00203    }
00204 
00205    return (icalparameter*) impl;
00206 }
00207 
00208 const char* icalparameter_get_delegatedfrom(const icalparameter* param)
00209 {
00210    icalerror_clear_errno();
00211     icalerror_check_arg_rz( (param!=0), "param");
00212     return (const char*)((struct icalparameter_impl*)param)->string;
00213 }
00214 
00215 void icalparameter_set_delegatedfrom(icalparameter* param, const char* v)
00216 {
00217    icalerror_check_arg_rv( (v!=0),"v");
00218    icalerror_check_arg_rv( (param!=0), "param");
00219    icalerror_clear_errno();
00220    
00221    ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
00222 }
00223 
00224 /* RELATED */
00225 icalparameter* icalparameter_new_related(icalparameter_related v)
00226 {
00227    struct icalparameter_impl *impl;
00228    icalerror_clear_errno();
00229    icalerror_check_arg_rz(v >= ICAL_RELATED_X,"v");
00230     icalerror_check_arg_rz(v < ICAL_RELATED_NONE,"v");
00231    impl = icalparameter_new_impl(ICAL_RELATED_PARAMETER);
00232    if (impl == 0) {
00233       return 0;
00234    }
00235 
00236    icalparameter_set_related((icalparameter*) impl,v);
00237    if (icalerrno != ICAL_NO_ERROR) {
00238       icalparameter_free((icalparameter*) impl);
00239       return 0;
00240    }
00241 
00242    return (icalparameter*) impl;
00243 }
00244 
00245 icalparameter_related icalparameter_get_related(const icalparameter* param)
00246 {
00247    icalerror_clear_errno();
00248 icalerror_check_arg( (param!=0), "param");
00249 
00250 return (icalparameter_related)((struct icalparameter_impl*)param)->data;
00251 }
00252 
00253 void icalparameter_set_related(icalparameter* param, icalparameter_related v)
00254 {
00255    icalerror_check_arg_rv(v >= ICAL_RELATED_X,"v");
00256     icalerror_check_arg_rv(v < ICAL_RELATED_NONE,"v");
00257    icalerror_check_arg_rv( (param!=0), "param");
00258    icalerror_clear_errno();
00259    
00260    ((struct icalparameter_impl*)param)->data = (int)v;
00261 }
00262 
00263 /* SENT-BY */
00264 icalparameter* icalparameter_new_sentby(const char* v)
00265 {
00266    struct icalparameter_impl *impl;
00267    icalerror_clear_errno();
00268    icalerror_check_arg_rz( (v!=0),"v");
00269    impl = icalparameter_new_impl(ICAL_SENTBY_PARAMETER);
00270    if (impl == 0) {
00271       return 0;
00272    }
00273 
00274    icalparameter_set_sentby((icalparameter*) impl,v);
00275    if (icalerrno != ICAL_NO_ERROR) {
00276       icalparameter_free((icalparameter*) impl);
00277       return 0;
00278    }
00279 
00280    return (icalparameter*) impl;
00281 }
00282 
00283 const char* icalparameter_get_sentby(const icalparameter* param)
00284 {
00285    icalerror_clear_errno();
00286     icalerror_check_arg_rz( (param!=0), "param");
00287     return (const char*)((struct icalparameter_impl*)param)->string;
00288 }
00289 
00290 void icalparameter_set_sentby(icalparameter* param, const char* v)
00291 {
00292    icalerror_check_arg_rv( (v!=0),"v");
00293    icalerror_check_arg_rv( (param!=0), "param");
00294    icalerror_clear_errno();
00295    
00296    ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
00297 }
00298 
00299 /* LANGUAGE */
00300 icalparameter* icalparameter_new_language(const char* v)
00301 {
00302    struct icalparameter_impl *impl;
00303    icalerror_clear_errno();
00304    icalerror_check_arg_rz( (v!=0),"v");
00305    impl = icalparameter_new_impl(ICAL_LANGUAGE_PARAMETER);
00306    if (impl == 0) {
00307       return 0;
00308    }
00309 
00310    icalparameter_set_language((icalparameter*) impl,v);
00311    if (icalerrno != ICAL_NO_ERROR) {
00312       icalparameter_free((icalparameter*) impl);
00313       return 0;
00314    }
00315 
00316    return (icalparameter*) impl;
00317 }
00318 
00319 const char* icalparameter_get_language(const icalparameter* param)
00320 {
00321    icalerror_clear_errno();
00322     icalerror_check_arg_rz( (param!=0), "param");
00323     return (const char*)((struct icalparameter_impl*)param)->string;
00324 }
00325 
00326 void icalparameter_set_language(icalparameter* param, const char* v)
00327 {
00328    icalerror_check_arg_rv( (v!=0),"v");
00329    icalerror_check_arg_rv( (param!=0), "param");
00330    icalerror_clear_errno();
00331    
00332    ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
00333 }
00334 
00335 /* RELTYPE */
00336 icalparameter* icalparameter_new_reltype(icalparameter_reltype v)
00337 {
00338    struct icalparameter_impl *impl;
00339    icalerror_clear_errno();
00340    icalerror_check_arg_rz(v >= ICAL_RELTYPE_X,"v");
00341     icalerror_check_arg_rz(v < ICAL_RELTYPE_NONE,"v");
00342    impl = icalparameter_new_impl(ICAL_RELTYPE_PARAMETER);
00343    if (impl == 0) {
00344       return 0;
00345    }
00346 
00347    icalparameter_set_reltype((icalparameter*) impl,v);
00348    if (icalerrno != ICAL_NO_ERROR) {
00349       icalparameter_free((icalparameter*) impl);
00350       return 0;
00351    }
00352 
00353    return (icalparameter*) impl;
00354 }
00355 
00356 icalparameter_reltype icalparameter_get_reltype(const icalparameter* param)
00357 {
00358    icalerror_clear_errno();
00359 icalerror_check_arg( (param!=0), "param");
00360      if ( ((struct icalparameter_impl*)param)->string != 0){
00361         return ICAL_RELTYPE_X;
00362         }
00363 
00364 return (icalparameter_reltype)((struct icalparameter_impl*)param)->data;
00365 }
00366 
00367 void icalparameter_set_reltype(icalparameter* param, icalparameter_reltype v)
00368 {
00369    icalerror_check_arg_rv(v >= ICAL_RELTYPE_X,"v");
00370     icalerror_check_arg_rv(v < ICAL_RELTYPE_NONE,"v");
00371    icalerror_check_arg_rv( (param!=0), "param");
00372    icalerror_clear_errno();
00373    
00374    ((struct icalparameter_impl*)param)->data = (int)v;
00375 }
00376 
00377 /* ENCODING */
00378 icalparameter* icalparameter_new_encoding(icalparameter_encoding v)
00379 {
00380    struct icalparameter_impl *impl;
00381    icalerror_clear_errno();
00382    icalerror_check_arg_rz(v >= ICAL_ENCODING_X,"v");
00383     icalerror_check_arg_rz(v < ICAL_ENCODING_NONE,"v");
00384    impl = icalparameter_new_impl(ICAL_ENCODING_PARAMETER);
00385    if (impl == 0) {
00386       return 0;
00387    }
00388 
00389    icalparameter_set_encoding((icalparameter*) impl,v);
00390    if (icalerrno != ICAL_NO_ERROR) {
00391       icalparameter_free((icalparameter*) impl);
00392       return 0;
00393    }
00394 
00395    return (icalparameter*) impl;
00396 }
00397 
00398 icalparameter_encoding icalparameter_get_encoding(const icalparameter* param)
00399 {
00400    icalerror_clear_errno();
00401 icalerror_check_arg( (param!=0), "param");
00402      if ( ((struct icalparameter_impl*)param)->string != 0){
00403         return ICAL_ENCODING_X;
00404         }
00405 
00406 return (icalparameter_encoding)((struct icalparameter_impl*)param)->data;
00407 }
00408 
00409 void icalparameter_set_encoding(icalparameter* param, icalparameter_encoding v)
00410 {
00411    icalerror_check_arg_rv(v >= ICAL_ENCODING_X,"v");
00412     icalerror_check_arg_rv(v < ICAL_ENCODING_NONE,"v");
00413    icalerror_check_arg_rv( (param!=0), "param");
00414    icalerror_clear_errno();
00415    
00416    ((struct icalparameter_impl*)param)->data = (int)v;
00417 }
00418 
00419 /* ALTREP */
00420 icalparameter* icalparameter_new_altrep(const char* v)
00421 {
00422    struct icalparameter_impl *impl;
00423    icalerror_clear_errno();
00424    icalerror_check_arg_rz( (v!=0),"v");
00425    impl = icalparameter_new_impl(ICAL_ALTREP_PARAMETER);
00426    if (impl == 0) {
00427       return 0;
00428    }
00429 
00430    icalparameter_set_altrep((icalparameter*) impl,v);
00431    if (icalerrno != ICAL_NO_ERROR) {
00432       icalparameter_free((icalparameter*) impl);
00433       return 0;
00434    }
00435 
00436    return (icalparameter*) impl;
00437 }
00438 
00439 const char* icalparameter_get_altrep(const icalparameter* param)
00440 {
00441    icalerror_clear_errno();
00442     icalerror_check_arg_rz( (param!=0), "param");
00443     return (const char*)((struct icalparameter_impl*)param)->string;
00444 }
00445 
00446 void icalparameter_set_altrep(icalparameter* param, const char* v)
00447 {
00448    icalerror_check_arg_rv( (v!=0),"v");
00449    icalerror_check_arg_rv( (param!=0), "param");
00450    icalerror_clear_errno();
00451    
00452    ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
00453 }
00454 
00455 /* FMTTYPE */
00456 icalparameter* icalparameter_new_fmttype(const char* v)
00457 {
00458    struct icalparameter_impl *impl;
00459    icalerror_clear_errno();
00460    icalerror_check_arg_rz( (v!=0),"v");
00461    impl = icalparameter_new_impl(ICAL_FMTTYPE_PARAMETER);
00462    if (impl == 0) {
00463       return 0;
00464    }
00465 
00466    icalparameter_set_fmttype((icalparameter*) impl,v);
00467    if (icalerrno != ICAL_NO_ERROR) {
00468       icalparameter_free((icalparameter*) impl);
00469       return 0;
00470    }
00471 
00472    return (icalparameter*) impl;
00473 }
00474 
00475 const char* icalparameter_get_fmttype(const icalparameter* param)
00476 {
00477    icalerror_clear_errno();
00478     icalerror_check_arg_rz( (param!=0), "param");
00479     return (const char*)((struct icalparameter_impl*)param)->string;
00480 }
00481 
00482 void icalparameter_set_fmttype(icalparameter* param, const char* v)
00483 {
00484    icalerror_check_arg_rv( (v!=0),"v");
00485    icalerror_check_arg_rv( (param!=0), "param");
00486    icalerror_clear_errno();
00487    
00488    ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
00489 }
00490 
00491 /* FBTYPE */
00492 icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v)
00493 {
00494    struct icalparameter_impl *impl;
00495    icalerror_clear_errno();
00496    icalerror_check_arg_rz(v >= ICAL_FBTYPE_X,"v");
00497     icalerror_check_arg_rz(v < ICAL_FBTYPE_NONE,"v");
00498    impl = icalparameter_new_impl(ICAL_FBTYPE_PARAMETER);
00499    if (impl == 0) {
00500       return 0;
00501    }
00502 
00503    icalparameter_set_fbtype((icalparameter*) impl,v);
00504    if (icalerrno != ICAL_NO_ERROR) {
00505       icalparameter_free((icalparameter*) impl);
00506       return 0;
00507    }
00508 
00509    return (icalparameter*) impl;
00510 }
00511 
00512 icalparameter_fbtype icalparameter_get_fbtype(const icalparameter* param)
00513 {
00514    icalerror_clear_errno();
00515 icalerror_check_arg( (param!=0), "param");
00516      if ( ((struct icalparameter_impl*)param)->string != 0){
00517         return ICAL_FBTYPE_X;
00518         }
00519 
00520 return (icalparameter_fbtype)((struct icalparameter_impl*)param)->data;
00521 }
00522 
00523 void icalparameter_set_fbtype(icalparameter* param, icalparameter_fbtype v)
00524 {
00525    icalerror_check_arg_rv(v >= ICAL_FBTYPE_X,"v");
00526     icalerror_check_arg_rv(v < ICAL_FBTYPE_NONE,"v");
00527    icalerror_check_arg_rv( (param!=0), "param");
00528    icalerror_clear_errno();
00529    
00530    ((struct icalparameter_impl*)param)->data = (int)v;
00531 }
00532 
00533 /* RSVP */
00534 icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v)
00535 {
00536    struct icalparameter_impl *impl;
00537    icalerror_clear_errno();
00538    icalerror_check_arg_rz(v >= ICAL_RSVP_X,"v");
00539     icalerror_check_arg_rz(v < ICAL_RSVP_NONE,"v");
00540    impl = icalparameter_new_impl(ICAL_RSVP_PARAMETER);
00541    if (impl == 0) {
00542       return 0;
00543    }
00544 
00545    icalparameter_set_rsvp((icalparameter*) impl,v);
00546    if (icalerrno != ICAL_NO_ERROR) {
00547       icalparameter_free((icalparameter*) impl);
00548       return 0;
00549    }
00550 
00551    return (icalparameter*) impl;
00552 }
00553 
00554 icalparameter_rsvp icalparameter_get_rsvp(const icalparameter* param)
00555 {
00556    icalerror_clear_errno();
00557 icalerror_check_arg( (param!=0), "param");
00558 
00559 return (icalparameter_rsvp)((struct icalparameter_impl*)param)->data;
00560 }
00561 
00562 void icalparameter_set_rsvp(icalparameter* param, icalparameter_rsvp v)
00563 {
00564    icalerror_check_arg_rv(v >= ICAL_RSVP_X,"v");
00565     icalerror_check_arg_rv(v < ICAL_RSVP_NONE,"v");
00566    icalerror_check_arg_rv( (param!=0), "param");
00567    icalerror_clear_errno();
00568    
00569    ((struct icalparameter_impl*)param)->data = (int)v;
00570 }
00571 
00572 /* RANGE */
00573 icalparameter* icalparameter_new_range(icalparameter_range v)
00574 {
00575    struct icalparameter_impl *impl;
00576    icalerror_clear_errno();
00577    icalerror_check_arg_rz(v >= ICAL_RANGE_X,"v");
00578     icalerror_check_arg_rz(v < ICAL_RANGE_NONE,"v");
00579    impl = icalparameter_new_impl(ICAL_RANGE_PARAMETER);
00580    if (impl == 0) {
00581       return 0;
00582    }
00583 
00584    icalparameter_set_range((icalparameter*) impl,v);
00585    if (icalerrno != ICAL_NO_ERROR) {
00586       icalparameter_free((icalparameter*) impl);
00587       return 0;
00588    }
00589 
00590    return (icalparameter*) impl;
00591 }
00592 
00593 icalparameter_range icalparameter_get_range(const icalparameter* param)
00594 {
00595    icalerror_clear_errno();
00596 icalerror_check_arg( (param!=0), "param");
00597 
00598 return (icalparameter_range)((struct icalparameter_impl*)param)->data;
00599 }
00600 
00601 void icalparameter_set_range(icalparameter* param, icalparameter_range v)
00602 {
00603    icalerror_check_arg_rv(v >= ICAL_RANGE_X,"v");
00604     icalerror_check_arg_rv(v < ICAL_RANGE_NONE,"v");
00605    icalerror_check_arg_rv( (param!=0), "param");
00606    icalerror_clear_errno();
00607    
00608    ((struct icalparameter_impl*)param)->data = (int)v;
00609 }
00610 
00611 /* DELEGATED-TO */
00612 icalparameter* icalparameter_new_delegatedto(const char* v)
00613 {
00614    struct icalparameter_impl *impl;
00615    icalerror_clear_errno();
00616    icalerror_check_arg_rz( (v!=0),"v");
00617    impl = icalparameter_new_impl(ICAL_DELEGATEDTO_PARAMETER);
00618    if (impl == 0) {
00619       return 0;
00620    }
00621 
00622    icalparameter_set_delegatedto((icalparameter*) impl,v);
00623    if (icalerrno != ICAL_NO_ERROR) {
00624       icalparameter_free((icalparameter*) impl);
00625       return 0;
00626    }
00627 
00628    return (icalparameter*) impl;
00629 }
00630 
00631 const char* icalparameter_get_delegatedto(const icalparameter* param)
00632 {
00633    icalerror_clear_errno();
00634     icalerror_check_arg_rz( (param!=0), "param");
00635     return (const char*)((struct icalparameter_impl*)param)->string;
00636 }
00637 
00638 void icalparameter_set_delegatedto(icalparameter* param, const char* v)
00639 {
00640    icalerror_check_arg_rv( (v!=0),"v");
00641    icalerror_check_arg_rv( (param!=0), "param");
00642    icalerror_clear_errno();
00643    
00644    ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
00645 }
00646 
00647 /* CN */
00648 icalparameter* icalparameter_new_cn(const char* v)
00649 {
00650    struct icalparameter_impl *impl;
00651    icalerror_clear_errno();
00652    icalerror_check_arg_rz( (v!=0),"v");
00653    impl = icalparameter_new_impl(ICAL_CN_PARAMETER);
00654    if (impl == 0) {
00655       return 0;
00656    }
00657 
00658    icalparameter_set_cn((icalparameter*) impl,v);
00659    if (icalerrno != ICAL_NO_ERROR) {
00660       icalparameter_free((icalparameter*) impl);
00661       return 0;
00662    }
00663 
00664    return (icalparameter*) impl;
00665 }
00666 
00667 const char* icalparameter_get_cn(const icalparameter* param)
00668 {
00669    icalerror_clear_errno();
00670     icalerror_check_arg_rz( (param!=0), "param");
00671     return (const char*)((struct icalparameter_impl*)param)->string;
00672 }
00673 
00674 void icalparameter_set_cn(icalparameter* param, const char* v)
00675 {
00676    icalerror_check_arg_rv( (v!=0),"v");
00677    icalerror_check_arg_rv( (param!=0), "param");
00678    icalerror_clear_errno();
00679    
00680    ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
00681 }
00682 
00683 /* ROLE */
00684 icalparameter* icalparameter_new_role(icalparameter_role v)
00685 {
00686    struct icalparameter_impl *impl;
00687    icalerror_clear_errno();
00688    icalerror_check_arg_rz(v >= ICAL_ROLE_X,"v");
00689     icalerror_check_arg_rz(v < ICAL_ROLE_NONE,"v");
00690    impl = icalparameter_new_impl(ICAL_ROLE_PARAMETER);
00691    if (impl == 0) {
00692       return 0;
00693    }
00694 
00695    icalparameter_set_role((icalparameter*) impl,v);
00696    if (icalerrno != ICAL_NO_ERROR) {
00697       icalparameter_free((icalparameter*) impl);
00698       return 0;
00699    }
00700 
00701    return (icalparameter*) impl;
00702 }
00703 
00704 icalparameter_role icalparameter_get_role(const icalparameter* param)
00705 {
00706    icalerror_clear_errno();
00707 icalerror_check_arg( (param!=0), "param");
00708      if ( ((struct icalparameter_impl*)param)->string != 0){
00709         return ICAL_ROLE_X;
00710         }
00711 
00712 return (icalparameter_role)((struct icalparameter_impl*)param)->data;
00713 }
00714 
00715 void icalparameter_set_role(icalparameter* param, icalparameter_role v)
00716 {
00717    icalerror_check_arg_rv(v >= ICAL_ROLE_X,"v");
00718     icalerror_check_arg_rv(v < ICAL_ROLE_NONE,"v");
00719    icalerror_check_arg_rv( (param!=0), "param");
00720    icalerror_clear_errno();
00721    
00722    ((struct icalparameter_impl*)param)->data = (int)v;
00723 }
00724 
00725 /* X-LIC-COMPARETYPE */
00726 icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v)
00727 {
00728    struct icalparameter_impl *impl;
00729    icalerror_clear_errno();
00730    icalerror_check_arg_rz(v >= ICAL_XLICCOMPARETYPE_X,"v");
00731     icalerror_check_arg_rz(v < ICAL_XLICCOMPARETYPE_NONE,"v");
00732    impl = icalparameter_new_impl(ICAL_XLICCOMPARETYPE_PARAMETER);
00733    if (impl == 0) {
00734       return 0;
00735    }
00736 
00737    icalparameter_set_xliccomparetype((icalparameter*) impl,v);
00738    if (icalerrno != ICAL_NO_ERROR) {
00739       icalparameter_free((icalparameter*) impl);
00740       return 0;
00741    }
00742 
00743    return (icalparameter*) impl;
00744 }
00745 
00746 icalparameter_xliccomparetype icalparameter_get_xliccomparetype(const icalparameter* param)
00747 {
00748    icalerror_clear_errno();
00749 icalerror_check_arg( (param!=0), "param");
00750 
00751 return (icalparameter_xliccomparetype)((struct icalparameter_impl*)param)->data;
00752 }
00753 
00754 void icalparameter_set_xliccomparetype(icalparameter* param, icalparameter_xliccomparetype v)
00755 {
00756    icalerror_check_arg_rv(v >= ICAL_XLICCOMPARETYPE_X,"v");
00757     icalerror_check_arg_rv(v < ICAL_XLICCOMPARETYPE_NONE,"v");
00758    icalerror_check_arg_rv( (param!=0), "param");
00759    icalerror_clear_errno();
00760    
00761    ((struct icalparameter_impl*)param)->data = (int)v;
00762 }
00763 
00764 /* PARTSTAT */
00765 icalparameter* icalparameter_new_partstat(icalparameter_partstat v)
00766 {
00767    struct icalparameter_impl *impl;
00768    icalerror_clear_errno();
00769    icalerror_check_arg_rz(v >= ICAL_PARTSTAT_X,"v");
00770     icalerror_check_arg_rz(v < ICAL_PARTSTAT_NONE,"v");
00771    impl = icalparameter_new_impl(ICAL_PARTSTAT_PARAMETER);
00772    if (impl == 0) {
00773       return 0;
00774    }
00775 
00776    icalparameter_set_partstat((icalparameter*) impl,v);
00777    if (icalerrno != ICAL_NO_ERROR) {
00778       icalparameter_free((icalparameter*) impl);
00779       return 0;
00780    }
00781 
00782    return (icalparameter*) impl;
00783 }
00784 
00785 icalparameter_partstat icalparameter_get_partstat(const icalparameter* param)
00786 {
00787    icalerror_clear_errno();
00788 icalerror_check_arg( (param!=0), "param");
00789      if ( ((struct icalparameter_impl*)param)->string != 0){
00790         return ICAL_PARTSTAT_X;
00791         }
00792 
00793 return (icalparameter_partstat)((struct icalparameter_impl*)param)->data;
00794 }
00795 
00796 void icalparameter_set_partstat(icalparameter* param, icalparameter_partstat v)
00797 {
00798    icalerror_check_arg_rv(v >= ICAL_PARTSTAT_X,"v");
00799     icalerror_check_arg_rv(v < ICAL_PARTSTAT_NONE,"v");
00800    icalerror_check_arg_rv( (param!=0), "param");
00801    icalerror_clear_errno();
00802    
00803    ((struct icalparameter_impl*)param)->data = (int)v;
00804 }
00805 
00806 /* X-LIC-ERRORTYPE */
00807 icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v)
00808 {
00809    struct icalparameter_impl *impl;
00810    icalerror_clear_errno();
00811    icalerror_check_arg_rz(v >= ICAL_XLICERRORTYPE_X,"v");
00812     icalerror_check_arg_rz(v < ICAL_XLICERRORTYPE_NONE,"v");
00813    impl = icalparameter_new_impl(ICAL_XLICERRORTYPE_PARAMETER);
00814    if (impl == 0) {
00815       return 0;
00816    }
00817 
00818    icalparameter_set_xlicerrortype((icalparameter*) impl,v);
00819    if (icalerrno != ICAL_NO_ERROR) {
00820       icalparameter_free((icalparameter*) impl);
00821       return 0;
00822    }
00823 
00824    return (icalparameter*) impl;
00825 }
00826 
00827 icalparameter_xlicerrortype icalparameter_get_xlicerrortype(const icalparameter* param)
00828 {
00829    icalerror_clear_errno();
00830 icalerror_check_arg( (param!=0), "param");
00831 
00832 return (icalparameter_xlicerrortype)((struct icalparameter_impl*)param)->data;
00833 }
00834 
00835 void icalparameter_set_xlicerrortype(icalparameter* param, icalparameter_xlicerrortype v)
00836 {
00837    icalerror_check_arg_rv(v >= ICAL_XLICERRORTYPE_X,"v");
00838     icalerror_check_arg_rv(v < ICAL_XLICERRORTYPE_NONE,"v");
00839    icalerror_check_arg_rv( (param!=0), "param");
00840    icalerror_clear_errno();
00841    
00842    ((struct icalparameter_impl*)param)->data = (int)v;
00843 }
00844 
00845 /* MEMBER */
00846 icalparameter* icalparameter_new_member(const char* v)
00847 {
00848    struct icalparameter_impl *impl;
00849    icalerror_clear_errno();
00850    icalerror_check_arg_rz( (v!=0),"v");
00851    impl = icalparameter_new_impl(ICAL_MEMBER_PARAMETER);
00852    if (impl == 0) {
00853       return 0;
00854    }
00855 
00856    icalparameter_set_member((icalparameter*) impl,v);
00857    if (icalerrno != ICAL_NO_ERROR) {
00858       icalparameter_free((icalparameter*) impl);
00859       return 0;
00860    }
00861 
00862    return (icalparameter*) impl;
00863 }
00864 
00865 const char* icalparameter_get_member(const icalparameter* param)
00866 {
00867    icalerror_clear_errno();
00868     icalerror_check_arg_rz( (param!=0), "param");
00869     return (const char*)((struct icalparameter_impl*)param)->string;
00870 }
00871 
00872 void icalparameter_set_member(icalparameter* param, const char* v)
00873 {
00874    icalerror_check_arg_rv( (v!=0),"v");
00875    icalerror_check_arg_rv( (param!=0), "param");
00876    icalerror_clear_errno();
00877    
00878    ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
00879 }
00880 
00881 /* X */
00882 icalparameter* icalparameter_new_x(const char* v)
00883 {
00884    struct icalparameter_impl *impl;
00885    icalerror_clear_errno();
00886    icalerror_check_arg_rz( (v!=0),"v");
00887    impl = icalparameter_new_impl(ICAL_X_PARAMETER);
00888    if (impl == 0) {
00889       return 0;
00890    }
00891 
00892    icalparameter_set_x((icalparameter*) impl,v);
00893    if (icalerrno != ICAL_NO_ERROR) {
00894       icalparameter_free((icalparameter*) impl);
00895       return 0;
00896    }
00897 
00898    return (icalparameter*) impl;
00899 }
00900 
00901 const char* icalparameter_get_x(const icalparameter* param)
00902 {
00903    icalerror_clear_errno();
00904     icalerror_check_arg_rz( (param!=0), "param");
00905     return (const char*)((struct icalparameter_impl*)param)->string;
00906 }
00907 
00908 void icalparameter_set_x(icalparameter* param, const char* v)
00909 {
00910    icalerror_check_arg_rv( (v!=0),"v");
00911    icalerror_check_arg_rv( (param!=0), "param");
00912    icalerror_clear_errno();
00913    
00914    ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
00915 }
00916 
00917 /* CUTYPE */
00918 icalparameter* icalparameter_new_cutype(icalparameter_cutype v)
00919 {
00920    struct icalparameter_impl *impl;
00921    icalerror_clear_errno();
00922    icalerror_check_arg_rz(v >= ICAL_CUTYPE_X,"v");
00923     icalerror_check_arg_rz(v < ICAL_CUTYPE_NONE,"v");
00924    impl = icalparameter_new_impl(ICAL_CUTYPE_PARAMETER);
00925    if (impl == 0) {
00926       return 0;
00927    }
00928 
00929    icalparameter_set_cutype((icalparameter*) impl,v);
00930    if (icalerrno != ICAL_NO_ERROR) {
00931       icalparameter_free((icalparameter*) impl);
00932       return 0;
00933    }
00934 
00935    return (icalparameter*) impl;
00936 }
00937 
00938 icalparameter_cutype icalparameter_get_cutype(const icalparameter* param)
00939 {
00940    icalerror_clear_errno();
00941 icalerror_check_arg( (param!=0), "param");
00942      if ( ((struct icalparameter_impl*)param)->string != 0){
00943         return ICAL_CUTYPE_X;
00944         }
00945 
00946 return (icalparameter_cutype)((struct icalparameter_impl*)param)->data;
00947 }
00948 
00949 void icalparameter_set_cutype(icalparameter* param, icalparameter_cutype v)
00950 {
00951    icalerror_check_arg_rv(v >= ICAL_CUTYPE_X,"v");
00952     icalerror_check_arg_rv(v < ICAL_CUTYPE_NONE,"v");
00953    icalerror_check_arg_rv( (param!=0), "param");
00954    icalerror_clear_errno();
00955    
00956    ((struct icalparameter_impl*)param)->data = (int)v;
00957 }
00958 
00959 /* TZID */
00960 icalparameter* icalparameter_new_tzid(const char* v)
00961 {
00962    struct icalparameter_impl *impl;
00963    icalerror_clear_errno();
00964    icalerror_check_arg_rz( (v!=0),"v");
00965    impl = icalparameter_new_impl(ICAL_TZID_PARAMETER);
00966    if (impl == 0) {
00967       return 0;
00968    }
00969 
00970    icalparameter_set_tzid((icalparameter*) impl,v);
00971    if (icalerrno != ICAL_NO_ERROR) {
00972       icalparameter_free((icalparameter*) impl);
00973       return 0;
00974    }
00975 
00976    return (icalparameter*) impl;
00977 }
00978 
00979 const char* icalparameter_get_tzid(const icalparameter* param)
00980 {
00981    icalerror_clear_errno();
00982     icalerror_check_arg_rz( (param!=0), "param");
00983     return (const char*)((struct icalparameter_impl*)param)->string;
00984 }
00985 
00986 void icalparameter_set_tzid(icalparameter* param, const char* v)
00987 {
00988    icalerror_check_arg_rv( (v!=0),"v");
00989    icalerror_check_arg_rv( (param!=0), "param");
00990    icalerror_clear_errno();
00991    
00992    ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
00993 }
00994 
00995 /* VALUE */
00996 icalparameter* icalparameter_new_value(icalparameter_value v)
00997 {
00998    struct icalparameter_impl *impl;
00999    icalerror_clear_errno();
01000    icalerror_check_arg_rz(v >= ICAL_VALUE_X,"v");
01001     icalerror_check_arg_rz(v < ICAL_VALUE_NONE,"v");
01002    impl = icalparameter_new_impl(ICAL_VALUE_PARAMETER);
01003    if (impl == 0) {
01004       return 0;
01005    }
01006 
01007    icalparameter_set_value((icalparameter*) impl,v);
01008    if (icalerrno != ICAL_NO_ERROR) {
01009       icalparameter_free((icalparameter*) impl);
01010       return 0;
01011    }
01012 
01013    return (icalparameter*) impl;
01014 }
01015 
01016 icalparameter_value icalparameter_get_value(const icalparameter* param)
01017 {
01018    icalerror_clear_errno();
01019 icalerror_check_arg( (param!=0), "param");
01020      if ( ((struct icalparameter_impl*)param)->string != 0){
01021         return ICAL_VALUE_X;
01022         }
01023 
01024 return (icalparameter_value)((struct icalparameter_impl*)param)->data;
01025 }
01026 
01027 void icalparameter_set_value(icalparameter* param, icalparameter_value v)
01028 {
01029    icalerror_check_arg_rv(v >= ICAL_VALUE_X,"v");
01030     icalerror_check_arg_rv(v < ICAL_VALUE_NONE,"v");
01031    icalerror_check_arg_rv( (param!=0), "param");
01032    icalerror_clear_errno();
01033    
01034    ((struct icalparameter_impl*)param)->data = (int)v;
01035 }
01036 
01037 /* DIR */
01038 icalparameter* icalparameter_new_dir(const char* v)
01039 {
01040    struct icalparameter_impl *impl;
01041    icalerror_clear_errno();
01042    icalerror_check_arg_rz( (v!=0),"v");
01043    impl = icalparameter_new_impl(ICAL_DIR_PARAMETER);
01044    if (impl == 0) {
01045       return 0;
01046    }
01047 
01048    icalparameter_set_dir((icalparameter*) impl,v);
01049    if (icalerrno != ICAL_NO_ERROR) {
01050       icalparameter_free((icalparameter*) impl);
01051       return 0;
01052    }
01053 
01054    return (icalparameter*) impl;
01055 }
01056 
01057 const char* icalparameter_get_dir(const icalparameter* param)
01058 {
01059    icalerror_clear_errno();
01060     icalerror_check_arg_rz( (param!=0), "param");
01061     return (const char*)((struct icalparameter_impl*)param)->string;
01062 }
01063 
01064 void icalparameter_set_dir(icalparameter* param, const char* v)
01065 {
01066    icalerror_check_arg_rv( (v!=0),"v");
01067    icalerror_check_arg_rv( (param!=0), "param");
01068    icalerror_clear_errno();
01069    
01070    ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
01071 }
01072 
01073 
01074 const char* icalparameter_kind_to_string(icalparameter_kind kind)
01075 {
01076     int i;
01077 
01078     for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) {
01079        if (parameter_map[i].kind == kind) {
01080            return parameter_map[i].name;
01081        }
01082     }
01083 
01084     return 0;
01085 
01086 }
01087 
01088 icalparameter_kind icalparameter_string_to_kind(const char* string)
01089 {
01090     int i;
01091 
01092     if (string ==0 ) { 
01093        return ICAL_NO_PARAMETER;
01094     }
01095 
01096     for (i=0; parameter_map[i].kind  != ICAL_NO_PARAMETER; i++) {
01097 
01098        if (strcmp(parameter_map[i].name, string) == 0) {
01099            return parameter_map[i].kind;
01100        }
01101     }
01102 
01103     if(strncmp(string,"X-",2)==0){
01104        return ICAL_X_PARAMETER;
01105     }
01106 
01107     return ICAL_NO_PARAMETER;
01108 }
01109 
01110 
01111 icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value)
01112 {
01113     int i;
01114 
01115     for (i=0; value_kind_map[i].kind  != ICAL_NO_VALUE; i++) {
01116 
01117        if (value_kind_map[i].value == value) {
01118            return value_kind_map[i].kind;
01119        }
01120     }
01121 
01122     return ICAL_NO_VALUE;
01123 }
01124 
01125 
01126 const char* icalparameter_enum_to_string(int e) 
01127 {
01128     int i;
01129 
01130     icalerror_check_arg_rz(e >= ICALPARAMETER_FIRST_ENUM,"e");
01131     icalerror_check_arg_rz(e <= ICALPARAMETER_LAST_ENUM,"e");
01132 
01133     for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
01134         if(e == icalparameter_map[i].enumeration){
01135             return icalparameter_map[i].str;
01136         }
01137     }
01138 
01139     return 0;
01140 }
01141 
01142 int icalparameter_string_to_enum(const char* str)
01143 {
01144     int i;
01145 
01146     icalerror_check_arg_rz(str != 0,"str");
01147 
01148     for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
01149         if(strcmp(str,icalparameter_map[i].str) == 0) {
01150             return icalparameter_map[i].enumeration;
01151         }
01152     }
01153 
01154     return 0;
01155 }
01156 
01157 icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind,const  char* val)
01158 {
01159 
01160     struct icalparameter_impl* param=0;
01161     int found_kind = 0;
01162     int i;
01163 
01164     icalerror_check_arg_rz((val!=0),"val");
01165 
01166     /* Search through the parameter map to find a matching kind */
01167 
01168     param = icalparameter_new_impl(kind);
01169 
01170     for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
01171         if(kind == icalparameter_map[i].kind) {
01172             found_kind = 1;
01173             if(strcmp(val,icalparameter_map[i].str) == 0) {
01174 
01175                 param->data = (int)icalparameter_map[i].enumeration;
01176                 return param;
01177             }
01178         }
01179     }
01180     
01181     if(found_kind == 1){
01182         /* The kind was in the parameter map, but the string did not
01183            match, so assume that it is an alternate value, like an
01184            X-value.*/
01185         
01186         icalparameter_set_xvalue(param, val);
01187 
01188     } else {
01189  
01190         /* If the kind was not found, then it must be a string type */
01191         
01192         ((struct icalparameter_impl*)param)->string = icalmemory_strdup(val);
01193 
01194     }
01195 
01196    return param;
01197 }
01198 
01199 
01200 
01201 
01202 /* Everything below this line is machine generated. Do not edit. */