Back to index

lightning-sunbird  0.9+nobinonly
icalvalue_cxx.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C -*- */
00002 /*======================================================================
00003  FILE: icalvalue_cxx.cpp
00004  CREATOR: fnguyen 12/21/01
00005  (C) COPYRIGHT 2001, Critical Path
00006 ======================================================================*/
00007 
00008 #ifndef ICALVALUE_CXX_H
00009 #include "icalvalue_cxx.h"
00010 #endif
00011 
00012 typedef       char* string; // Will use the string library from STL
00013 
00014 ICalValue::ICalValue() throw(icalerrorenum) : imp(icalvalue_new(ICAL_ANY_VALUE)){}
00015 
00016 ICalValue::ICalValue(const ICalValue& v) throw (icalerrorenum) {
00017        imp = icalvalue_new_clone(v.imp);
00018        if (!imp) throw icalerrno;
00019 }
00020 ICalValue& ICalValue::operator=(const ICalValue& v) throw(icalerrorenum) {
00021        if (this == &v) return *this;
00022 
00023        if (imp != NULL)
00024        {
00025               icalvalue_free(imp);
00026               imp = icalvalue_new_clone(v.imp);
00027               if (!imp) throw icalerrno;
00028        }
00029 
00030        return *this;
00031 }
00032 
00033 ICalValue::~ICalValue(){
00034        if (imp != NULL) icalvalue_free(imp);
00035 }
00036 
00037 ICalValue::ICalValue(icalvalue* v) throw(icalerrorenum) : imp(v){
00038 }
00039 
00040 ICalValue::ICalValue(icalvalue_kind kind) throw(icalerrorenum) {
00041        imp = icalvalue_new(kind);
00042        if (!imp) throw icalerrno;
00043 }
00044 
00045 ICalValue::ICalValue(icalvalue_kind kind, string  str) throw(icalerrorenum) {
00046        imp = icalvalue_new_from_string(kind, str);
00047        if (!imp) throw icalerrno;
00048 }
00049 
00050 string ICalValue::as_ical_string(){
00051        return (string)icalvalue_as_ical_string(imp);
00052 }
00053 bool ICalValue::is_valid(){
00054        if (imp == NULL) return false;
00055        return (icalvalue_is_valid(imp) ? true : false);
00056 }
00057 icalvalue_kind ICalValue::isa(){
00058        return icalvalue_isa(imp);
00059 }
00060 int ICalValue::isa_value(void* value){
00061        return icalvalue_isa_value(value);
00062 }
00063 
00064 /* Special, non autogenerated value accessors */
00065 void ICalValue::set_recur(struct icalrecurrencetype v){
00066        icalvalue_set_recur(imp, v);
00067 }
00068 struct icalrecurrencetype ICalValue::get_recur(){
00069        return icalvalue_get_recur(imp);
00070 }
00071 
00072 void ICalValue::set_trigger(struct icaltriggertype v){}
00073 struct icaltriggertype ICalValue::get_trigger(){
00074        return icalvalue_get_trigger(imp);
00075 }
00076 
00077 void ICalValue::set_datetimeperiod(struct icaldatetimeperiodtype v){
00078        icalvalue_set_datetimeperiod(imp, v);
00079 }
00080 struct icaldatetimeperiodtype ICalValue::get_datetimeperiod(){
00081        return icalvalue_get_datetimeperiod(imp);
00082 }
00083 
00084 icalparameter_xliccomparetype ICalValue::compare(ICalValue& a, ICalValue& b){
00085        return icalvalue_compare(a, b);
00086 }
00087 
00088 /* Convert enumerations */
00089 icalvalue_kind ICalValue::string_to_kind(string  str){
00090        return icalvalue_string_to_kind(str);
00091 }
00092 string ICalValue::kind_to_string(icalvalue_kind kind){
00093        return (string)icalvalue_kind_to_string(kind);
00094 }
00095 
00096 /* BOOLEAN */ 
00097 int ICalValue::get_boolean(){
00098        return icalvalue_get_boolean(imp);
00099 } 
00100 void ICalValue::set_boolean(int v){
00101        icalvalue_set_boolean(imp, v);
00102 }
00103 
00104 /* UTC-OFFSET */ 
00105 int ICalValue::get_utcoffset(){
00106        return icalvalue_get_utcoffset(imp);
00107 } 
00108 void ICalValue::set_utcoffset(int v){
00109        icalvalue_set_utcoffset(imp, v);
00110 }
00111 
00112 /* METHOD */ 
00113 enum icalproperty_method ICalValue::get_method(){
00114        return icalvalue_get_method(imp);
00115 } 
00116 void ICalValue::set_method(enum icalproperty_method v){
00117        icalvalue_set_method(imp, v);
00118 }
00119 
00120 /* CAL-ADDRESS */ 
00121 string ICalValue::get_caladdress(){
00122        return (string)icalvalue_get_caladdress(imp);
00123 } 
00124 void ICalValue::set_caladdress(string  v){
00125        icalvalue_set_caladdress(imp, v);
00126 }
00127 
00128 /* PERIOD */ 
00129 struct icalperiodtype ICalValue::get_period(){
00130        return icalvalue_get_period(imp);
00131 } 
00132 void ICalValue::set_period(struct icalperiodtype v){
00133        icalvalue_set_period(imp, v);
00134 }
00135 
00136 /* STATUS */ 
00137 enum icalproperty_status ICalValue::get_status(){
00138        return icalvalue_get_status(imp);
00139 } 
00140 void ICalValue::set_status(enum icalproperty_status v){
00141        icalvalue_set_status(imp, v);
00142 }
00143 
00144 /* BINARY */ 
00145 string ICalValue::get_binary(){
00146        return (string)icalvalue_get_binary(imp);
00147 } 
00148 void ICalValue::set_binary(string  v){
00149        icalvalue_set_binary(imp, v);
00150 }
00151 
00152 /* TEXT */ 
00153 string ICalValue::get_text(){
00154        return (string)icalvalue_get_text(imp);
00155 } 
00156 void ICalValue::set_text(string  v){
00157        icalvalue_set_text(imp, v);
00158 }
00159 
00160 /* DURATION */ 
00161 struct icaldurationtype ICalValue::get_duration(){
00162        return icalvalue_get_duration(imp);
00163 } 
00164 void ICalValue::set_duration(struct icaldurationtype v){
00165        icalvalue_set_duration(imp, v);
00166 }
00167 
00168 /* INTEGER */ 
00169 int ICalValue::get_integer(){
00170        return icalvalue_get_integer(imp);
00171 } 
00172 void ICalValue::set_integer(int v){
00173        icalvalue_set_integer(imp, v);
00174 }
00175 
00176 /* URI */ 
00177 string ICalValue::get_uri(){
00178        return (string)icalvalue_get_uri(imp);
00179 } 
00180 void ICalValue::set_uri(string  v){
00181        icalvalue_set_uri(imp, v);
00182 }
00183 
00184 /* ATTACH */ 
00185 icalattach *ICalValue::get_attach(){
00186        return icalvalue_get_attach(imp);
00187 } 
00188 void ICalValue::set_attach(icalattach *v){
00189        icalvalue_set_attach(imp, v);
00190 }
00191 
00192 /* CLASS */ 
00193 enum icalproperty_class ICalValue::get_class(){
00194        return icalvalue_get_class(imp);
00195 } 
00196 void ICalValue::set_class(enum icalproperty_class v){
00197        icalvalue_set_class(imp, v);
00198 }
00199 
00200 /* FLOAT */ 
00201 float ICalValue::get_float(){
00202        return icalvalue_get_float(imp);
00203 } 
00204 void ICalValue::set_float(float v){
00205        icalvalue_set_float(imp, v);
00206 }
00207 
00208 /* QUERY */ 
00209 string ICalValue::get_query(){
00210        return (string)icalvalue_get_query(imp);
00211 } 
00212 void ICalValue::set_query(string  v){
00213        icalvalue_set_query(imp, v);
00214 }
00215 
00216 /* STRING */ 
00217 string ICalValue::get_string(){
00218        return (string)icalvalue_get_string(imp);
00219 } 
00220 void ICalValue::set_string(string v){
00221        icalvalue_set_string(imp, v);
00222 }
00223 
00224 /* TRANSP */ 
00225 enum icalproperty_transp ICalValue::get_transp(){
00226        return icalvalue_get_transp(imp);
00227 } 
00228 void ICalValue::set_transp(enum icalproperty_transp v){
00229        icalvalue_set_transp(imp, v);
00230 }
00231 
00232 /* DATE-TIME */ 
00233 struct icaltimetype ICalValue::get_datetime(){
00234        return icalvalue_get_datetime(imp);
00235 } 
00236 void ICalValue::set_datetime(struct icaltimetype v){
00237        icalvalue_set_datetime(imp, v);
00238 }
00239 
00240 /* GEO */ 
00241 struct icalgeotype ICalValue::get_geo(){
00242        return icalvalue_get_geo(imp);
00243 } 
00244 void ICalValue::set_geo(struct icalgeotype v){
00245        icalvalue_set_geo(imp, v);
00246 }
00247 
00248 /* DATE */ 
00249 struct icaltimetype ICalValue::get_date(){
00250        return icalvalue_get_date(imp);
00251 } 
00252 void ICalValue::set_date(struct icaltimetype v){
00253        icalvalue_set_date(imp, v);
00254 }
00255 
00256 /* ACTION */ 
00257 enum icalproperty_action ICalValue::get_action(){
00258        return icalvalue_get_action(imp);
00259 } 
00260 void ICalValue::set_action(enum icalproperty_action v){
00261        icalvalue_set_action(imp, v);
00262 }