BibleTime
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CSwordBibleModuleInfo Class Reference

Implementation for Sword Bibles. More...

#include <cswordbiblemoduleinfo.h>

Inheritance diagram for CSwordBibleModuleInfo:

Public Member Functions

unsigned int bookNumber (const QString &book) const
 
QStringList const & books () const
 
unsigned int chapterCount (const QString &book) const
 
unsigned int chapterCount (const unsigned int book) const
 
CSwordKeycreateKey () const final override
 
 CSwordBibleModuleInfo (sword::SWModule &module, CSwordBackend &backend, ModuleType type=Bible)
 
bool hasNewTestament () const
 
bool hasOldTestament () const
 
CSwordVerseKey const & lowerBound () const
 
CSwordVerseKey const & upperBound () const
 
unsigned int verseCount (const QString &book, const unsigned int chapter) const
 
unsigned int verseCount (const unsigned int book, const unsigned int chapter) const
 
 ~CSwordBibleModuleInfo () noexcept override
 
- Public Member Functions inherited from CSwordModuleInfo
QString aboutText () const
 
void buildIndex ()
 
CSwordModuleInfo::Category category () const
 
QString config (const CSwordModuleInfo::ConfigEntry entry) const
 
 CSwordModuleInfo (CSwordModuleInfo &&)=delete
 
 CSwordModuleInfo (CSwordModuleInfo const &)=delete
 
void deleteEntry (CSwordKey *const key)
 
void deleteIndex ()
 
QString getModuleBaseIndexLocation () const
 
QString getModuleStandardIndexLocation () const
 
QString getUnlockInfo ()
 
std::shared_ptr< Language const > glossaryTargetlanguage () const
 
bool has (CSwordModuleInfo::Feature const feature) const noexcept
 
bool has (CSwordModuleInfo::FilterOption const &) const
 
bool hasIndex () const
 
bool hasVersion () const
 
::qint64 indexSize () const
 
bool isEncrypted () const
 
bool isHidden () const
 
bool isLocked () const
 
bool isUnicode () const noexcept
 
virtual bool isWritable () const
 
std::shared_ptr< Language const > language () const
 
sword::SWVersion minimumSwordVersion () const
 
QIcon moduleIcon () const
 
QString const & name () const
 
CSwordModuleInfooperator= (CSwordModuleInfo &&)=delete
 
CSwordModuleInfooperator= (CSwordModuleInfo const &)=delete
 
CSwordModuleSearch::ModuleResultList searchIndexed (QString const &searchedText, sword::ListKey const &scope) const
 
bool setHidden (bool hide)
 
virtual bool snap () const
 
sword::SWModule & swordModule () const
 
CSwordModuleInfo::TextDirection textDirection () const
 
char const * textDirectionAsHtml () const
 
ModuleType type () const
 
bool unlock (const QString &unlockKey)
 
bool unlockKeyIsValid () const
 
void write (CSwordKey *key, const QString &newText)
 

Private Member Functions

void initBounds () const
 

Private Attributes

std::optional< QStringList > m_bookList
 
bool m_boundsInitialized
 
QString m_cachedLocale
 
bool m_hasNT
 
bool m_hasOT
 
CSwordVerseKey m_lowerBound
 
CSwordVerseKey m_upperBound
 

Additional Inherited Members

- Public Types inherited from CSwordModuleInfo
enum  Category {
  UnknownCategory = 0x0 , NoCategory = 0x0 , Bibles = 0x01 , Commentaries = 0x02 ,
  Books = 0x04 , Lexicons = 0x08 , Glossary = 0x10 , DailyDevotional = 0x20 ,
  Images = 0x40 , Cult = 0x80 , AllCategories = 0xff
}
 
enum  ConfigEntry {
  AboutInformation , AbsoluteDataPath , CipherKey , DataPath ,
  Description , ModuleVersion , MinimumSwordVersion , TextDir ,
  DisplayLevel , GlossaryFrom , GlossaryTo , DistributionLicense ,
  DistributionSource , DistributionNotes , TextSource , CopyrightNotes ,
  CopyrightHolder , CopyrightDate , CopyrightContactName , CopyrightContactAddress ,
  CopyrightContactEmail , Markup
}
 
enum  Feature {
  FeatureStrongsNumbers = 1 , FeatureGreekDef = 1 << 1 , FeatureHebrewDef = 1 << 2 , FeatureGreekParse = 1 << 3 ,
  FeatureHebrewParse = 1 << 4 , FeatureDailyDevotion = 1 << 5 , FeatureGlossary = 1 << 6 , FeatureImages = 1 << 7 ,
  FeatureNoParagraphs = 1 << 8
}
 
