BibleTime
cswordldkey.h
Go to the documentation of this file.
1 /*********
2 *
3 * In the name of the Father, and of the Son, and of the Holy Spirit.
4 *
5 * This file is part of BibleTime's source code, https://bibletime.info/
6 *
7 * Copyright 1999-2021 by the BibleTime developers.
8 * The BibleTime source code is licensed under the GNU General Public License
9 * version 2.0.
10 *
11 **********/
12 
13 #pragma once
14 
15 #include "cswordkey.h"
16 
17 #include <QString>
18 
19 // Sword includes:
20 #pragma GCC diagnostic push
21 #pragma GCC diagnostic ignored "-Wextra-semi"
22 #pragma GCC diagnostic ignored "-Wsuggest-override"
23 #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
24 #include <swkey.h>
25 #pragma GCC diagnostic pop
26 
27 
28 class CSwordModuleInfo;
29 
30 /**
31  * This class is the implementation of CSwordKey used for dictionaries and lexicons.
32  *
33  * CSwordLDKey is the implementation of CKey for Lexicons and dictionaries.
34  * It provides a simple interface to set the current key,
35  * to get the text for the key and functions to get the next and previous items
36  * of the used module in comparision to the current key.<br/>
37  * Here's an example how to use this class:<br/>
38  * @code
39  * CSwordLexiconModuleInfo* m_module = backend()->findModuleByName("ISBE");
40  * CSwordLDKey ldKey(m_module);
41  * ldKey.key("Adam");
42  * ldKey.nextEntry();
43  * qDebug( QString("The current key is: %1").arg(ldKey.key()));
44  * @endcode
45  *
46  * Please not, that the result will be invalid if use the operator const char*
47  * on the adress of the object, use something like this
48  *
49  * @code
50  * CSwordLDKey* key = new CSwordLDKey( lexicon_module );
51  * const QString keyname = key->getKey();
52  * @endcode
53  *
54  * @author The BibleTime team
55  * @version $Id: cswordldkey.h,v 1.24 2006/02/25 11:38:15 joachim Exp $
56  */
57 
58 class CSwordLDKey final : public CSwordKey {
59 
60  public:
61 
62  CSwordLDKey & operator=(CSwordLDKey const &) = delete;
63 
64  /**
65  \todo Document param
66  */
68 
70 
71  /**
72  \todo Document params
73  */
74  CSwordLDKey(const sword::SWKey *k, const CSwordModuleInfo *module);
75 
76  sword::SWKey const & asSwordKey() const noexcept final override;
77 
78  CSwordLDKey* copy() const final override;
79  /**
80  * Uses the parameter to returns the next entry afer this key.
81  */
83  /**
84  * Uses the parameter to returns the previous entry afer this key.
85  */
87 
88  void setModule(const CSwordModuleInfo *module) final override;
89 
90  QString key() const final override;
91 
92  bool setKey(const QString &newKey) final override;
93 
94  bool setKey(const char *key) final override;
95 
96  protected:
97 
98  const char* rawKey() const final override;
99 
100  private: // fields:
101 
102  sword::SWKey m_key;
103 
104 };
CSwordModuleInfo const * module() const
Definition: cswordkey.h:68
CSwordLDKey * NextEntry()
CSwordLDKey * PreviousEntry()
CSwordLDKey * copy() const final override
Definition: cswordldkey.cpp:56
CSwordLDKey(const CSwordModuleInfo *module)
Definition: cswordldkey.cpp:37
sword::SWKey m_key
Definition: cswordldkey.h:102
void setModule(const CSwordModuleInfo *module) final override
Definition: cswordldkey.cpp:61
CSwordLDKey & operator=(CSwordLDKey const &)=delete
bool setKey(const QString &newKey) final override
Definition: cswordldkey.cpp:86
sword::SWKey const & asSwordKey() const noexcept final override
Definition: cswordldkey.cpp:53
QString key() const final override
Definition: cswordldkey.cpp:71
const char * rawKey() const final override
Definition: cswordldkey.cpp:82