Fix KwBibleModule::fillPassage to provide correct manager id to KwBiblePassage object
[kworship.git] / kworship / bible / KwBibleModuleSword.h
blob577ed588ad8944dd419e3d30cfd7b9e23c1fedc4
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 QString managerId();
64 // Reimplemented
65 virtual int numChapters(int book);
67 // Reimplemented
68 virtual int numVerses(int book, int chapter);
70 // Reimplemented
71 virtual bool fillPassageVerse(int bookIndex, int chapterIndex, int verseIndex, KwBiblePassage* outPassage);
73 protected:
76 * Protected virtual interface
79 // Reimplemented
80 virtual void obtainBooks();
83 * Internal functions
86 /** Convert a local book index to a bible book index.
87 * @param localIndex Local index of book in module.
88 * @returns Index of the book in the bible.
90 int localToBible(int localIndex) const;
92 /** Convert a bible book index to a local book index.
93 * @param bibleIndex Index of book in bible.
94 * @returns Local index of book in module.
96 int bibleToLocal(int bibleIndex) const;
98 /** Convert a testament & book number to a bible book index.
99 * @param testament Testament number [0,1].
100 * @param book Book number [0,..].
101 * @returns Bible book index.
103 int testamentBookToBible(int testament, int book) const;
105 /** Convert a bible book index into a testament and book number.
106 * @param bibleIndex Bible book index.
107 * @param book[out] Points to int in which to write book number.
108 * @returns Which testament [0,1].
110 int bibleToTestamentBook(int bibleIndex, int* book) const;
112 /** Convert a testament & book number to a local book index.
113 * @param testament Testament number [0,1].
114 * @param book Book number [0,..].
115 * @returns Local book index.
117 int testamentBookToLocal(int testament, int book) const;
119 /** Convert a local book index into a testament and book number.
120 * @param localIndex Local book index.
121 * @param book[out] Points to int in which to write book number.
122 * @returns Which testament [0,1].
124 int localToTestamentBook(int localIndex, int* book) const;
126 private:
129 * Variables
132 /// SWORD module object.
133 sword::SWText* m_module;
135 /// First book of the bible in this module.
136 int m_firstBibleBookIndex;
138 /// Last book of the bible in this module.
139 int m_lastBibleBookIndex;
142 #endif // _KwBibleModuleSword_h_