~ubuntu-branches/debian/squeeze/sword/squeeze

« back to all changes in this revision

Viewing changes to bindings/swig/versekey.i

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Glassey
  • Date: 2004-01-15 15:50:07 UTC
  • Revision ID: james.westby@ubuntu.com-20040115155007-n9mz4x0zxrs1isd3
Tags: upstream-1.5.7
ImportĀ upstreamĀ versionĀ 1.5.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%{
 
2
#include "versekey.h"
 
3
#include "listkey.h"
 
4
using namespace sword;
 
5
%}
 
6
 
 
7
class VerseKey : public SWKey {
 
8
public:
 
9
  VerseKey(const char *ikey = 0);
 
10
  VerseKey(const SWKey * ikey);
 
11
  VerseKey(const char *min, const char *max);
 
12
  VerseKey(const VerseKey &k);
 
13
  virtual ~VerseKey();
 
14
 
 
15
  virtual SWKey *clone() const;
 
16
 
 
17
//bound management
 
18
//  VerseKey & LowerBound(const char *lb);
 
19
//  VerseKey & UpperBound(const char *ub);
 
20
  VerseKey & LowerBound() const;
 
21
  VerseKey & UpperBound() const;
 
22
  void ClearBounds();
 
23
 
 
24
//data functions
 
25
  virtual ListKey ParseVerseList (const char *buf, const char *defaultKey="Genesis 1:1", bool expandRange=false);
 
26
 
 
27
  virtual void setText(const char *ikey);
 
28
  virtual const char* getText () const;
 
29
  virtual const char *getRangeText() const;
 
30
  virtual const char *getShortText() const;
 
31
 
 
32
 
 
33
  virtual char Traversable();
 
34
 
 
35
  virtual void decrement(int step);
 
36
  virtual void increment(int step);
 
37
 
 
38
  virtual const char *getBookName() const;
 
39
  virtual const char *getBookAbbrev() const;
 
40
 
 
41
  virtual char Testament() const;
 
42
  virtual char Book() const;
 
43
  virtual int Chapter() const;
 
44
  virtual int Verse() const;
 
45
 
 
46
  //virtual char Testament(char itestament);
 
47
//  virtual char Book(char ibook);
 
48
//  virtual int Chapter(int ichapter);
 
49
//  virtual int Verse(int iverse);
 
50
 
 
51
  virtual void Normalize(char autocheck = 0);
 
52
  virtual char AutoNormalize(char iautonorm = MAXPOS (char));
 
53
 
 
54
  virtual char Headings(char iheadings = MAXPOS (char));
 
55
  virtual const char *getOSISRef() const;
 
56
 
 
57
  virtual int compare(const SWKey & ikey);
 
58
  virtual int _compare(const VerseKey & ikey);
 
59
 
 
60
  virtual void setLocale(const char *name);
 
61
  virtual const char *getLocale() const;
 
62
 
 
63
// extensions to Sword's class
 
64
 
 
65
%extend {
 
66
        /* Get number of books in the given testament
 
67
        * testament may be 1 (OT) or 2 (NT)
 
68
        */
 
69
        const int bookCount( const int testament ) {
 
70
                if ( (testament < 1) || (testament > 2) ) {
 
71
                        return 0;
 
72
                };
 
73
                return self->BMAX[testament-1];
 
74
        };
 
75
 
 
76
        /* Get name of book
 
77
        * Returns the name of the booknumber in the givn testament.
 
78
        * Testament may be 1 (OT) or 2 (NT)
 
79
        * book may be in the range of 1 <= bookCount(testament)
 
80
        */
 
81
        const char* bookName( const int testament, const int book ) {
 
82
                if ( (testament < 1) || (testament > 2) ) {
 
83
                        return "";
 
84
                };
 
85
                if ( (book < 1) || (book > self->BMAX[testament-1]) ) {
 
86
                        return "";
 
87
                }
 
88
 
 
89
                return self->books[testament-1][book-1].name;
 
90
        };
 
91
 
 
92
        /* Get number of chapters in the given testament and book number
 
93
        * testament may be 1 (OT) or 2 (NT)
 
94
        * book may be in the range 1 <= bookCount(testament)
 
95
        */
 
96
        const int chapterCount( const int testament, const int book ) {
 
97
                if ( (testament < 1) || (testament > 2) ) {
 
98
                        return 0;
 
99
                };
 
100
                if ( (book < 1) || (book > self->BMAX[testament-1]) ) {
 
101
                        return 0;
 
102
                }
 
103
 
 
104
                return self->books[testament-1][book-1].chapmax;
 
105
        };
 
106
 
 
107
        /* Get number of verses in the given chapter of the given in the given testament,
 
108
        * testament may be 1 (OT) or 2 (NT)
 
109
        * book may be in the range 1 <= bookCount(testament)
 
110
        * chapter may be in the range 1 <= chapterCount(testament, book)
 
111
        */
 
112
        const int verseCount( const int testament, const int book, const int chapter ) {
 
113
                if ( (testament < 1) || (testament > 2) ) {
 
114
                        return 0;
 
115
                };
 
116
                if ( (book < 1) || (book > self->BMAX[testament-1]) ) {
 
117
                        return 0;
 
118
                }
 
119
                if ( (chapter < 1) || (chapter > self->books[testament-1][book-1].chapmax) ) {
 
120
                        return 0;
 
121
                }
 
122
 
 
123
                return self->books[testament-1][book-1].versemax[chapter-1];
 
124
 
 
125
        };
 
126
}
 
127
 
 
128
};