Bibletime – a bible study tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cswordbiblemoduleinfo.h 3.7KB

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