enum  ModuleType {
  Unknown , Bible , Commentary , Lexicon ,
  GenericBook
}
 
enum  TextDirection { LeftToRight , RightToLeft }
 
enum  UnlockErrorCode { noError , wrongUnlockKey , notLocked , noPermission }
 
- Public Slots inherited from CSwordModuleInfo
void cancelIndexing (std::memory_order const memoryOrder=std::memory_order_relaxed) noexcept
 
- Signals inherited from CSwordModuleInfo
void hasIndexChanged (bool hasIndex)
 
void hiddenChanged (bool hidden)
 
void indexingFinished ()
 
void indexingProgress (int)
 
void unlockedChanged (bool unlocked)
 
- Static Public Member Functions inherited from CSwordModuleInfo
static QIcon const & categoryIcon (CSwordModuleInfo::Category category)
 
static QString categoryName (const CSwordModuleInfo::Category &category)
 
static void deleteIndexForModule (const QString &name)
 
static QString getGlobalBaseIndexLocation ()
 
static QIcon const & moduleIcon (CSwordModuleInfo const &module)
 
- Static Public Attributes inherited from CSwordModuleInfo
static FilterOption const footnotes
 
static FilterOption const greekAccents
 
static FilterOption const headings
 
static FilterOption const hebrewCantillation
 
static FilterOption const hebrewPoints
 
static FilterOption const lemmas
 
static FilterOption const morphSegmentation
 
static FilterOption const morphTags
 
static FilterOption const redLetterWords
 
static FilterOption const scriptureReferences
 
static FilterOption const strongNumbers
 
static FilterOption const textualVariants
 
- Protected Member Functions inherited from CSwordModuleInfo
CSwordBackendbackend () const
 
 CSwordModuleInfo (sword::SWModule &module, CSwordBackend &backend, ModuleType type)
 
QString getFormattedConfigEntry (const QString &name) const
 
QString getSimpleConfigEntry (const QString &name) const
 
bool hasImportantFilterOption () const
 
void setImportantFilterOptions (bool enable)
 

Detailed Description

Implementation for Sword Bibles.

This is the CModuleInfo imlementation for Bible modules managed by Sword.

Definition at line 27 of file cswordbiblemoduleinfo.h.

Constructor & Destructor Documentation

◆ CSwordBibleModuleInfo()

CSwordBibleModuleInfo::CSwordBibleModuleInfo ( sword::SWModule &  module,
CSwordBackend backend,
ModuleType  type = Bible 
)

Definition at line 25 of file cswordbiblemoduleinfo.cpp.

◆ ~CSwordBibleModuleInfo()

CSwordBibleModuleInfo::~CSwordBibleModuleInfo ( )
overridedefaultnoexcept

Member Function Documentation

◆ bookNumber()

unsigned int CSwordBibleModuleInfo::bookNumber ( const QString &  book) const
Returns
the index of the book given by its name.
Return values
0if a book with the given name was not found.

Definition at line 136 of file cswordbiblemoduleinfo.cpp.

References createKey(), and CSwordModuleInfo::swordModule().

Referenced by chapterCount(), and verseCount().

◆ books()

QStringList const & CSwordBibleModuleInfo::books ( ) const
Returns
a QStringList containing the books available in this module.

Returns the books available in this module

Definition at line 64 of file cswordbiblemoduleinfo.cpp.

References CSwordModuleInfo::backend(), CSwordVerseKey::bookName(), CSwordBackend::booknameLanguage(), initBounds(), CSwordVerseKey::key(), m_bookList, m_boundsInitialized, m_cachedLocale, m_lowerBound, m_upperBound, CSwordVerseKey::next(), and CSwordVerseKey::setKey().

Referenced by BtBibleKeyWidget::populateBookMenu().

◆ chapterCount() [1/2]

unsigned int CSwordBibleModuleInfo::chapterCount ( const QString &  book) const
Returns
the number of available chapters in the given book.

Definition at line 106 of file cswordbiblemoduleinfo.cpp.

References bookNumber(), and chapterCount().

◆ chapterCount() [2/2]

unsigned int CSwordBibleModuleInfo::chapterCount ( const unsigned int  book) const
Returns
the number of available chapters in the given book.

Definition at line 91 of file cswordbiblemoduleinfo.cpp.

References createKey(), and CSwordModuleInfo::swordModule().

Referenced by chapterCount(), and BtBibleKeyWidget::populateChapterMenu().

◆ createKey()

