~vcs-imports/bibletime/trunk

« back to all changes in this revision

Viewing changes to bibletime/backend/cswordbiblemoduleinfo.h

  • Committer: mgruner
  • Date: 2007-05-08 15:51:07 UTC
  • Revision ID: vcs-imports@canonical.com-20070508155107-0rj7jdmm5ivf8685
-imported source and data files to new svn module
-this is where KDE4-based development will take place

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*********
 
2
*
 
3
* This file is part of BibleTime's source code, http://www.bibletime.info/.
 
4
*
 
5
* Copyright 1999-2006 by the BibleTime developers.
 
6
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
 
7
*
 
8
**********/
 
9
 
 
10
 
 
11
 
 
12
#ifndef CSWORDBIBLEMODULEINFO_H
 
13
#define CSWORDBIBLEMODULEINFO_H
 
14
 
 
15
//own includes
 
16
#include "cswordmoduleinfo.h"
 
17
#include "cswordversekey.h"
 
18
 
 
19
//Qt includes
 
20
#include <qstringlist.h>
 
21
 
 
22
//Sword includes
 
23
 
 
24
 
 
25
/**
 
26
 * This is the CModuleInfo imlementation for Bible modules managed by Sword.
 
27
 * 
 
28
 * @short Implementation for Sword Bibles
 
29
  * @author The BibleTime team
 
30
  * @version $Id: cswordbiblemoduleinfo.h,v 1.18 2006/02/25 11:38:15 joachim Exp $
 
31
  */
 
32
 
 
33
class CSwordBibleModuleInfo : public CSwordModuleInfo {
 
34
 
 
35
public:
 
36
        enum Testament {
 
37
                OldTestament = 1,
 
38
                NewTestament = 2
 
39
        };
 
40
 
 
41
        /**
 
42
        * The constructor of this class
 
43
        */
 
44
        CSwordBibleModuleInfo( sword::SWModule* module, CSwordBackend* const = CPointers::backend()  );
 
45
        /** The copy constructor for this Bible module.
 
46
        */
 
47
        CSwordBibleModuleInfo( const CSwordBibleModuleInfo& m );
 
48
        /**
 
49
        * The destructor of this class
 
50
        */
 
51
        ~CSwordBibleModuleInfo();
 
52
        /**
 
53
        * Returns the number of avalable verses for the given chapter and book.
 
54
        *
 
55
        * @param book The number book we should use
 
56
        * @param chapter The chapter we should use
 
57
        * @return The number of verses for the given book and chapter
 
58
        */
 
59
        virtual const unsigned int verseCount( const unsigned int book, const unsigned int chapter );
 
60
        /**
 
61
        * Returns the number of avalable verses for the given chapter and book.
 
62
        *
 
63
        * @param book The name of the book we use
 
64
        * @param chapter The number of the chapter we use
 
65
        * @return The number of verses for the given book and chapter
 
66
        */
 
67
        virtual const unsigned int verseCount( const QString& book, const unsigned int chapter );
 
68
        /** Information about the chapters in a book.
 
69
        * @return The number of available chapters of the given book.
 
70
        * @return The number of chapters for the given book
 
71
        */
 
72
        virtual const unsigned int chapterCount( const unsigned int book );
 
73
        /** Information about the chapters in a book.
 
74
        * @return The number of available chapters of the given book.
 
75
        */
 
76
        virtual const unsigned int chapterCount( const QString& book );
 
77
        /** Return all book of this module.
 
78
        * @return A QStringList containing the books which are available in this module.
 
79
        */
 
80
        virtual QStringList* const books();
 
81
        /**
 
82
        * Reimplementation, Returns the type
 
83
        */
 
84
        virtual const CSwordModuleInfo::ModuleType type() const;
 
85
        /**
 
86
        * @return the book number, values starting with 1; 0 if not found
 
87
        */
 
88
        const unsigned int bookNumber(const QString &book);
 
89
        /**
 
90
        * Returns true if his module has the text of desired type of testament
 
91
        */
 
92
        const bool hasTestament( CSwordBibleModuleInfo::Testament );
 
93
        /** Reimplementation to clone this object. */
 
94
        virtual CSwordModuleInfo* clone();
 
95
        /**
 
96
        * Returns the key which represents the lower bound of this module.
 
97
        */
 
98
        inline const CSwordVerseKey& lowerBound();
 
99
        /**
 
100
        * Returns the key which represents the upper bound of this module.
 
101
        */
 
102
        inline const CSwordVerseKey& upperBound();
 
103
 
 
104
private:
 
105
        void initBounds();
 
106
 
 
107
        CSwordVerseKey m_lowerBound;
 
108
        CSwordVerseKey m_upperBound;
 
109
 
 
110
        QStringList* m_bookList; //This booklist is cached
 
111
        QString m_cachedLocale;
 
112
        short int m_hasOT;
 
113
        short int m_hasNT;
 
114
};
 
115
 
 
116
inline const CSwordModuleInfo::ModuleType CSwordBibleModuleInfo::type() const {
 
117
        return CSwordModuleInfo::Bible;
 
118
}
 
119
 
 
120
/** Returns the key which represents the lower bound of this module. */
 
121
inline const CSwordVerseKey& CSwordBibleModuleInfo::lowerBound() {
 
122
        initBounds();
 
123
        return m_lowerBound;
 
124
}
 
125
 
 
126
/** Returns the key which represents the lower bound of this module. */
 
127
inline const CSwordVerseKey& CSwordBibleModuleInfo::upperBound() {
 
128
        initBounds();
 
129
        return m_upperBound;
 
130
}
 
131
 
 
132
#endif