aboutsummaryrefslogblamecommitdiffstats
path: root/doc/api-documentation/html/thmlosis_8cpp-source.html
blob: 1fdebd0ebde8bcfe23060fe37438c1c7bbaf5041 (plain) (tree)























































































































































































































































































































































                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
<!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>thmlosis.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>thmlosis.cpp</h1><div class="fragment"><pre>00001 <font class="comment">/******************************************************************************</font>
00002 <font class="comment"> *</font>
00003 <font class="comment"> * thmlstrongs -        SWFilter decendant to hide or show strongs number</font>
00004 <font class="comment"> *                      in a ThML module.</font>
00005 <font class="comment"> */</font>
00006 
00007 
00008 <font class="preprocessor">#include &lt;stdlib.h&gt;</font>
00009 <font class="preprocessor">#include &lt;stdio.h&gt;</font>
00010 <font class="preprocessor">#include &lt;string.h&gt;</font>
00011 <font class="preprocessor">#include &lt;thmlosis.h&gt;</font>
00012 <font class="preprocessor">#include &lt;swmodule.h&gt;</font>
00013 <font class="preprocessor">#include &lt;versekey.h&gt;</font>
00014 <font class="preprocessor">#ifndef __GNUC__</font>
00015 <font class="preprocessor"></font><font class="preprocessor">#else</font>
00016 <font class="preprocessor"></font><font class="preprocessor">#include &lt;unixstr.h&gt;</font>
00017 <font class="preprocessor">#endif</font>
00018 <font class="preprocessor"></font>
00019 
00020 ThMLOSIS::ThMLOSIS() {
00021 }
00022 
00023 
00024 ThMLOSIS::~ThMLOSIS() {
00025 }
00026 
00027 
00028 <font class="keywordtype">char</font> ThMLOSIS::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) {
00029 
00030         <font class="keywordtype">char</font> *to, *from, token[2048]; <font class="comment">// cheese.  Fix.</font>
00031         <font class="keywordtype">int</font> tokpos = 0;
00032         <font class="keywordtype">bool</font> intoken = <font class="keyword">false</font>;
00033         <font class="keywordtype">int</font> len;
00034         <font class="keywordtype">bool</font> lastspace = <font class="keyword">false</font>;
00035         <font class="keywordtype">int</font> word = 1;
00036         <font class="keywordtype">char</font> val[128];
00037         <font class="keywordtype">char</font> buf[128];
00038         <font class="keywordtype">char</font> wordstr[5];
00039         <font class="keywordtype">char</font> *valto;
00040         <font class="keywordtype">char</font> *ch;
00041         <font class="keywordtype">char</font> *textStart, *textEnd;
00042         <font class="keywordtype">char</font> *wordStart, *wordEnd;
00043         <font class="keywordtype">bool</font> newText = <font class="keyword">false</font>;
00044         <font class="keywordtype">bool</font> newWord = <font class="keyword">false</font>;
00045         string tmp;
00046         <font class="keywordtype">bool</font> suspendTextPassThru = <font class="keyword">false</font>;
00047         <font class="keywordtype">bool</font> keepToken = <font class="keyword">false</font>;
00048 
00049         len = strlen(text) + 1; <font class="comment">// shift string to right of buffer</font>
00050         <font class="keywordflow">if</font> (len &lt; maxlen) {
00051                 memmove(&amp;text[maxlen - len], text, len);
00052                 from = &amp;text[maxlen - len];
00053         }
00054         <font class="keywordflow">else</font>    from = text;
00055         
00056         textStart = from;
00057         wordStart = text;
00058 
00059         <font class="comment">// -------------------------------</font>
00060 
00061         <font class="keywordflow">for</font> (to = text; *from; from++) {
00062                 <font class="keywordflow">if</font> (*from == <font class="charliteral">'&lt;'</font>) {
00063                         intoken = <font class="keyword">true</font>;
00064                         tokpos = 0;
00065                         token[0] = 0;
00066                         token[1] = 0;
00067                         token[2] = 0;
00068                         textEnd = from-1;
00069                         wordEnd = to;
00070                         <font class="keywordflow">continue</font>;
00071                 }
00072                 <font class="keywordflow">if</font> (*from == <font class="charliteral">'&gt;'</font>) {     <font class="comment">// process tokens</font>
00073                         intoken = <font class="keyword">false</font>;
00074                         keepToken = <font class="keyword">false</font>;
00075                         suspendTextPassThru = <font class="keyword">false</font>;
00076                         newWord = <font class="keyword">true</font>;
00077 
00078 
00079                         <font class="keywordflow">while</font> (wordStart &lt; (text+maxlen)) {
00080 <font class="comment">//                              if (strchr(" ,;.?!()'\"", *wordStart))</font>
00081                                 <font class="keywordflow">if</font> (strchr(<font class="stringliteral">";,: .?!()'\""</font>, *wordStart))
00082                                         wordStart++;
00083                                 <font class="keywordflow">else</font> <font class="keywordflow">break</font>;
00084                         }
00085                         <font class="keywordflow">while</font> (wordEnd &gt; wordStart) {
00086                                 <font class="keywordflow">if</font> (strchr(<font class="stringliteral">" ,;:.?!()'\""</font>, *wordEnd))
00087                                         wordEnd--;
00088                                 <font class="keywordflow">else</font> <font class="keywordflow">break</font>;
00089                         }
00090 
00091                         <font class="comment">// Scripture Reference</font>
00092                         <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"scripRef"</font>, 8)) {
00093         <font class="comment">//                      pushString(buf, "&lt;reference work=\"Bible.KJV\" reference=\"");</font>
00094                                 suspendTextPassThru = <font class="keyword">true</font>;
00095                                 newText = <font class="keyword">true</font>;
00096                         }
00097                         <font class="keywordflow">else</font>    <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"/scripRef"</font>, 9)) {
00098                                 tmp = <font class="stringliteral">""</font>;
00099                                 tmp.append(textStart, (<font class="keywordtype">int</font>)(textEnd - textStart)+1);
00100                                 pushString(&amp;to, convertToOSIS(tmp.c_str(), key));
00101                                 suspendTextPassThru = <font class="keyword">false</font>;
00102                         }
00103 
00104                         <font class="comment">// Footnote</font>
00105                         <font class="keywordflow">if</font> (!strcmp(token, <font class="stringliteral">"note"</font>)) {
00106         <font class="comment">//                      pushString(buf, "&lt;reference work=\"Bible.KJV\" reference=\"");</font>
00107                                 suspendTextPassThru = <font class="keyword">true</font>;
00108                                 newText = <font class="keyword">true</font>;
00109                         }
00110                         <font class="keywordflow">else</font>    <font class="keywordflow">if</font> (!strcmp(token, <font class="stringliteral">"/note"</font>)) {
00111                                 tmp = <font class="stringliteral">"&lt;note type=\"x-StudyNote\"&gt;&lt;notePart type=\"x-MainText\"&gt;"</font>;
00112                                 tmp.append(textStart, (<font class="keywordtype">int</font>)(textEnd - textStart)+1);
00113                                 tmp += <font class="stringliteral">"&lt;/notePart&gt;&lt;/note&gt;"</font>;
00114                                 pushString(&amp;to, tmp.c_str());
00115                                 suspendTextPassThru = <font class="keyword">false</font>;
00116                         }
00117 
00118                         <font class="comment">// Figure</font>
00119                         <font class="keywordflow">else</font>    <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"img "</font>, 4)) {
00120                                 <font class="keyword">const</font> <font class="keywordtype">char</font> *src = strstr(token, <font class="stringliteral">"src"</font>);
00121                                 <font class="keywordflow">if</font> (!src)               <font class="comment">// assert we have a src attribute</font>
00122                                         <font class="keywordflow">return</font> <font class="keyword">false</font>;
00123 
00124                                 pushString(&amp;to, <font class="stringliteral">"&lt;figure src=\""</font>);
00125                                 <font class="keyword">const</font> <font class="keywordtype">char</font> *c;
00126                                 <font class="keywordflow">for</font> (c = src;((*c) &amp;&amp; (*c != <font class="charliteral">'"'</font>)); c++);
00127 
00128                                 <font class="comment">/* uncomment for SWORD absolute path logic</font>
00129 <font class="comment">                                if (*(c+1) == '/') {</font>
00130 <font class="comment">                                        pushString(buf, "file:");</font>
00131 <font class="comment">                                        pushString(buf, module-&gt;getConfigEntry("AbsoluteDataPath"));</font>
00132 <font class="comment">                                        if (*((*buf)-1) == '/')</font>
00133 <font class="comment">                                                c++;            // skip '/'</font>
00134 <font class="comment">                                }</font>
00135 <font class="comment">                                end of uncomment for asolute path logic */</font>
00136 
00137                                 <font class="keywordflow">for</font> (c++;((*c) &amp;&amp; (*c != <font class="charliteral">'"'</font>)); c++)
00138                                         *to++ = *c;
00139 
00140                                 pushString(&amp;to, <font class="stringliteral">"\" /&gt;"</font>);
00141                                 <font class="keywordflow">return</font> <font class="keyword">true</font>;
00142                         }
00143 
00144                         <font class="comment">// Strongs numbers</font>
00145                         <font class="keywordflow">else</font>    <font class="keywordflow">if</font> (!strnicmp(token, <font class="stringliteral">"sync type=\"Strongs\" "</font>, 20)) {   <font class="comment">// Strongs</font>
00146                                 <font class="keywordflow">if</font> (module-&gt;<a class="code" href="class_s_w_module.html#a64">isProcessEntryAttributes</a>()) {
00147                                         valto = val;
00148                                         <font class="keywordflow">for</font> (<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> i = 27; token[i] != <font class="charliteral">'\"'</font> &amp;&amp; i &lt; 150; i++)
00149                                                 *valto++ = token[i];
00150                                         *valto = 0;
00151                                         <font class="keywordflow">if</font> (atoi((!isdigit(*val))?val+1:val) &lt; 5627) {
00152                                                 <font class="comment">// normal strongs number</font>
00153                                                 strstrip(val);
00154                                                 sprintf(buf, <font class="stringliteral">"&lt;w lemma=\"x-Strong:%s\"&gt;"</font>, val);
00155                                                 memmove(wordStart+strlen(buf), wordStart, (to-wordStart)+1);
00156                                                 memcpy(wordStart, buf, strlen(buf));
00157                                                 to+=strlen(buf);
00158                                                 pushString(&amp;to, <font class="stringliteral">"&lt;/w&gt;"</font>);
00159                                                 module-&gt;<a class="code" href="class_s_w_module.html#a62">getEntryAttributes</a>()[<font class="stringliteral">"Word"</font>][wordstr][<font class="stringliteral">"Strongs"</font>] = val;
00160 <font class="comment">//                                              tmp = "";</font>
00161 <font class="comment">//                                              tmp.append(textStart, (int)(wordEnd - wordStart));</font>
00162 <font class="comment">//                                              module-&gt;getEntryAttributes()["Word"][wordstr]["Text"] = tmp;</font>
00163                                         }
00164                                         <font class="keywordflow">else</font> {
00165                                                 <font class="comment">// verb morph</font>
00166                                                 sprintf(wordstr, <font class="stringliteral">"%03d"</font>, word-1);
00167                                                 module-&gt;<a class="code" href="class_s_w_module.html#a62">getEntryAttributes</a>()[<font class="stringliteral">"Word"</font>][wordstr][<font class="stringliteral">"Morph"</font>] = val;
00168                                         }
00169                                 }
00170                         }
00171 
00172                         <font class="comment">// Morphology</font>
00173                         <font class="keywordflow">else</font>    <font class="keywordflow">if</font> (!strncmp(token, <font class="stringliteral">"sync type=\"morph\""</font>, 17)) {
00174                                 <font class="keywordflow">for</font> (ch = token+17; *ch; ch++) {
00175                                         <font class="keywordflow">if</font> (!strncmp(ch, <font class="stringliteral">"class=\""</font>, 7)) {
00176                                                 valto = val;
00177                                                 <font class="keywordflow">for</font> (<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> i = 7; ch[i] != <font class="charliteral">'\"'</font> &amp;&amp; i &lt; 127; i++)
00178                                                         *valto++ = ch[i];
00179                                                 *valto = 0;
00180                                                 sprintf(wordstr, <font class="stringliteral">"%03d"</font>, word-1);
00181                                                 strstrip(val);
00182                                                 module-&gt;<a class="code" href="class_s_w_module.html#a62">getEntryAttributes</a>()[<font class="stringliteral">"Word"</font>][wordstr][<font class="stringliteral">"MorphClass"</font>] = val;
00183                                         }
00184                                         <font class="keywordflow">if</font> (!strncmp(ch, <font class="stringliteral">"value=\""</font>, 7)) {
00185                                                 valto = val;
00186                                                 <font class="keywordflow">for</font> (<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> i = 7; ch[i] != <font class="charliteral">'\"'</font> &amp;&amp; i &lt; 127; i++)
00187                                                         *valto++ = ch[i];
00188                                                 *valto = 0;
00189                                                 sprintf(wordstr, <font class="stringliteral">"%03d"</font>, word-1);
00190                                                 strstrip(val);
00191                                                 module-&gt;<a class="code" href="class_s_w_module.html#a62">getEntryAttributes</a>()[<font class="stringliteral">"Word"</font>][wordstr][<font class="stringliteral">"Morph"</font>] = val;
00192                                         }
00193                                 }
00194                                 <font class="keywordflow">if</font> (!strncmp(wordStart, <font class="stringliteral">"&lt;w "</font>, 3)) {
00195 
00196                                         <font class="keyword">const</font> <font class="keywordtype">char</font> *cls = <font class="stringliteral">"Unknown"</font>, *morph;
00197 
00198                                         <font class="keywordflow">if</font> (module-&gt;<a class="code" href="class_s_w_module.html#a62">getEntryAttributes</a>()[<font class="stringliteral">"Word"</font>][wordstr][<font class="stringliteral">"Morph"</font>].size() &gt; 0) {
00199                                                 <font class="keywordflow">if</font> (module-&gt;<a class="code" href="class_s_w_module.html#a62">getEntryAttributes</a>()[<font class="stringliteral">"Word"</font>][wordstr][<font class="stringliteral">"MorphClass"</font>].size() &gt; 0)
00200                                                         cls = module-&gt;<a class="code" href="class_s_w_module.html#a62">getEntryAttributes</a>()[<font class="stringliteral">"Word"</font>][wordstr][<font class="stringliteral">"MorphClass"</font>].c_str();
00201                                                 morph = module-&gt;<a class="code" href="class_s_w_module.html#a62">getEntryAttributes</a>()[<font class="stringliteral">"Word"</font>][wordstr][<font class="stringliteral">"Morph"</font>].c_str();
00202                                         
00203                                                 sprintf(buf, <font class="stringliteral">"morph=\"x-%s:%s\" "</font>, cls, morph);
00204                                                 memmove(wordStart+3+strlen(buf), wordStart+3, (to-wordStart)+1);
00205                                                 memcpy(wordStart+3, buf, strlen(buf));
00206                                                 to+=strlen(buf);
00207                                         }
00208                                 }
00209                         }
00210 
00211                         <font class="keywordflow">if</font> (!keepToken) {       <font class="comment">// if we don't want strongs</font>
00212                                 <font class="keywordflow">if</font> (strchr(<font class="stringliteral">" ,:;.?!()'\""</font>, from[1])) {
00213                                         <font class="keywordflow">if</font> (lastspace)
00214                                                 to--;
00215                                 }
00216                                 <font class="keywordflow">if</font> (newText) {textStart = from+1; newText = <font class="keyword">false</font>; }
00217 <font class="comment">//                              if (newWord) {wordStart = to; newWord = false; }</font>
00218                                 <font class="keywordflow">continue</font>;
00219                         }
00220                         <font class="comment">// if not a strongs token, keep token in text</font>
00221                         *to++ = <font class="charliteral">'&lt;'</font>;
00222                         <font class="keywordflow">for</font> (<font class="keywordtype">char</font> *tok = token; *tok; tok++)
00223                                 *to++ = *tok;
00224                         *to++ = <font class="charliteral">'&gt;'</font>;
00225                         <font class="keywordflow">if</font> (newText) {textStart = to; newWord = <font class="keyword">false</font>; }
00226 <font class="comment">//                      if (newWord) {wordStart = to; newWord = false; }</font>
00227                         <font class="keywordflow">continue</font>;
00228                 }
00229                 <font class="keywordflow">if</font> (intoken) {
00230                         <font class="keywordflow">if</font> ((tokpos &lt; 2045) &amp;&amp; ((*from != 10)&amp;&amp;(*from != 13))) {
00231                                 token[tokpos++] = *from;
00232                                 token[tokpos+2] = 0;
00233                         }
00234                 }
00235                 <font class="keywordflow">else</font>    {
00236                         <font class="keywordflow">if</font> (newWord &amp;&amp; (*from != <font class="charliteral">' '</font>)) {wordStart = to; newWord = <font class="keyword">false</font>; memset(to, 0, 10); }
00237                         <font class="keywordflow">if</font> (!suspendTextPassThru) {
00238                                 *to++ = *from;
00239                                 lastspace = (*from == <font class="charliteral">' '</font>);
00240                         }
00241                 }
00242         }
00243 
00244         <a class="code" href="class_verse_key.html">VerseKey</a> *vkey = SWDYNAMIC_CAST(<a class="code" href="class_verse_key.html">VerseKey</a>, key);
00245         <font class="keywordflow">if</font> (vkey) {
00246                 <font class="keywordtype">char</font> ref[254];
00247                 <font class="keywordflow">if</font> (vkey-&gt;<a class="code" href="class_verse_key.html#a25">Verse</a>())
00248                         sprintf(ref, <font class="stringliteral">"&lt;verseStart ref=\"%s\" /&gt;"</font>, vkey-&gt;<a class="code" href="class_verse_key.html#a36">getOSISRef</a>());
00249                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (vkey-&gt;<a class="code" href="class_verse_key.html#a24">Chapter</a>())
00250                         sprintf(ref, <font class="stringliteral">"&lt;chapterStart ref=\"%s\" /&gt;"</font>, vkey-&gt;<a class="code" href="class_verse_key.html#a36">getOSISRef</a>());
00251                 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (vkey-&gt;<a class="code" href="class_verse_key.html#a23">Book</a>())
00252                         sprintf(ref, <font class="stringliteral">"&lt;bookStart ref=\"%s\" /&gt;"</font>, vkey-&gt;<a class="code" href="class_verse_key.html#a36">getOSISRef</a>());
00253                 <font class="keywordflow">else</font> *ref = 0;
00254                 <font class="keywordflow">if</font> (*ref) {
00255                         memmove(text+strlen(ref), text, maxlen-strlen(ref)-1);
00256                         memcpy(text, ref, strlen(ref));
00257                         to+=strlen(ref);
00258                         <font class="keywordflow">if</font> (vkey-&gt;<a class="code" href="class_verse_key.html#a25">Verse</a>()) {
00259                                 <a class="code" href="class_verse_key.html">VerseKey</a> tmp;
00260                                 tmp = *vkey;
00261                                 tmp.<a class="code" href="class_verse_key.html#a31">AutoNormalize</a>(0);
00262                                 tmp.<a class="code" href="class_verse_key.html#a32">Headings</a>(1);
00263                                 sprintf(ref, <font class="stringliteral">"&lt;verseEnd ref=\"%s\" /&gt;"</font>, vkey-&gt;<a class="code" href="class_verse_key.html#a36">getOSISRef</a>());
00264                                 pushString(&amp;to, ref);
00265                                 tmp = MAXVERSE;
00266                                 <font class="keywordflow">if</font> (*vkey == tmp) {
00267                                         tmp.<a class="code" href="class_verse_key.html#a25">Verse</a>(0);
00268                                         sprintf(ref, <font class="stringliteral">"&lt;chapterEnd ref=\"%s\" /&gt;"</font>, tmp.<a class="code" href="class_verse_key.html#a36">getOSISRef</a>());
00269                                         pushString(&amp;to, ref);
00270                                         tmp = MAXCHAPTER;
00271                                         tmp = MAXVERSE;
00272                                         <font class="keywordflow">if</font> (*vkey == tmp) {
00273                                                 tmp.<a class="code" href="class_verse_key.html#a24">Chapter</a>(0);
00274                                                 tmp.<a class="code" href="class_verse_key.html#a25">Verse</a>(0);
00275                                                 sprintf(ref, <font class="stringliteral">"&lt;bookEnd ref=\"%s\" /&gt;"</font>, tmp.<a class="code" href="class_verse_key.html#a36">getOSISRef</a>());
00276                                                 pushString(&amp;to, ref);
00277                                         }
00278                                 }
00279                         }
00280 
00281                         <font class="keywordflow">else</font> <font class="keywordflow">if</font> (vkey-&gt;<a class="code" href="class_verse_key.html#a24">Chapter</a>())
00282                                 sprintf(ref, <font class="stringliteral">"&lt;chapterStart ref=\"%s\" /&gt;"</font>, vkey-&gt;<a class="code" href="class_verse_key.html#a36">getOSISRef</a>());
00283                         <font class="keywordflow">else</font> sprintf(ref, <font class="stringliteral">"&lt;bookStart ref=\"%s\" /&gt;"</font>, vkey-&gt;<a class="code" href="class_verse_key.html#a36">getOSISRef</a>());
00284                 }
00285         }
00286         *to++ = 0;
00287         *to = 0;
00288         <font class="keywordflow">return</font> 0;
00289 }
00290 
00291 
00292 <font class="keywordtype">void</font> ThMLOSIS::pushString(<font class="keywordtype">char</font> **buf, <font class="keyword">const</font> <font class="keywordtype">char</font> *format, ...) {
00293   va_list argptr;
00294 
00295   va_start(argptr, format);
00296   *buf += vsprintf(*buf, format, argptr);
00297   va_end(argptr);
00298 
00299 <font class="comment">//  *buf += strlen(*buf);</font>
00300 }
00301 
00302 
00303 <font class="keyword">const</font> <font class="keywordtype">char</font> *ThMLOSIS::convertToOSIS(<font class="keyword">const</font> <font class="keywordtype">char</font> *inRef, <font class="keyword">const</font> <a class="code" href="class_s_w_key.html">SWKey</a> *key) {
00304         <font class="keyword">static</font> string outRef;
00305 
00306         outRef = <font class="stringliteral">""</font>;
00307 
00308         <a class="code" href="class_verse_key.html">VerseKey</a> defLanguage;
00309         <a class="code" href="class_list_key.html">ListKey</a> verses = defLanguage.<a class="code" href="class_verse_key.html#a37">ParseVerseList</a>(inRef, (*key), <font class="keyword">true</font>);
00310         <font class="keyword">const</font> <font class="keywordtype">char</font> *startFrag = inRef;
00311         <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i = 0; i &lt; verses.<a class="code" href="class_list_key.html#a5">Count</a>(); i++) {
00312                 <a class="code" href="class_verse_key.html">VerseKey</a> *element = SWDYNAMIC_CAST(<a class="code" href="class_verse_key.html">VerseKey</a>, verses.<a class="code" href="class_list_key.html#a8">GetElement</a>(i));
00313                 <font class="keywordtype">char</font> buf[5120];
00314                 <font class="keywordtype">char</font> frag[800];
00315                 <font class="keywordflow">if</font> (element) {
00316                         memmove(frag, startFrag, ((<font class="keyword">const</font> <font class="keywordtype">char</font> *)element-&gt;<a class="code" href="class_s_w_key.html#m0">userData</a> - startFrag) + 1);
00317                         frag[((<font class="keyword">const</font> <font class="keywordtype">char</font> *)element-&gt;<a class="code" href="class_s_w_key.html#m0">userData</a> - startFrag) + 1] = 0;
00318                         startFrag = (<font class="keyword">const</font> <font class="keywordtype">char</font> *)element-&gt;<a class="code" href="class_s_w_key.html#m0">userData</a> + 1;
00319                         sprintf(buf, <font class="stringliteral">"&lt;reference refStart=\"KJV:%s\" refEnd=\"%s\"&gt;%s&lt;/reference&gt;"</font>, element-&gt;<a class="code" href="class_verse_key.html#a5">LowerBound</a>().<a class="code" href="class_verse_key.html#a36">getOSISRef</a>(), element-&gt;<a class="code" href="class_verse_key.html#a6">UpperBound</a>().<a class="code" href="class_verse_key.html#a36">getOSISRef</a>(), frag);
00320                 }
00321                 <font class="keywordflow">else</font> {
00322                         memmove(frag, startFrag, ((<font class="keyword">const</font> <font class="keywordtype">char</font> *)verses.<a class="code" href="class_list_key.html#a8">GetElement</a>(i)-&gt;<a class="code" href="class_s_w_key.html#m0">userData</a> - startFrag) + 1);
00323                         frag[((<font class="keyword">const</font> <font class="keywordtype">char</font> *)verses.<a class="code" href="class_list_key.html#a8">GetElement</a>(i)-&gt;<a class="code" href="class_s_w_key.html#m0">userData</a> - startFrag) + 1] = 0;
00324                         startFrag = (<font class="keyword">const</font> <font class="keywordtype">char</font> *)verses.<a class="code" href="class_list_key.html#a8">GetElement</a>(i)-&gt;<a class="code" href="class_s_w_key.html#m0">userData</a> + 1;
00325                         sprintf(buf, <font class="stringliteral">"&lt;reference refStart=\"KJV:%s\"&gt;%s&lt;/reference&gt;"</font>, <a class="code" href="class_verse_key.html">VerseKey</a>(*verses.<a class="code" href="class_list_key.html#a8">GetElement</a>(i)).getOSISRef(), frag);
00326                 }
00327                 outRef+=buf;
00328         }
00329         <font class="keywordflow">return</font> outRef.c_str();
00330 }
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:13:01 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>