BibleTime
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
CSwordLDKey Class Referencefinal

#include <cswordldkey.h>

Inheritance diagram for CSwordLDKey:

Public Member Functions

sword::SWKey const & asSwordKey () const noexcept final override
 
CSwordLDKeycopy () const final override
 
 CSwordLDKey (const CSwordLDKey &copy)
 
 CSwordLDKey (const CSwordModuleInfo *module)
 
 CSwordLDKey (const sword::SWKey *k, const CSwordModuleInfo *module)
 
QString key () const final override
 
CSwordLDKeyNextEntry ()
 
CSwordLDKeyoperator= (CSwordLDKey const &)=delete
 
CSwordLDKeyPreviousEntry ()
 
bool setKey (const char *key) final override
 
bool setKey (const QString &newKey) final override
 
void setModule (const CSwordModuleInfo *module) final override
 
- Public Member Functions inherited from CSwordKey
bool isValid () const
 
CSwordModuleInfo const * module () const
 
virtual QString normalizedKey () const
 
CSwordKeyoperator= (CSwordKey const &)=delete
 
QString rawText ()
 
QString renderedText (const CSwordKey::TextRenderType mode=CSwordKey::Normal)
 
QString strippedText ()
 
virtual ~CSwordKey () noexcept
 

Protected Member Functions

const char * rawKey () const final override
 
- Protected Member Functions inherited from CSwordKey
 CSwordKey (CSwordKey const &copy)=default
 
 CSwordKey (CSwordModuleInfo const *const module=nullptr)
 

Private Attributes

sword::SWKey m_key
 

Additional Inherited Members

- Public Types inherited from CSwordKey
enum  TextRenderType { Normal , ProcessEntryAttributesOnly }
 
- Protected Attributes inherited from CSwordKey
const CSwordModuleInfom_module
 
bool m_valid = true
 

Detailed Description

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.
Here's an example how to use this class:

CSwordLexiconModuleInfo* m_module = backend()->findModuleByName("ISBE");
ldKey.key("Adam");
ldKey.nextEntry();
qDebug( QString("The current key is: %1").arg(ldKey.key()));
const CSwordModuleInfo * m_module
Definition: cswordkey.h:112
std::unique_ptr< CSwordBackend > backend(sword::InstallSource const &is)

Please not, that the result will be invalid if use the operator const char* on the adress of the object, use something like this

CSwordLDKey* key = new CSwordLDKey( lexicon_module );
const QString keyname = key->getKey();
CSwordLDKey(const CSwordModuleInfo *module)
Definition: cswordldkey.cpp:37
QString key() const final override
Definition: cswordldkey.cpp:71
Author
The BibleTime team
Version
Id
cswordldkey.h,v 1.24 2006/02/25 11:38:15 joachim Exp

Definition at line 58 of file cswordldkey.h.

Constructor & Destructor Documentation

◆ CSwordLDKey() [1/3]

CSwordLDKey::CSwordLDKey ( const CSwordModuleInfo module)
Todo:
Document param

Definition at line 37 of file cswordldkey.cpp.

References m_key.

Referenced by copy().

◆ CSwordLDKey() [2/3]

CSwordLDKey::CSwordLDKey ( const CSwordLDKey copy)

No descriptions

Definition at line 42 of file cswordldkey.cpp.

◆ CSwordLDKey() [3/3]

CSwordLDKey::CSwordLDKey ( const sword::SWKey *  k,
const CSwordModuleInfo module 
)
Todo:
Document params

No descriptions

Definition at line 48 of file cswordldkey.cpp.

Member Function Documentation

◆ asSwordKey()

sword::SWKey const & CSwordLDKey::asSwordKey ( ) const
finaloverridevirtualnoexcept
Returns
a reference to this object as a sword::SWKey.

Implements CSwordKey.

Definition at line 53 of file cswordldkey.cpp.

References m_key.

◆ copy()

CSwordLDKey * CSwordLDKey::copy ( ) const
finaloverridevirtual

Clones this object by copying the members.

Implements CSwordKey.

Definition at line 56 of file cswordldkey.cpp.

References CSwordLDKey().

◆ key()

QString CSwordLDKey::key ( ) const
finaloverridevirtual
Returns
The key which belongs to the current object.

Implements CSwordKey.

Definition at line 71 of file cswordldkey.cpp.

References BT_ASSERT, CSwordModuleInfo::isUnicode(), m_key, CSwordKey::m_module, and util::cp1252::toUnicode().

Referenced by CLexiconKeyChooser::CLexiconKeyChooser(), setModule(), and CLexiconKeyChooser::updateKey().

◆ NextEntry()

CSwordLDKey * CSwordLDKey::NextEntry ( )

Uses the parameter to returns the next entry afer this key.

Definition at line 112 of file cswordldkey.cpp.

References m_key, CSwordKey::m_module, setKey(), and CSwordModuleInfo::swordModule().

◆ operator=()

CSwordLDKey& CSwordLDKey::operator= ( CSwordLDKey const &  )
delete

◆ PreviousEntry()

CSwordLDKey * CSwordLDKey::PreviousEntry ( )

Uses the parameter to returns the previous entry afer this key.

Uses the parameter to returns the next entry afer this key.

Definition at line 128 of file cswordldkey.cpp.

References m_key, CSwordKey::m_module, and CSwordModuleInfo::swordModule().

◆ rawKey()

const char * CSwordLDKey::rawKey ( ) const
finaloverrideprotectedvirtual
Returns
the encoded key appropriate for use directly with Sword.

Implements CSwordKey.

Definition at line 82 of file cswordldkey.cpp.

References m_key.

◆ setKey() [1/2]

bool CSwordLDKey::setKey ( const char *  newKey)
finaloverridevirtual

Sets the key of this instance

Implements CSwordKey.

Definition at line 99 of file cswordldkey.cpp.

References BT_ASSERT, m_key, CSwordKey::m_module, CSwordModuleInfo::snap(), and CSwordModuleInfo::swordModule().

◆ setKey() [2/2]

bool CSwordLDKey::setKey ( const QString &  key)
finaloverridevirtual

Sets the current key using a utf8 enabled QString.

Parameters
[in]keyThe key which should be used to set the current one.

Implements CSwordKey.

Definition at line 86 of file cswordldkey.cpp.

References BT_ASSERT, util::cp1252::fromUnicode(), CSwordModuleInfo::isUnicode(), and CSwordKey::m_module.

Referenced by CLexiconKeyChooser::CLexiconKeyChooser(), NextEntry(), and setModule().

◆ setModule()

void CSwordLDKey::setModule ( const CSwordModuleInfo newModule)
finaloverridevirtual

Sets the module of this key.

Reimplemented from CSwordKey.

Definition at line 61 of file cswordldkey.cpp.

References BT_ASSERT, key(), CSwordModuleInfo::Lexicon, CSwordKey::m_module, setKey(), and CSwordModuleInfo::type().

Member Data Documentation

◆ m_key

sword::SWKey CSwordLDKey::m_key
private

Definition at line 102 of file cswordldkey.h.

Referenced by asSwordKey(), CSwordLDKey(), key(), NextEntry(), PreviousEntry(), rawKey(), and setKey().


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