Sophie

Sophie

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

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>ListKey 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>ListKey  Class Reference</h1>ListKey is the basis for all types of keys that have lists of specified indexes (e.g. 
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="listkey_8h-source.html">listkey.h</a>&gt;</code>
<p>
Inheritance diagram for ListKey:<p><center><img src="class_list_key__inherit__graph.png" border="0" usemap="#_list_key__inherit__map" alt="Inheritance graph"></center>
<map name="_list_key__inherit__map">
<area href="class_s_w_key.html" shape="rect" coords="22,84,78,103" alt="">
<area href="class_s_w_object.html" shape="rect" coords="14,15,86,33" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center>Collaboration diagram for ListKey:<p><center><img src="class_list_key__coll__graph.png" border="0" usemap="#_list_key__coll__map" alt="Collaboration graph"></center>
<map name="_list_key__coll__map">
<area href="class_s_w_key.html" shape="rect" coords="114,197,170,215" alt="">
<area href="class_s_w_object.html" shape="rect" coords="219,106,291,125" alt="">
<area href="class_s_w_class.html" shape="rect" coords="103,15,167,34" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="class_list_key-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>&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a0">ListKey</a> (const char *ikey=0)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>initializes instance of ListKey.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top><a name="a1" doxytag="ListKey::ListKey"></a>
&nbsp;</td><td valign=bottom><b>ListKey</b> (ListKey const &amp;k)</td></tr>
<tr><td nowrap align=right valign=top><a name="a2" doxytag="ListKey::~ListKey"></a>
virtual&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a2">~ListKey</a> ()</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>cleans up instance of ListKey.</em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>virtual <a class="el" href="class_s_w_key.html">SWKey</a> *&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a3">clone</a> () const</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Returns a copy of this <a class="el" href="class_s_w_key.html">SWKey</a> object.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top><a name="a4" doxytag="ListKey::ClearList"></a>
virtual void&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a4">ClearList</a> ()</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Clears out elements of list.</em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>virtual int&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a5">Count</a> ()</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Returns number of elements in list.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top><a name="a6" doxytag="ListKey::Remove"></a>
virtual void&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a6">Remove</a> ()</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Removes current element from list.</em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>virtual char&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a7">SetToElement</a> (int ielement, SW_POSITION=TOP)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Sets key to element number.</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>virtual <a class="el" href="class_s_w_key.html">SWKey</a> *&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a8">GetElement</a> (int pos=-1)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Gets a key element number.</em> <a href="#a8">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>ListKey &amp;&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a9">operator&lt;&lt;</a> (const <a class="el" href="class_s_w_key.html">SWKey</a> &amp;ikey)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Adds an element to the list.</em> <a href="#a9">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top><a name="a10" doxytag="ListKey::add"></a>
virtual void&nbsp;</td><td valign=bottom><b>add</b> (const <a class="el" href="class_s_w_key.html">SWKey</a> &amp;ikey)</td></tr>
<tr><td nowrap align=right valign=top>virtual void&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a11">copyFrom</a> (const ListKey &amp;ikey)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Equates this ListKey to another ListKey object.</em> <a href="#a11">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>virtual void&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a12">copyFrom</a> (const <a class="el" href="class_s_w_key.html">SWKey</a> &amp;ikey)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Equates this <a class="el" href="class_s_w_key.html">SWKey</a> to another <a class="el" href="class_s_w_key.html">SWKey</a> object.</em> <a href="#a12">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>virtual void&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a13">setPosition</a> (SW_POSITION)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Positions this key.</em> <a href="#a13">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top><a name="a14" doxytag="ListKey::decrement"></a>
virtual void&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a14">decrement</a> (int step)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Decrements a number of elements.</em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top><a name="a15" doxytag="ListKey::increment"></a>
virtual void&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a15">increment</a> (int step)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Increments a number of elements.</em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top><a name="a16" doxytag="ListKey::Traversable"></a>
virtual char&nbsp;</td><td valign=bottom><b>Traversable</b> ()</td></tr>
<tr><td nowrap align=right valign=top>virtual long&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a17">Index</a> () const</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Use this function to get te current position withing a module.</em> <a href="#a17">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>virtual long&nbsp;</td><td valign=bottom><a class="el" href="class_list_key.html#a18">Index</a> (long index)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Returns the index for the new one given as as parameter.</em> <a href="#a18">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top><a name="a19" doxytag="ListKey::operator="></a>
SWKEY_OPERATORS ListKey &amp;&nbsp;</td><td valign=bottom><b>operator=</b> (const ListKey &amp;key)</td></tr>
<tr><td colspan=2><br><h2>Protected Attributes</h2></td></tr>
<tr><td nowrap align=right valign=top><a name="n0" doxytag="ListKey::arraypos"></a>
int&nbsp;</td><td valign=bottom><b>arraypos</b></td></tr>
<tr><td nowrap align=right valign=top><a name="n1" doxytag="ListKey::arraymax"></a>
int&nbsp;</td><td valign=bottom><b>arraymax</b></td></tr>
<tr><td nowrap align=right valign=top><a name="n2" doxytag="ListKey::arraycnt"></a>
int&nbsp;</td><td valign=bottom><b>arraycnt</b></td></tr>
<tr><td nowrap align=right valign=top><a name="n3" doxytag="ListKey::array"></a>
<a class="el" href="class_s_w_key.html">SWKey</a> **&nbsp;</td><td valign=bottom><b>array</b></td></tr>
<tr><td colspan=2><br><h2>Private Methods</h2></td></tr>
<tr><td nowrap align=right valign=top><a name="c0" doxytag="ListKey::init"></a>
void&nbsp;</td><td valign=bottom><b>init</b> ()</td></tr>
<tr><td colspan=2><br><h2>Static Private Attributes</h2></td></tr>
<tr><td nowrap align=right valign=top><a name="r0" doxytag="ListKey::classdef"></a>
<a class="el" href="class_s_w_class.html">SWClass</a>&nbsp;</td><td valign=bottom><b>classdef</b></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
ListKey is the basis for all types of keys that have lists of specified indexes (e.g.
<p>
a list of verses, place, etc.) 
<p>

<p>
Definition at line <a class="el" href="listkey_8h-source.html#l00036">36</a> of file <a class="el" href="listkey_8h-source.html">listkey.h</a>.<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a name="a0" doxytag="ListKey::ListKey"></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"> ListKey::ListKey </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const char *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>ikey</em> = 0          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

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

<p>
initializes instance of ListKey.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>ikey</em>&nbsp;</td><td>
text key </td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="listkey_8cpp-source.html#l00022">22</a> of file <a class="el" href="listkey_8cpp-source.html">listkey.cpp</a>.
<p>
References <a class="el" href="listkey_8cpp-source.html#l00064">ClearList</a>().
<p>
Referenced by <a class="el" href="listkey_8cpp-source.html#l00045">clone</a>().
<p>
<div class="fragment"><pre>00022                                 : <a class="code" href="class_s_w_key.html#a0">SWKey</a>(ikey) {
00023         arraymax = 0;
00024         <a class="code" href="class_list_key.html#a4">ClearList</a>();
00025         init();
00026 }
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a name="a3" doxytag="ListKey::clone"></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"> <a class="el" href="class_s_w_key.html">SWKey</a> * ListKey::clone </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap> const<code> [virtual]</code></td>
        </tr>

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

<p>
Returns a copy of this <a class="el" href="class_s_w_key.html">SWKey</a> object.
<p>
This is useful to get a 1:1 copy of an <a class="el" href="class_s_w_key.html">SWKey</a> based object. <dl compact><dt><b>
Returns: </b><dd>
<a class="el" href="class_s_w_key.html">SWKey</a> </dl>
<p>
Reimplemented from <a class="el" href="class_s_w_key.html#a3">SWKey</a>.
<p>
Definition at line <a class="el" href="listkey_8cpp-source.html#l00045">45</a> of file <a class="el" href="listkey_8cpp-source.html">listkey.cpp</a>.
<p>
References <a class="el" href="listkey_8cpp-source.html#l00022">ListKey</a>().
<p>
<div class="fragment"><pre>00046 {
00047         <font class="keywordflow">return</font> <font class="keyword">new</font> <a class="code" href="class_list_key.html#a0">ListKey</a>(*<font class="keyword">this</font>);
00048 }
</pre></div>    </td>
  </tr>
</table>
<a name="a12" doxytag="ListKey::copyFrom"></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"> virtual void ListKey::copyFrom </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="class_s_w_key.html">SWKey</a> &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>ikey</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline, virtual]</code></td>
        </tr>

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

<p>
Equates this <a class="el" href="class_s_w_key.html">SWKey</a> to another <a class="el" href="class_s_w_key.html">SWKey</a> object.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>ikey</em>&nbsp;</td><td>
other swkey object </td></tr>
</table>
</dl>
<p>
Reimplemented from <a class="el" href="class_s_w_key.html#a8">SWKey</a>.
<p>
Definition at line <a class="el" href="listkey_8h-source.html#l00090">90</a> of file <a class="el" href="listkey_8h-source.html">listkey.h</a>.
<p>
References <a class="el" href="swkey_8cpp-source.html#l00126">SWKey::copyFrom</a>().
<p>
<div class="fragment"><pre>00090 { <a class="code" href="class_s_w_key.html#a8">SWKey::copyFrom</a>(ikey); }
</pre></div>    </td>
  </tr>
</table>
<a name="a11" doxytag="ListKey::copyFrom"></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"> void ListKey::copyFrom </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const ListKey &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>ikey</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [virtual]</code></td>
        </tr>

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

<p>
Equates this ListKey to another ListKey object.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>ikey</em>&nbsp;</td><td>
other ListKey object </td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="listkey_8cpp-source.html#l00087">87</a> of file <a class="el" href="listkey_8cpp-source.html">listkey.cpp</a>.
<p>
References <a class="el" href="listkey_8h-source.html#l00044">array</a>, <a class="el" href="listkey_8h-source.html#l00043">arraycnt</a>, <a class="el" href="listkey_8h-source.html#l00042">arraymax</a>, <a class="el" href="listkey_8h-source.html#l00041">arraypos</a>, <a class="el" href="listkey_8cpp-source.html#l00064">ClearList</a>(), <a class="el" href="swkey_8cpp-source.html#l00045">SWKey::clone</a>(), and <a class="el" href="listkey_8cpp-source.html#l00199">SetToElement</a>().
<p>
<div class="fragment"><pre>00087                                           {
00088         <a class="code" href="class_list_key.html#a4">ClearList</a>();
00089 
00090         arraymax = ikey.<a class="code" href="class_list_key.html#n1">arraymax</a>;
00091         arraypos = ikey.<a class="code" href="class_list_key.html#n0">arraypos</a>;
00092         arraycnt = ikey.<a class="code" href="class_list_key.html#n2">arraycnt</a>;
00093         array = (arraymax)?(<a class="code" href="class_s_w_key.html">SWKey</a> **)malloc(ikey.<a class="code" href="class_list_key.html#n1">arraymax</a> * <font class="keyword">sizeof</font>(<a class="code" href="class_s_w_key.html">SWKey</a> *)):0;
00094         <font class="keywordflow">for</font> (<font class="keywordtype">int</font> i = 0; i &lt; arraycnt; i++)
00095                 array[i] = ikey.<a class="code" href="class_list_key.html#n3">array</a>[i]-&gt;<a class="code" href="class_s_w_key.html#a3">clone</a>();
00096 
00097         <a class="code" href="class_list_key.html#a7">SetToElement</a>(0);
00098 }
</pre></div>    </td>
  </tr>
</table>
<a name="a5" doxytag="ListKey::Count"></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"> int ListKey::Count </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [virtual]</code></td>
        </tr>

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

<p>
Returns number of elements in list.
<p>
<dl compact><dt><b>
Returns: </b><dd>
number of elements in list </dl>
<p>
Definition at line <a class="el" href="listkey_8cpp-source.html#l00186">186</a> of file <a class="el" href="listkey_8cpp-source.html">listkey.cpp</a>.
<p>
Referenced by <a class="el" href="versekey_8cpp-source.html#l00231">VerseKey::parse</a>().
<p>
<div class="fragment"><pre>00186                    {
00187         <font class="keywordflow">return</font> arraycnt;
00188 }
</pre></div>    </td>
  </tr>
</table>
<a name="a8" doxytag="ListKey::GetElement"></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"> <a class="el" href="class_s_w_key.html">SWKey</a> * ListKey::GetElement </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">int&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>pos</em> = -1          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [virtual]</code></td>
        </tr>

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

<p>
Gets a key element number.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>pos</em>&nbsp;</td><td>
element number to get (or default current) </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Key or null on error </dl>
<p>
Definition at line <a class="el" href="listkey_8cpp-source.html#l00233">233</a> of file <a class="el" href="listkey_8cpp-source.html">listkey.cpp</a>.
<p>
<div class="fragment"><pre>00233                                   {
00234         <font class="keywordflow">if</font> (pos &gt;=0) {
00235                 <font class="keywordflow">if</font> (pos &gt;=arraycnt)
00236                         error = KEYERR_OUTOFBOUNDS;
00237         }
00238         <font class="keywordflow">else</font> pos = arraypos;
00239         <font class="keywordflow">return</font> (error) ? 0:array[pos];
00240 }
</pre></div>    </td>
  </tr>
</table>
<a name="a18" doxytag="ListKey::Index"></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"> virtual long ListKey::Index </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">long&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>index</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline, virtual]</code></td>
        </tr>

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

