blob: 4881756a5216cb61c8a1631b49a4828cc20d794b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
<!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> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> </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 <plainfootnotes.h></font>
00019 <font class="preprocessor">#include <swkey.h></font>
00020
00021 <font class="preprocessor">#include <stdlib.h></font>
00022 <font class="preprocessor">#include <string.h></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 <unixstr.h></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 < maxlen)
00068 {
00069 memmove(&text[maxlen - len], text, len);
00070 from = &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 < 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>
|