-rw-r--r-- | libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | 15 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccessvcal.cpp | 17 | ||||
-rw-r--r-- | libopie2/opiepim/private/vobject_p.h | 408 |
3 files changed, 428 insertions, 12 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp index b569f8b..ffa6a7d 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp | |||
@@ -20,31 +20,36 @@ | |||
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | /* | 29 | /* |
30 | * VCard Backend for the OPIE-Contact Database. | 30 | * VCard Backend for the OPIE-Contact Database. |
31 | */ | 31 | */ |
32 | #include <opie2/ocontactaccessbackend_vcard.h> | ||
33 | #include "../../../../library/backend/vobject_p.h" | ||
34 | #include "../../../../library/backend/qfiledirect_p.h" | ||
35 | 32 | ||
33 | |||
34 | #include "vobject_p.h" | ||
35 | |||
36 | /* OPIE */ | ||
37 | #include <opie2/ocontactaccessbackend_vcard.h> | ||
36 | #include <qpe/timeconversion.h> | 38 | #include <qpe/timeconversion.h> |
37 | 39 | ||
40 | //FIXME: Hack to allow direct access to FILE* fh. Rewrite this! | ||
41 | #define protected public | ||
38 | #include <qfile.h> | 42 | #include <qfile.h> |
43 | #undef protected | ||
39 | 44 | ||
40 | namespace Opie { | 45 | namespace Opie { |
41 | 46 | ||
42 | OPimContactAccessBackend_VCard::OPimContactAccessBackend_VCard ( const QString& , const QString& filename ): | 47 | OPimContactAccessBackend_VCard::OPimContactAccessBackend_VCard ( const QString& , const QString& filename ): |
43 | m_dirty( false ), | 48 | m_dirty( false ), |
44 | m_file( filename ) | 49 | m_file( filename ) |
45 | { | 50 | { |
46 | load(); | 51 | load(); |
47 | } | 52 | } |
48 | 53 | ||
49 | 54 | ||
50 | bool OPimContactAccessBackend_VCard::load () | 55 | bool OPimContactAccessBackend_VCard::load () |
@@ -85,36 +90,36 @@ bool OPimContactAccessBackend_VCard::load () | |||
85 | return true; | 90 | return true; |
86 | 91 | ||
87 | } | 92 | } |
88 | bool OPimContactAccessBackend_VCard::reload() | 93 | bool OPimContactAccessBackend_VCard::reload() |
89 | { | 94 | { |
90 | return load(); | 95 | return load(); |
91 | } | 96 | } |
92 | bool OPimContactAccessBackend_VCard::save() | 97 | bool OPimContactAccessBackend_VCard::save() |
93 | { | 98 | { |
94 | if (!m_dirty ) | 99 | if (!m_dirty ) |
95 | return true; | 100 | return true; |
96 | 101 | ||
97 | QFileDirect file( m_file ); | 102 | QFile file( m_file ); |
98 | if (!file.open(IO_WriteOnly ) ) | 103 | if (!file.open(IO_WriteOnly ) ) |
99 | return false; | 104 | return false; |
100 | 105 | ||
101 | VObject *obj; | 106 | VObject *obj; |
102 | obj = newVObject( VCCalProp ); | 107 | obj = newVObject( VCCalProp ); |
103 | addPropValue( obj, VCVersionProp, "1.0" ); | 108 | addPropValue( obj, VCVersionProp, "1.0" ); |
104 | 109 | ||
105 | VObject *vo; | 110 | VObject *vo; |
106 | for(QMap<int, OPimContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ | 111 | for(QMap<int, OPimContact>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ |
107 | vo = createVObject( *it ); | 112 | vo = createVObject( *it ); |
108 | writeVObject( file.directHandle() , vo ); | 113 | writeVObject( file.fh, vo ); //FIXME: HACK!!! |
109 | cleanVObject( vo ); | 114 | cleanVObject( vo ); |
110 | } | 115 | } |
111 | cleanStrTbl(); | 116 | cleanStrTbl(); |
112 | deleteVObject( obj ); | 117 | deleteVObject( obj ); |
113 | 118 | ||
114 | m_dirty = false; | 119 | m_dirty = false; |
115 | return true; | 120 | return true; |
116 | 121 | ||
117 | 122 | ||
118 | } | 123 | } |
119 | void OPimContactAccessBackend_VCard::clear () | 124 | void OPimContactAccessBackend_VCard::clear () |
120 | { | 125 | { |
diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp index 0a1baf9..03d4479 100644 --- a/libopie2/opiepim/backend/otodoaccessvcal.cpp +++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp | |||
@@ -17,32 +17,35 @@ | |||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | #include <qfile.h> | ||
30 | |||
31 | #include <qtopia/private/vobject_p.h> | ||
32 | #include <qtopia/timeconversion.h> | ||
33 | #include <qtopia/private/qfiledirect_p.h> | ||
34 | 29 | ||
30 | /* OPIE */ | ||
31 | #include "vobject_p.h" | ||
32 | #include <qpe/timeconversion.h> | ||
35 | #include <opie2/otodoaccessvcal.h> | 33 | #include <opie2/otodoaccessvcal.h> |
36 | 34 | ||
35 | //FIXME: Hack to allow direct access to FILE* fh. Rewrite this! | ||
36 | #define protected public | ||
37 | #include <qfile.h> | ||
38 | #undef protected | ||
39 | |||
37 | using namespace Opie; | 40 | using namespace Opie; |
38 | 41 | ||
39 | namespace { | 42 | namespace { |
40 | static OPimTodo eventByVObj( VObject *obj ){ | 43 | static OPimTodo eventByVObj( VObject *obj ){ |
41 | OPimTodo event; | 44 | OPimTodo event; |
42 | VObject *ob; | 45 | VObject *ob; |
43 | QCString name; | 46 | QCString name; |
44 | // no uid, attendees, ... and no fun | 47 | // no uid, attendees, ... and no fun |
45 | // description | 48 | // description |
46 | if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){ | 49 | if( ( ob = isAPropertyOf( obj, VCDescriptionProp )) != 0 ){ |
47 | name = vObjectStringZValue( ob ); | 50 | name = vObjectStringZValue( ob ); |
48 | #if 0 | 51 | #if 0 |
@@ -170,37 +173,37 @@ bool OPimTodoAccessVCal::load() { | |||
170 | 173 | ||
171 | // Should I do a delete vcal? | 174 | // Should I do a delete vcal? |
172 | 175 | ||
173 | return true; | 176 | return true; |
174 | } | 177 | } |
175 | bool OPimTodoAccessVCal::reload() { | 178 | bool OPimTodoAccessVCal::reload() { |
176 | return load(); | 179 | return load(); |
177 | } | 180 | } |
178 | bool OPimTodoAccessVCal::save() { | 181 | bool OPimTodoAccessVCal::save() { |
179 | if (!m_dirty ) | 182 | if (!m_dirty ) |
180 | return true; | 183 | return true; |
181 | 184 | ||
182 | QFileDirect file( m_file ); | 185 | QFile file( m_file ); |
183 | if (!file.open(IO_WriteOnly ) ) | 186 | if (!file.open(IO_WriteOnly ) ) |
184 | return false; | 187 | return false; |
185 | 188 | ||
186 | VObject *obj; | 189 | VObject *obj; |
187 | obj = newVObject( VCCalProp ); | 190 | obj = newVObject( VCCalProp ); |
188 | addPropValue( obj, VCVersionProp, "1.0" ); | 191 | addPropValue( obj, VCVersionProp, "1.0" ); |
189 | VObject *vo; | 192 | VObject *vo; |
190 | for(QMap<int, OPimTodo>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ | 193 | for(QMap<int, OPimTodo>::ConstIterator it=m_map.begin(); it !=m_map.end(); ++it ){ |
191 | vo = vobjByEvent( it.data() ); | 194 | vo = vobjByEvent( it.data() ); |
192 | addVObjectProp(obj, vo ); | 195 | addVObjectProp(obj, vo ); |
193 | } | 196 | } |
194 | writeVObject( file.directHandle(), obj ); | 197 | writeVObject( file.fh, obj ); //FIXME: HACK!!! |
195 | cleanVObject( obj ); | 198 | cleanVObject( obj ); |
196 | cleanStrTbl(); | 199 | cleanStrTbl(); |
197 | 200 | ||
198 | m_dirty = false; | 201 | m_dirty = false; |
199 | return true; | 202 | return true; |
200 | } | 203 | } |
201 | void OPimTodoAccessVCal::clear() { | 204 | void OPimTodoAccessVCal::clear() { |
202 | m_map.clear(); | 205 | m_map.clear(); |
203 | m_dirty = true; | 206 | m_dirty = true; |
204 | } | 207 | } |
205 | bool OPimTodoAccessVCal::add( const OPimTodo& to ) { | 208 | bool OPimTodoAccessVCal::add( const OPimTodo& to ) { |
206 | m_map.insert( to.uid(), to ); | 209 | m_map.insert( to.uid(), to ); |
diff --git a/libopie2/opiepim/private/vobject_p.h b/libopie2/opiepim/private/vobject_p.h new file mode 100644 index 0000000..3c9d0d3 --- a/dev/null +++ b/libopie2/opiepim/private/vobject_p.h | |||
@@ -0,0 +1,408 @@ | |||
1 | /*************************************************************************** | ||
2 | (C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International | ||
3 | Business Machines Corporation and Siemens Rolm Communications Inc. | ||
4 | |||
5 | For purposes of this license notice, the term Licensors shall mean, | ||
6 | collectively, Apple Computer, Inc., AT&T Corp., International | ||
7 | Business Machines Corporation and Siemens Rolm Communications Inc. | ||
8 | The term Licensor shall mean any of the Licensors. | ||
9 | |||
10 | Subject to acceptance of the following conditions, permission is hereby | ||
11 | granted by Licensors without the need for written agreement and without | ||
12 | license or royalty fees, to use, copy, modify and distribute this | ||
13 | software for any purpose. | ||
14 | |||
15 | The above copyright notice and the following four paragraphs must be | ||
16 | reproduced in all copies of this software and any software including | ||
17 | this software. | ||
18 | |||
19 | THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE | ||
20 | ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR | ||
21 | MODIFICATIONS. | ||
22 | |||
23 | IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, | ||
24 | INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT | ||
25 | OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
26 | DAMAGE. | ||
27 | |||
28 | EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, | ||
29 | INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE | ||
30 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
31 | PURPOSE. | ||
32 | |||
33 | The software is provided with RESTRICTED RIGHTS. Use, duplication, or | ||
34 | disclosure by the government are subject to restrictions set forth in | ||
35 | DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. | ||
36 | |||
37 | ***************************************************************************/ | ||
38 | |||
39 | /* | ||
40 | |||
41 | The vCard/vCalendar C interface is implemented in the set | ||
42 | of files as follows: | ||
43 | |||
44 | vcc.y, yacc source, and vcc.c, the yacc output you will use | ||
45 | implements the core parser | ||
46 | |||
47 | vobject.c implements an API that insulates the caller from | ||
48 | the parser and changes in the vCard/vCalendar BNF | ||
49 | |||
50 | port.h defines compilation environment dependent stuff | ||
51 | |||
52 | vcc.h and vobject.h are header files for their .c counterparts | ||
53 | |||
54 | vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions | ||
55 | which you may find useful. | ||
56 | |||
57 | test.c is a standalone test driver that exercises some of | ||
58 | the features of the APIs provided. Invoke test.exe on a | ||
59 | VCARD/VCALENDAR input text file and you will see the pretty | ||
60 | print output of the internal representation (this pretty print | ||
61 | output should give you a good idea of how the internal | ||
62 | representation looks like -- there is one such output in the | ||
63 | following too). Also, a file with the .out suffix is generated | ||
64 | to show that the internal representation can be written back | ||
65 | in the original text format. | ||
66 | |||
67 | For more information on this API see the readme.txt file | ||
68 | which accompanied this distribution. | ||
69 | |||
70 | Also visit: | ||
71 | |||
72 | http://www.versit.com | ||
73 | http://www.ralden.com | ||
74 | |||
75 | */ | ||
76 | |||
77 | // No tr() anywhere in this file | ||
78 | |||
79 | |||
80 | #ifndef __VOBJECT_H__ | ||
81 | #define __VOBJECT_H__ 1 | ||
82 | |||
83 | #include <qstring.h> | ||
84 | |||
85 | #define vCardClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCard" | ||
86 | #define vCalendarClipboardFormat"+//ISBN 1-887687-00-9::versit::PDI//vCalendar" | ||
87 | |||
88 | /* The above strings vCardClipboardFormat and vCalendarClipboardFormat | ||
89 | are globally unique IDs which can be used to generate clipboard format | ||
90 | ID's as per the requirements of a specific platform. For example, in | ||
91 | Windows they are used as the parameter in a call to RegisterClipboardFormat. | ||
92 | For example: | ||
93 | |||
94 | CLIPFORMAT foo = RegisterClipboardFormat(vCardClipboardFormat); | ||
95 | |||
96 | */ | ||
97 | |||
98 | #define vCardMimeType "text/x-vCard" | ||
99 | #define vCalendarMimeType"text/x-vCalendar" | ||
100 | |||
101 | #undef DLLEXPORT | ||
102 | #include <qtopia/global.h> | ||
103 | #if defined(QTOPIA_MAKEDLL) | ||
104 | #define DLLEXPORT(t) __declspec(dllexport) t | ||
105 | #elif defined(QTOPIA_DLL) | ||
106 | #define DLLEXPORT(t) __declspec(dllimport) t | ||
107 | #else | ||
108 | #define DLLEXPORT(t) t | ||
109 | #endif | ||
110 | |||
111 | #ifndef FALSE | ||
112 | #define FALSE0 | ||
113 | #endif | ||
114 | #ifndef TRUE | ||
115 | #define TRUE1 | ||
116 | #endif | ||
117 | |||
118 | #include <stdlib.h> | ||
119 | #include <stdio.h> | ||
120 | |||
121 | |||
122 | #define VC7bitProp "7BIT" | ||
123 | #define VC8bitProp "8BIT" | ||
124 | #define VCAAlarmProp "AALARM" | ||
125 | #define VCAdditionalNamesProp"ADDN" | ||
126 | #define VCAdrProp "ADR" | ||
127 | #define VCAgentProp "AGENT" | ||
128 | #define VCAIFFProp "AIFF" | ||
129 | #define VCAOLProp "AOL" | ||
130 | #define VCAppleLinkProp "APPLELINK" | ||
131 | #define VCAttachProp "ATTACH" | ||
132 | #define VCAttendeeProp "ATTENDEE" | ||
133 | #define VCATTMailProp "ATTMAIL" | ||
134 | #define VCAudioContentProp "AUDIOCONTENT" | ||
135 | #define VCAVIProp "AVI" | ||
136 | #define VCBase64Prop "BASE64" | ||
137 | #define VCBBSProp "BBS" | ||
138 | #define VCBirthDateProp "BDAY" | ||
139 | #define VCBMPProp "BMP" | ||
140 | #define VCBodyProp "BODY" | ||
141 | #define VCBusinessRoleProp "ROLE" | ||
142 | #define VCCalProp "VCALENDAR" | ||
143 | #define VCCaptionProp "CAP" | ||
144 | #define VCCardProp "VCARD" | ||
145 | #define VCCarProp "CAR" | ||
146 | #define VCCategoriesProp "CATEGORIES" | ||
147 | #define VCCellularProp "CELL" | ||
148 | #define VCCGMProp "CGM" | ||
149 | #define VCCharSetProp "CHARSET" | ||
150 | #define VCCIDProp "CID" | ||
151 | #define VCCISProp "CIS" | ||
152 | #define VCCityProp "L" | ||
153 | #define VCClassProp "CLASS" | ||
154 | #define VCCommentProp "NOTE" | ||
155 | #define VCCompletedProp "COMPLETED" | ||
156 | #define VCContentIDProp "CONTENT-ID" | ||
157 | #define VCCountryNameProp "C" | ||
158 | #define VCDAlarmProp "DALARM" | ||
159 | #define VCDataSizeProp "DATASIZE" | ||
160 | #define VCDayLightProp "DAYLIGHT" | ||
161 | #define VCDCreatedProp "DCREATED" | ||
162 | #define VCDeliveryLabelProp "LABEL" | ||
163 | #define VCDescriptionProp "DESCRIPTION" | ||
164 | #define VCDIBProp "DIB" | ||
165 | #define VCDisplayStringProp "DISPLAYSTRING" | ||
166 | #define VCDomesticProp "DOM" | ||
167 | #define VCDTendProp "DTEND" | ||
168 | #define VCDTstartProp "DTSTART" | ||
169 | #define VCDueProp "DUE" | ||
170 | #define VCEmailAddressProp "EMAIL" | ||
171 | #define VCEncodingProp "ENCODING" | ||
172 | #define VCEndProp "END" | ||
173 | #define VCEventProp "VEVENT" | ||
174 | #define VCEWorldProp "EWORLD" | ||
175 | #define VCExNumProp "EXNUM" | ||
176 | #define VCExpDateProp "EXDATE" | ||
177 | #define VCExpectProp "EXPECT" | ||
178 | #define VCExtAddressProp "EXT ADD" | ||
179 | #define VCFamilyNameProp "F" | ||
180 | #define VCFaxProp "FAX" | ||
181 | #define VCFullNameProp "FN" | ||
182 | #define VCGeoProp "GEO" | ||
183 | #define VCGeoLocationProp "GEO" | ||
184 | #define VCGIFProp "GIF" | ||
185 | #define VCGivenNameProp "G" | ||
186 | #define VCGroupingProp "Grouping" | ||
187 | #define VCHomeProp "HOME" | ||
188 | #define VCIBMMailProp "IBMMail" | ||
189 | #define VCInlineProp "INLINE" | ||
190 | #define VCInternationalProp "INTL" | ||
191 | #define VCInternetProp "INTERNET" | ||
192 | #define VCISDNProp "ISDN" | ||
193 | #define VCJPEGProp "JPEG" | ||
194 | #define VCLanguageProp "LANG" | ||
195 | #define VCLastModifiedProp "LAST-MODIFIED" | ||
196 | #define VCLastRevisedProp "REV" | ||
197 | #define VCLocationProp "LOCATION" | ||
198 | #define VCLogoProp "LOGO" | ||
199 | #define VCMailerProp "MAILER" | ||
200 | #define VCMAlarmProp "MALARM" | ||
201 | #define VCMCIMailProp "MCIMAIL" | ||
202 | #define VCMessageProp "MSG" | ||
203 | #define VCMETProp "MET" | ||
204 | #define VCModemProp "MODEM" | ||
205 | #define VCMPEG2Prop "MPEG2" | ||
206 | #define VCMPEGProp "MPEG" | ||
207 | #define VCMSNProp "MSN" | ||
208 | #define VCNamePrefixesProp "NPRE" | ||
209 | #define VCNameProp "N" | ||
210 | #define VCNameSuffixesProp "NSUF" | ||
211 | #define VCNoteProp "NOTE" | ||
212 | #define VCOrgNameProp "ORGNAME" | ||
213 | #define VCOrgProp "ORG" | ||
214 | #define VCOrgUnit2Prop "OUN2" | ||
215 | #define VCOrgUnit3Prop "OUN3" | ||
216 | #define VCOrgUnit4Prop "OUN4" | ||
217 | #define VCOrgUnitProp "OUN" | ||
218 | #define VCPagerProp "PAGER" | ||
219 | #define VCPAlarmProp "PALARM" | ||
220 | #define VCParcelProp "PARCEL" | ||
221 | #define VCPartProp "PART" | ||
222 | #define VCPCMProp "PCM" | ||
223 | #define VCPDFProp "PDF" | ||
224 | #define VCPGPProp "PGP" | ||
225 | #define VCPhotoProp "PHOTO" | ||
226 | #define VCPICTProp "PICT" | ||
227 | #define VCPMBProp "PMB" | ||
228 | #define VCPostalBoxProp "BOX" | ||
229 | #define VCPostalCodeProp "PC" | ||
230 | #define VCPostalProp "POSTAL" | ||
231 | #define VCPowerShareProp "POWERSHARE" | ||
232 | #define VCPreferredProp "PREF" | ||
233 | #define VCPriorityProp "PRIORITY" | ||
234 | #define VCProcedureNameProp "PROCEDURENAME" | ||
235 | #define VCProdIdProp "PRODID" | ||
236 | #define VCProdigyProp "PRODIGY" | ||
237 | #define VCPronunciationProp "SOUND" | ||
238 | #define VCPSProp "PS" | ||
239 | #define VCPublicKeyProp "KEY" | ||
240 | #define VCQPProp "QP" | ||
241 | #define VCQuickTimeProp "QTIME" | ||
242 | #define VCQuotedPrintableProp"QUOTED-PRINTABLE" | ||
243 | #define VCRDateProp "RDATE" | ||
244 | #define VCRegionProp "R" | ||
245 | #define VCRelatedToProp "RELATED-TO" | ||
246 | #define VCRepeatCountProp "REPEATCOUNT" | ||
247 | #define VCResourcesProp "RESOURCES" | ||
248 | #define VCRNumProp "RNUM" | ||
249 | #define VCRoleProp "ROLE" | ||
250 | #define VCRRuleProp "RRULE" | ||
251 | #define VCRSVPProp "RSVP" | ||
252 | #define VCRunTimeProp "RUNTIME" | ||
253 | #define VCSequenceProp "SEQUENCE" | ||
254 | #define VCSnoozeTimeProp "SNOOZETIME" | ||
255 | #define VCStartProp "START" | ||
256 | #define VCStatusProp "STATUS" | ||
257 | #define VCStreetAddressProp "STREET" | ||
258 | #define VCSubTypeProp "SUBTYPE" | ||
259 | #define VCSummaryProp "SUMMARY" | ||
260 | #define VCTelephoneProp "TEL" | ||
261 | #define VCTIFFProp "TIFF" | ||
262 | #define VCTimeZoneProp "TZ" | ||
263 | #define VCTitleProp "TITLE" | ||
264 | #define VCTLXProp "TLX" | ||
265 | #define VCTodoProp "VTODO" | ||
266 | #define VCTranspProp "TRANSP" | ||
267 | #define VCUniqueStringProp "UID" | ||
268 | #define VCURLProp "URL" | ||
269 | #define VCURLValueProp "URLVAL" | ||
270 | #define VCValueProp "VALUE" | ||
271 | #define VCVersionProp "VERSION" | ||
272 | #define VCVideoProp "VIDEO" | ||
273 | #define VCVoiceProp "VOICE" | ||
274 | #define VCWAVEProp "WAVE" | ||
275 | #define VCWMFProp "WMF" | ||
276 | #define VCWorkProp "WORK" | ||
277 | #define VCX400Prop "X400" | ||
278 | #define VCX509Prop "X509" | ||
279 | #define VCXRuleProp "XRULE" | ||
280 | |||
281 | |||
282 | typedef struct VObject VObject; | ||
283 | |||
284 | typedef struct VObjectIterator { | ||
285 | VObject* start; | ||
286 | VObject* next; | ||
287 | } VObjectIterator; | ||
288 | |||
289 | extern DLLEXPORT(VObject*) newVObject(const char *id); | ||
290 | extern DLLEXPORT(void) deleteVObject(VObject *p); | ||
291 | extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size); | ||
292 | extern DLLEXPORT(void) deleteStr(const char *p); | ||
293 | extern DLLEXPORT(void) unUseStr(const char *s); | ||
294 | |||
295 | extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id); | ||
296 | extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s); | ||
297 | extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s); | ||
298 | extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i); | ||
299 | extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l); | ||
300 | extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t); | ||
301 | extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size); | ||
302 | extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size); | ||
303 | |||
304 | extern DLLEXPORT(const char*) vObjectName(VObject *o); | ||
305 | extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o); | ||
306 | extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o); | ||
307 | extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o); | ||
308 | extern DLLEXPORT(void*) vObjectAnyValue(VObject *o); | ||
309 | extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o); | ||
310 | extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p); | ||
311 | |||
312 | extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p); | ||
313 | extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id); | ||
314 | extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id); | ||
315 | extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v); | ||
316 | extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size); | ||
317 | extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size); | ||
318 | extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g); | ||
319 | extern DLLEXPORT(void) addList(VObject **o, VObject *p); | ||
320 | |||
321 | extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id); | ||
322 | |||
323 | extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o); | ||
324 | extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o); | ||
325 | extern DLLEXPORT(int) moreIteration(VObjectIterator *i); | ||
326 | extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i); | ||
327 | |||
328 | extern DLLEXPORT(const char*) lookupStr(const char *s); | ||
329 | extern DLLEXPORT(void) cleanStrTbl(); | ||
330 | |||
331 | extern DLLEXPORT(void) cleanVObject(VObject *o); | ||
332 | extern DLLEXPORT(void) cleanVObjects(VObject *list); | ||
333 | |||
334 | extern DLLEXPORT(const char*) lookupProp(const char* str); | ||
335 | extern DLLEXPORT(const char*) lookupProp_(const char* str); | ||
336 | |||
337 | extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o); | ||
338 | extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list); | ||
339 | |||
340 | extern DLLEXPORT(int) vObjectValueType(VObject *o); | ||
341 | |||
342 | /* return type of vObjectValueType: */ | ||
343 | #define VCVT_NOVALUE0 | ||
344 | /* if the VObject has no value associated with it. */ | ||
345 | #define VCVT_STRINGZ1 | ||
346 | /* if the VObject has value set by setVObjectStringZValue. */ | ||
347 | #define VCVT_UINT 2 | ||
348 | /* if the VObject has value set by setVObjectIntegerValue. */ | ||
349 | #define VCVT_ULONG 3 | ||
350 | /* if the VObject has value set by setVObjectLongValue. */ | ||
351 | #define VCVT_RAW 4 | ||
352 | /* if the VObject has value set by setVObjectAnyValue. */ | ||
353 | #define VCVT_VOBJECT5 | ||
354 | /* if the VObject has value set by setVObjectVObjectValue. */ | ||
355 | |||
356 | extern DLLEXPORT(const char**) fieldedProp; | ||
357 | |||
358 | /*************************************************** | ||
359 | * The methods below are implemented in vcc.c (generated from vcc.y ) | ||
360 | ***************************************************/ | ||
361 | |||
362 | /* NOTE regarding printVObject and writeVObject | ||
363 | |||
364 | The functions below are not exported from the DLL because they | ||
365 | take a FILE* as a parameter, which cannot be passed across a DLL | ||
366 | interface (at least that is my experience). Instead you can use | ||
367 | their companion functions which take file names or pointers | ||
368 | to memory. However, if you are linking this code into | ||
369 | your build directly then you may find them a more convenient API | ||
370 | and you can go ahead and use them. If you try to use them with | ||
371 | the DLL LIB you will get a link error. | ||
372 | */ | ||
373 | extern DLLEXPORT(void) writeVObject(FILE *fp, VObject *o); | ||
374 | |||
375 | |||
376 | |||
377 | typedef void (*MimeErrorHandler)(char *); | ||
378 | |||
379 | extern DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler); | ||
380 | |||
381 | extern DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len); | ||
382 | extern DLLEXPORT(VObject*) Parse_MIME_FromFileName(char* fname); | ||
383 | |||
384 | |||
385 | /* NOTE regarding Parse_MIME_FromFile | ||
386 | The function above, Parse_MIME_FromFile, comes in two flavors, | ||
387 | neither of which is exported from the DLL. Each version takes | ||
388 | a CFile or FILE* as a parameter, neither of which can be | ||
389 | passed across a DLL interface (at least that is my experience). | ||
390 | If you are linking this code into your build directly then | ||
391 | you may find them a more convenient API that the other flavors | ||
392 | that take a file name. If you use them with the DLL LIB you | ||
393 | will get a link error. | ||
394 | */ | ||
395 | |||
396 | |||
397 | #if INCLUDEMFC | ||
398 | extern DLLEXPORT(VObject*) Parse_MIME_FromFile(CFile *file); | ||
399 | #else | ||
400 | extern DLLEXPORT(VObject*) Parse_MIME_FromFile(FILE *file); | ||
401 | #endif | ||
402 | |||
403 | extern DLLEXPORT(const char *) vObjectTypeInfo(VObject *o); | ||
404 | |||
405 | |||
406 | #endif /* __VOBJECT_H__ */ | ||
407 | |||
408 | |||