BibleTime
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CSwordKey Class Referenceabstract

#include <cswordkey.h>

Inheritance diagram for CSwordKey:

Public Types

enum  TextRenderType { Normal , ProcessEntryAttributesOnly }
 

Public Member Functions

virtual sword::SWKey const & asSwordKey () const noexcept=0
 
virtual CSwordKeycopy () const =0
 
bool isValid () const
 
virtual QString key () const =0
 
CSwordModuleInfo const * module () const
 
virtual QString normalizedKey () const
 
CSwordKeyoperator= (CSwordKey const &)=delete
 
QString rawText ()
 
QString renderedText (const CSwordKey::TextRenderType mode=CSwordKey::Normal)
 
virtual bool setKey (const char *key)=0
 
virtual bool setKey (const QString &key)=0
 
virtual void setModule (const CSwordModuleInfo *newModule)
 
QString strippedText ()
 
virtual ~CSwordKey () noexcept
 

Protected Member Functions

 CSwordKey (CSwordKey const &copy)=default
 
 CSwordKey (CSwordModuleInfo const *const module=nullptr)
 
virtual const char * rawKey () const =0
 

Protected Attributes

const CSwordModuleInfom_module
 
bool m_valid = true
 

Detailed Description

Base class for all Sword based keys.

Definition at line 22 of file cswordkey.h.

Member Enumeration Documentation

◆ TextRenderType

Enumerator
Normal 
ProcessEntryAttributesOnly 

Definition at line 26 of file cswordkey.h.

Constructor & Destructor Documentation

◆ ~CSwordKey()

CSwordKey::~CSwordKey ( )
virtualdefaultnoexcept

◆ CSwordKey() [1/2]

CSwordKey::CSwordKey ( CSwordModuleInfo const *const  module = nullptr)
inlineprotected

Definition at line 99 of file cswordkey.h.

◆ CSwordKey() [2/2]

CSwordKey::CSwordKey ( CSwordKey const &  copy)
protecteddefault

Member Function Documentation

◆ asSwordKey()

virtual sword::SWKey const& CSwordKey::asSwordKey ( ) const
pure virtualnoexcept
Returns
a reference to this object as a sword::SWKey.

Implemented in CSwordVerseKey, CSwordTreeKey, and CSwordLDKey.

◆ copy()

virtual CSwordKey* CSwordKey::copy ( ) const
pure virtual
Returns
a clone of this object.

Implemented in CSwordVerseKey, CSwordTreeKey, and CSwordLDKey.

Referenced by BtQmlInterface::copyRange().

◆ isValid()

bool CSwordKey::isValid ( ) const
inline

Check whether key is valid. Can be invalidated during av11n mapping.

Definition at line 95 of file cswordkey.h.

References m_valid.

Referenced by Rendering::CTextRendering::renderEntry().

◆ key()

virtual QString CSwordKey::key ( ) const
pure virtual

◆ module()

CSwordModuleInfo const* CSwordKey::module ( ) const
inline

◆ normalizedKey()

QString CSwordKey::normalizedKey ( ) const
virtual
Returns
the normalized (English) key.

Reimplemented in CSwordVerseKey.

Definition at line 43 of file cswordkey.cpp.

◆ operator=()

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

◆ rawKey()

virtual const char* CSwordKey::rawKey ( ) const
protectedpure virtual
Returns
the encoded key appropriate for use directly with Sword.

Implemented in CSwordVerseKey, CSwordTreeKey, and CSwordLDKey.

Referenced by rawText(), renderedText(), and strippedText().

◆ rawText()

QString CSwordKey::rawText ( )
Returns
the raw, unchanged text from the module (i.e. without any filter modifications).

Definition at line 45 of file cswordkey.cpp.

References key(), m_module, rawKey(), and CSwordModuleInfo::swordModule().

Referenced by BtQmlInterface::getRawText(), Rendering::CDisplayRendering::renderDisplayEntry(), and BtModuleTextModel::verseData().

◆ renderedText()

QString CSwordKey::renderedText ( const CSwordKey::TextRenderType  mode = CSwordKey::Normal)
Returns
the rendered text by passing the text under the current key through the filters.

Definition at line 58 of file cswordkey.cpp.

References BT_ASSERT, key(), CSwordModuleInfo::Lexicon, m_module, ProcessEntryAttributesOnly, rawKey(), CSwordModuleInfo::snap(), CSwordModuleInfo::swordModule(), and CSwordModuleInfo::type().

Referenced by Rendering::CTextRendering::renderEntry().

◆ setKey() [1/2]

virtual bool CSwordKey::setKey ( const char *  key)
pure virtual

Set the key using a utf8-decoded c-string.

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

Implemented in CSwordVerseKey, CSwordTreeKey, and CSwordLDKey.

◆ setKey() [2/2]

virtual bool CSwordKey::setKey ( const QString &  key)
pure virtual

Sets the current key using a utf8 enabled QString.

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

Implemented in CSwordLDKey, CSwordVerseKey, and CSwordTreeKey.

Referenced by BtModelViewReadDisplay::BtModelViewReadDisplay(), Rendering::CTextRendering::renderEntry(), and CDisplayWindow::setupMainWindowToolBars().

◆ setModule()

virtual void CSwordKey::setModule ( const CSwordModuleInfo newModule)
inlinevirtual

Sets the module which belongs to this key.

Parameters
[in]newModulethe module to set.

Reimplemented in CSwordVerseKey, CSwordTreeKey, and CSwordLDKey.

Definition at line 74 of file cswordkey.h.

References m_module.

Referenced by Rendering::CTextRendering::renderEntry().

◆ strippedText()

QString CSwordKey::strippedText ( )
Returns
the text after removing all markup tags from it.

Definition at line 118 of file cswordkey.cpp.

References m_module, rawKey(), and CSwordModuleInfo::swordModule().

Referenced by BtModelViewReadDisplay::text().

Member Data Documentation

◆ m_module

const CSwordModuleInfo* CSwordKey::m_module
protected

◆ m_valid

bool CSwordKey::m_valid = true
protected

Definition at line 113 of file cswordkey.h.

Referenced by isValid(), CSwordVerseKey::setKey(), and CSwordVerseKey::setModule().


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