comparison python/python-libpst.cpp @ 204:268458c79e9b

more cleanup of the shared library interface, but still not fully thread safe
author Carl Byington <carl@five-ten-sg.com>
date Sat, 06 Jun 2009 11:39:02 -0700
parents 3850a3b11745
children 94bde95d7e18
comparison
equal deleted inserted replaced
203:9fb600ef4e03 204:268458c79e9b
35 size_t pst_attach_to_file_base64(pst_item_attach *attach, FILE* fp); 35 size_t pst_attach_to_file_base64(pst_item_attach *attach, FILE* fp);
36 pst_desc_tree* pst_getNextDptr(pst_desc_tree* d); 36 pst_desc_tree* pst_getNextDptr(pst_desc_tree* d);
37 pst_item* pst_parse_item(pst_desc_tree *d_ptr, pst_id2_tree *m_head); 37 pst_item* pst_parse_item(pst_desc_tree *d_ptr, pst_id2_tree *m_head);
38 void pst_freeItem(pst_item *item); 38 void pst_freeItem(pst_item *item);
39 pst_index_ll* pst_getID(uint64_t i_id); 39 pst_index_ll* pst_getID(uint64_t i_id);
40 int pst_decrypt(uint64_t i_id, char *buf, size_t size, unsigned char type);
41 size_t pst_ff_getIDblock_dec(uint64_t i_id, char **buf); 40 size_t pst_ff_getIDblock_dec(uint64_t i_id, char **buf);
42 size_t pst_ff_getIDblock(uint64_t i_id, char** buf);
43 string pst_rfc2426_escape(char *str); 41 string pst_rfc2426_escape(char *str);
44 string pst_rfc2425_datetime_format(const FILETIME *ft); 42 string pst_rfc2425_datetime_format(const FILETIME *ft);
45 string pst_rfc2445_datetime_format(const FILETIME *ft); 43 string pst_rfc2445_datetime_format(const FILETIME *ft);
46 string pst_default_charset(pst_item *item); 44 string pst_default_charset(pst_item *item);
47 void pst_convert_utf8_null(pst_item *item, pst_string *str); 45 void pst_convert_utf8_null(pst_item *item, pst_string *str);
69 root = NULL; 67 root = NULL;
70 topf = NULL; 68 topf = NULL;
71 if (is_open) { 69 if (is_open) {
72 ::pst_load_index(&pf); 70 ::pst_load_index(&pf);
73 ::pst_load_extended_attributes(&pf); 71 ::pst_load_extended_attributes(&pf);
74 root = ::pst_parse_item(&pf, pf.d_head, NULL); 72 if (pf.d_head) root = ::pst_parse_item(&pf, pf.d_head, NULL);
75 topf = ::pst_getTopOfFolders(&pf, root)->child; 73 if (root) topf = ::pst_getTopOfFolders(&pf, root)->child;
76 } 74 }
77 } 75 }
78 76
79 pst::~pst() { 77 pst::~pst() {
80 if (root) pst_freeItem(root); 78 if (root) pst_freeItem(root);
115 113
116 pst_index_ll* pst::pst_getID(uint64_t i_id) { 114 pst_index_ll* pst::pst_getID(uint64_t i_id) {
117 return ::pst_getID(&pf, i_id); 115 return ::pst_getID(&pf, i_id);
118 } 116 }
119 117
120 int pst::pst_decrypt(uint64_t i_id, char *buf, size_t size, unsigned char type) {
121 return ::pst_decrypt(i_id, buf, size, type);
122 }
123
124 size_t pst::pst_ff_getIDblock_dec(uint64_t i_id, char **buf) { 118 size_t pst::pst_ff_getIDblock_dec(uint64_t i_id, char **buf) {
125 return ::pst_ff_getIDblock_dec(&pf, i_id, buf); 119 return ::pst_ff_getIDblock_dec(&pf, i_id, buf);
126 }
127
128 size_t pst::pst_ff_getIDblock(uint64_t i_id, char** buf) {
129 return ::pst_ff_getIDblock(&pf, i_id, buf);
130 } 120 }
131 121
132 string pst::pst_rfc2426_escape(char *str) { 122 string pst::pst_rfc2426_escape(char *str) {
133 return ::pst_rfc2426_escape(str); 123 return ::pst_rfc2426_escape(str);
134 } 124 }
612 .def("pst_attach_to_file_base64", &pst::pst_attach_to_file_base64) 602 .def("pst_attach_to_file_base64", &pst::pst_attach_to_file_base64)
613 .def("pst_getNextDptr", &pst::pst_getNextDptr, return_value_policy<reference_existing_object>()) 603 .def("pst_getNextDptr", &pst::pst_getNextDptr, return_value_policy<reference_existing_object>())
614 .def("pst_parse_item", &pst::pst_parse_item, return_value_policy<reference_existing_object>()) 604 .def("pst_parse_item", &pst::pst_parse_item, return_value_policy<reference_existing_object>())
615 .def("pst_freeItem", &pst::pst_freeItem) 605 .def("pst_freeItem", &pst::pst_freeItem)
616 .def("pst_getID", &pst::pst_getID, return_value_policy<reference_existing_object>()) 606 .def("pst_getID", &pst::pst_getID, return_value_policy<reference_existing_object>())
617 .def("pst_decrypt", &pst::pst_decrypt)
618 .def("pst_ff_getIDblock_dec", &pst::pst_ff_getIDblock_dec) 607 .def("pst_ff_getIDblock_dec", &pst::pst_ff_getIDblock_dec)
619 .def("pst_ff_getIDblock", &pst::pst_ff_getIDblock)
620 .def("pst_rfc2426_escape", &pst::pst_rfc2426_escape) 608 .def("pst_rfc2426_escape", &pst::pst_rfc2426_escape)
621 .def("pst_rfc2425_datetime_format", &pst::pst_rfc2425_datetime_format) 609 .def("pst_rfc2425_datetime_format", &pst::pst_rfc2425_datetime_format)
622 .def("pst_rfc2445_datetime_format", &pst::pst_rfc2445_datetime_format) 610 .def("pst_rfc2445_datetime_format", &pst::pst_rfc2445_datetime_format)
623 .def("pst_default_charset", &pst::pst_default_charset) 611 .def("pst_default_charset", &pst::pst_default_charset)
624 .def("pst_convert_utf8_null", &pst::pst_convert_utf8_null) 612 .def("pst_convert_utf8_null", &pst::pst_convert_utf8_null)