diff options
Diffstat (limited to 'libical/src/libical/icalderivedproperty.c.in')
-rw-r--r-- | libical/src/libical/icalderivedproperty.c.in | 83 |
1 files changed, 59 insertions, 24 deletions
diff --git a/libical/src/libical/icalderivedproperty.c.in b/libical/src/libical/icalderivedproperty.c.in index ceec0b797d..36ddc846ae 100644 --- a/libical/src/libical/icalderivedproperty.c.in +++ b/libical/src/libical/icalderivedproperty.c.in @@ -4,7 +4,7 @@ FILE: icalderivedproperty.c CREATOR: eric 15 Feb 2001 - $Id: icalderivedproperty.c.in,v 1.1 2001/04/17 17:23:17 jpr Exp $ + $Id: icalderivedproperty.c.in,v 1.2 2003/09/11 22:04:19 hansp Exp $ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org @@ -43,10 +43,9 @@ #include <stdio.h> /* for printf */ #include <stdarg.h> /* for va_list, va_start, etc. */ -#define TMP_BUF_SIZE 1024 - struct icalproperty_impl* icalproperty_new_impl (icalproperty_kind kind); +void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args); /* This map associates the property kinds with the string representation of the property name and the kind of VALUE that the @@ -59,7 +58,29 @@ struct icalproperty_map { }; -extern struct icalproperty_map property_map[]; +/* This map associates the property enumerations with the king of + property that they are used in and the string representation of the + enumeration */ + +struct icalproperty_enum_map { + icalproperty_kind prop; + int prop_enum; + const char* str; +}; + + +<insert_code_here> + +int icalproperty_kind_is_valid(const icalproperty_kind kind) +{ + int i = 0; + do { + if (property_map[i].kind == kind) + return 1; + } while (property_map[i++].kind != ICAL_NO_PROPERTY); + + return 0; +} const char* icalproperty_kind_to_string(icalproperty_kind kind) { @@ -100,7 +121,7 @@ icalproperty_kind icalproperty_string_to_kind(const char* string) } -icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind) +icalproperty_kind icalproperty_value_kind_to_kind(icalvalue_kind kind) { int i; @@ -110,7 +131,7 @@ icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind) } } - return ICAL_NO_VALUE; + return ICAL_NO_PROPERTY; } @@ -129,19 +150,6 @@ icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind) } -/* This map associates the property enumerations with the king of - property that they are used in and the string representation of the - enumeration */ - -struct icalproperty_enum_map { - icalproperty_kind prop; - int prop_enum; - const char* str; -}; - -extern struct icalproperty_enum_map enum_map[]; - - const char* icalproperty_enum_to_string(int e) { icalerror_check_arg_rz(e >= ICALPROPERTY_FIRST_ENUM,"e"); @@ -150,6 +158,37 @@ const char* icalproperty_enum_to_string(int e) return enum_map[e-ICALPROPERTY_FIRST_ENUM].str; } +int icalproperty_kind_and_string_to_enum(const int kind, const char* str) +{ + 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; +} + +/** @deprecated please use icalproperty_kind_and_string_to_enum instead */ int icalproperty_string_to_enum(const char* str) { int i; @@ -237,14 +276,10 @@ icalproperty_status icalenum_string_to_status(const char* str) i != ICAL_STATUS_NONE-ICALPROPERTY_FIRST_ENUM; i++) { if ( strcmp(enum_map[i].str, str) == 0) { - return (icalproperty_method)enum_map[i].prop_enum; + return (icalproperty_status)enum_map[i].prop_enum; } } return ICAL_STATUS_NONE; } - - - -/* Everything below this line is machine generated. Do not edit. */ |