<p>
Returns the index for the new one given as as parameter.
<p>
The first parameter is the new index. 
<p>
Reimplemented from <a class="el" href="class_s_w_key.html">SWKey</a>.
<p>
Definition at line <a class="el" href="listkey_8h-source.html#l00112">112</a> of file <a class="el" href="listkey_8h-source.html">listkey.h</a>.
<p>
References <a class="el" href="swkey_8h-source.html#l00208">SWKey::Index</a>().
<p>
<div class="fragment"><pre>00112 { <a class="code" href="class_list_key.html#a7">SetToElement</a> (index); <font class="keywordflow">return</font> <a class="code" href="class_list_key.html#a17">Index</a> (); }
</pre></div>    </td>
  </tr>
</table>
<a name="a17" doxytag="ListKey::Index"></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"> virtual long ListKey::Index </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap> const<code> [inline, virtual]</code></td>
        </tr>

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

<p>
Use this function to get te current position withing a module.
<p>
Here's a small example how to use this function and <a class="el" href="class_list_key.html#a18">Index</a>(long). This function uses the GerLut module and chooses a random verse from the Bible and returns it. <div class="fragment"><pre> <font class="keyword">const</font> <font class="keywordtype">char</font>* randomVerse() {
   <a class="code" href="class_verse_key.html">VerseKey</a> vk;
   <a class="code" href="class_s_w_mgr.html">SWMgr</a> mgr;
   <a class="code" href="class_locale_mgr.html#p0">LocaleMgr::systemLocaleMgr</a>.<a class="code" href="class_locale_mgr.html#a6">setDefaultLocaleName</a>(<font class="stringliteral">"de"</font>);

   <a class="code" href="class_s_w_module.html">SWModule</a>* module = mgr-&gt;<a class="code" href="class_s_w_mgr.html#m2">Modules</a>(<font class="stringliteral">"GerLut"</font>);
   srand( time(0) );
   <font class="keyword">const</font> <font class="keywordtype">double</font> newIndex = (double(rand())/RAND_MAX)*(24108+8224);
   vk.<a class="code" href="class_verse_key.html#a34">Index</a>(newIndex);
   module-&gt;<a class="code" href="class_s_w_module.html#a8">SetKey</a>(vk);

   <font class="keywordtype">char</font>* text;
   sprintf(text, <font class="stringliteral">"%s: %s"</font>,(<font class="keyword">const</font> <font class="keywordtype">char</font>*)vk ,module-&gt;<a class="code" href="class_s_w_module.html#a56">StripText</a>(&amp;vk));
   <font class="keywordflow">return</font> text;
