Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > a74ec78bdb789d910d054e3918f3f007 > files > 244

libsword1-devel-1.5.5-2mdk.ppc.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>ThMLHTMLHREF class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </center>
<hr><h1>ThMLHTMLHREF  Class Reference</h1>this filter converts ThML text to HTML text with hrefs. 
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="thmlhtmlhref_8h-source.html">thmlhtmlhref.h</a>&gt;</code>
<p>
Inheritance diagram for ThMLHTMLHREF:<p><center><img src="class_th_m_l_h_t_m_l_h_r_e_f__inherit__graph.png" border="0" usemap="#_th_m_l_h_t_m_l_h_r_e_f__inherit__map" alt="Inheritance graph"></center>
<map name="_th_m_l_h_t_m_l_h_r_e_f__inherit__map">
<area href="class_s_w_basic_filter.html" shape="rect" coords="23,15,119,34" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for ThMLHTMLHREF:<p><center><img src="class_th_m_l_h_t_m_l_h_r_e_f__coll__graph.png" border="0" usemap="#_th_m_l_h_t_m_l_h_r_e_f__coll__map" alt="Collaboration graph"></center>
<map name="_th_m_l_h_t_m_l_h_r_e_f__coll__map">
<area href="class_s_w_basic_filter.html" shape="rect" coords="206,481,302,500" alt="">
<area href="class_s_w_key.html" shape="rect" coords="150,196,206,215" alt="">
<area href="class_s_w_module.html" shape="rect" coords="179,391,254,409" alt="">
<area href="class_list_key.html" shape="rect" coords="75,293,129,312" alt="">
<area href="class_s_w_object.html" shape="rect" coords="226,105,298,124" alt="">
<area href="class_s_w_display.html" shape="rect" coords="309,196,383,215" alt="">
<area href="class_s_w_class.html" shape="rect" coords="151,15,215,33" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="class_th_m_l_h_t_m_l_h_r_e_f-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2><br><h2>Public Methods</h2></td></tr>
<tr><td nowrap align=right valign=top><a name="a0" doxytag="ThMLHTMLHREF::ThMLHTMLHREF"></a>
&nbsp;</td><td valign=bottom><b>ThMLHTMLHREF</b> ()</td></tr>
<tr><td colspan=2><br><h2>Protected Methods</h2></td></tr>
<tr><td nowrap align=right valign=top>virtual bool&nbsp;</td><td valign=bottom><a class="el" href="class_th_m_l_h_t_m_l_h_r_e_f.html#b0">handleToken</a> (char **buf, const char *token, DualStringMap &amp;userData)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>This function is called for every token encountered in the input text.</em> <a href="#b0">More...</a><em></em></font><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
this filter converts ThML text to HTML text with hrefs.
<p>

