3
* This file is part of BibleTime's source code, http://www.bibletime.info/.
5
* Copyright 1999-2006 by the BibleTime developers.
6
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
13
#include "cswordbookmoduleinfo.h"
14
#include "cswordtreekey.h"
17
#include <treekeyidx.h>
25
CSwordBookModuleInfo::CSwordBookModuleInfo( sword::SWModule* module, CSwordBackend* const usedBackend )
26
: CSwordModuleInfo(module, usedBackend),
29
CSwordBookModuleInfo::CSwordBookModuleInfo( const CSwordBookModuleInfo& module )
30
: CSwordModuleInfo(module) {
31
m_depth = module.m_depth;
34
CSwordBookModuleInfo::~CSwordBookModuleInfo() {}
36
const int CSwordBookModuleInfo::depth() {
38
sword::TreeKeyIdx* key = tree();
49
void CSwordBookModuleInfo::computeDepth(sword::TreeKeyIdx* key, int level ) {
51
// savedKey = key->getFullName(); //sword 1.5.8
52
savedKey = key->getText();
54
if (level > m_depth) {
58
if (key->hasChildren()) {
60
computeDepth(key, level+1);
62
key->setText( savedKey.c_str() );//return to the initial value
65
if (key->nextSibling()) {
66
computeDepth(key, level);
70
/** Returns a treekey filled with the structure of this module */
71
sword::TreeKeyIdx* const CSwordBookModuleInfo::tree() const {
72
sword::TreeKeyIdx* treeKey = dynamic_cast<sword::TreeKeyIdx*>((sword::SWKey*)*(module()));