</pre></div> 
<p>
Reimplemented from <a class="el" href="class_s_w_key.html#a17">SWKey</a>.
<p>
Definition at line <a class="el" href="listkey_8h-source.html#l00106">106</a> of file <a class="el" href="listkey_8h-source.html">listkey.h</a>.
<p>
<div class="fragment"><pre>00106 { <font class="keywordflow">return</font> arraypos; }
</pre></div>    </td>
  </tr>
</table>
<a name="a9" doxytag="ListKey::operator<<"></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"> ListKey&amp; ListKey::operator&lt;&lt; </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">const <a class="el" href="class_s_w_key.html">SWKey</a> &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>ikey</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

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

<p>
Adds an element to the list.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>ikey</em>&nbsp;</td><td>
the element to add </td></tr>
</table>
</dl>
<p>
Definition at line <a class="el" href="listkey_8h-source.html#l00082">82</a> of file <a class="el" href="listkey_8h-source.html">listkey.h</a>.
<p>
<div class="fragment"><pre>00082 { add(ikey); <font class="keywordflow">return</font> *<font class="keyword">this</font>; }
</pre></div>    </td>
  </tr>
</table>
<a name="a13" doxytag="ListKey::setPosition"></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"> void ListKey::setPosition </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">SW_POSITION&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap><code> [virtual]</code></td>
        </tr>

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

