diff options
Diffstat (limited to 'doc/api-documentation/html/gbfstrongs_8cpp-source.html')
-rw-r--r-- | doc/api-documentation/html/gbfstrongs_8cpp-source.html | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/doc/api-documentation/html/gbfstrongs_8cpp-source.html b/doc/api-documentation/html/gbfstrongs_8cpp-source.html new file mode 100644 index 0000000..064c24c --- /dev/null +++ b/doc/api-documentation/html/gbfstrongs_8cpp-source.html @@ -0,0 +1,144 @@ +<!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>gbfstrongs.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>gbfstrongs.cpp</h1><div class="fragment"><pre>00001 <font class="comment">/******************************************************************************</font> +00002 <font class="comment"> *</font> +00003 <font class="comment"> * gbfstrongs - SWFilter decendant to hide or show strongs number</font> +00004 <font class="comment"> * in a GBF module.</font> +00005 <font class="comment"> */</font> +00006 +00007 +00008 <font class="preprocessor">#include <stdlib.h></font> +00009 <font class="preprocessor">#include <string.h></font> +00010 <font class="preprocessor">#include <gbfstrongs.h></font> +00011 <font class="preprocessor">#include <swmodule.h></font> +00012 <font class="preprocessor">#ifndef __GNUC__</font> +00013 <font class="preprocessor"></font><font class="preprocessor">#else</font> +00014 <font class="preprocessor"></font><font class="preprocessor">#include <unixstr.h></font> +00015 <font class="preprocessor">#endif</font> +00016 <font class="preprocessor"></font> +00017 +00018 <font class="keyword">const</font> <font class="keywordtype">char</font> GBFStrongs::on[] = <font class="stringliteral">"On"</font>; +00019 <font class="keyword">const</font> <font class="keywordtype">char</font> GBFStrongs::off[] = <font class="stringliteral">"Off"</font>; +00020 <font class="keyword">const</font> <font class="keywordtype">char</font> GBFStrongs::optName[] = <font class="stringliteral">"Strong's Numbers"</font>; +00021 <font class="keyword">const</font> <font class="keywordtype">char</font> GBFStrongs::optTip[] = <font class="stringliteral">"Toggles Strong's Numbers On and Off if they exist"</font>; +00022 +00023 +00024 GBFStrongs::GBFStrongs() { +00025 option = <font class="keyword">false</font>; +00026 options.push_back(on); +00027 options.push_back(off); +00028 } +00029 +00030 +00031 GBFStrongs::~GBFStrongs() { +00032 } +00033 +00034 <font class="keywordtype">void</font> GBFStrongs::setOptionValue(<font class="keyword">const</font> <font class="keywordtype">char</font> *ival) +00035 { +00036 option = (!stricmp(ival, on)); +00037 } +00038 +00039 <font class="keyword">const</font> <font class="keywordtype">char</font> *GBFStrongs::getOptionValue() +00040 { +00041 <font class="keywordflow">return</font> (option) ? on:off; +00042 } +00043 +00044 <font class="keywordtype">char</font> GBFStrongs::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) +00045 { +00046 <font class="keywordtype">char</font> *to, *from, token[2048]; <font class="comment">// cheese. Fix.</font> +00047 <font class="keywordtype">int</font> tokpos = 0; +00048 <font class="keywordtype">bool</font> intoken = <font class="keyword">false</font>; +00049 <font class="keywordtype">int</font> len; +00050 <font class="keywordtype">bool</font> lastspace = <font class="keyword">false</font>; +00051 <font class="keywordtype">int</font> word = 1; +00052 <font class="keywordtype">char</font> val[128]; +00053 <font class="keywordtype">char</font> wordstr[5]; +00054 <font class="keywordtype">char</font> *valto; +00055 <font class="keywordtype">char</font> *ch; +00056 <font class="keywordtype">char</font> *textStart = text, *textEnd = 0; +00057 <font class="keywordtype">bool</font> newText = <font class="keyword">false</font>; +00058 string tmp; +00059 +00060 len = strlen(text) + 1; <font class="comment">// shift string to right of buffer</font> +00061 <font class="keywordflow">if</font> (len < maxlen) { +00062 memmove(&text[maxlen - len], text, len); +00063 from = &text[maxlen - len]; +00064 } +00065 <font class="keywordflow">else</font> from = text; <font class="comment">// -------------------------------</font> +00066 +00067 <font class="keywordflow">for</font> (to = text; *from; from++) { +00068 <font class="keywordflow">if</font> (*from == <font class="charliteral">'<'</font>) { +00069 intoken = <font class="keyword">true</font>; +00070 tokpos = 0; +00071 token[0] = 0; +00072 token[1] = 0; +00073 token[2] = 0; +00074 textEnd = to; +00075 <font class="keywordflow">continue</font>; +00076 } +00077 <font class="keywordflow">if</font> (*from == <font class="charliteral">'>'</font>) { <font class="comment">// process tokens</font> +00078 intoken = <font class="keyword">false</font>; +00079 <font class="keywordflow">if</font> (*token == <font class="charliteral">'W'</font> && (token[1] == <font class="charliteral">'G'</font> || token[1] == <font class="charliteral">'H'</font>)) { <font class="comment">// Strongs</font> +00080 <font class="keywordflow">if</font> (module-><a class="code" href="class_s_w_module.html#a64">isProcessEntryAttributes</a>()) { +00081 valto = val; +00082 <font class="keywordflow">for</font> (<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> i = 2; ((token[i]) && (i < 150)); i++) +00083 *valto++ = token[i]; +00084 *valto = 0; +00085 <font class="keywordflow">if</font> (atoi((!isdigit(*val))?val+1:val) < 5627) { +00086 <font class="comment">// normal strongs number</font> +00087 sprintf(wordstr, <font class="stringliteral">"%03d"</font>, word++); +00088 module-><a class="code" href="class_s_w_module.html#a62">getEntryAttributes</a>()[<font class="stringliteral">"Word"</font>][wordstr][<font class="stringliteral">"Strongs"</font>] = val; +00089 tmp = <font class="stringliteral">""</font>; +00090 tmp.append(textStart, (<font class="keywordtype">int</font>)(textEnd - textStart)); +00091 module-><a class="code" href="class_s_w_module.html#a62">getEntryAttributes</a>()[<font class="stringliteral">"Word"</font>][wordstr][<font class="stringliteral">"Text"</font>] = tmp; +00092 newText = <font class="keyword">true</font>; +00093 } +00094 <font class="keywordflow">else</font> { +00095 <font class="comment">// verb morph</font> +00096 sprintf(wordstr, <font class="stringliteral">"%03d"</font>, word-1); +00097 module-><a class="code" href="class_s_w_module.html#a62">getEntryAttributes</a>()[<font class="stringliteral">"Word"</font>][wordstr][<font class="stringliteral">"Morph"</font>] = val; +00098 } +00099 } +00100 <font class="keywordflow">if</font> (!option) { +00101 <font class="keywordflow">if</font> ((from[1] == <font class="charliteral">' '</font>) || (from[1] == <font class="charliteral">','</font>) || (from[1] == <font class="charliteral">';'</font>) || (from[1] == <font class="charliteral">'.'</font>) || (from[1] == <font class="charliteral">'?'</font>) || (from[1] == <font class="charliteral">'!'</font>) || (from[1] == <font class="charliteral">')'</font>) || (from[1] == <font class="charliteral">'\''</font>) || (from[1] == <font class="charliteral">'\"'</font>)) { +00102 <font class="keywordflow">if</font> (lastspace) +00103 to--; +00104 } +00105 <font class="keywordflow">if</font> (newText) {textStart = to; newText = <font class="keyword">false</font>; } +00106 <font class="keywordflow">continue</font>; +00107 } +00108 } +00109 <font class="comment">// if not a strongs token, keep token in text</font> +00110 *to++ = <font class="charliteral">'<'</font>; +00111 <font class="keywordflow">for</font> (<font class="keywordtype">char</font> *tok = token; *tok; tok++) +00112 *to++ = *tok; +00113 *to++ = <font class="charliteral">'>'</font>; +00114 <font class="keywordflow">if</font> (newText) {textStart = to; newText = <font class="keyword">false</font>; } +00115 <font class="keywordflow">continue</font>; +00116 } +00117 <font class="keywordflow">if</font> (intoken) { +00118 <font class="keywordflow">if</font> (tokpos < 2045) +00119 token[tokpos++] = *from; +00120 token[tokpos+2] = 0; +00121 } +00122 <font class="keywordflow">else</font> { +00123 *to++ = *from; +00124 lastspace = (*from == <font class="charliteral">' '</font>); +00125 } +00126 } +00127 *to++ = 0; +00128 *to = 0; +00129 <font class="keywordflow">return</font> 0; +00130 } +</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> |