Improve sword integration and bible interface
[kworship.git] / kworship / bible / KwBibleModuleSword.h
blobdb41e339ae5c50110c571285a867f80ece98e83b
1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
4 * *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _KwBibleModuleSword_h_
21 #define _KwBibleModuleSword_h_
23 /**
24 * @file KwBibleModuleSword.h
25 * @brief A SWORD bible module.
26 * @author James Hogan <james@albanarts.com>
29 #include "KwBibleModule.h"
31 namespace sword
33 class SWText;
36 /// A SWORD bible module.
37 class KwBibleModuleSword : public KwBibleModule
39 public:
42 * Constructors + destructor
45 /// Default constructor.
46 KwBibleModuleSword(sword::SWText* module);
48 /// Destructor.
49 virtual ~KwBibleModuleSword();
52 * Main interface
55 // Reimplemented
56 virtual QString name();
58 // Reimplemented
59 virtual QString description();
61 // Reimplemented
62 virtual int numChapters(int book);
64 // Reimplemented
65 virtual int numVerses(int book, int chapter);
67 // Reimplemented
68 virtual QString renderText(const KwBibleModule::Key& key);
70 protected:
73 * Protected virtual interface
76 // Reimplemented
77 virtual void obtainBooks();
80 * Internal functions
83 /// Find whether the module has a given testament.
84 bool hasTestament(int testament);
86 /// Find the testament and index of the book within the testament.
87 int bookInTestament(int& book);
89 /// Find the book index from testament and book id.
90 int toBookIndex(int testament, int book);
92 private:
95 * Variables
98 /// SWORD module object.
99 sword::SWText* m_module;
101 /// Whether the module has each testament.
102 int m_hasTestament[2];
105 #endif // _KwBibleModuleSword_h_