<p>
Positions this key.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>p</em>&nbsp;</td><td>
position </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
*this </dl>
<p>
Reimplemented from <a class="el" href="class_s_w_key.html">SWKey</a>.
<p>
Definition at line <a class="el" href="listkey_8cpp-source.html#l00124">124</a> of file <a class="el" href="listkey_8cpp-source.html">listkey.cpp</a>.
<p>
References <a class="el" href="listkey_8cpp-source.html#l00199">SetToElement</a>().
<p>
<div class="fragment"><pre>00124                                        {
00125         <font class="keywordflow">switch</font> (p) {
00126         <font class="keywordflow">case</font> 1: <font class="comment">// GCC won't compile P_TOP</font>
00127                 <a class="code" href="class_list_key.html#a7">SetToElement</a>(0);
00128                 <font class="keywordflow">break</font>;
00129         <font class="keywordflow">case</font> 2: <font class="comment">// GCC won't compile P_BOTTOM</font>
00130                 <a class="code" href="class_list_key.html#a7">SetToElement</a>(arraycnt-1);
00131                 <font class="keywordflow">break</font>;
00132         }
00133 }
</pre></div>    </td>
  </tr>
</table>
<a name="a7" doxytag="ListKey::SetToElement"></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"> char ListKey::SetToElement </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>ielement</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>SW_POSITION&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; = TOP</td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [virtual]</code></td>
        </tr>

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

