Tarball tree for barry-0.17.0.tar.bz2
[barry.git] / doc / www / doxygen / html / r__task_8cc-source.html
blob8aa3fc177488712c78dfd63e42fc85a174846a2d
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3 <title>Barry: r_task.cc Source File</title>
4 <link href="doxygen.css" rel="stylesheet" type="text/css">
5 <link href="tabs.css" rel="stylesheet" type="text/css">
6 </head><body>
7 <!-- Generated by Doxygen 1.5.6 -->
8 <div class="navigation" id="top">
9 <div class="tabs">
10 <ul>
11 <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
12 <li><a href="modules.html"><span>Modules</span></a></li>
13 <li><a href="namespaces.html"><span>Namespaces</span></a></li>
14 <li><a href="classes.html"><span>Classes</span></a></li>
15 <li class="current"><a href="files.html"><span>Files</span></a></li>
16 <li><a href="dirs.html"><span>Directories</span></a></li>
17 </ul>
18 </div>
19 <div class="navpath"><a class="el" href="dir_edc0f428e3eefcfdce9c25befd901c57.html">src</a>
20 </div>
21 </div>
22 <div class="contents">
23 <h1>r_task.cc</h1><a href="r__task_8cc.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">///</span>
24 <a name="l00002"></a>00002 <span class="comment"></span><span class="comment">/// \file r_task.cc</span>
25 <a name="l00003"></a>00003 <span class="comment"></span><span class="comment">/// Record parsing class for the task database.</span>
26 <a name="l00004"></a>00004 <span class="comment"></span><span class="comment">///</span>
27 <a name="l00005"></a>00005 <span class="comment"></span>
28 <a name="l00006"></a>00006 <span class="comment">/*</span>
29 <a name="l00007"></a>00007 <span class="comment"> Copyright (C) 2005-2011, Net Direct Inc. (http://www.netdirect.ca/)</span>
30 <a name="l00008"></a>00008 <span class="comment"> Copyright (C) 2007, Brian Edginton</span>
31 <a name="l00009"></a>00009 <span class="comment"></span>
32 <a name="l00010"></a>00010 <span class="comment"> This program is free software; you can redistribute it and/or modify</span>
33 <a name="l00011"></a>00011 <span class="comment"> it under the terms of the GNU General Public License as published by</span>
34 <a name="l00012"></a>00012 <span class="comment"> the Free Software Foundation; either version 2 of the License, or</span>
35 <a name="l00013"></a>00013 <span class="comment"> (at your option) any later version.</span>
36 <a name="l00014"></a>00014 <span class="comment"></span>
37 <a name="l00015"></a>00015 <span class="comment"> This program is distributed in the hope that it will be useful,</span>
38 <a name="l00016"></a>00016 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
39 <a name="l00017"></a>00017 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</span>
40 <a name="l00018"></a>00018 <span class="comment"></span>
41 <a name="l00019"></a>00019 <span class="comment"> See the GNU General Public License in the COPYING file at the</span>
42 <a name="l00020"></a>00020 <span class="comment"> root directory of this project for more details.</span>
43 <a name="l00021"></a>00021 <span class="comment">*/</span>
44 <a name="l00022"></a>00022
45 <a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="r__task_8h.html" title="Record parsing class for the task database.">r_task.h</a>"</span>
46 <a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="r__calendar_8h.html" title="Blackberry database record parser class for calendar records.">r_calendar.h</a>"</span> <span class="comment">// for CAL_* defines</span>
47 <a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="record-internal_8h.html" title="Support functions, types, and templates for the general record parsing classes in...">record-internal.h</a>"</span>
48 <a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="protostructs_8h.html" title="USB Blackberry bulk protocol API.">protostructs.h</a>"</span>
49 <a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="data_8h.html" title="Class to deal with pre-saved data files.">data.h</a>"</span>
50 <a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="time_8h.html" title="Time related conversion routines.">time.h</a>"</span>
51 <a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="iconv_8h.html" title="iconv wrapper class, and pluggable interface for records">iconv.h</a>"</span>
52 <a name="l00030"></a>00030 <span class="preprocessor">#include "debug.h"</span>
53 <a name="l00031"></a>00031 <span class="preprocessor">#include &lt;ostream&gt;</span>
54 <a name="l00032"></a>00032 <span class="preprocessor">#include &lt;iomanip&gt;</span>
55 <a name="l00033"></a>00033 <span class="preprocessor">#include &lt;string.h&gt;</span>
56 <a name="l00034"></a>00034
57 <a name="l00035"></a>00035 <span class="keyword">using namespace </span>std;
58 <a name="l00036"></a>00036 <span class="keyword">using namespace </span>Barry::Protocol;
59 <a name="l00037"></a>00037
60 <a name="l00038"></a>00038 <span class="keyword">namespace </span>Barry {
61 <a name="l00039"></a>00039
62 <a name="l00040"></a>00040 <span class="comment"></span>
63 <a name="l00041"></a>00041 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
64 <a name="l00042"></a>00042 <span class="comment"></span><span class="comment">// Task Class, static members</span>
65 <a name="l00043"></a>00043
66 <a name="l00044"></a>00044 <span class="comment">//</span>
67 <a name="l00045"></a>00045 <span class="comment">// Note! These functions currently only pass the same values through.</span>
68 <a name="l00046"></a>00046 <span class="comment">// In actuality, these are technically two different values:</span>
69 <a name="l00047"></a>00047 <span class="comment">// one on the raw protocol side, and the other part of the</span>
70 <a name="l00048"></a>00048 <span class="comment">// guaranteed Barry API. If the Blackberry ever changes the</span>
71 <a name="l00049"></a>00049 <span class="comment">// meanings for these codes, do the translation here.</span>
72 <a name="l00050"></a>00050 <span class="comment">//</span>
73 <a name="l00051"></a>00051
74 <a name="l00052"></a>00052 Task::AlarmFlagType Task::AlarmProto2Rec(uint8_t a)
75 <a name="l00053"></a>00053 {
76 <a name="l00054"></a>00054 <span class="keywordflow">return</span> (AlarmFlagType)a;
77 <a name="l00055"></a>00055 }
78 <a name="l00056"></a>00056
79 <a name="l00057"></a>00057 uint8_t Task::AlarmRec2Proto(AlarmFlagType a)
80 <a name="l00058"></a>00058 {
81 <a name="l00059"></a>00059 <span class="keywordflow">return</span> a;
82 <a name="l00060"></a>00060 }
83 <a name="l00061"></a>00061
84 <a name="l00062"></a>00062 Task::PriorityFlagType Task::PriorityProto2Rec(uint8_t p)
85 <a name="l00063"></a>00063 {
86 <a name="l00064"></a>00064 <span class="keywordflow">return</span> (PriorityFlagType)p;
87 <a name="l00065"></a>00065 }
88 <a name="l00066"></a>00066
89 <a name="l00067"></a>00067 uint8_t Task::PriorityRec2Proto(PriorityFlagType p)
90 <a name="l00068"></a>00068 {
91 <a name="l00069"></a>00069 <span class="keywordflow">return</span> p;
92 <a name="l00070"></a>00070 }
93 <a name="l00071"></a>00071
94 <a name="l00072"></a>00072 Task::StatusFlagType Task::StatusProto2Rec(uint8_t s)
95 <a name="l00073"></a>00073 {
96 <a name="l00074"></a>00074 <span class="keywordflow">return</span> (StatusFlagType)s;
97 <a name="l00075"></a>00075 }
98 <a name="l00076"></a>00076
99 <a name="l00077"></a>00077 uint8_t Task::StatusRec2Proto(StatusFlagType s)
100 <a name="l00078"></a>00078 {
101 <a name="l00079"></a>00079 <span class="keywordflow">return</span> s;
102 <a name="l00080"></a>00080 }
103 <a name="l00081"></a>00081
104 <a name="l00082"></a>00082 <span class="comment"></span>
105 <a name="l00083"></a>00083 <span class="comment">///////////////////////////////////////////////////////////////////////////////</span>
106 <a name="l00084"></a>00084 <span class="comment"></span><span class="comment">// Task Class</span>
107 <a name="l00085"></a>00085
108 <a name="l00086"></a>00086 <span class="comment">// Task Field Codes</span>
109 <a name="l00087"></a>00087 <span class="preprocessor">#define TSKFC_TASK_TYPE 0x01</span>
110 <a name="l00088"></a>00088 <span class="preprocessor"></span><span class="preprocessor">#define TSKFC_TITLE 0x02</span>
111 <a name="l00089"></a>00089 <span class="preprocessor"></span><span class="preprocessor">#define TSKFC_NOTES 0x03</span>
112 <a name="l00090"></a>00090 <span class="preprocessor"></span><span class="preprocessor">#define TSKFC_DUE_TIME 0x05</span>
113 <a name="l00091"></a>00091 <span class="preprocessor"></span><span class="preprocessor">#define TSKFC_START_TIME 0x06 // This is fuzzy... most devices seem</span>
114 <a name="l00092"></a>00092 <span class="preprocessor"></span> <span class="comment">// to anchor this value == to DUE_TIME</span>
115 <a name="l00093"></a>00093 <span class="preprocessor">#define TSKFC_DUE_FLAG 0x08</span>
116 <a name="l00094"></a>00094 <span class="preprocessor"></span><span class="preprocessor">#define TSKFC_STATUS 0x09</span>
117 <a name="l00095"></a>00095 <span class="preprocessor"></span><span class="preprocessor">#define TSKFC_PRIORITY 0x0a</span>
118 <a name="l00096"></a>00096 <span class="preprocessor"></span><span class="preprocessor">#define TSKFC_ALARM_TYPE 0x0e</span>
119 <a name="l00097"></a>00097 <span class="preprocessor"></span><span class="preprocessor">#define TSKFC_ALARM_TIME 0x0f</span>
120 <a name="l00098"></a>00098 <span class="preprocessor"></span><span class="preprocessor">#define TSKFC_TIMEZONE_CODE 0x10</span>
121 <a name="l00099"></a>00099 <span class="preprocessor"></span><span class="preprocessor">#define TSKFC_CATEGORIES 0x11</span>
122 <a name="l00100"></a>00100 <span class="preprocessor"></span><span class="preprocessor">#define TSKFC_END 0xffff</span>
123 <a name="l00101"></a>00101 <span class="preprocessor"></span>
124 <a name="l00102"></a>00102 <span class="keyword">static</span> FieldLink&lt;Task&gt; TaskFieldLinks[] = {
125 <a name="l00103"></a>00103 { TSKFC_TITLE, <span class="stringliteral">"Summary"</span>, 0, 0, &amp;Task::Summary, 0, 0, 0, 0, <span class="keyword">true</span> },
126 <a name="l00104"></a>00104 { TSKFC_NOTES, <span class="stringliteral">"Notes"</span>, 0, 0, &amp;Task::Notes, 0, 0, 0, 0, <span class="keyword">true</span> },
127 <a name="l00105"></a>00105 { TSKFC_START_TIME, <span class="stringliteral">"Start Time"</span>, 0, 0, 0, 0, &amp;Task::StartTime, 0, 0, <span class="keyword">false</span> },
128 <a name="l00106"></a>00106 { TSKFC_DUE_TIME, <span class="stringliteral">"Due Time"</span>, 0, 0, 0, 0, &amp;Task::DueTime, 0, 0, <span class="keyword">false</span> },
129 <a name="l00107"></a>00107 { TSKFC_ALARM_TIME, <span class="stringliteral">"Alarm Time"</span>, 0, 0, 0, 0, &amp;Task::AlarmTime, 0, 0, <span class="keyword">false</span> },
130 <a name="l00108"></a>00108 { TSKFC_END, <span class="stringliteral">"End of List"</span>, 0, 0, 0, 0, 0, 0, 0, <span class="keyword">false</span> },
131 <a name="l00109"></a>00109 };
132 <a name="l00110"></a>00110
133 <a name="l00111"></a>00111 Task::Task()
134 <a name="l00112"></a>00112 {
135 <a name="l00113"></a>00113 Clear();
136 <a name="l00114"></a>00114 }
137 <a name="l00115"></a>00115
138 <a name="l00116"></a>00116 Task::~Task()
139 <a name="l00117"></a>00117 {
140 <a name="l00118"></a>00118 }
141 <a name="l00119"></a>00119
142 <a name="l00120"></a>00120 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span>* Task::ParseField(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *begin,
143 <a name="l00121"></a>00121 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *end,
144 <a name="l00122"></a>00122 <span class="keyword">const</span> IConverter *ic)
145 <a name="l00123"></a>00123 {
146 <a name="l00124"></a>00124 <span class="keyword">const</span> CommonField *field = (<span class="keyword">const</span> CommonField *) begin;
147 <a name="l00125"></a>00125
148 <a name="l00126"></a>00126 <span class="comment">// advance and check size</span>
149 <a name="l00127"></a>00127 begin += COMMON_FIELD_HEADER_SIZE + btohs(field-&gt;size);
150 <a name="l00128"></a>00128 <span class="keywordflow">if</span>( begin &gt; end ) <span class="comment">// if begin==end, we are ok</span>
151 <a name="l00129"></a>00129 <span class="keywordflow">return</span> begin;
152 <a name="l00130"></a>00130
153 <a name="l00131"></a>00131 <span class="keywordflow">if</span>( !btohs(field-&gt;size) ) <span class="comment">// if field has no size, something's up</span>
154 <a name="l00132"></a>00132 <span class="keywordflow">return</span> begin;
155 <a name="l00133"></a>00133
156 <a name="l00134"></a>00134 <span class="keywordflow">if</span>( field-&gt;type == TSKFC_TASK_TYPE ) {
157 <a name="l00135"></a>00135 <span class="keywordflow">if</span>( field-&gt;u.raw[0] != <span class="charliteral">'t'</span> ) {
158 <a name="l00136"></a>00136 <span class="keywordflow">throw</span> Error(<span class="stringliteral">"Task::ParseField: Task Type is not 't'"</span>);
159 <a name="l00137"></a>00137 }
160 <a name="l00138"></a>00138 <span class="keywordflow">return</span> begin;
161 <a name="l00139"></a>00139 }
162 <a name="l00140"></a>00140
163 <a name="l00141"></a>00141 <span class="comment">// cycle through the type table</span>
164 <a name="l00142"></a>00142 <span class="keywordflow">for</span>( FieldLink&lt;Task&gt; *b = TaskFieldLinks;
165 <a name="l00143"></a>00143 b-&gt;type != TSKFC_END;
166 <a name="l00144"></a>00144 b++ )
167 <a name="l00145"></a>00145 {
168 <a name="l00146"></a>00146 <span class="keywordflow">if</span>( b-&gt;type == field-&gt;type ) {
169 <a name="l00147"></a>00147 <span class="keywordflow">if</span>( b-&gt;strMember ) {
170 <a name="l00148"></a>00148 std::string &amp;s = this-&gt;*(b-&gt;strMember);
171 <a name="l00149"></a>00149 s = ParseFieldString(field);
172 <a name="l00150"></a>00150 <span class="keywordflow">if</span>( b-&gt;iconvNeeded &amp;&amp; ic )
173 <a name="l00151"></a>00151 s = ic-&gt;FromBB(s);
174 <a name="l00152"></a>00152 <span class="keywordflow">return</span> begin; <span class="comment">// done!</span>
175 <a name="l00153"></a>00153 }
176 <a name="l00154"></a>00154 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( b-&gt;timeMember &amp;&amp; btohs(field-&gt;size) == 4 ) {
177 <a name="l00155"></a>00155 time_t &amp;t = this-&gt;*(b-&gt;timeMember);
178 <a name="l00156"></a>00156 t = min2time(field-&gt;u.min1900);
179 <a name="l00157"></a>00157 <span class="keywordflow">return</span> begin;
180 <a name="l00158"></a>00158 }
181 <a name="l00159"></a>00159 }
182 <a name="l00160"></a>00160 }
183 <a name="l00161"></a>00161 <span class="comment">// handle special cases</span>
184 <a name="l00162"></a>00162 <span class="keywordflow">switch</span>( field-&gt;type )
185 <a name="l00163"></a>00163 {
186 <a name="l00164"></a>00164 <span class="keywordflow">case</span> TSKFC_PRIORITY:
187 <a name="l00165"></a>00165 <span class="keywordflow">if</span>( field-&gt;u.raw[0] &gt; TR_PRIORITY_RANGE_HIGH ) {
188 <a name="l00166"></a>00166 <span class="keywordflow">throw</span> Error( <span class="stringliteral">"Task::ParseField: priority field out of bounds"</span> );
189 <a name="l00167"></a>00167 }
190 <a name="l00168"></a>00168 <span class="keywordflow">else</span> {
191 <a name="l00169"></a>00169 PriorityFlag = PriorityProto2Rec(field-&gt;u.raw[0]);
192 <a name="l00170"></a>00170 }
193 <a name="l00171"></a>00171 <span class="keywordflow">return</span> begin;
194 <a name="l00172"></a>00172
195 <a name="l00173"></a>00173 <span class="keywordflow">case</span> TSKFC_STATUS:
196 <a name="l00174"></a>00174 <span class="keywordflow">if</span>( field-&gt;u.raw[0] &gt; TR_STATUS_RANGE_HIGH ) {
197 <a name="l00175"></a>00175 <span class="keywordflow">throw</span> Error( <span class="stringliteral">"Task::ParseField: priority field out of bounds"</span> );
198 <a name="l00176"></a>00176 }
199 <a name="l00177"></a>00177 <span class="keywordflow">else</span> {
200 <a name="l00178"></a>00178 StatusFlag = StatusProto2Rec(field-&gt;u.raw[0]);
201 <a name="l00179"></a>00179 }
202 <a name="l00180"></a>00180 <span class="keywordflow">return</span> begin;
203 <a name="l00181"></a>00181
204 <a name="l00182"></a>00182 <span class="keywordflow">case</span> TSKFC_TIMEZONE_CODE:
205 <a name="l00183"></a>00183 <span class="keywordflow">if</span>( btohs(field-&gt;size) == 4 ) {
206 <a name="l00184"></a>00184 TimeZoneCode = btohs(field-&gt;u.code);
207 <a name="l00185"></a>00185 TimeZoneValid = <span class="keyword">true</span>;
208 <a name="l00186"></a>00186 }
209 <a name="l00187"></a>00187 <span class="keywordflow">else</span> {
210 <a name="l00188"></a>00188 <span class="keywordflow">throw</span> Error(<span class="stringliteral">"Task::ParseField: not enough data in time zone code field"</span>);
211 <a name="l00189"></a>00189 }
212 <a name="l00190"></a>00190 <span class="keywordflow">return</span> begin;
213 <a name="l00191"></a>00191
214 <a name="l00192"></a>00192 <span class="keywordflow">case</span> TSKFC_DUE_FLAG:
215 <a name="l00193"></a>00193 DueDateFlag = field-&gt;u.raw[0];
216 <a name="l00194"></a>00194 <span class="keywordflow">return</span> begin;
217 <a name="l00195"></a>00195
218 <a name="l00196"></a>00196 <span class="keywordflow">case</span> TSKFC_ALARM_TYPE:
219 <a name="l00197"></a>00197 <span class="keywordflow">if</span>( field-&gt;u.raw[0] &gt; TR_ALARM_RANGE_HIGH ) {
220 <a name="l00198"></a>00198 <span class="keywordflow">throw</span> Error(<span class="stringliteral">"Task::ParseField: AlarmType out of bounds"</span> );
221 <a name="l00199"></a>00199 }
222 <a name="l00200"></a>00200 <span class="keywordflow">else</span> {
223 <a name="l00201"></a>00201 AlarmType = AlarmProto2Rec(field-&gt;u.raw[0]);
224 <a name="l00202"></a>00202 }
225 <a name="l00203"></a>00203 <span class="keywordflow">return</span> begin;
226 <a name="l00204"></a>00204
227 <a name="l00205"></a>00205 <span class="keywordflow">case</span> TSKFC_CATEGORIES:
228 <a name="l00206"></a>00206 {
229 <a name="l00207"></a>00207 std::string catstring = ParseFieldString(field);
230 <a name="l00208"></a>00208 <span class="keywordflow">if</span>( ic )
231 <a name="l00209"></a>00209 catstring = ic-&gt;FromBB(catstring);
232 <a name="l00210"></a>00210 Categories.CategoryStr2List(catstring);
233 <a name="l00211"></a>00211 }
234 <a name="l00212"></a>00212 <span class="keywordflow">return</span> begin;
235 <a name="l00213"></a>00213 }
236 <a name="l00214"></a>00214 <span class="comment">// base class handles recurring data</span>
237 <a name="l00215"></a>00215 <span class="keywordflow">if</span>( RecurBase::ParseField(field-&gt;type, field-&gt;u.raw, btohs(field-&gt;size), ic) )
238 <a name="l00216"></a>00216 <span class="keywordflow">return</span> begin;
239 <a name="l00217"></a>00217
240 <a name="l00218"></a>00218 <span class="comment">// if still not handled, add to the Unknowns list</span>
241 <a name="l00219"></a>00219 UnknownField uf;
242 <a name="l00220"></a>00220 uf.type = field-&gt;type;
243 <a name="l00221"></a>00221 uf.data.assign((<span class="keyword">const</span> <span class="keywordtype">char</span>*)field-&gt;u.raw, btohs(field-&gt;size));
244 <a name="l00222"></a>00222 Unknowns.push_back(uf);
245 <a name="l00223"></a>00223
246 <a name="l00224"></a>00224 <span class="comment">// return new pointer for next field</span>
247 <a name="l00225"></a>00225 <span class="keywordflow">return</span> begin;
248 <a name="l00226"></a>00226 }
249 <a name="l00227"></a>00227
250 <a name="l00228"></a>00228 <span class="keywordtype">void</span> Task::ParseHeader(<span class="keyword">const</span> Data &amp;data, <span class="keywordtype">size_t</span> &amp;offset)
251 <a name="l00229"></a>00229 {
252 <a name="l00230"></a>00230 <span class="comment">// no header in Task records</span>
253 <a name="l00231"></a>00231 }
254 <a name="l00232"></a>00232
255 <a name="l00233"></a>00233 <span class="keywordtype">void</span> Task::ParseFields(<span class="keyword">const</span> Data &amp;data, <span class="keywordtype">size_t</span> &amp;offset, <span class="keyword">const</span> IConverter *ic)
256 <a name="l00234"></a>00234 {
257 <a name="l00235"></a>00235 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *finish = ParseCommonFields(*<span class="keyword">this</span>,
258 <a name="l00236"></a>00236 data.GetData() + offset, data.GetData() + data.GetSize(), ic);
259 <a name="l00237"></a>00237 offset += finish - (data.GetData() + offset);
260 <a name="l00238"></a>00238 }
261 <a name="l00239"></a>00239
262 <a name="l00240"></a>00240
263 <a name="l00241"></a>00241 <span class="keywordtype">void</span> Task::BuildHeader(Data &amp;data, <span class="keywordtype">size_t</span> &amp;offset)<span class="keyword"> const</span>
264 <a name="l00242"></a>00242 <span class="keyword"></span>{
265 <a name="l00243"></a>00243 <span class="comment">// no header in Task records</span>
266 <a name="l00244"></a>00244 }
267 <a name="l00245"></a>00245
268 <a name="l00246"></a>00246
269 <a name="l00247"></a>00247 <span class="comment">//</span>
270 <a name="l00248"></a>00248 <span class="comment">// Build</span>
271 <a name="l00249"></a>00249 <span class="comment">//</span><span class="comment"></span>
272 <a name="l00250"></a>00250 <span class="comment">/// Build fields part of record.</span>
273 <a name="l00251"></a>00251 <span class="comment">///</span>
274 <a name="l00252"></a>00252 <span class="comment"></span><span class="keywordtype">void</span> Task::BuildFields(Data &amp;data, <span class="keywordtype">size_t</span> &amp;offset, <span class="keyword">const</span> IConverter *ic)<span class="keyword"> const</span>
275 <a name="l00253"></a>00253 <span class="keyword"></span>{
276 <a name="l00254"></a>00254 data.Zap();
277 <a name="l00255"></a>00255
278 <a name="l00256"></a>00256 <span class="comment">// tack on the 't' task type field first</span>
279 <a name="l00257"></a>00257 BuildField(data, offset, TSKFC_TASK_TYPE, <span class="charliteral">'t'</span>);
280 <a name="l00258"></a>00258
281 <a name="l00259"></a>00259 BuildField(data, offset, TSKFC_STATUS, StatusRec2Proto(StatusFlag));
282 <a name="l00260"></a>00260 BuildField(data, offset, TSKFC_PRIORITY, PriorityRec2Proto(PriorityFlag));
283 <a name="l00261"></a>00261 BuildField(data, offset, TSKFC_ALARM_TYPE, AlarmRec2Proto(AlarmType));
284 <a name="l00262"></a>00262
285 <a name="l00263"></a>00263 <span class="keywordflow">if</span> ( DueDateFlag )
286 <a name="l00264"></a>00264 BuildField(data, offset, TSKFC_DUE_FLAG, (<span class="keywordtype">char</span>) 1);
287 <a name="l00265"></a>00265 <span class="keywordflow">else</span>
288 <a name="l00266"></a>00266 BuildField(data, offset, TSKFC_DUE_FLAG, (<span class="keywordtype">char</span>) 0);
289 <a name="l00267"></a>00267
290 <a name="l00268"></a>00268 <span class="keywordflow">if</span>( TimeZoneValid ) {
291 <a name="l00269"></a>00269 <span class="comment">// the time zone code field is 4 bytes, but we only use</span>
292 <a name="l00270"></a>00270 <span class="comment">// the first two... pad it with zeros</span>
293 <a name="l00271"></a>00271 uint32_t code = TimeZoneCode;
294 <a name="l00272"></a>00272 BuildField(data, offset, TSKFC_TIMEZONE_CODE, code);
295 <a name="l00273"></a>00273 }
296 <a name="l00274"></a>00274
297 <a name="l00275"></a>00275 <span class="comment">// cycle through the type table</span>
298 <a name="l00276"></a>00276 <span class="keywordflow">for</span>( FieldLink&lt;Task&gt; *b = TaskFieldLinks;
299 <a name="l00277"></a>00277 b-&gt;type != TSKFC_END;
300 <a name="l00278"></a>00278 b++ )
301 <a name="l00279"></a>00279 {
302 <a name="l00280"></a>00280 <span class="comment">// print only fields with data</span>
303 <a name="l00281"></a>00281 <span class="keywordflow">if</span>( b-&gt;strMember ) {
304 <a name="l00282"></a>00282 <span class="keyword">const</span> std::string &amp;field = this-&gt;*(b-&gt;strMember);
305 <a name="l00283"></a>00283 <span class="keywordflow">if</span>( field.size() ) {
306 <a name="l00284"></a>00284 std::string s = (b-&gt;iconvNeeded &amp;&amp; ic) ? ic-&gt;ToBB(field) : field;
307 <a name="l00285"></a>00285 BuildField(data, offset, b-&gt;type, s);
308 <a name="l00286"></a>00286 }
309 <a name="l00287"></a>00287 }
310 <a name="l00288"></a>00288 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( b-&gt;timeMember ) {
311 <a name="l00289"></a>00289 time_t t = this-&gt;*(b-&gt;timeMember);
312 <a name="l00290"></a>00290 <span class="keywordflow">if</span>( t &gt; 0 )
313 <a name="l00291"></a>00291 BuildField1900(data, offset, b-&gt;type, t);
314 <a name="l00292"></a>00292 }
315 <a name="l00293"></a>00293 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( b-&gt;postMember &amp;&amp; b-&gt;postField ) {
316 <a name="l00294"></a>00294 <span class="keyword">const</span> std::string &amp;field = (this-&gt;*(b-&gt;postMember)).*(b-&gt;postField);
317 <a name="l00295"></a>00295 <span class="keywordflow">if</span>( field.size() ) {
318 <a name="l00296"></a>00296 std::string s = (b-&gt;iconvNeeded &amp;&amp; ic) ? ic-&gt;ToBB(field) : field;
319 <a name="l00297"></a>00297 BuildField(data, offset, b-&gt;type, s);
320 <a name="l00298"></a>00298 }
321 <a name="l00299"></a>00299 }
322 <a name="l00300"></a>00300 }
323 <a name="l00301"></a>00301
324 <a name="l00302"></a>00302 <span class="comment">// Categories</span>
325 <a name="l00303"></a>00303 <span class="keywordflow">if</span>( Categories.size() ) {
326 <a name="l00304"></a>00304 <span class="keywordtype">string</span> store;
327 <a name="l00305"></a>00305 Categories.CategoryList2Str(store);
328 <a name="l00306"></a>00306 BuildField(data, offset, TSKFC_CATEGORIES, ic ? ic-&gt;ToBB(store) : store);
329 <a name="l00307"></a>00307 }
330 <a name="l00308"></a>00308
331 <a name="l00309"></a>00309 <span class="comment">// and finally save unknowns</span>
332 <a name="l00310"></a>00310 UnknownsType::const_iterator
333 <a name="l00311"></a>00311 ub = Unknowns.begin(), ue = Unknowns.end();
334 <a name="l00312"></a>00312 <span class="keywordflow">for</span>( ; ub != ue; ub++ ) {
335 <a name="l00313"></a>00313 BuildField(data, offset, *ub);
336 <a name="l00314"></a>00314 }
337 <a name="l00315"></a>00315
338 <a name="l00316"></a>00316 data.ReleaseBuffer(offset);
339 <a name="l00317"></a>00317 }
340 <a name="l00318"></a>00318
341 <a name="l00319"></a>00319
342 <a name="l00320"></a>00320
343 <a name="l00321"></a>00321 <span class="keywordtype">void</span> Task::Clear()
344 <a name="l00322"></a>00322 {
345 <a name="l00323"></a>00323 <span class="comment">// clear the base class first</span>
346 <a name="l00324"></a>00324 RecurBase::Clear();
347 <a name="l00325"></a>00325
348 <a name="l00326"></a>00326 <span class="comment">// our variables...</span>
349 <a name="l00327"></a>00327 RecType = GetDefaultRecType();
350 <a name="l00328"></a>00328 RecordId = 0;
351 <a name="l00329"></a>00329
352 <a name="l00330"></a>00330 Summary.clear();
353 <a name="l00331"></a>00331 Notes.clear();
354 <a name="l00332"></a>00332 Categories.clear();
355 <a name="l00333"></a>00333 UID.clear();
356 <a name="l00334"></a>00334
357 <a name="l00335"></a>00335 StartTime = DueTime = AlarmTime = 0;
358 <a name="l00336"></a>00336 TimeZoneCode = <a class="code" href="namespaceBarry.html#56ac220ad3edcfbefcebb35c685212d1" title="Searches the internal timezone table for the first matching Code.">GetTimeZoneCode</a>( 0, 0 ); <span class="comment">// default to GMT</span>
359 <a name="l00337"></a>00337 TimeZoneValid = <span class="keyword">false</span>;
360 <a name="l00338"></a>00338
361 <a name="l00339"></a>00339 AlarmType = (AlarmFlagType)0;
362 <a name="l00340"></a>00340 PriorityFlag = (PriorityFlagType)0;
363 <a name="l00341"></a>00341 StatusFlag = (StatusFlagType)0;
364 <a name="l00342"></a>00342
365 <a name="l00343"></a>00343 DueDateFlag = <span class="keyword">false</span>;
366 <a name="l00344"></a>00344
367 <a name="l00345"></a>00345 Unknowns.clear();
368 <a name="l00346"></a>00346 }
369 <a name="l00347"></a>00347
370 <a name="l00348"></a>00348 std::string Task::GetDescription()<span class="keyword"> const</span>
371 <a name="l00349"></a>00349 <span class="keyword"></span>{
372 <a name="l00350"></a>00350 <span class="keywordflow">return</span> Summary;
373 <a name="l00351"></a>00351 }
374 <a name="l00352"></a>00352
375 <a name="l00353"></a>00353 <span class="keywordtype">void</span> Task::Dump(std::ostream &amp;os)<span class="keyword"> const</span>
376 <a name="l00354"></a>00354 <span class="keyword"></span>{
377 <a name="l00355"></a>00355 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *PriorityName[] = { <span class="stringliteral">"High"</span>, <span class="stringliteral">"Normal"</span>, <span class="stringliteral">"Low"</span> };
378 <a name="l00356"></a>00356 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *StatusName[] = { <span class="stringliteral">"Not Started"</span>, <span class="stringliteral">"In Progress"</span>,
379 <a name="l00357"></a>00357 <span class="stringliteral">"Completed"</span>, <span class="stringliteral">"Waiting"</span>, <span class="stringliteral">"Deferred"</span> };
380 <a name="l00358"></a>00358 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *DayNames[] = { <span class="stringliteral">"Sun"</span>, <span class="stringliteral">"Mon"</span>, <span class="stringliteral">"Tue"</span>, <span class="stringliteral">"Wed"</span>,
381 <a name="l00359"></a>00359 <span class="stringliteral">"Thu"</span>, <span class="stringliteral">"Fri"</span>, <span class="stringliteral">"Sat"</span> };
382 <a name="l00360"></a>00360 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *MonthNames[] = { <span class="stringliteral">"Jan"</span>, <span class="stringliteral">"Feb"</span>, <span class="stringliteral">"Mar"</span>, <span class="stringliteral">"Apr"</span>,
383 <a name="l00361"></a>00361 <span class="stringliteral">"May"</span>, <span class="stringliteral">"Jun"</span>, <span class="stringliteral">"Jul"</span>, <span class="stringliteral">"Aug"</span>, <span class="stringliteral">"Sep"</span>, <span class="stringliteral">"Oct"</span>, <span class="stringliteral">"Nov"</span>, <span class="stringliteral">"Dec"</span> };
384 <a name="l00362"></a>00362 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *AlarmTypeName[] = { <span class="stringliteral">"None"</span>, <span class="stringliteral">"By Date"</span>, <span class="stringliteral">"Relative"</span> };
385 <a name="l00363"></a>00363
386 <a name="l00364"></a>00364 os &lt;&lt; <span class="stringliteral">"Task entry: 0x"</span> &lt;&lt; setbase(16) &lt;&lt; RecordId
387 <a name="l00365"></a>00365 &lt;&lt; <span class="stringliteral">" ("</span> &lt;&lt; (<span class="keywordtype">unsigned</span> int)RecType &lt;&lt; <span class="stringliteral">")\n"</span>;
388 <a name="l00366"></a>00366
389 <a name="l00367"></a>00367 <span class="comment">// cycle through the type table</span>
390 <a name="l00368"></a>00368 <span class="keywordflow">for</span>( <span class="keyword">const</span> FieldLink&lt;Task&gt; *b = TaskFieldLinks;
391 <a name="l00369"></a>00369 b-&gt;type != TSKFC_END;
392 <a name="l00370"></a>00370 b++ )
393 <a name="l00371"></a>00371 {
394 <a name="l00372"></a>00372 <span class="keywordflow">if</span>( b-&gt;strMember ) {
395 <a name="l00373"></a>00373 <span class="keyword">const</span> std::string &amp;s = this-&gt;*(b-&gt;strMember);
396 <a name="l00374"></a>00374 <span class="keywordflow">if</span>( s.size() )
397 <a name="l00375"></a>00375 os &lt;&lt; <span class="stringliteral">" "</span> &lt;&lt; b-&gt;name &lt;&lt; <span class="stringliteral">": "</span> &lt;&lt; s &lt;&lt; <span class="stringliteral">"\n"</span>;
398 <a name="l00376"></a>00376 }
399 <a name="l00377"></a>00377 <span class="keywordflow">else</span> <span class="keywordflow">if</span>( b-&gt;timeMember ) {
400 <a name="l00378"></a>00378 time_t t = this-&gt;*(b-&gt;timeMember);
401 <a name="l00379"></a>00379 <span class="keywordflow">if</span>( t &gt; 0 )
402 <a name="l00380"></a>00380 os &lt;&lt; <span class="stringliteral">" "</span> &lt;&lt; b-&gt;name &lt;&lt; <span class="stringliteral">": "</span> &lt;&lt; ctime(&amp;t);
403 <a name="l00381"></a>00381 }
404 <a name="l00382"></a>00382 }
405 <a name="l00383"></a>00383
406 <a name="l00384"></a>00384 os &lt;&lt; <span class="stringliteral">" Due Date Flag: "</span> &lt;&lt; (DueDateFlag ? <span class="stringliteral">"true"</span> : <span class="stringliteral">"false"</span>) &lt;&lt; <span class="stringliteral">"\n"</span>;
407 <a name="l00385"></a>00385 os &lt;&lt; <span class="stringliteral">" Priority: "</span> &lt;&lt; PriorityName[PriorityFlag] &lt;&lt; <span class="stringliteral">"\n"</span>;
408 <a name="l00386"></a>00386 os &lt;&lt; <span class="stringliteral">" Status: "</span> &lt;&lt; StatusName[StatusFlag] &lt;&lt; <span class="stringliteral">"\n"</span>;
409 <a name="l00387"></a>00387 <span class="keywordflow">if</span>( AlarmType ) {
410 <a name="l00388"></a>00388 os &lt;&lt; <span class="stringliteral">" Alarm Type: "</span> &lt;&lt; AlarmTypeName[AlarmType] &lt;&lt; <span class="stringliteral">"\n"</span>;
411 <a name="l00389"></a>00389 }
412 <a name="l00390"></a>00390 <span class="keywordflow">if</span>( TimeZoneValid )
413 <a name="l00391"></a>00391 os &lt;&lt; <span class="stringliteral">" Time Zone: "</span> &lt;&lt; <a class="code" href="namespaceBarry.html#8b42d46bf7b5cb8f4d9e0bde1d61f226" title="Searches the internal timezone code table for the given Code and returns a pointer...">GetTimeZone</a>(TimeZoneCode)-&gt;Name &lt;&lt; <span class="stringliteral">"\n"</span>;
414 <a name="l00392"></a>00392
415 <a name="l00393"></a>00393 <span class="comment">// print recurrence data if available</span>
416 <a name="l00394"></a>00394 os &lt;&lt; <span class="stringliteral">" Recurring: "</span> &lt;&lt; (Recurring ? <span class="stringliteral">"yes"</span> : <span class="stringliteral">"no"</span>) &lt;&lt; <span class="stringliteral">"\n"</span>;
417 <a name="l00395"></a>00395 <span class="keywordflow">if</span>( Recurring ) {
418 <a name="l00396"></a>00396 <span class="keywordflow">switch</span>( RecurringType )
419 <a name="l00397"></a>00397 {
420 <a name="l00398"></a>00398 <span class="keywordflow">case</span> Day:
421 <a name="l00399"></a>00399 os &lt;&lt; <span class="stringliteral">" Every day.\n"</span>;
422 <a name="l00400"></a>00400 <span class="keywordflow">break</span>;
423 <a name="l00401"></a>00401
424 <a name="l00402"></a>00402 <span class="keywordflow">case</span> MonthByDate:
425 <a name="l00403"></a>00403 os &lt;&lt; <span class="stringliteral">" Every month on the "</span>
426 <a name="l00404"></a>00404 &lt;&lt; DayOfMonth
427 <a name="l00405"></a>00405 &lt;&lt; (DayOfMonth == 1 ? <span class="stringliteral">"st"</span> : <span class="stringliteral">""</span>)
428 <a name="l00406"></a>00406 &lt;&lt; (DayOfMonth == 2 ? <span class="stringliteral">"nd"</span> : <span class="stringliteral">""</span>)
429 <a name="l00407"></a>00407 &lt;&lt; (DayOfMonth == 3 ? <span class="stringliteral">"rd"</span> : <span class="stringliteral">""</span>)
430 <a name="l00408"></a>00408 &lt;&lt; (DayOfMonth &gt; 3 ? <span class="stringliteral">"th"</span> : <span class="stringliteral">""</span>)
431 <a name="l00409"></a>00409 &lt;&lt; <span class="stringliteral">"\n"</span>;
432 <a name="l00410"></a>00410 <span class="keywordflow">break</span>;
433 <a name="l00411"></a>00411
434 <a name="l00412"></a>00412 <span class="keywordflow">case</span> MonthByDay:
435 <a name="l00413"></a>00413 os &lt;&lt; <span class="stringliteral">" Every month on the "</span>
436 <a name="l00414"></a>00414 &lt;&lt; DayNames[DayOfWeek]
437 <a name="l00415"></a>00415 &lt;&lt; <span class="stringliteral">" of week "</span>
438 <a name="l00416"></a>00416 &lt;&lt; WeekOfMonth
439 <a name="l00417"></a>00417 &lt;&lt; <span class="stringliteral">"\n"</span>;
440 <a name="l00418"></a>00418 <span class="keywordflow">break</span>;
441 <a name="l00419"></a>00419
442 <a name="l00420"></a>00420 <span class="keywordflow">case</span> YearByDate:
443 <a name="l00421"></a>00421 os &lt;&lt; <span class="stringliteral">" Every year on "</span>
444 <a name="l00422"></a>00422 &lt;&lt; MonthNames[MonthOfYear-1]
445 <a name="l00423"></a>00423 &lt;&lt; <span class="stringliteral">" "</span> &lt;&lt; DayOfMonth &lt;&lt; <span class="stringliteral">"\n"</span>;
446 <a name="l00424"></a>00424 <span class="keywordflow">break</span>;
447 <a name="l00425"></a>00425
448 <a name="l00426"></a>00426 <span class="keywordflow">case</span> YearByDay:
449 <a name="l00427"></a>00427 os &lt;&lt; <span class="stringliteral">" Every year in "</span> &lt;&lt; MonthNames[MonthOfYear-1]
450 <a name="l00428"></a>00428 &lt;&lt; <span class="stringliteral">" on "</span>
451 <a name="l00429"></a>00429 &lt;&lt; DayNames[DayOfWeek]
452 <a name="l00430"></a>00430 &lt;&lt; <span class="stringliteral">" of week "</span> &lt;&lt; WeekOfMonth &lt;&lt; <span class="stringliteral">"\n"</span>;
453 <a name="l00431"></a>00431 <span class="keywordflow">break</span>;
454 <a name="l00432"></a>00432
455 <a name="l00433"></a>00433 <span class="keywordflow">case</span> Week:
456 <a name="l00434"></a>00434 os &lt;&lt; <span class="stringliteral">" Every week on: "</span>;
457 <a name="l00435"></a>00435 <span class="keywordflow">if</span>( WeekDays &amp; CAL_WD_SUN ) os &lt;&lt; <span class="stringliteral">"Sun "</span>;
458 <a name="l00436"></a>00436 <span class="keywordflow">if</span>( WeekDays &amp; CAL_WD_MON ) os &lt;&lt; <span class="stringliteral">"Mon "</span>;
459 <a name="l00437"></a>00437 <span class="keywordflow">if</span>( WeekDays &amp; CAL_WD_TUE ) os &lt;&lt; <span class="stringliteral">"Tue "</span>;
460 <a name="l00438"></a>00438 <span class="keywordflow">if</span>( WeekDays &amp; CAL_WD_WED ) os &lt;&lt; <span class="stringliteral">"Wed "</span>;
461 <a name="l00439"></a>00439 <span class="keywordflow">if</span>( WeekDays &amp; CAL_WD_THU ) os &lt;&lt; <span class="stringliteral">"Thu "</span>;
462 <a name="l00440"></a>00440 <span class="keywordflow">if</span>( WeekDays &amp; CAL_WD_FRI ) os &lt;&lt; <span class="stringliteral">"Fri "</span>;
463 <a name="l00441"></a>00441 <span class="keywordflow">if</span>( WeekDays &amp; CAL_WD_SAT ) os &lt;&lt; <span class="stringliteral">"Sat "</span>;
464 <a name="l00442"></a>00442 os &lt;&lt; <span class="stringliteral">"\n"</span>;
465 <a name="l00443"></a>00443 <span class="keywordflow">break</span>;
466 <a name="l00444"></a>00444
467 <a name="l00445"></a>00445 <span class="keywordflow">default</span>:
468 <a name="l00446"></a>00446 os &lt;&lt; <span class="stringliteral">" Unknown recurrence type\n"</span>;
469 <a name="l00447"></a>00447 <span class="keywordflow">break</span>;
470 <a name="l00448"></a>00448 }
471 <a name="l00449"></a>00449
472 <a name="l00450"></a>00450 os &lt;&lt; <span class="stringliteral">" Interval: "</span> &lt;&lt; Interval &lt;&lt; <span class="stringliteral">"\n"</span>;
473 <a name="l00451"></a>00451
474 <a name="l00452"></a>00452 <span class="keywordflow">if</span>( Perpetual )
475 <a name="l00453"></a>00453 os &lt;&lt; <span class="stringliteral">" Ends: never\n"</span>;
476 <a name="l00454"></a>00454 <span class="keywordflow">else</span>
477 <a name="l00455"></a>00455 os &lt;&lt; <span class="stringliteral">" Ends: "</span> &lt;&lt; ctime(&amp;RecurringEndTime);
478 <a name="l00456"></a>00456 }
479 <a name="l00457"></a>00457
480 <a name="l00458"></a>00458 <span class="keywordflow">if</span>( Categories.size() ) {
481 <a name="l00459"></a>00459 <span class="keywordtype">string</span> display;
482 <a name="l00460"></a>00460 Categories.CategoryList2Str(display);
483 <a name="l00461"></a>00461 os &lt;&lt; <span class="stringliteral">" Categories: "</span> &lt;&lt; display &lt;&lt; <span class="stringliteral">"\n"</span>;
484 <a name="l00462"></a>00462 }
485 <a name="l00463"></a>00463
486 <a name="l00464"></a>00464 os &lt;&lt; Unknowns;
487 <a name="l00465"></a>00465 os &lt;&lt; <span class="stringliteral">"\n\n"</span>;
488 <a name="l00466"></a>00466 }
489 <a name="l00467"></a>00467
490 <a name="l00468"></a>00468 <span class="keywordtype">bool</span> Task::operator&lt;(<span class="keyword">const</span> Task &amp;other)<span class="keyword"> const</span>
491 <a name="l00469"></a>00469 <span class="keyword"></span>{
492 <a name="l00470"></a>00470 <span class="keywordflow">if</span>( StartTime != other.StartTime )
493 <a name="l00471"></a>00471 <span class="keywordflow">return</span> StartTime &lt; other.StartTime;
494 <a name="l00472"></a>00472 <span class="keywordflow">if</span>( AlarmTime != other.AlarmTime )
495 <a name="l00473"></a>00473 <span class="keywordflow">return</span> AlarmTime &lt; other.AlarmTime;
496 <a name="l00474"></a>00474
497 <a name="l00475"></a>00475 <span class="keywordtype">int</span> cmp = Summary.compare(other.Summary);
498 <a name="l00476"></a>00476 <span class="keywordflow">if</span>( cmp == 0 )
499 <a name="l00477"></a>00477 cmp = Notes.compare(other.Notes);
500 <a name="l00478"></a>00478 <span class="keywordflow">return</span> cmp &lt; 0;
501 <a name="l00479"></a>00479 }
502 <a name="l00480"></a>00480
503 <a name="l00481"></a>00481 } <span class="comment">// namespace Barry</span>
504 <a name="l00482"></a>00482
505 </pre></div></div>
506 <hr size="1"><address style="text-align: right;"><small>Generated on Thu Feb 10 16:13:59 2011 for Barry by&nbsp;
507 <a href="http://www.doxygen.org/index.html">
508 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
509 </body>
510 </html>