CSwordKey * CSwordBibleModuleInfo::createKey ( ) const
finaloverridevirtual

Implements CSwordModuleInfo.

Definition at line 150 of file cswordbiblemoduleinfo.cpp.

References BT_ASSERT, and CSwordModuleInfo::swordModule().

Referenced by bookNumber(), chapterCount(), and verseCount().

◆ hasNewTestament()

bool CSwordBibleModuleInfo::hasNewTestament ( ) const
inline
Returns
whether this module has the New Testament texts.

Definition at line 86 of file cswordbiblemoduleinfo.h.

References initBounds(), m_boundsInitialized, and m_hasNT.

◆ hasOldTestament()

bool CSwordBibleModuleInfo::hasOldTestament ( ) const
inline
Returns
whether this module has the Old Testament texts.

Definition at line 77 of file cswordbiblemoduleinfo.h.

References initBounds(), m_boundsInitialized, and m_hasOT.

Referenced by CSwordVerseKey::bookName().

◆ initBounds()

void CSwordBibleModuleInfo::initBounds ( ) const
private
Todo:
The fields calculated by this method could be cached to disk.

Definition at line 36 of file cswordbiblemoduleinfo.cpp.

References BT_ASSERT.

Referenced by books(), hasNewTestament(), hasOldTestament(), lowerBound(), and upperBound().

◆ lowerBound()

CSwordVerseKey const& CSwordBibleModuleInfo::lowerBound ( ) const
inline
Returns
the key which represents the lower bound of this module.

Definition at line 95 of file cswordbiblemoduleinfo.h.

References initBounds(), m_boundsInitialized, and m_lowerBound.

Referenced by CSwordModuleInfo::buildIndex(), BtModuleTextModel::reloadModules(), and CSwordVerseKey::setModule().

◆ upperBound()

CSwordVerseKey const& CSwordBibleModuleInfo::upperBound ( ) const
inline
Returns
the key which represents the upper bound of this module.

Definition at line 104 of file cswordbiblemoduleinfo.h.

References initBounds(), m_boundsInitialized, and m_upperBound.

Referenced by CSwordModuleInfo::buildIndex(), BtModuleTextModel::reloadModules(), and CSwordVerseKey::setModule().

◆ verseCount() [1/2]

unsigned int CSwordBibleModuleInfo::verseCount ( const QString &  book,
const unsigned int  chapter 
) const
Returns
the number of avalable verses for the given chapter and book.
Parameters
bookThe name of the book we use
chapterThe number of the chapter we use

Definition at line 130 of file cswordbiblemoduleinfo.cpp.

References bookNumber(), and verseCount().

◆ verseCount() [2/2]

unsigned int CSwordBibleModuleInfo::verseCount ( const unsigned int  book,
const unsigned int  chapter 
) const
Returns
the number of avalable verses for the given chapter and book.
Parameters
bookThe number book we should use
chapterThe chapter we should use

Returns the number of verses for the given chapter.

Definition at line 112 of file cswordbiblemoduleinfo.cpp.

References createKey(), and CSwordModuleInfo::swordModule().

Referenced by BtBibleKeyWidget::populateVerseMenu(), and verseCount().

Member Data Documentation

◆ m_bookList

std::optional<QStringList> CSwordBibleModuleInfo::m_bookList
mutableprivate

Definition at line 124 of file cswordbiblemoduleinfo.h.

Referenced by books().

◆ m_boundsInitialized

bool CSwordBibleModuleInfo::m_boundsInitialized
mutableprivate

◆ m_cachedLocale

QString CSwordBibleModuleInfo::m_cachedLocale
mutableprivate

Definition at line 125 of file cswordbiblemoduleinfo.h.

Referenced by books().

◆ m_hasNT

bool CSwordBibleModuleInfo::m_hasNT
mutableprivate

Definition at line 122 of file cswordbiblemoduleinfo.h.

Referenced by hasNewTestament().

◆ m_hasOT

bool CSwordBibleModuleInfo::m_hasOT
mutableprivate

Definition at line 121 of file cswordbiblemoduleinfo.h.

Referenced by hasOldTestament().

◆ m_lowerBound

CSwordVerseKey CSwordBibleModuleInfo::m_lowerBound
mutableprivate

Definition at line 119 of file cswordbiblemoduleinfo.h.

Referenced by books(), and lowerBound().

◆ m_upperBound

CSwordVerseKey CSwordBibleModuleInfo::m_upperBound
mutableprivate

Definition at line 120 of file cswordbiblemoduleinfo.h.

Referenced by books(), and upperBound().


The documentation for this class was generated from the following files: