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-2026 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#ifdef __GNUC__
21#pragma GCC diagnostic push
22#pragma GCC diagnostic ignored "-Wextra-semi"
23#pragma GCC diagnostic ignored "-Wsuggest-override"
24#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
25#endif
26#include <swkey.h>
27#ifdef __GNUC__
28#pragma GCC diagnostic pop
29#endif
30
31
33
34/**
35 * This class is the implementation of CSwordKey used for dictionaries and lexicons.
36 *
37 * CSwordLDKey is the implementation of CKey for Lexicons and dictionaries.
38 * It provides a simple interface to set the current key,
39 * to get the text for the key and functions to get the next and previous items
40 * of the used module in comparision to the current key.<br/>
41 * Here's an example how to use this class:<br/>
42 * @code
43 * CSwordLexiconModuleInfo* m_module = backend()->findModuleByName("ISBE");
44 * CSwordLDKey ldKey(m_module);
45 * ldKey.key("Adam");
46 * ldKey.nextEntry();
47 * qDebug( QString("The current key is: %1").arg(ldKey.key()));
48 * @endcode
49 *
50 * Please not, that the result will be invalid if use the operator const char*
51 * on the adress of the object, use something like this
52 *
53 * @code
54 * CSwordLDKey* key = new CSwordLDKey( lexicon_module );
55 * const QString keyname = key->getKey();
56 * @endcode
57 *
58 * @author The BibleTime team
59 * @version $Id: cswordldkey.h,v 1.24 2006/02/25 11:38:15 joachim Exp $
60 */
61
62class CSwordLDKey final : public CSwordKey {
63
64 public:
65
66 CSwordLDKey & operator=(CSwordLDKey const &) = delete;
67
68 /**
69 \todo Document param
70 */
72
74
75 /**
76 \todo Document params
77 */
78 CSwordLDKey(const sword::SWKey *k, const CSwordModuleInfo *module);
79
80 sword::SWKey const & asSwordKey() const noexcept final override;
81
82 CSwordLDKey* copy() const final override;
83 /**
84 * Uses the parameter to returns the next entry afer this key.
85 */
87 /**
88 * Uses the parameter to returns the previous entry afer this key.
89 */
91
92 void setModule(const CSwordModuleInfo *module) final override;
93
94 QString key() const final override;
95
96 bool setKey(const QString &newKey) final override;
97
98 bool setKey(const char *key) final override;
99
100 protected:
101
102 const char* rawKey() const final override;
103
104 private: // fields:
105
106 sword::SWKey m_key;
107
108};
CSwordModuleInfo const * module() const
Definition cswordkey.h:68
CSwordLDKey * NextEntry()
CSwordLDKey * PreviousEntry()
CSwordLDKey * copy() const final override
sword::SWKey m_key
void setModule(const CSwordModuleInfo *module) final override
bool setKey(const QString &newKey) final override
sword::SWKey const & asSwordKey() const noexcept final override
QString key() const final override
CSwordLDKey & operator=(CSwordLDKey const &)=delete
const char * rawKey() const final override