<p>
Definition at line <a class="el" href="thmlhtmlhref_8h-source.html#l00026">26</a> of file <a class="el" href="thmlhtmlhref_8h-source.html">thmlhtmlhref.h</a>.<hr><h2>Member Function Documentation</h2>
<a name="b0" doxytag="ThMLHTMLHREF::handleToken"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> bool ThMLHTMLHREF::handleToken </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">char **&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>buf</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>const char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>token</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>DualStringMap &amp;&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>userData</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [protected, virtual]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
This function is called for every token encountered in the input text.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>buf</em>&nbsp;</td><td>
the output buffer (FIXME: what is its size?) </td></tr>
<tr><td valign=top><em>token</em>&nbsp;</td><td>
the token (e.g. <code>"p align='left'"</code> </td></tr>
<tr><td valign=top><em>userData</em>&nbsp;</td><td>
FIXME: document this </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
<code>false</code> if was not handled and should be handled in the default way (by just substituting). </dl>
<p>
Reimplemented from <a class="el" href="class_s_w_basic_filter.html#b13">SWBasicFilter</a>.
<p>
Definition at line <a class="el" href="thmlhtmlhref_8cpp-source.html#l00137">137</a> of file <a class="el" href="thmlhtmlhref_8cpp-source.html">thmlhtmlhref.cpp</a>.
<p>
References <a class="el" href="swmodule_8cpp-source.html#l00667">SWModule::getConfigEntry</a>(), and <a class="el" href="swbasicfilter_8cpp-source.html#l00110">SWBasicFilter::pushString</a>().
<p>
<div class="fragment"><pre>00137                                                                                      {
00138         <font class="keyword">const</font> <font class="keywordtype">char</font> *tok;
00139         <font class="keywordflow">if</font> (!substituteToken(buf, token)) {
00140         <font class="comment">// manually process if it wasn't a simple substitution</font>
00141                 <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"sync "</font>, 5)) {
00142                         <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, <font class="stringliteral">"&lt;a href=\""</font>);
00143                         <font class="keywordflow">for</font> (tok = token + 5; *(tok+1); tok++)
00144                                 <font class="keywordflow">if</font>(*tok != <font class="charliteral">'\"'</font>)
00145                                         *(*buf)++ = *tok;
00146                         *(*buf)++ = <font class="charliteral">'\"'</font>;
00147                         *(*buf)++ = <font class="charliteral">'&gt;'</font>;
00148 
00149                         <font class="comment">//scan for value and add it to the buffer</font>
00150                         <font class="keywordflow">for</font> (tok = token + 5; *tok; tok++) {
00151                                 <font class="keywordflow">if</font> (!strncmp(tok, <font class="stringliteral">"value=\""</font>, 7)) {
00152                                         tok += 7;
00153                                         <font class="keywordflow">for</font> (;*tok != <font class="charliteral">'\"'</font>; tok++)
00154                                                 *(*buf)++ = *tok;
00155                                         <font class="keywordflow">break</font>;
00156                                 }
00157                         }
00158                         <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, <font class="stringliteral">"&lt;/a&gt;"</font>);
00159                 }
00160                 
00161                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"scripture "</font>, 10)) {
00162                         userData[<font class="stringliteral">"inscriptRef"</font>] = <font class="stringliteral">"true"</font>;
00163                         <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, <font class="stringliteral">"&lt;i&gt;"</font>);
00164                 } 
00165 
00166                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"scripRef p"</font>, 10) || !strncmp(token, <font class="stringliteral">"scripRef v"</font>, 10)) {
00167                         userData[<font class="stringliteral">"inscriptRef"</font>] = <font class="stringliteral">"true"</font>;
00168                         <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, <font class="stringliteral">"&lt;a href=\""</font>);
00169                         <font class="keywordflow">for</font> (<font class="keyword">const</font> <font class="keywordtype">char</font> *tok = token + 9; *(tok+1); tok++)                              
00170                                 <font class="keywordflow">if</font>(*tok != <font class="charliteral">'\"'</font>)                        
00171                                         *(*buf)++ = *tok;
00172                         *(*buf)++ = <font class="charliteral">'\"'</font>;
00173                         *(*buf)++ = <font class="charliteral">'&gt;'</font>;
00174                 } 
00175 
00176                 <font class="comment">// we're starting a scripRef like "&lt;scripRef&gt;John 3:16&lt;/scripRef&gt;"</font>
00177                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strcmp(token, <font class="stringliteral">"scripRef"</font>)) {
00178                         userData[<font class="stringliteral">"inscriptRef"</font>] = <font class="stringliteral">"false"</font>;
00179                         <font class="comment">// let's stop text from going to output</font>
00180                         userData[<font class="stringliteral">"suspendTextPassThru"</font>] = <font class="stringliteral">"true"</font>;
00181                 }
00182 
00183                 <font class="comment">// we've ended a scripRef </font>
00184                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strcmp(token, <font class="stringliteral">"/scripRef"</font>)) {
00185                         <font class="keywordflow">if</font> (userData[<font class="stringliteral">"inscriptRef"</font>] == <font class="stringliteral">"true"</font>) { <font class="comment">// like  "&lt;scripRef passage="John 3:16"&gt;John 3:16&lt;/scripRef&gt;"</font>
00186                                 userData[<font class="stringliteral">"inscriptRef"</font>] = <font class="stringliteral">"false"</font>;
00187                                 <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, <font class="stringliteral">"&lt;/a&gt;"</font>);
00188                         }
00189                         
00190                         <font class="keywordflow">else</font> { <font class="comment">// like "&lt;scripRef&gt;John 3:16&lt;/scripRef&gt;"</font>
00191                                 <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, <font class="stringliteral">"&lt;a href=\"passage="</font>);
00192                                 <font class="comment">//char *strbuf = (char *)userData["lastTextNode"].c_str();</font>
00193                                 <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, userData[<font class="stringliteral">"lastTextNode"</font>].c_str());
00194                                 *(*buf)++ = <font class="charliteral">'\"'</font>;
00195                                 *(*buf)++ = <font class="charliteral">'&gt;'</font>;
00196                                 <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, userData[<font class="stringliteral">"lastTextNode"</font>].c_str());
00197                                 <font class="comment">// let's let text resume to output again</font>
00198                                 userData[<font class="stringliteral">"suspendTextPassThru"</font>] = <font class="stringliteral">"false"</font>;      
00199                                 <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, <font class="stringliteral">"&lt;/a&gt;"</font>);
00200                         }
00201                 }
00202                         
00203                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"div class=\"sechead\""</font>, 19)) {
00204                         userData[<font class="stringliteral">"SecHead"</font>] = <font class="stringliteral">"true"</font>;
00205                         <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, <font class="stringliteral">"&lt;br /&gt;&lt;b&gt;&lt;i&gt;"</font>);
00206                 }
00207                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"div class=\"title\""</font>, 19)) {
00208                         userData[<font class="stringliteral">"SecHead"</font>] = <font class="stringliteral">"true"</font>;
00209                         <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, <font class="stringliteral">"&lt;br /&gt;&lt;b&gt;&lt;i&gt;"</font>);
00210                 }
00211                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"/div"</font>, 4)) {
00212                         <font class="keywordflow">if</font> (userData[<font class="stringliteral">"SecHead"</font>] == <font class="stringliteral">"true"</font>) {
00213                                 <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, <font class="stringliteral">"&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;"</font>);
00214                                 userData[<font class="stringliteral">"SecHead"</font>] = <font class="stringliteral">"false"</font>;
00215                         }
00216                 }
00217 
00218                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"sync type=\"Strongs\" value=\"T"</font>, 28)) {
00219                         <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, <font class="stringliteral">"&lt;a href=\""</font>);
00220                         <font class="keywordflow">for</font> (tok = token + 5; *(tok+1); tok++)                          
00221                                 <font class="keywordflow">if</font>(*tok != <font class="charliteral">'\"'</font>)                        
00222                                         *(*buf)++ = *tok;
00223                         *(*buf)++ = <font class="charliteral">'\"'</font>;
00224                         *(*buf)++ = <font class="charliteral">'&gt;'</font>;
00225                         <font class="keywordflow">for</font> (tok = token + 29; *(tok+2); tok++)                         
00226                                 <font class="keywordflow">if</font>(*tok != <font class="charliteral">'\"'</font>)                        
00227                                         *(*buf)++ = *tok;               
00228                         <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, <font class="stringliteral">"&lt;/a&gt;"</font>);
00229                 }
00230                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"img "</font>, 4)) {
00231                         <font class="keyword">const</font> <font class="keywordtype">char</font> *src = strstr(token, <font class="stringliteral">"src"</font>);
00232                         <font class="keywordflow">if</font> (!src)               <font class="comment">// assert we have a src attribute</font>
00233                                 <font class="keywordflow">return</font> <font class="keyword">false</font>;
00234 
00235                         *(*buf)++ = <font class="charliteral">'&lt;'</font>;
00236                         <font class="keywordflow">for</font> (<font class="keyword">const</font> <font class="keywordtype">char</font> *c = token; *c; c++) {
00237                                 <font class="keywordflow">if</font> (c == src) {
00238                                         <font class="keywordflow">for</font> (;((*c) &amp;&amp; (*c != <font class="charliteral">'"'</font>)); c++)
00239                                                 *(*buf)++ = *c;
00240 
00241                                         <font class="keywordflow">if</font> (!*c) { c--; <font class="keywordflow">continue</font>; }
00242 
00243                                         *(*buf)++ = <font class="charliteral">'"'</font>;
00244                                         <font class="keywordflow">if</font> (*(c+1) == <font class="charliteral">'/'</font>) {
00245                                                 <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, <font class="stringliteral">"file:"</font>);
00246                                                 <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, module-&gt;<a class="code" href="class_s_w_module.html#a6">getConfigEntry</a>(<font class="stringliteral">"AbsoluteDataPath"</font>));
00247                                                 <font class="keywordflow">if</font> (*((*buf)-1) == <font class="charliteral">'/'</font>)
00248                                                         c++;            <font class="comment">// skip '/'</font>
00249                                         }
00250                                         <font class="keywordflow">continue</font>;
00251                                 }
00252                                 *(*buf)++ = *c;
00253                         }
00254                         *(*buf)++ = <font class="charliteral">'&gt;'</font>;
00255                 }
00256                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"note"</font>, 4)) {
00257                         <a class="code" href="class_s_w_basic_filter.html#b12">pushString</a>(buf, <font class="stringliteral">" &lt;small&gt;&lt;font color=\"#800000\"&gt;("</font>);
00258                 }                
00259                 <font class="keywordflow">else</font> {
00260                         *(*buf)++ = <font class="charliteral">'&lt;'</font>;
00261                         <font class="keywordflow">for</font> (<font class="keyword">const</font> <font class="keywordtype">char</font> *tok = token; *tok; tok++)
00262                                 *(*buf)++ = *tok;
00263                         *(*buf)++ = <font class="charliteral">'&gt;'</font>;
00264                         <font class="comment">//return false;  // we still didn't handle token</font>
00265                 }
00266         }
00267         <font class="keywordflow">return</font> <font class="keyword">true</font>;
00268 }
</pre></div>    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="thmlhtmlhref_8h-source.html">thmlhtmlhref.h</a><li><a class="el" href="thmlhtmlhref_8cpp-source.html">thmlhtmlhref.cpp</a></ul>
<hr><address align="right"><small>Generated on Thu Jun 20 22:13:04 2002 for The Sword Project by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>