11
#include "cswordbookmoduleinfo.h"
10
#include "backend/drivers/cswordbookmoduleinfo.h"
12
12
#include "backend/keys/cswordtreekey.h"
15
16
#include <treekeyidx.h>
18
19
CSwordBookModuleInfo::CSwordBookModuleInfo( sword::SWModule* module, CSwordBackend* const usedBackend )
19
: CSwordModuleInfo(module, usedBackend),
20
: CSwordModuleInfo(module, usedBackend),
22
23
CSwordBookModuleInfo::CSwordBookModuleInfo( const CSwordBookModuleInfo& module )
23
: CSwordModuleInfo(module) {
24
m_depth = module.m_depth;
24
: CSwordModuleInfo(module) {
25
m_depth = module.m_depth;
27
28
CSwordBookModuleInfo::~CSwordBookModuleInfo() {}
29
30
int CSwordBookModuleInfo::depth() {
31
sword::TreeKeyIdx* key = tree();
32
sword::TreeKeyIdx* key = tree();
42
43
void CSwordBookModuleInfo::computeDepth(sword::TreeKeyIdx* key, int level ) {
44
// savedKey = key->getFullName(); //sword 1.5.8
45
savedKey = key->getText();
47
if (level > m_depth) {
51
if (key->hasChildren()) {
53
computeDepth(key, level+1);
55
key->setText( savedKey.c_str() );//return to the initial value
58
if (key->nextSibling()) {
59
computeDepth(key, level);
45
// savedKey = key->getFullName(); //sword 1.5.8
46
savedKey = key->getText();
48
if (level > m_depth) {
52
if (key->hasChildren()) {
54
computeDepth(key, level + 1);
56
key->setText( savedKey.c_str() );//return to the initial value
59
if (key->nextSibling()) {
60
computeDepth(key, level);
63
64
/** Returns a treekey filled with the structure of this module */
64
65
sword::TreeKeyIdx* CSwordBookModuleInfo::tree() const {
65
sword::TreeKeyIdx* treeKey = dynamic_cast<sword::TreeKeyIdx*>((sword::SWKey*)*(module()));
66
sword::TreeKeyIdx* treeKey = dynamic_cast<sword::TreeKeyIdx*>((sword::SWKey*) * (module()));