[sword-cvs] sword/bindings/swig versekey.i,1.2,1.3
sword@www.crosswire.org
sword@www.crosswire.org
Thu, 30 Jan 2003 17:24:07 -0700
- Previous message: [sword-cvs] sword/apps/windoze/CBuilder5/BibleCS mainfrm.cpp,1.108,1.109 optionfrm.cpp,1.32,1.33 PrintFrm.cpp,1.10,1.11 PrintFrm.h,1.4,1.5 RxRichEditX.cpp,1.39,1.40 RxRichEditX.h,1.13,1.14
- Next message: [sword-cvs] sword/bindings/swig/perl Sword.cxx,1.7,1.8 Sword.pm,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/local/cvsroot/sword/bindings/swig
In directory www:/tmp/cvs-serv21861
Modified Files:
versekey.i
Log Message:
improved SWIG bindings
Index: versekey.i
===================================================================
RCS file: /usr/local/cvsroot/sword/bindings/swig/versekey.i,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** versekey.i 27 Nov 2002 21:20:35 -0000 1.2
--- versekey.i 31 Jan 2003 00:24:01 -0000 1.3
***************
*** 24,28 ****
//data functions
virtual ListKey ParseVerseList (const char *buf, const char *defaultKey="Genesis 1:1", bool expandRange=false);
!
virtual void setText(const char *ikey);
virtual const char* getText () const;
--- 24,28 ----
//data functions
virtual ListKey ParseVerseList (const char *buf, const char *defaultKey="Genesis 1:1", bool expandRange=false);
!
virtual void setText(const char *ikey);
virtual const char* getText () const;
***************
*** 59,61 ****
--- 59,127 ----
virtual void setLocale(const char *name);
virtual const char *getLocale() const;
+
+ // extensions to Sword's class
+
+ %extend {
+ /* Get number of books in the given testament
+ * testament may be 1 (OT) or 2 (NT)
+ */
+ const int bookCount( const int testament ) {
+ if ( (testament < 1) || (testament > 2) ) {
+ return 0;
+ };
+ return self->BMAX[testament-1];
+ };
+
+ /* Get name of book
+ * Returns the name of the booknumber in the givn testament.
+ * Testament may be 1 (OT) or 2 (NT)
+ * book may be in the range of 1 <= bookCount(testament)
+ */
+ const char* bookName( const int testament, const int book ) {
+ if ( (testament < 1) || (testament > 2) ) {
+ return "";
+ };
+ if ( (book < 1) || (book > self->BMAX[testament-1]) ) {
+ return "";
+ }
+
+ return self->books[testament-1][book-1].name;
+ };
+
+ /* Get number of chapters in the given testament and book number
+ * testament may be 1 (OT) or 2 (NT)
+ * book may be in the range 1 <= bookCount(testament)
+ */
+ const int chapterCount( const int testament, const int book ) {
+ if ( (testament < 1) || (testament > 2) ) {
+ return 0;
+ };
+ if ( (book < 1) || (book > self->BMAX[testament-1]) ) {
+ return 0;
+ }
+
+ return self->books[testament-1][book-1].chapmax;
+ };
+
+ /* Get number of verses in the given chapter of the given in the given testament,
+ * testament may be 1 (OT) or 2 (NT)
+ * book may be in the range 1 <= bookCount(testament)
+ * chapter may be in the range 1 <= chapterCount(testament, book)
+ */
+ const int verseCount( const int testament, const int book, const int chapter ) {
+ if ( (testament < 1) || (testament > 2) ) {
+ return 0;
+ };
+ if ( (book < 1) || (book > self->BMAX[testament-1]) ) {
+ return 0;
+ }
+ if ( (chapter < 1) || (chapter > self->books[testament-1][book-1].chapmax) ) {
+ return 0;
+ }
+
+ return self->books[testament-1][book-1].versemax[chapter-1];
+
+ };
+ }
+
};
- Previous message: [sword-cvs] sword/apps/windoze/CBuilder5/BibleCS mainfrm.cpp,1.108,1.109 optionfrm.cpp,1.32,1.33 PrintFrm.cpp,1.10,1.11 PrintFrm.h,1.4,1.5 RxRichEditX.cpp,1.39,1.40 RxRichEditX.h,1.13,1.14
- Next message: [sword-cvs] sword/bindings/swig/perl Sword.cxx,1.7,1.8 Sword.pm,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]