<p>
Sets key to element number.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>ielement</em>&nbsp;</td><td>
element number to set to </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
error status </dl>
<p>
Definition at line <a class="el" href="listkey_8cpp-source.html#l00199">199</a> of file <a class="el" href="listkey_8cpp-source.html">listkey.cpp</a>.
<p>
Referenced by <a class="el" href="listkey_8cpp-source.html#l00087">copyFrom</a>(), <a class="el" href="listkey_8cpp-source.html#l00163">decrement</a>(), <a class="el" href="listkey_8cpp-source.html#l00140">increment</a>(), <a class="el" href="listkey_8cpp-source.html#l00247">Remove</a>(), and <a class="el" href="listkey_8cpp-source.html#l00124">setPosition</a>().
<p>
<div class="fragment"><pre>00199                                                         {
00200         arraypos = ielement;
00201         <font class="keywordflow">if</font> (arraypos &gt;= arraycnt) {
00202                 arraypos = (arraycnt&gt;0)?arraycnt - 1:0;
00203                 error = KEYERR_OUTOFBOUNDS;
00204         }
00205         <font class="keywordflow">else</font> {
00206                 <font class="keywordflow">if</font> (arraypos &lt; 0) {
00207                         arraypos = 0;
00208                         error = KEYERR_OUTOFBOUNDS;
00209                 }
00210                 <font class="keywordflow">else</font> {
00211                         error = 0;
00212                 }
00213         }
00214         
00215         <font class="keywordflow">if</font> (arraycnt) {
00216                 (*array[arraypos]) = pos;
00217                 *<font class="keyword">this</font> = (<font class="keyword">const</font> <font class="keywordtype">char</font> *)(*array[arraypos]);
00218         }
00219         <font class="keywordflow">else</font> *<font class="keyword">this</font> = <font class="stringliteral">""</font>;
00220         
00221         <font class="keywordflow">return</font> error;
00222 }
</pre></div>    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="listkey_8h-source.html">listkey.h</a><li><a class="el" href="listkey_8cpp-source.html">listkey.cpp</a></ul>
<hr><address align="right"><small>Generated on Thu Jun 20 22:13:02 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>