blob: ca6c283191e21f6f94924484d9ed21a4a9e315f5 (
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
<!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>swkey.h 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>swkey.h</h1><div class="fragment"><pre>00001 <font class="comment">/******************************************************************************</font>
00002 <font class="comment"> * swkey.h - code for base class 'swkey'. swkey is the basis for all</font>
00003 <font class="comment"> * types of keys for indexing into modules (e.g. verse, word,</font>
00004 <font class="comment"> * place, etc.)</font>
00005 <font class="comment"> *</font>
00006 <font class="comment"> * $Id: swkey_8h-source.html,v 1.7 2002/06/20 20:23:10 mgruner Exp $</font>
00007 <font class="comment"> *</font>
00008 <font class="comment"> * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)</font>
00009 <font class="comment"> * CrossWire Bible Society</font>
00010 <font class="comment"> * P. O. Box 2528</font>
00011 <font class="comment"> * Tempe, AZ 85280-2528</font>
00012 <font class="comment"> *</font>
00013 <font class="comment"> * This program is free software; you can redistribute it and/or modify it</font>
00014 <font class="comment"> * under the terms of the GNU General Public License as published by the</font>
00015 <font class="comment"> * Free Software Foundation version 2.</font>
00016 <font class="comment"> *</font>
00017 <font class="comment"> * This program is distributed in the hope that it will be useful, but</font>
00018 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00019 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00020 <font class="comment"> * General Public License for more details.</font>
00021 <font class="comment"> *</font>
00022 <font class="comment"> */</font>
00023
00024 <font class="preprocessor">#ifndef SWKEY_H</font>
00025 <font class="preprocessor"></font><font class="preprocessor">#define SWKEY_H</font>
00026 <font class="preprocessor"></font>
00027 <font class="preprocessor">#include <swobject.h></font>
00028
00029 <font class="preprocessor">#include <defs.h></font>
00030
00031 <font class="preprocessor">#define KEYERR_OUTOFBOUNDS 1</font>
00032 <font class="preprocessor"></font>
00033 <font class="preprocessor">#define SWKEY_OPERATORS \</font>
00034 <font class="preprocessor"> SWKey & operator = (const char *ikey) { setText(ikey); return *this; } \</font>
00035 <font class="preprocessor"> SWKey & operator = (const SWKey &ikey) { copyFrom(ikey); return *this; } \</font>
00036 <font class="preprocessor"> SWKey & operator = (SW_POSITION pos) { setPosition(pos); return *this; } \</font>
00037 <font class="preprocessor"> operator const char *() const { return getText(); } \</font>
00038 <font class="preprocessor"> bool operator == (const SWKey & ikey) { return equals(ikey); } \</font>
00039 <font class="preprocessor"> bool operator != (const SWKey & ikey) { return !equals(ikey); } \</font>
00040 <font class="preprocessor"> virtual bool operator > (const SWKey & ikey) { return (compare (ikey) > 0); } \</font>
00041 <font class="preprocessor"> virtual bool operator < (const SWKey & ikey) { return (compare (ikey) < 0); } \</font>
00042 <font class="preprocessor"> virtual bool operator >= (const SWKey & ikey) { return (compare (ikey) > -1); } \</font>
00043 <font class="preprocessor"> virtual bool operator <= (const SWKey & ikey) { return (compare (ikey) < 1); } \</font>
00044 <font class="preprocessor"> SWKey & operator -= (int steps) { decrement(steps); return *this; } \</font>
00045 <font class="preprocessor"> SWKey & operator += (int steps) { increment(steps); return *this; } \</font>
00046 <font class="preprocessor"> SWKey & operator++ (int) { return *this += 1; } \</font>
00047 <font class="preprocessor"> SWKey & operator-- (int) { return *this -= 1; }</font>
00048 <font class="preprocessor"></font>
00049
00050 <font class="comment">// For use with = operator to position key.</font>
00051
00052 <font class="keyword">class </font>SW_POSITION
00053 {
00054 <font class="keywordtype">char</font> pos;
00055 <font class="keyword">public</font>:
00056 SW_POSITION (<font class="keywordtype">char</font> ipos)
00057 {
00058 pos = ipos;
00059 }
00060 operator char ()
00061 {
00062 <font class="keywordflow">return</font> pos;
00063 }
00064 };
00065
00066 <font class="preprocessor">#define POS_TOP ((char)1)</font>
00067 <font class="preprocessor"></font><font class="preprocessor">#define POS_BOTTOM ((char)2)</font>
00068 <font class="preprocessor"></font>
00069 <font class="preprocessor">#define TOP SW_POSITION(POS_TOP)</font>
00070 <font class="preprocessor"></font><font class="preprocessor">#define BOTTOM SW_POSITION(POS_BOTTOM)</font>
00071 <font class="preprocessor"></font>
<a name="l00076"></a><a class="code" href="class_s_w_key.html">00076</a> <font class="keyword">class </font>SWDLLEXPORT <a class="code" href="class_s_w_key.html">SWKey</a> : <font class="keyword">public</font> <a class="code" href="class_s_w_object.html">SWObject</a> {
00077 <font class="keywordtype">long</font> index;
00078 <font class="keyword">static</font> <a class="code" href="class_s_w_class.html">SWClass</a> classdef;
00079 <font class="keywordtype">void</font> init ();
00080
00081 <font class="keyword">protected</font>:
00082 <font class="keywordtype">char</font> *keytext;
00083 <font class="keywordtype">char</font> persist;
00084 <font class="keywordtype">char</font> error;
00085
00086 <font class="keyword">public</font>:
00087
00088 <font class="comment">// misc pointer for whatever</font>
00089 <font class="keywordtype">void</font> *userData;
00090
00095 <a class="code" href="class_s_w_key.html">SWKey</a> (<font class="keyword">const</font> <font class="keywordtype">char</font> *ikey = 0);
00096
00100 <a class="code" href="class_s_w_key.html">SWKey</a> (<a class="code" href="class_s_w_key.html">SWKey</a> <font class="keyword">const</font> &k);
00101
00104 <font class="keyword">virtual</font> ~ SWKey ();
00105
00110 <font class="keyword">virtual</font> <a class="code" href="class_s_w_key.html">SWKey</a> *clone () <font class="keyword">const</font>;
00111
00118 <font class="keywordtype">char</font> Persist () <font class="keyword">const</font>;
00119
00128 <font class="keywordtype">char</font> Persist (<font class="keywordtype">signed</font> <font class="keywordtype">char</font> ikey);
00129
00134 <font class="keyword">virtual</font> <font class="keywordtype">char</font> Error ();
00135
00140 <font class="keyword">virtual</font> <font class="keywordtype">void</font> setText(<font class="keyword">const</font> <font class="keywordtype">char</font> *ikey);
00141
00146 <font class="keyword">virtual</font> <font class="keywordtype">void</font> copyFrom(<font class="keyword">const</font> <a class="code" href="class_s_w_key.html">SWKey</a> &ikey);
00147
00150 <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font> *getText() <font class="keyword">const</font>;
00151 <font class="keyword">virtual</font> <font class="keyword">const</font> <font class="keywordtype">char</font> *getShortText()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> getText(); }
00152
00160 <font class="keyword">virtual</font> <font class="keywordtype">int</font> compare (<font class="keyword">const</font> <a class="code" href="class_s_w_key.html">SWKey</a> & ikey);
00161
<a name="l00167"></a><a class="code" href="class_s_w_key.html#a12">00167</a> <font class="keyword">virtual</font> <font class="keywordtype">bool</font> equals(<font class="keyword">const</font> <a class="code" href="class_s_w_key.html">SWKey</a> &ikey) { <font class="keywordflow">return</font> !compare(ikey); }
00168
00169 <font class="keyword">virtual</font> <font class="keywordtype">void</font> setPosition(SW_POSITION);
00170
00176 <font class="keyword">virtual</font> <font class="keywordtype">void</font> decrement(<font class="keywordtype">int</font> steps = 1);
00177
00183 <font class="keyword">virtual</font> <font class="keywordtype">void</font> increment(<font class="keywordtype">int</font> steps = 1);
00184
00185 <font class="keyword">virtual</font> <font class="keywordtype">char</font> Traversable () { <font class="keywordflow">return</font> 0; }
00186
<a name="l00208"></a><a class="code" href="class_s_w_key.html#a17">00208</a> <font class="keyword">virtual</font> <font class="keywordtype">long</font> Index ()<font class="keyword"> const </font>{ <font class="keywordflow">return</font> index; }
00209 <font class="keyword">virtual</font> <font class="keywordtype">long</font> Index (<font class="keywordtype">long</font> iindex) { index = iindex; <font class="keywordflow">return</font> index; }
00210
00211 SWKEY_OPERATORS
00212
00213 };
00214
00215
00216 <font class="preprocessor">#endif</font>
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:13:00 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>
|