comparison python/python-libpst.cpp @ 199:e3a46f66332b

more changes in recurrence decoding
author Carl Byington <carl@five-ten-sg.com>
date Wed, 13 May 2009 11:59:55 -0700
parents 7c60d6d1c681
children 3850a3b11745
comparison
equal deleted inserted replaced
198:7c60d6d1c681 199:e3a46f66332b
132 string pst::pst_rfc2426_escape(char *str) { 132 string pst::pst_rfc2426_escape(char *str) {
133 return ::pst_rfc2426_escape(str); 133 return ::pst_rfc2426_escape(str);
134 } 134 }
135 135
136 string pst::pst_rfc2425_datetime_format(const FILETIME *ft) { 136 string pst::pst_rfc2425_datetime_format(const FILETIME *ft) {
137 return ::pst_rfc2425_datetime_format((FILETIME *)ft); // cast away const is ok, since libpst did not modify it anyway, and the signature will change in more recent versions 137 char buf[30];
138 ::pst_rfc2425_datetime_format(ft, sizeof(buf), buf);
139 return string(buf);
138 } 140 }
139 141
140 string pst::pst_rfc2445_datetime_format(const FILETIME *ft) { 142 string pst::pst_rfc2445_datetime_format(const FILETIME *ft) {
141 return ::pst_rfc2445_datetime_format((FILETIME *)ft); // cast away const is ok, since libpst did not modify it anyway, and the signature will change in more recent versions 143 char buf[30];
144 ::pst_rfc2445_datetime_format(ft, sizeof(buf), buf);
145 return string(buf);
142 } 146 }
143 147
144 string pst::pst_default_charset(pst_item *item) { 148 string pst::pst_default_charset(pst_item *item) {
145 return ::pst_default_charset(item); 149 return ::pst_default_charset(item);
146 } 150 }
201 } 205 }
202 return NULL; 206 return NULL;
203 } 207 }
204 }; 208 };
205 209
206 struct make_python_pst_recurrence {
207 static PyObject* convert(pst_recurrence* const &s) {
208 if (s) return to_python_indirect<pst_recurrence*, detail::make_reference_holder>()(s);
209 return NULL;
210 }
211 };
212
213 struct make_python_pst_item_email { 210 struct make_python_pst_item_email {
214 static PyObject* convert(pst_item_email* const &s) { 211 static PyObject* convert(pst_item_email* const &s) {
215 if (s) return to_python_indirect<pst_item_email*, detail::make_reference_holder>()(s); 212 if (s) return to_python_indirect<pst_item_email*, detail::make_reference_holder>()(s);
216 return NULL; 213 return NULL;
217 } 214 }
250 //boost::python::docstring_options doc_options(); 247 //boost::python::docstring_options doc_options();
251 248
252 to_python_converter<pst_binary, make_python_pst_binary>(); 249 to_python_converter<pst_binary, make_python_pst_binary>();
253 to_python_converter<ppst_binary, make_python_ppst_binary>(); 250 to_python_converter<ppst_binary, make_python_ppst_binary>();
254 to_python_converter<char*, make_python_string>(); 251 to_python_converter<char*, make_python_string>();
255 to_python_converter<pst_recurrence*, make_python_pst_recurrence>();
256 to_python_converter<pst_item_email*, make_python_pst_item_email>(); 252 to_python_converter<pst_item_email*, make_python_pst_item_email>();
257 to_python_converter<pst_item_attach*, make_python_pst_item_attach>(); 253 to_python_converter<pst_item_attach*, make_python_pst_item_attach>();
258 to_python_converter<pst_desc_tree*, make_python_pst_desc_tree>(); 254 to_python_converter<pst_desc_tree*, make_python_pst_desc_tree>();
259 to_python_converter<pst_index_ll*, make_python_pst_index_ll>(); 255 to_python_converter<pst_index_ll*, make_python_pst_index_ll>();
260 to_python_converter<FILE*, make_python_FILE>(); 256 to_python_converter<FILE*, make_python_FILE>();
526 .def_readonly("parm3", &pst_recurrence::parm3) 522 .def_readonly("parm3", &pst_recurrence::parm3)
527 .def_readonly("parm4", &pst_recurrence::parm4) 523 .def_readonly("parm4", &pst_recurrence::parm4)
528 .def_readonly("parm5", &pst_recurrence::parm5) 524 .def_readonly("parm5", &pst_recurrence::parm5)
529 .def_readonly("termination", &pst_recurrence::termination) 525 .def_readonly("termination", &pst_recurrence::termination)
530 .def_readonly("interval", &pst_recurrence::interval) 526 .def_readonly("interval", &pst_recurrence::interval)
527 .def_readonly("bydaymask", &pst_recurrence::bydaymask)
528 .def_readonly("dayofmonth", &pst_recurrence::dayofmonth)
529 .def_readonly("monthofyear", &pst_recurrence::monthofyear)
530 .def_readonly("position", &pst_recurrence::position)
531 .def_readonly("count", &pst_recurrence::count) 531 .def_readonly("count", &pst_recurrence::count)
532 ; 532 ;
533 533
534 class_<pst_item_appointment>("pst_item_appointment") 534 class_<pst_item_appointment>("pst_item_appointment")
535 .add_property("start", make_getter(&pst_item_appointment::start, return_value_policy<reference_existing_object>())) 535 .add_property("start", make_getter(&pst_item_appointment::start, return_value_policy<reference_existing_object>()))