Sophie

Sophie

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

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>plainfootnotes.cpp Source File</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>plainfootnotes.cpp</h1><div class="fragment"><pre>00001 <font class="comment">/***************************************************************************</font>
00002 <font class="comment">                          plainfootnotes.cpp  -  description</font>
00003 <font class="comment">                             -------------------</font>
00004 <font class="comment">    begin                : Wed Oct 13 1999</font>
00005 <font class="comment">    copyright            : (C) 1999 by The team of BibleTime</font>
00006 <font class="comment">    email                : info@bibletime.de</font>
00007 <font class="comment"> ***************************************************************************/</font>
00008 
00009 <font class="comment">/***************************************************************************</font>
00010 <font class="comment"> *                                                                         *</font>
00011 <font class="comment"> *   This program is free software; you can redistribute it and/or modify  *</font>
00012 <font class="comment"> *   it under the terms of the GNU General Public License as published by  *</font>
00013 <font class="comment"> *   the Free Software Foundation; either version 2 of the License, or     *</font>
00014 <font class="comment"> *   (at your option) any later version.                                   *</font>
00015 <font class="comment"> *                                                                         *</font>
00016 <font class="comment"> ***************************************************************************/</font>
00017 
00018 <font class="preprocessor">#include &lt;plainfootnotes.h&gt;</font>
00019 <font class="preprocessor">#include &lt;swkey.h&gt;</font>
00020 
00021 <font class="preprocessor">#include &lt;stdlib.h&gt;</font>
00022 <font class="preprocessor">#include &lt;string.h&gt;</font>
00023 <font class="preprocessor">#ifndef __GNUC__</font>
00024 <font class="preprocessor"></font><font class="preprocessor">#else</font>
00025 <font class="preprocessor"></font><font class="preprocessor">#include &lt;unixstr.h&gt;</font>
00026 <font class="preprocessor">#endif</font>
00027 <font class="preprocessor"></font>
00028 <font class="keyword">const</font> <font class="keywordtype">char</font> PLAINFootnotes::on[] = <font class="stringliteral">"On"</font>;
00029 <font class="keyword">const</font> <font class="keywordtype">char</font> PLAINFootnotes::off[] = <font class="stringliteral">"Off"</font>;
00030 <font class="keyword">const</font> <font class="keywordtype">char</font> PLAINFootnotes::optName[] = <font class="stringliteral">"Footnotes"</font>;
00031 <font class="keyword">const</font> <font class="keywordtype">char</font> PLAINFootnotes::optTip[] = <font class="stringliteral">"Toggles Footnotes On and Off In Bible Texts If They Exist"</font>;
00032 
00033 PLAINFootnotes::PLAINFootnotes(){
00034         option = <font class="keyword">false</font>;
00035         options.push_back(on);
00036         options.push_back(off);
00037 }
00038 
00039 PLAINFootnotes::~PLAINFootnotes(){
00040 }
00041 
00042 
00043 <font class="keywordtype">void</font> PLAINFootnotes::setOptionValue(<font class="keyword">const</font> <font class="keywordtype">char</font> *ival)
00044 {
00045         option = (!stricmp(ival, on));
00046 }
00047 
00048 <font class="keyword">const</font> <font class="keywordtype">char</font> *PLAINFootnotes::getOptionValue()
00049 {
00050         <font class="keywordflow">return</font> (option) ? on:off;
00051 }
00052 
00053 
00054 <font class="keywordtype">char</font> PLAINFootnotes::ProcessText(<font class="keywordtype">char</font> *text, <font class="keywordtype">int</font> maxlen, <font class="keyword">const</font> <a class="code" href="class_s_w_key.html">SWKey</a> *key, <font class="keyword">const</font> <a class="code" href="class_s_w_module.html">SWModule</a> *module)
00055 {
00056         <font class="keywordtype">char</font> token[2048];
00057         <font class="keywordtype">int</font> tokpos = 0;
00058         <font class="keywordtype">bool</font> intoken    = <font class="keyword">false</font>;
00059         <font class="keywordtype">bool</font> lastspace = <font class="keyword">false</font>;
00060 
00061         <font class="keywordflow">if</font> (!option) {  <font class="comment">// if we don't want footnotes</font>
00062                 <font class="keywordtype">char</font> *to, *from;
00063                 <font class="keywordtype">int</font> len;
00064                 <font class="keywordtype">bool</font> hide = <font class="keyword">false</font>;
00065 
00066                 len = strlen(text) + 1; <font class="comment">// shift string to right of buffer</font>
00067                 <font class="keywordflow">if</font> (len &lt; maxlen)
00068                 {
00069                         memmove(&amp;text[maxlen - len], text, len);
00070                         from = &amp;text[maxlen - len];
00071                 }
00072                 <font class="keywordflow">else</font>    from = text;    <font class="comment">// -------------------------------</font>
00073 
00074                 <font class="keywordflow">for</font> (to = text; *from; from++) {
00075                         <font class="keywordflow">if</font> (*from == <font class="charliteral">'{'</font>) <font class="comment">// Footnote start</font>
00076                         {
00077                                 hide = <font class="keyword">true</font>;
00078                                 <font class="keywordflow">continue</font>;
00079                         }
00080                         <font class="keywordflow">if</font> (*from == <font class="charliteral">'}'</font>) <font class="comment">// Footnote end</font>
00081                         {
00082                                 hide=<font class="keyword">false</font>;
00083                                 <font class="keywordflow">continue</font>;
00084                         }
00085                         <font class="keywordflow">if</font> (intoken) {
00086                                 <font class="keywordflow">if</font> (tokpos &lt; 2045)
00087                                         token[tokpos++] = *from;
00088                                         token[tokpos+2] = 0;
00089                         }
00090                         <font class="keywordflow">else</font>    {
00091                                 <font class="keywordflow">if</font> (!hide) {
00092                                         *to++ = *from;
00093                                         lastspace = (*from == <font class="charliteral">' '</font>);
00094                                 }
00095                         }
00096                 }
00097                 *to++ = 0;
00098                 *to = 0;
00099         }
00100         <font class="keywordflow">return</font> 0;
00101 }
00102 
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:12:59 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>