BibleTime
cswordlexiconmoduleinfo.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 "cswordmoduleinfo.h"
16 
17 #include <QObject>
18 #include <QString>
19 #include <QStringList>
20 
21 
22 class CSwordBackend;
23 namespace sword { class SWModule; }
24 
25 /**
26  The implementation of CModuleInfo for the Sword lexiccons and citionaries.
27 */
29  Q_OBJECT
30 
31  public: // methods:
32  CSwordLexiconModuleInfo(sword::SWModule & module,
34 
35  /**
36  Return true if this lexicon has Strong's keys
37  */
38  bool hasStrongsKeys() const;
39 
40  /**
41  Takes a Strong's key string and formats it consistent
42  with the key strings of this module.
43  */
44  QString normalizeStrongsKey(const QString& key) const;
45 
46  /**
47  This method returns the entries of the modules represented by this
48  object. If this function is called for the first time the list is load
49  from disk and stored in a list which cahes it. If the function is
50  called again, the cached list is returned so we have a major speed
51  improvement.
52  \returns the list of lexicon entries in the module.
53  */
54  const QStringList &entries() const;
55 
56  /** Jumps to the closest entry in the module. */
57  bool snap() const final override;
58 
59  CSwordKey * createKey() const final override;
60 
61  private: // fields:
62 
63  bool m_hasStrongsKeys = false;
66 
67  /**
68  This is the list which caches the entres of the module.
69  */
70  mutable QStringList m_entries;
71 };
The backend layer main class, a backend implementation of Sword.
Definition: cswordbackend.h:56
CSwordLexiconModuleInfo(sword::SWModule &module, CSwordBackend &backend)
QString normalizeStrongsKey(const QString &key) const
CSwordKey * createKey() const final override
const QStringList & entries() const
bool snap() const final override
CSwordBackend & backend() const