blob: 2e460d78a14794b250f0d9b90181439bae0b2c7c (
plain)
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
|
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2008 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
#ifndef CSWORDLDKEY_H
#define CSWORDLDKEY_H
#include "backend/keys/cswordkey.h"
#include <QString>
// Sword includes:
#include <swkey.h>
class CSwordModuleInfo;
/**
* This class is the implementation of CSwordKey used for dictionaries and lexicons.
*
* CSwordLDKey is the implementation of CKey for Lexicons and dictionaries.
* It provides a simple interface to set the current key,
* to get the text for the key and functions to get the next and previous items
* of the used module in comparision to the current key.<br/>
* Here's an example how to use this class:<br/>
* @code
* CSwordLexiconModuleInfo* m_module = backend()->findModuleByName("ISBE");
* CSwordLDKey ldKey(m_module);
* ldKey.key("Adam");
* ldKey.nextEntry();
* qDebug( QString("The current key is: %1").arg(ldKey.key()));
* @endcode
*
* Please not, that the result will be invalid if use the operator const char*
* on the adress of the object, use something like this
*
* @code
* CSwordLDKey* key = new CSwordLDKey( lexicon_module );
* const QString keyname = key->getKey();
* @endcode
*
* @author The BibleTime team
* @version $Id: cswordldkey.h,v 1.24 2006/02/25 11:38:15 joachim Exp $
*/
class CSwordLDKey : public CSwordKey, public sword::SWKey {
public:
/**
* Constructor of CSwordLDKey
*/
CSwordLDKey( CSwordModuleInfo* module );
/**
* Copy constructor for this key class.
*/
CSwordLDKey( const CSwordLDKey &k );
/**
* Copy constructor for this key class.
*/
CSwordLDKey( const sword::SWKey *k, CSwordModuleInfo* module);
/**
* Clones this object by copying the members.
*/
virtual CSwordLDKey* copy() const;
/**
* Uses the parameter to returns the next entry afer this key.
*/
CSwordLDKey* NextEntry( void );
/**
* Uses the parameter to returns the previous entry afer this key.
*/
CSwordLDKey* PreviousEntry( void );
/**
* Sets the module of this key.
*/
virtual CSwordModuleInfo* module( CSwordModuleInfo* const module = 0 );
/**
* Returns the current key as a QString
*/
virtual QString key() const;
/**
* Set the current key using unicode decoded QString.
*/
virtual bool key( const QString& newKey );
/**
* Set the current key from char*. To avoid encoding problems use key(QString) instead.
*/
virtual bool key( const char* );
protected:
/**
* Returns the raw key appropriate for use directly with Sword.
*/
virtual const char* rawKey() const;
private:
/**
* Disable assignment operator
*/
CSwordLDKey& operator= (const CSwordLDKey& );
};
#endif
|