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

CSwordKey implementation for Sword's TreeKey. More...

#include <cswordtreekey.h>

Inheritance diagram for CSwordTreeKey:

Public Types

using Offset = decltype(std::declval< sword::TreeKeyIdx const & >().getOffset())
 
- Public Types inherited from CSwordKey
enum  TextRenderType { Normal , ProcessEntryAttributesOnly }
 

Public Member Functions

sword::TreeKeyIdx const & asSwordKey () const noexcept final override
 
 BibleTime_CSwordTreeKey_DEFINE_COMP (<) BibleTime_CSwordTreeKey_DEFINE_COMP(<
 
CSwordTreeKeycopy () const final override
 
 CSwordTreeKey (const CSwordTreeKey &k)
 
 CSwordTreeKey (const sword::TreeKeyIdx *k, const CSwordModuleInfo *module)
 
QString getLocalNameUnicode ()
 
bool hasChildren ()
 
QString key () const final override
 
Offset offset () const
 
bool positionToFirstChild ()
 
bool positionToNextSibling ()
 
bool positionToParent ()
 
void positionToRoot ()
 
bool setKey (const char *key) final override
 
bool setKey (const QString &key) final override
 
void setModule (const CSwordModuleInfo *newModule) final override
 
void setOffset (Offset value)
 
- 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::TreeKeyIdx m_key
 

Additional Inherited Members

- Protected Attributes inherited from CSwordKey
const CSwordModuleInfom_module
 
bool m_valid = true
 

Detailed Description

CSwordKey implementation for Sword's TreeKey.

BibleTime's implementation of Sword's TreeKeyIdx class.

Author
The BibleTime team

Definition at line 43 of file cswordtreekey.h.

Member Typedef Documentation

◆ Offset

using CSwordTreeKey::Offset = decltype(std::declval<sword::TreeKeyIdx const &>().getOffset())

Definition at line 47 of file cswordtreekey.h.

Constructor & Destructor Documentation

◆ CSwordTreeKey() [1/2]

CSwordTreeKey::CSwordTreeKey ( const sword::TreeKeyIdx *  k,
const CSwordModuleInfo module 
)
Parameters
kThe Sword tree key which belongs to this key
moduleThe module which belongs to this key

Definition at line 31 of file cswordtreekey.cpp.

Referenced by copy().

◆ CSwordTreeKey() [2/2]

CSwordTreeKey::CSwordTreeKey ( const CSwordTreeKey k)

Definition at line 26 of file cswordtreekey.cpp.

Member Function Documentation

◆ asSwordKey()

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

Implements CSwordKey.

Definition at line 37 of file cswordtreekey.cpp.

References m_key.

◆ BibleTime_CSwordTreeKey_DEFINE_COMP()

CSwordTreeKey::BibleTime_CSwordTreeKey_DEFINE_COMP ( )

◆ copy()

CSwordTreeKey * CSwordTreeKey::copy ( ) const
finaloverridevirtual
Returns
a clone of this object.

Implements CSwordKey.

Definition at line 40 of file cswordtreekey.cpp.

References CSwordTreeKey().

◆ getLocalNameUnicode()

QString CSwordTreeKey::getLocalNameUnicode ( )

Returns the TreeKeyIdx::getLocalKey value in unicode. Local key is the last part of the tree key, for example "Subsection1" from "/Section1/Subsection1". Use this instead of getLocalKey() to avoid encoding problems.

Definition at line 83 of file cswordtreekey.cpp.

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

Referenced by CBookKeyChooser::setKey(), and CBookKeyChooser::setupCombo().

◆ hasChildren()

bool CSwordTreeKey::hasChildren ( )
inline

Definition at line 98 of file cswordtreekey.h.

References m_key.

Referenced by CBookKeyChooser::setKey().

◆ key()

QString CSwordTreeKey::key ( ) const
finaloverridevirtual

◆ offset()

Offset CSwordTreeKey::offset ( ) const
inline

◆ positionToFirstChild()

bool CSwordTreeKey::positionToFirstChild ( )
inline

Definition at line 101 of file cswordtreekey.h.

References m_key.

Referenced by CBookKeyChooser::setKey(), setModule(), and CBookKeyChooser::setupCombo().

◆ positionToNextSibling()

bool CSwordTreeKey::positionToNextSibling ( )
inline

Definition at line 102 of file cswordtreekey.h.

References m_key.

Referenced by CBookKeyChooser::setKey(), and CBookKeyChooser::setupCombo().

◆ positionToParent()

bool CSwordTreeKey::positionToParent ( )
inline

Definition at line 100 of file cswordtreekey.h.

References m_key.

Referenced by CBookKeyChooser::setupCombo().

◆ positionToRoot()

void CSwordTreeKey::positionToRoot ( )
inline

◆ rawKey()

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

Implements CSwordKey.

Definition at line 56 of file cswordtreekey.cpp.

References m_key.

◆ setKey() [1/2]

bool CSwordTreeKey::setKey ( const char *  key)
finaloverridevirtual

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

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

Implements CSwordKey.

Definition at line 70 of file cswordtreekey.cpp.

References BT_ASSERT, m_key, and positionToRoot().

◆ setKey() [2/2]

bool CSwordTreeKey::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 58 of file cswordtreekey.cpp.

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

Referenced by BtQmlInterface::getCurrentModelIndex(), CBookTreeChooser::itemActivated(), CBookKeyChooser::keyChooserChanged(), CBookKeyChooser::setKey(), setModule(), and CBookKeyChooser::setupCombo().

◆ setModule()

void CSwordTreeKey::setModule ( const CSwordModuleInfo newModule)
finaloverridevirtual

Sets the module which belongs to this key.

Parameters
[in]newModulethe module to set.

Reimplemented from CSwordKey.

Definition at line 95 of file cswordtreekey.cpp.

References BT_ASSERT, CSwordModuleInfo::GenericBook, key(), m_key, CSwordKey::m_module, positionToFirstChild(), positionToRoot(), setKey(), and CSwordModuleInfo::type().

◆ setOffset()

void CSwordTreeKey::setOffset ( Offset  value)
inline

Member Data Documentation

◆ m_key

sword::TreeKeyIdx CSwordTreeKey::m_key
private

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