diff options
Diffstat (limited to 'src/backend/keys/cswordldkey.cpp')
-rw-r--r-- | src/backend/keys/cswordldkey.cpp | 100 |
1 files changed, 51 insertions, 49 deletions
diff --git a/src/backend/keys/cswordldkey.cpp b/src/backend/keys/cswordldkey.cpp index 3205827..4aa95cb 100644 --- a/src/backend/keys/cswordldkey.cpp +++ b/src/backend/keys/cswordldkey.cpp @@ -19,11 +19,11 @@ #include <QTextCodec> CSwordLDKey::CSwordLDKey( CSwordModuleInfo* module ) { - if ((m_module = dynamic_cast<CSwordLexiconModuleInfo*>(module))) { - // *(m_module->module()) = TOP; - } + if ((m_module = dynamic_cast<CSwordLexiconModuleInfo*>(module))) { + // *(m_module->module()) = TOP; + } - SWKey::operator= (" "); + SWKey::operator= (" "); } /** No descriptions */ @@ -34,85 +34,87 @@ CSwordLDKey::CSwordLDKey( const SWKey *k, CSwordModuleInfo* module) : CSwordKey( /** Clones this object by copying the members. */ CSwordLDKey* CSwordLDKey::copy() const { - return new CSwordLDKey(*this); + return new CSwordLDKey(*this); } /** Sets the module of this key. */ CSwordModuleInfo* CSwordLDKey::module(CSwordModuleInfo* const newModule) { - if (newModule && newModule->type() == CSwordModuleInfo::Lexicon) { - const QString oldKey = key(); - m_module = newModule; - key(oldKey); - } + if (newModule && newModule->type() == CSwordModuleInfo::Lexicon) { + const QString oldKey = key(); + m_module = newModule; + key(oldKey); + } - return m_module; + return m_module; } QString CSwordLDKey::key() const { - //return QString::fromUtf8((const char*)*this); - Q_ASSERT(m_module); - - if (m_module->isUnicode()) { - return QString::fromUtf8((const char*)*this); - } else { - return cp1252Codec()->toUnicode((const char*)*this); - } + //return QString::fromUtf8((const char*)*this); + Q_ASSERT(m_module); + + if (m_module->isUnicode()) { + return QString::fromUtf8((const char*)*this); + } + else { + return cp1252Codec()->toUnicode((const char*)*this); + } } const char * CSwordLDKey::rawKey() const { - return (const char*)*this; + return (const char*)*this; } bool CSwordLDKey::key( const QString& newKey ) { - Q_ASSERT(m_module); - - if (m_module->isUnicode()) { - return key(newKey.toUtf8().constData()); - } else { - return key((const char*)cp1252Codec()->fromUnicode(newKey)); - } + Q_ASSERT(m_module); + + if (m_module->isUnicode()) { + return key(newKey.toUtf8().constData()); + } + else { + return key((const char*)cp1252Codec()->fromUnicode(newKey)); + } } /** Sets the key of this instance */ bool CSwordLDKey::key( const char* newKey ) { - Q_ASSERT(newKey); + Q_ASSERT(newKey); - if (newKey) { - SWKey::operator = (newKey); //set the key - m_module->module()->SetKey(this); - m_module->snap(); - } + if (newKey) { + SWKey::operator = (newKey); //set the key + m_module->module()->SetKey(this); + m_module->snap(); + } - return !Error(); + return !Error(); } /** Uses the parameter to returns the next entry afer this key. */ CSwordLDKey* CSwordLDKey::NextEntry() { - m_module->module()->SetKey(this); //use this key as base for the next one! - // m_module->module()->getKey()->setText( (const char*)key().utf8() ); + m_module->module()->SetKey(this); //use this key as base for the next one! + // m_module->module()->getKey()->setText( (const char*)key().utf8() ); - m_module->module()->setSkipConsecutiveLinks(true); - ( *( m_module->module() ) )++; - m_module->module()->setSkipConsecutiveLinks(false); + m_module->module()->setSkipConsecutiveLinks(true); + ( *( m_module->module() ) )++; + m_module->module()->setSkipConsecutiveLinks(false); - key(m_module->module()->KeyText()); - SWKey::operator = (m_module->module()->KeyText()); + key(m_module->module()->KeyText()); + SWKey::operator = (m_module->module()->KeyText()); - return this; + return this; } /** Uses the parameter to returns the next entry afer this key. */ CSwordLDKey* CSwordLDKey::PreviousEntry() { - m_module->module()->SetKey(this); //use this key as base for the next one! - // m_module->module()->getKey()->setText( (const char*)key().utf8() ); + m_module->module()->SetKey(this); //use this key as base for the next one! + // m_module->module()->getKey()->setText( (const char*)key().utf8() ); - m_module->module()->setSkipConsecutiveLinks(true); - ( *( m_module->module() ) )--; - m_module->module()->setSkipConsecutiveLinks(false); + m_module->module()->setSkipConsecutiveLinks(true); + ( *( m_module->module() ) )--; + m_module->module()->setSkipConsecutiveLinks(false); - SWKey::operator = (m_module->module()->KeyText()); + SWKey::operator = (m_module->module()->KeyText()); - return this; + return this; } |