aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@src.gnome.org>2001-02-06 03:16:23 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-02-06 03:16:23 +0800
commit1994ec032fd25516ca9ed2f5953130794a4767a2 (patch)
treebc93a2a95e89f4d3f6b15f5c43e318b82cecf981
parentd2293e1adc8339042d9fa273e61ebfe1cb1032c6 (diff)
downloadgsoc2013-evolution-1994ec032fd25516ca9ed2f5953130794a4767a2.tar
gsoc2013-evolution-1994ec032fd25516ca9ed2f5953130794a4767a2.tar.gz
gsoc2013-evolution-1994ec032fd25516ca9ed2f5953130794a4767a2.tar.bz2
gsoc2013-evolution-1994ec032fd25516ca9ed2f5953130794a4767a2.tar.lz
gsoc2013-evolution-1994ec032fd25516ca9ed2f5953130794a4767a2.tar.xz
gsoc2013-evolution-1994ec032fd25516ca9ed2f5953130794a4767a2.tar.zst
gsoc2013-evolution-1994ec032fd25516ca9ed2f5953130794a4767a2.zip
Initial revision
svn path=/trunk/; revision=7973
-rw-r--r--libical/src/libical/icallangbind.c170
-rw-r--r--libical/src/libical/icallangbind.h32
2 files changed, 202 insertions, 0 deletions
diff --git a/libical/src/libical/icallangbind.c b/libical/src/libical/icallangbind.c
new file mode 100644
index 0000000000..ad1ee2821e
--- /dev/null
+++ b/libical/src/libical/icallangbind.c
@@ -0,0 +1,170 @@
+/* -*- Mode: C -*-
+ ======================================================================
+ FILE: icallangbind.c
+ CREATOR: eric 15 dec 2000
+
+ DESCRIPTION:
+
+ $Id$
+ $Locker$
+
+ (C) COPYRIGHT 1999 Eric Busboom
+ http://www.softwarestudio.org
+
+ This package is free software and is provided "as is" without
+ express or implied warranty. It may be used, redistributed and/or
+ modified under the same terms as perl itself. ( Either the Artistic
+ License or the GPL. )
+
+ ======================================================================*/
+
+#include "ical.h"
+
+
+
+int* icallangbind_new_array(int size){
+ int* p = malloc(size*sizeof(int));
+ return p; /* Caller handles failures */
+}
+
+void icallangbind_free_array(int* array){
+ free(array);
+}
+
+int icallangbind_access_array(int* array, int index) {
+ return array[index];
+}
+
+/* Return the nth occurrence of 'prop' in c */
+icalproperty* icallangbind_get_property(icalcomponent *c, int n, const char* prop)
+{
+ int count;
+ icalproperty_kind kind;
+ icalproperty *p;
+ icalcomponent * comps[3];
+ int compno = 0;
+ int propno = 0;
+
+ if(c == 0 || prop == 0 || n < 0){
+ return 0;
+ }
+
+ kind = icalenum_string_to_property_kind(prop);
+
+ if (kind == ICAL_NO_PROPERTY){
+ return 0;
+ }
+
+ comps[0] = c;
+ comps[1] = icalcomponent_get_first_real_component(c);
+ comps[2] = 0;
+
+ if(kind == ICAL_X_PROPERTY){
+
+ for(compno ==0; comps[compno]!=0 ; compno++){
+
+ for(p = icalcomponent_get_first_property(comps[compno],kind);
+ p !=0;
+ p = icalcomponent_get_next_property(comps[compno],kind)
+ ){
+
+ if(strcmp(icalproperty_get_xname(p),prop) == 0){
+
+ if(propno == n ){
+ return p;
+ }
+
+ propno++;
+ }
+ }
+ }
+
+ } else {
+ for(compno ==0; comps[compno]!=0 ; compno++){
+
+ for(propno=0,
+ p = icalcomponent_get_first_property(comps[compno],kind);
+ propno != n && p !=0;
+ propno++,
+ p = icalcomponent_get_next_property(comps[compno],kind)
+ )
+ {
+ }
+
+ if(p != 0){
+ return p;
+ }
+
+ }
+ }
+
+ return 0;
+
+}
+
+const char* icallangbind_get_property_val(icalproperty* p)
+{
+ icalvalue *v;
+ if (p == 0){
+ return 0;
+ }
+
+ v = icalproperty_get_value(p);
+
+ if(v == 0){
+ return v;
+ }
+
+ return icalvalue_as_ical_string(v);
+
+}
+
+const char* icallangbind_get_parameter(icalproperty *p, const char* parameter)
+{
+ icalparameter_kind kind;
+ icalparameter *param;
+
+ if(p == 0 || parameter == 0){
+ return 0;
+ }
+
+ kind = icalenum_string_to_parameter_kind(parameter);
+
+ if(kind == ICAL_NO_PARAMETER){
+ return 0;
+ }
+
+ if(kind == ICAL_X_PARAMETER){
+ for(param = icalproperty_get_first_parameter(p,ICAL_X_PARAMETER);
+ param != 0;
+ param = icalproperty_get_next_parameter(p,ICAL_X_PARAMETER)){
+
+ if(strcmp(icalparameter_get_xname(param),parameter) ==0){
+ return icalparameter_as_ical_string(param);
+ }
+ }
+
+ } else {
+
+ param = icalproperty_get_first_parameter(p,kind);
+
+ if (param !=0){
+ return icalparameter_as_ical_string(param);
+ }
+
+ }
+
+ return 0;
+}
+
+icalcomponent* icallangbind_get_component(icalcomponent *c, const char* comp)
+{
+ if(c == 0 || comp == 0){
+ return 0;
+ }
+
+
+}
+
+
+
diff --git a/libical/src/libical/icallangbind.h b/libical/src/libical/icallangbind.h
new file mode 100644
index 0000000000..184233147f
--- /dev/null
+++ b/libical/src/libical/icallangbind.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C -*-
+ ======================================================================
+ FILE: icallangbind.h
+ CREATOR: eric 25 jan 2001
+
+ DESCRIPTION:
+
+ $Id$
+ $Locker$
+
+ (C) COPYRIGHT 1999 Eric Busboom
+ http://www.softwarestudio.org
+
+ This package is free software and is provided "as is" without
+ express or implied warranty. It may be used, redistributed and/or
+ modified under the same terms as perl itself. ( Either the Artistic
+ License or the GPL. )
+
+ ======================================================================*/
+
+#ifndef __ICALLANGBIND_H__
+#define __ICALLANGBIND_H__
+
+int* icallangbind_new_array(int size);
+void icallangbind_free_array(int* array);
+int icallangbind_access_array(int* array, int index);
+icalproperty* icallangbind_get_property(icalcomponent *c, int n, const char* prop);
+const char* icallangbind_get_property_val(icalproperty* p);
+const char* icallangbind_get_parameter(icalproperty *p, const char* parameter);
+icalcomponent* icallangbind_get_component(icalcomponent *c, const char* comp);
+
+#endif /*__ICALLANGBIND_H__*/