summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Greek2Greek.h7
-rw-r--r--include/GreekChars.h7
-rw-r--r--include/Makefile.am44
-rw-r--r--include/apocrypha.h219
-rw-r--r--include/canon.h64
-rw-r--r--include/cdsourcemgr.h40
-rw-r--r--include/cipherfil.h20
-rw-r--r--include/defs.h38
-rw-r--r--include/echomod.h6
-rw-r--r--include/encfiltmgr.h9
-rw-r--r--include/entriesblk.h4
-rw-r--r--include/filemgr.h180
-rw-r--r--include/flatapi.h76
-rw-r--r--include/ftpparse.h53
-rw-r--r--include/gbffootnotes.h38
-rw-r--r--include/gbfheadings.h38
-rw-r--r--include/gbfhtml.h62
-rw-r--r--include/gbfhtmlhref.h49
-rw-r--r--include/gbfmorph.h37
-rw-r--r--include/gbfosis.h69
-rw-r--r--include/gbfplain.h16
-rw-r--r--include/gbfredletterwords.h40
-rw-r--r--include/gbfrtf.h18
-rw-r--r--include/gbfstrongs.h42
-rw-r--r--include/gbfthml.h47
-rw-r--r--include/gbfwebif.h41
-rw-r--r--include/greeklexattribs.h15
-rw-r--r--include/hebrewmcim.h5
-rw-r--r--include/hrefcom.h28
-rw-r--r--include/installmgr.h93
-rw-r--r--include/latin1utf16.h16
-rw-r--r--include/latin1utf8.h16
-rw-r--r--include/listkey.h54
-rw-r--r--include/localemgr.h125
-rw-r--r--include/lzsscomprs.h5
-rw-r--r--include/markupfiltmgr.h20
-rw-r--r--include/multimapwdef.h18
-rw-r--r--include/nullim.h4
-rw-r--r--include/osisfootnotes.h38
-rw-r--r--include/osisheadings.h38
-rw-r--r--include/osishtmlhref.h51
-rw-r--r--include/osislemma.h38
-rw-r--r--include/osismorph.h (renamed from include/thmlolb.h)27
-rw-r--r--include/osisplain.h47
-rw-r--r--include/osisredletterwords.h38
-rw-r--r--include/osisrtf.h52
-rw-r--r--include/osisscripref.h38
-rw-r--r--include/osisstrongs.h38
-rw-r--r--include/osiswebif.h41
-rw-r--r--include/plainfootnotes.h77
-rw-r--r--include/plainhtml.h52
-rw-r--r--include/rawcom.h42
-rw-r--r--include/rawfiles.h94
-rw-r--r--include/rawgbf.h6
-rw-r--r--include/rawgenbook.h44
-rw-r--r--include/rawld.h63
-rw-r--r--include/rawld4.h59
-rw-r--r--include/rawstr.h23
-rw-r--r--include/rawstr4.h44
-rw-r--r--include/rawtext.h62
-rw-r--r--include/rawverse.h32
-rw-r--r--include/remotesourcemgr.h38
-rw-r--r--include/roman.h11
-rw-r--r--include/rtfhtml.h50
-rw-r--r--include/rwphtml.h38
-rw-r--r--include/sapphire.h6
-rw-r--r--include/scsuutf8.h23
-rw-r--r--include/strkey.h6
-rw-r--r--include/swbasicfilter.h99
-rw-r--r--include/swbuf.h223
-rw-r--r--include/swcacher.h8
-rw-r--r--include/swcipher.h11
-rw-r--r--include/swcom.h37
-rw-r--r--include/swcomprs.h5
-rw-r--r--include/swconfig.h92
-rw-r--r--include/swdisp.h13
-rw-r--r--include/swdisprtf.h48
-rw-r--r--include/swdisprtfchap.h35
-rw-r--r--include/swfilter.h116
-rw-r--r--include/swfiltermgr.h9
-rw-r--r--include/swgenbook.h31
-rw-r--r--include/swinputmeth.h4
-rw-r--r--include/swinstallmgr.h (renamed from include/Makefile.in)0
-rw-r--r--include/swkey.h316
-rw-r--r--include/swld.h54
-rw-r--r--include/swlocale.h56
-rw-r--r--include/swlog.h30
-rw-r--r--include/swmacs.h6
-rw-r--r--include/swmgr.h500
-rw-r--r--include/swmodule.h1107
-rw-r--r--include/swobject.h11
-rw-r--r--include/swoptfilter.h48
-rw-r--r--include/swremotemgr.h0
-rw-r--r--include/swsearchable.h89
-rw-r--r--include/swsourcemgr.h68
-rw-r--r--include/swtext.h39
-rw-r--r--include/swunicod.h5
-rw-r--r--include/swversion.h34
-rw-r--r--include/swwinlog.h6
-rw-r--r--include/sysdata.h1
-rw-r--r--include/tbdisp.h8
-rw-r--r--include/thmlfootnotes.h40
-rw-r--r--include/thmlgbf.h19
-rw-r--r--include/thmlheadings.h42
-rw-r--r--include/thmlhtml.h49
-rw-r--r--include/thmlhtmlhref.h53
-rw-r--r--include/thmllemma.h42
-rw-r--r--include/thmlmorph.h43
-rw-r--r--include/thmlosis.h40
-rw-r--r--include/thmlplain.h19
-rw-r--r--include/thmlrtf.h31
-rw-r--r--include/thmlscripref.h40
-rw-r--r--include/thmlstrongs.h42
-rw-r--r--include/thmlvariants.h63
-rw-r--r--include/thmlwebif.h (renamed from include/rwprtf.h)32
-rw-r--r--include/treekey.h8
-rw-r--r--include/treekeyidx.h13
-rw-r--r--include/unicodertf.h17
-rw-r--r--include/unixstr.h6
-rw-r--r--include/untgz.h3
-rw-r--r--include/utf16utf8.h16
-rw-r--r--include/utf8arshaping.h33
-rw-r--r--include/utf8bidireorder.h33
-rw-r--r--include/utf8cantillation.h37
-rw-r--r--include/utf8greekaccents.h37
-rw-r--r--include/utf8hebrewpoints.h41
-rw-r--r--include/utf8html.h16
-rw-r--r--include/utf8latin1.h18
-rw-r--r--include/utf8nfc.h29
-rw-r--r--include/utf8nfkd.h29
-rw-r--r--include/utf8transliterator.h93
-rw-r--r--include/utf8utf16.h16
-rw-r--r--include/utilconf.h5
-rw-r--r--include/utilfuns.h4
-rw-r--r--include/utilstr.h10
-rw-r--r--include/utilweb.h40
-rw-r--r--include/utilxml.h83
-rw-r--r--include/versekey.h50
-rw-r--r--include/zcom.h73
-rw-r--r--include/zconf.h6
-rw-r--r--include/zipcomprs.h5
-rw-r--r--include/zld.h45
-rw-r--r--include/zlib.h6
-rw-r--r--include/zstr.h12
-rw-r--r--include/ztext.h66
-rw-r--r--include/zverse.h28
146 files changed, 4623 insertions, 2798 deletions
diff --git a/include/Greek2Greek.h b/include/Greek2Greek.h
index 9770ea2..2704388 100644
--- a/include/Greek2Greek.h
+++ b/include/Greek2Greek.h
@@ -17,7 +17,7 @@
//*****************************************************************************
/*
*
- * $Id: Greek2Greek.h,v 1.2 2001/02/09 15:38:51 jansorg Exp $
+ * $Id: Greek2Greek.h,v 1.3 2002/10/01 19:52:40 dglassey Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -38,6 +38,9 @@
#ifndef __GREEK2GREEK
#define __GREEK2GREEK
+#include <defs.h>
+SWORD_NAMESPACE_START
+
//*****************************************************************************
// Used to convert a string created by using the Greek font supplied with the
// Sword Project to a string that conforms to the b-Greek discussion list
@@ -109,6 +112,6 @@ unsigned char getbGreekPunct (unsigned char Greek);
//*****************************************************************************
bool isPunctSpace (unsigned char c);
-
+SWORD_NAMESPACE_END
#endif // __GREEK2GREEK
diff --git a/include/GreekChars.h b/include/GreekChars.h
index c4f94be..f0522e5 100644
--- a/include/GreekChars.h
+++ b/include/GreekChars.h
@@ -18,7 +18,7 @@
//*****************************************************************************
/*
*
- * $Id: GreekChars.h,v 1.3 2001/03/18 21:04:25 scribe Exp $
+ * $Id: GreekChars.h,v 1.4 2002/10/01 19:52:40 dglassey Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -42,6 +42,9 @@
// This enum represents the values of the characters used for the
// transliteration as used on the b-greek discussion list.
+#include <defs.h>
+SWORD_NAMESPACE_START
+
enum bGreekChars
{
ALPHA = 65, // A
@@ -146,4 +149,6 @@ enum GreekPunct
gQUESTION = ';'
};
+SWORD_NAMESPACE_END
+
#endif // __GREEKCHARS_H
diff --git a/include/Makefile.am b/include/Makefile.am
index 5dae109..a0e67a2 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -11,16 +11,21 @@ pkginclude_HEADERS += $(swincludedir)/entriesblk.h
pkginclude_HEADERS += $(swincludedir)/femain.h
pkginclude_HEADERS += $(swincludedir)/filemgr.h
pkginclude_HEADERS += $(swincludedir)/flatapi.h
+
pkginclude_HEADERS += $(swincludedir)/gbffootnotes.h
pkginclude_HEADERS += $(swincludedir)/gbfheadings.h
pkginclude_HEADERS += $(swincludedir)/gbfhtml.h
pkginclude_HEADERS += $(swincludedir)/gbfhtmlhref.h
+pkginclude_HEADERS += $(swincludedir)/gbfwebif.h
pkginclude_HEADERS += $(swincludedir)/gbfmorph.h
+pkginclude_HEADERS += $(swincludedir)/gbfosis.h
pkginclude_HEADERS += $(swincludedir)/gbfplain.h
+pkginclude_HEADERS += $(swincludedir)/gbfredletterwords.h
pkginclude_HEADERS += $(swincludedir)/gbfrtf.h
pkginclude_HEADERS += $(swincludedir)/gbfstrongs.h
pkginclude_HEADERS += $(swincludedir)/gbfthml.h
pkginclude_HEADERS += $(swincludedir)/greeklexattribs.h
+
pkginclude_HEADERS += $(swincludedir)/hebrewmcim.h
pkginclude_HEADERS += $(swincludedir)/hrefcom.h
pkginclude_HEADERS += $(swincludedir)/latin1utf16.h
@@ -31,6 +36,20 @@ pkginclude_HEADERS += $(swincludedir)/lzsscomprs.h
pkginclude_HEADERS += $(swincludedir)/markupfiltmgr.h
pkginclude_HEADERS += $(swincludedir)/multimapwdef.h
pkginclude_HEADERS += $(swincludedir)/nullim.h
+
+pkginclude_HEADERS += $(swincludedir)/osisheadings.h
+pkginclude_HEADERS += $(swincludedir)/osishtmlhref.h
+pkginclude_HEADERS += $(swincludedir)/osiswebif.h
+pkginclude_HEADERS += $(swincludedir)/osismorph.h
+pkginclude_HEADERS += $(swincludedir)/osisplain.h
+pkginclude_HEADERS += $(swincludedir)/osisrtf.h
+pkginclude_HEADERS += $(swincludedir)/osisstrongs.h
+pkginclude_HEADERS += $(swincludedir)/osisfootnotes.h
+pkginclude_HEADERS += $(swincludedir)/osislemma.h
+pkginclude_HEADERS += $(swincludedir)/osisredletterwords.h
+pkginclude_HEADERS += $(swincludedir)/osisscripref.h
+
+pkginclude_HEADERS += $(swincludedir)/plainfootnotes.h
pkginclude_HEADERS += $(swincludedir)/plainfootnotes.h
pkginclude_HEADERS += $(swincludedir)/plainhtml.h
pkginclude_HEADERS += $(swincludedir)/rawcom.h
@@ -46,12 +65,11 @@ pkginclude_HEADERS += $(swincludedir)/rawverse.h
pkginclude_HEADERS += $(swincludedir)/regex.h
pkginclude_HEADERS += $(swincludedir)/roman.h
pkginclude_HEADERS += $(swincludedir)/rtfhtml.h
-pkginclude_HEADERS += $(swincludedir)/rwphtml.h
-pkginclude_HEADERS += $(swincludedir)/rwprtf.h
pkginclude_HEADERS += $(swincludedir)/sapphire.h
pkginclude_HEADERS += $(swincludedir)/scsuutf8.h
pkginclude_HEADERS += $(swincludedir)/strkey.h
pkginclude_HEADERS += $(swincludedir)/swbasicfilter.h
+pkginclude_HEADERS += $(swincludedir)/swbuf.h
pkginclude_HEADERS += $(swincludedir)/swcacher.h
pkginclude_HEADERS += $(swincludedir)/swcipher.h
pkginclude_HEADERS += $(swincludedir)/swcom.h
@@ -71,26 +89,31 @@ pkginclude_HEADERS += $(swincludedir)/swlog.h
pkginclude_HEADERS += $(swincludedir)/swmacs.h
pkginclude_HEADERS += $(swincludedir)/swmgr.h
pkginclude_HEADERS += $(swincludedir)/swmodule.h
+pkginclude_HEADERS += $(swincludedir)/swoptfilter.h
pkginclude_HEADERS += $(swincludedir)/swobject.h
+pkginclude_HEADERS += $(swincludedir)/swsearchable.h
pkginclude_HEADERS += $(swincludedir)/swtext.h
pkginclude_HEADERS += $(swincludedir)/swunicod.h
pkginclude_HEADERS += $(swincludedir)/swversion.h
pkginclude_HEADERS += $(swincludedir)/swwinlog.h
pkginclude_HEADERS += $(swincludedir)/sysdata.h
pkginclude_HEADERS += $(swincludedir)/tbdisp.h
+
pkginclude_HEADERS += $(swincludedir)/thmlfootnotes.h
pkginclude_HEADERS += $(swincludedir)/thmlgbf.h
pkginclude_HEADERS += $(swincludedir)/thmlheadings.h
pkginclude_HEADERS += $(swincludedir)/thmlhtml.h
pkginclude_HEADERS += $(swincludedir)/thmlhtmlhref.h
+pkginclude_HEADERS += $(swincludedir)/thmlwebif.h
pkginclude_HEADERS += $(swincludedir)/thmllemma.h
pkginclude_HEADERS += $(swincludedir)/thmlmorph.h
-pkginclude_HEADERS += $(swincludedir)/thmlolb.h
+pkginclude_HEADERS += $(swincludedir)/thmlosis.h
pkginclude_HEADERS += $(swincludedir)/thmlplain.h
pkginclude_HEADERS += $(swincludedir)/thmlrtf.h
pkginclude_HEADERS += $(swincludedir)/thmlscripref.h
pkginclude_HEADERS += $(swincludedir)/thmlstrongs.h
pkginclude_HEADERS += $(swincludedir)/thmlvariants.h
+
pkginclude_HEADERS += $(swincludedir)/treekey.h
pkginclude_HEADERS += $(swincludedir)/treekeyidx.h
pkginclude_HEADERS += $(swincludedir)/unicodertf.h
@@ -111,11 +134,26 @@ pkginclude_HEADERS += $(swincludedir)/utf8utf16.h
pkginclude_HEADERS += $(swincludedir)/utilconf.h
pkginclude_HEADERS += $(swincludedir)/utilfuns.h
pkginclude_HEADERS += $(swincludedir)/utilstr.h
+pkginclude_HEADERS += $(swincludedir)/utilxml.h
+pkginclude_HEADERS += $(swincludedir)/utilweb.h
+
pkginclude_HEADERS += $(swincludedir)/versekey.h
pkginclude_HEADERS += $(swincludedir)/zcom.h
pkginclude_HEADERS += $(swincludedir)/zconf.h
pkginclude_HEADERS += $(swincludedir)/zipcomprs.h
pkginclude_HEADERS += $(swincludedir)/zld.h
pkginclude_HEADERS += $(swincludedir)/zlib.h
+pkginclude_HEADERS += $(swincludedir)/zstr.h
pkginclude_HEADERS += $(swincludedir)/ztext.h
pkginclude_HEADERS += $(swincludedir)/zverse.h
+pkginclude_HEADERS += $(swincludedir)/installmgr.h
+pkginclude_HEADERS += $(swincludedir)/ftpparse.h
+
+if INSTALLMGR
+REMOTE_HEAD = $(swincludedir)/swremotemgr.h
+REMOTE_HEAD += $(swincludedir)/swinstallmgr.h
+else
+REMOTE_HEAD =
+endif
+
+pkginclude_HEADERS += $(REMOTE_HEAD)
diff --git a/include/apocrypha.h b/include/apocrypha.h
new file mode 100644
index 0000000..5e69f8a
--- /dev/null
+++ b/include/apocrypha.h
@@ -0,0 +1,219 @@
+/******************************************************************************
+ * apocrypha.h - Apocryphal text information to be included by VerseKey.cpp
+ *
+ * $Id: apocrypha.h,v 1.3 2003/05/10 00:55:43 chrislit Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+/******************************************************************************
+ * [a]tbooks - initialize static instance for all canonical text names
+ * and chapmax
+ */
+
+#include <defs.h>
+//SWORD_NAMESPACE_START
+
+//Data based on NRSVA unless otherwise noted; this book ordering is not necessarily optimal.
+
+struct sbook
+VerseKey::otbooks[] = {
+ //Catholic Deuterocanon
+ {"Tobit", "Tob", 14}, //67
+ {"Judith", "Jdt", 16}, //68
+ {"Wisdom", "Wis", 19}, //69
+ {"Sirach", "Sir", 51}, //70 //51 or 52? count prologue as separate book or just chapter?
+ {"Baruch", "Bar", 5}, //71 //5 or 6? (see next line)
+ {"Letter of Jeremiah", "EpJer", 1}, //72 //1 or 6? EpJer is ch6 of Baruch
+ {"1 Esdras", "1Esd", 9}, //73
+ {"2 Esdras", "2Esd", 16}, //74
+ {"1 Maccabees", "1Macc", 16}, //75
+ {"2 Maccabees", "2Macc", 15}, //76
+
+ //LXX
+ {"3 Maccabees", "3Macc", 7}, //77
+ {"4 Maccabees", "4Macc", 18}, //78
+ {"Odes", "Odes", 14}, //79 //based on LXX
+ {"Psalms of Solomon", "PssSol", 18}, //80 //based on LXX
+
+ //Protestant Apocrypha
+ {"Additions to Esther", "AddEsth", 6}, //81 //based on Charles/NRSVA //6 or F or 16? If you're Catholic, you have a 16 chapter canonical book called Esther (ie Greek Esther); if you're Protestant you have a 10 chapter canonical book called Esther (ie Hebrew Esther) plus a 6 "chapter" set of "Additions" in an apocryphal book called Additions to Esther, which are "numbered" A through F or continue from chapter 10 through 16.
+ {"Prayer of Azariah", "PrAzar", 1}, //82
+ {"Susanna", "Sus", 1}, //83
+ {"Bel and the Dragon", "Bel", 1}, //84
+ {"Prayer of Manasses", "PrMan", 1}, //85
+ {"Psalm 151", "Ps151", 1}, //86
+
+ //Vulgate
+ {"Epistle to the Laodiceans", "EpLao", 1}, //87 //based on Vulgate
+
+ //Other books may follow at a later date (e.g. Jub, 1En)
+};
+
+/******************************************************************************
+ * Abbreviations - MUST be in alphabetical order & by PRIORITY
+ * RULE: first match of entire key
+ * (e.g. key: "1CH"; match: "1CHRONICLES")
+ */
+
+const struct abbrev
+ VerseKey::builtin_abbrevs[] = {
+ {"1 ESDRAS", 73},
+ {"1 MACCABEES", 75},
+ {"1ESDRAS", 73},
+ {"1MACCABEES", 75},
+ {"2 ESDRAS", 74},
+ {"2 MACCABEES", 76},
+ {"2ESDRAS", 74},
+ {"2MACCABEES", 76},
+ {"3 MACCABEES", 77},
+ {"3MACCABEES", 77},
+ {"4 MACCABEES", 78},
+ {"4MACCABEES", 78},
+ {"ADDESTHER", 81},
+ {"ADDITIONS TO ESTHER", 81},
+ {"BARUCH", 71},
+ {"BEL AND THE DRAGON", 84},
+ {"BEN SIRACH", 70},
+ {"ECCLESIASTICUS", 70},
+ {"EPISTLE OF JEREMIAH", 72},
+ {"EPISTLE TO THE LAODICEANS", 87},
+ {"EPJER", 72},
+ {"EPLAO", 87},
+ {"I ESDRAS", 73},
+ {"I MACCABEES", 75},
+ {"IESDRAS", 73},
+ {"II ESDRAS", 74},
+ {"II MACCABEES", 76},
+ {"IIESDRAS", 74},
+ {"III MACCABEES", 77},
+ {"IIII MACCABEES", 78},
+ {"IIIIMACCABEES", 78},
+ {"IIIMACCABEES", 77},
+ {"IIMACCABEES", 76},
+ {"IMACCABEES", 75},
+ {"IV MACCABEES", 78},
+ {"IVMACCABEES", 78},
+ {"JDT", 68},
+ {"JESUS BEN SIRACH", 70},
+ {"JUDITH", 68},
+ {"LAODICEANS", 87},
+ {"LETTER OF JEREMIAH", 72},
+ {"MANASSEH", 85},
+ {"MANASSES", 85},
+ {"ODES", 79},
+ {"PRAYER OF AZARIAH", 82},
+ {"PRAYER OF MANASSEH", 85},
+ {"PRAYER OF MANASSES", 85},
+ {"PRAZAR", 82},
+ {"PRMAN", 85},
+ {"PS151", 86},
+ {"PSALM151", 86},
+ {"PSALMS OF SOLOMON", 80},
+ {"PSSOL", 80},
+ {"PSSSOL", 80},
+ {"SIRACH", 70},
+ {"SUSANNA", 83},
+ {"TOBIT", 67},
+ {"WISDOM OF JESUS BEN SIRACH", 70},
+ {"WISDOM", 69},
+ {"", -1}
+};
+
+
+/******************************************************************************
+ * Maximum verses per chapter
+ */
+
+int
+VerseKey::vm[] = {
+ //Catholic Deuterocanon
+ //Tobit 14 //67
+ 22, 14, 17, 21, 21, 17, 18, 21, 6, 12,
+ 19, 22, 18, 15,
+ //Judith 16 //68
+ 16, 28, 10, 15, 24, 21, 32, 36, 14, 23,
+ 23, 20, 20, 19, 13, 25,
+ //Wisdom 19 //69
+ 16, 24, 19, 20, 23, 25, 30, 21, 18, 21,
+ 26, 27, 19, 31, 19, 29, 21, 25, 22,
+ //Sirach 51 //70 //Prologue has 36 vv. in LXX, 1 v. in NRSVA
+ 30, 18, 31, 31, 15, 37, 36, 19, 18, 31,
+ 34, 18, 26, 27, 20, 30, 32, 33, 30, 32,
+ 28, 27, 27, 34, 26, 29, 30, 26, 28, 25,
+ 31, 24, 31, 26, 20, 26, 31, 34, 35, 30,
+ 23, 25, 33, 23, 26, 20, 25, 25, 16, 29,
+ 30,
+ //Baruch 5 //71
+ 21, 35, 37, 37, 9,
+ //Letter of Jeremiah 1 //72
+ 73,
+ //1 Esdras 9 //73
+ 58, 30, 24, 63, 73, 34, 15, 96, 55,
+ //2 Esdras 16 //74
+ 40, 48, 36, 52, 56, 59, 140, 63, 47, 59,
+ 46, 51, 58, 48, 63, 78,
+ //1 Maccabees 16 //75
+ 64, 70, 60, 61, 68, 63, 50, 32, 73, 89,
+ 74, 53, 53, 49, 41, 24,
+ //2 Maccabees 15 //76
+ 36, 32, 40, 50, 27, 31, 42, 36, 29, 38,
+ 38, 45, 26, 46, 39,
+
+ //LXX
+ //3 Maccabees 7 //77
+ 29, 33, 30, 21, 51, 41, 23,
+ //4 Maccabees 18 //78
+ 35, 24, 21, 26, 38, 35, 23, 29, 32, 21,
+ 27, 19, 27, 20, 32, 25, 24, 24,
+ //Odes 14 //79
+ 19, 43, 10, 19, 20, 10, 45, 88, 79, 9,
+ 20, 15, 32, 46,
+ //Psalms of Solomon 18 //80
+ 8, 37, 12, 25, 19, 6, 10, 34, 11, 8,
+ 9, 6, 12, 10, 13, 15, 46, 12,
+
+ //Protestant Apocrypha
+ //Additions to Esther 6 //81
+ 17, 7, 30, 16, 24, 11
+ //Prayer of Azariah 1 //82
+ 68,
+ //Susanna 1 //83
+ 64,
+ //Bel and the Dragon 1 //84
+ 42,
+ //Prayer of Manasses 1 //85
+ 15,
+ //Psalm 151 1 //86
+ 7,
+
+ //Vulgate
+ //Epistle to the Laodiceans 1 //87
+ 20,
+};
+
+
+long
+ VerseKey::atbks[] = {
+0, 1, 16, 33, 53, 105, 111, 113, 123, 140, 157, 173, 181, 200, 215, 234, 241, 243, 245, 247, 249, 251
+};
+
+long
+ VerseKey::atcps[] = {
+0, 2, 3, 26, 41, 59, 81, 103, 121, 140, 162, 169, 183, 203, 226, 245, 262, 279, 308, 319, 335, 360, 382, 415, 452, 467, 492, 516, 537, 558, 578, 592, 619, 636, 661, 681, 702, 726, 752, 783, 805, 824, 847, 874, 902, 922, 954, 974, 1004, 1026, 1052, 1076, 1107, 1126, 1158, 1190, 1206, 1244, 1281, 1301, 1320, 1353, 1388, 1407, 1434, 1462, 1483, 1514, 1547, 1581, 1612, 1646, 1675, 1703, 1731, 1766, 1793, 1823, 1854, 1881, 1910, 1937, 1969, 1994, 2026, 2053, 2074, 2101, 2133, 2168, 2204, 2236, 2260, 2286, 2320, 2344, 2371, 2392, 2418, 2444, 2461, 2492, 2524, 2546, 2582, 2620, 2658, 2669, 2744, 2803, 2834, 2859, 2923, 2997, 3032, 3048, 3145, 3202, 3243, 3292, 3329, 3382, 3439, 3499, 3640, 3704, 3752, 3813, 3860, 3912, 3971, 4020, 4084, 4164, 4229, 4300, 4361, 4423, 4492, 4556, 4607, 4640, 4714, 4805, 4880, 4934, 4988, 5038, 5080, 5106, 5143, 5176, 5217, 5268, 5296, 5328, 5371, 5408, 5438, 5478, 5517, 5563, 5590, 5637, 5678, 5708, 5742, 5773, 5795, 5847, 5889, 5914, 5950, 5975, 5997, 6024, 6063, 6099, 6123, 6153, 6186, 6209, 6237, 6257, 6285, 6306, 6339, 6365, 6390, 6416, 6436, 6480, 6491, 6511, 6532, 6543, 6589, 6678, 6758, 6769, 6790, 6806, 6839, 6887, 6896, 6934, 6947, 6973, 6993, 7000, 7011, 7046, 7058, 7068, 7078, 7085, 7098, 7109, 7123, 7139, 7186, 7200, 7270, 7336, 7380, 7397, 7406
+};
+
+//SWORD_NAMESPACE_END
diff --git a/include/canon.h b/include/canon.h
index 115b348..edf5023 100644
--- a/include/canon.h
+++ b/include/canon.h
@@ -1,7 +1,7 @@
/******************************************************************************
* canon.h - Canonical text information to be included by VerseKey.cpp
*
- * $Id: canon.h,v 1.8 2002/02/17 00:50:29 scribe Exp $
+ * $Id: canon.h,v 1.19 2003/07/04 21:45:24 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -24,6 +24,9 @@
* and chapmax
*/
+#include <defs.h>
+//SWORD_NAMESPACE_START
+
struct sbook
VerseKey::otbooks[] = {
{"Genesis", "Gen", 50},
@@ -34,17 +37,17 @@ struct sbook
{"Joshua", "Josh", 24},
{"Judges", "Judg", 21},
{"Ruth", "Ruth", 4},
- {"I Samuel", "I Sam", 31},
- {"II Samuel", "II Sam", 24},
- {"I Kings", "I Kin", 22},
- {"II Kings", "II Kin", 25},
- {"I Chronicles", "I Chr", 29},
- {"II Chronicles", "II Chr", 36},
+ {"I Samuel", "1Sam", 31},
+ {"II Samuel", "2Sam", 24},
+ {"I Kings", "1Kgs", 22},
+ {"II Kings", "2Kgs", 25},
+ {"I Chronicles", "1Chr", 29},
+ {"II Chronicles", "2Chr", 36},
{"Ezra", "Ezra", 10},
{"Nehemiah", "Neh", 13},
{"Esther", "Esth", 10},
{"Job", "Job", 42},
- {"Psalms", "Psa", 150},
+ {"Psalms", "Ps", 150},
{"Proverbs", "Prov", 31},
{"Ecclesiastes", "Eccl", 12},
{"Song of Solomon", "Song", 8},
@@ -69,31 +72,31 @@ struct sbook
struct sbook
VerseKey::ntbooks[] = {
- {"Matthew", "Mat", 28},
+ {"Matthew", "Matt", 28},
{"Mark", "Mark", 16},
{"Luke", "Luke", 24},
{"John", "John", 21},
{"Acts", "Acts", 28},
{"Romans", "Rom", 16},
- {"I Corinthians", "I Cor", 16},
- {"II Corinthians", "II Cor", 13},
+ {"I Corinthians", "1Cor", 16},
+ {"II Corinthians", "2Cor", 13},
{"Galatians", "Gal", 6},
{"Ephesians", "Eph", 6},
- {"Philippians", "Philip", 4},
+ {"Philippians", "Phil", 4},
{"Colossians", "Col", 4},
- {"I Thessalonians", "I Thes", 5},
- {"II Thessalonians", "II Thes", 3},
- {"I Timothy", "I Tim", 6},
- {"II Timothy", "II Tim", 4},
+ {"I Thessalonians", "1Thess", 5},
+ {"II Thessalonians", "2Thess", 3},
+ {"I Timothy", "1Tim", 6},
+ {"II Timothy", "2Tim", 4},
{"Titus", "Titus", 3},
- {"Philemon", "Philem", 1},
+ {"Philemon", "Phlm", 1},
{"Hebrews", "Heb", 13},
{"James", "Jas", 5},
- {"I Peter", "I Pet", 5},
- {"II Peter", "II Pet", 3},
- {"I John", "I Jo", 5},
- {"II John", "II Jo", 1},
- {"III John", "III Jo", 1},
+ {"I Peter", "1Pet", 5},
+ {"II Peter", "2Pet", 3},
+ {"I John", "1John", 5},
+ {"II John", "2John", 1},
+ {"III John", "3John", 1},
{"Jude", "Jude", 1},
{"Revelation of John", "Rev", 22}
};
@@ -175,6 +178,7 @@ const struct abbrev
{"ESTHER", 17}, // Esther
{"EXODUS", 2}, // Exodus
{"EZEKIEL", 26}, // Ezekiel
+ {"EZK", 26}, // Ezekiel
{"EZRA", 15}, // Ezra
{"G", 1}, // Genesis
{"GALATIANS", 48}, // Galatians
@@ -241,15 +245,17 @@ const struct abbrev
{"J", 43}, // John
{"JAMES", 59}, // James
{"JAS", 59}, // James
+ {"JDGS", 7}, // Judges
{"JEREMIAH", 24}, // Jeremiah
+ {"JHN", 43}, // John
{"JN", 43}, // John
{"JO", 43}, // John
{"JOB", 18}, // Job
{"JOEL", 29}, // Joel
{"JOHN", 43}, // John
+ {"JOL", 29}, // Joel
{"JONAH", 32}, // Jonah
{"JOSHUA", 6}, // Joshua
- {"JUD", 7}, // Judges
{"JUDE", 65}, // Jude
{"JUDGES", 7}, // Judges
{"L", 42}, // Luke
@@ -263,10 +269,11 @@ const struct abbrev
{"MATTHEW", 40}, // Matthew
{"MICAH", 33}, // Micah
{"MK", 41}, // Mark
- {"MR", 41}, // Mark
+ {"MRK", 41}, // Mark
{"MT", 40}, // Matthew
{"N", 4}, // Numbers
{"NAHUM", 34}, // Nahum
+ {"NAM", 34}, // Nahum
{"NEHEMIAH", 16}, // Nehemiah
{"NUMBERS", 4}, // Numbers
{"OBADIAH", 31}, // Obadiah
@@ -274,23 +281,26 @@ const struct abbrev
{"PHIL", 50}, // Philippians
{"PHILEMON", 57}, // Philemon
{"PHILIPPIANS", 50}, // Philippians
+ {"PHLM", 57}, // Philemon
{"PHM", 57}, // Philemon
{"PHP", 50}, // Philippians
{"PROVERBS", 20}, // Proverbs
{"PSALMS", 19}, // Psalms
{"PSM", 19}, // Psalms
{"PSS", 19}, // Psalms
- {"QOHELETH", 21}, // Qohelot (Ecclesiastes)
+ {"QOHELETH", 21}, // Qohelet (Ecclesiastes)
{"REVELATION OF JOHN", 66}, // Revelation
{"ROMANS", 45}, // Romans
{"RUTH", 8}, // Ruth
+ {"SNG", 22}, // Song of Solomon
+ {"SOLOMON", 22}, // Song of Solomon
{"SONG OF SOLOMON", 22}, // Song of Solomon
{"SONG OF SONGS", 22}, // Song of Solomon
{"SOS", 22}, // Song of Solomon
{"TITUS", 56}, // Titus
{"ZECHARIAH", 38}, // Zechariah
{"ZEPHANIAH", 36}, // Zephaniah
- {"", -1} // Zephaniah
+ {"", -1}
};
@@ -687,3 +697,5 @@ int
{ {sizeof (VerseKey::otbks) / 4, sizeof (VerseKey::otcps) / 4}
, {sizeof (VerseKey::ntbks) / 4, sizeof (VerseKey::ntcps) / 4}
};
+
+//SWORD_NAMESPACE_END
diff --git a/include/cdsourcemgr.h b/include/cdsourcemgr.h
new file mode 100644
index 0000000..91a122c
--- /dev/null
+++ b/include/cdsourcemgr.h
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * cdsourcemgr.h - definition of class SWCacheMgr used to provide an interface for
+ * caching information of module sources
+ *
+ * $Id: cdsourcemgr.h,v 1.1 2002/10/23 23:13:35 dglassey Exp $
+ *
+ * Copyright 2002 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef CDSOURCEMGR_H
+#define CDSOURCEMGR_H
+
+ #include <defs.h>
+ #include "swsourcemgr.h"
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT CDSourceMgr: public SWSourceMgr {
+public:
+ CDSourceMgr(const char *iConfigPath);
+ char Refresh();
+}
+
+CDSourceMgr *DetectCD(const char *iCDPath);
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/cipherfil.h b/include/cipherfil.h
index 4f63e48..1ecea5d 100644
--- a/include/cipherfil.h
+++ b/include/cipherfil.h
@@ -1,6 +1,6 @@
-/*
+/***************************************************************************
*
- * $Id: cipherfil.h,v 1.7 2001/12/11 22:35:10 scribe Exp $
+ * $Id: cipherfil.h,v 1.10 2003/02/20 07:25:19 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -24,16 +24,16 @@
#include <swfilter.h>
#include <swcipher.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
-class SWDLLEXPORT CipherFilter:public SWFilter
-{
- SWCipher *cipher;
+class SWDLLEXPORT CipherFilter:public SWFilter {
+ SWCipher *cipher;
public:
- CipherFilter (const char *key);
- virtual ~ CipherFilter ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual SWCipher *getCipher ();
+ CipherFilter(const char *key);
+ virtual ~CipherFilter();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule * = 0);
+ virtual SWCipher *getCipher();
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/defs.h b/include/defs.h
index bd36c01..4b197ed 100644
--- a/include/defs.h
+++ b/include/defs.h
@@ -1,8 +1,19 @@
// ----------------------------------------------------------------------------
// Making or using sword as a Windows DLL
// ----------------------------------------------------------------------------
+#ifndef SWORDDEFS_H
+#define SWORDDEFS_H
+
+#ifdef NO_SWORD_NAMESPACE
+ #define SWORD_NAMESPACE_START namespace sword {
+ #define SWORD_NAMESPACE_END }; using namespace sword;
+#else
+ #define SWORD_NAMESPACE_START namespace sword {
+ #define SWORD_NAMESPACE_END }
+#endif
-#if defined(__SWMSW__)
+
+SWORD_NAMESPACE_START
// _declspec works in BC++ 5 and later, as well as VC++
#if defined(_MSC_VER)
@@ -37,7 +48,7 @@
# define SWDLLEXPORT_CTORFN
# endif
-#elif defined(__GNUWIN32__) || defined(__BORLANDC__)
+#elif defined(__GNUWIN32__)
# ifdef SWMAKINGDLL
# define SWDLLEXPORT __declspec( dllexport )
@@ -53,6 +64,20 @@
# define SWDLLEXPORT_CTORFN
# endif
+#elif defined(__BORLANDC__)
+# ifdef SWMAKINGDLL
+# define SWDLLEXPORT _export
+# define SWDLLEXPORT_DATA(type) __declspec( dllexport ) type
+# define SWDLLEXPORT_CTORFN
+# elif defined(SWUSINGDLL)
+# define SWDLLEXPORT __declspec( dllimport )
+# define SWDLLEXPORT_DATA(type) __declspec( dllimport ) type
+# define SWDLLEXPORT_CTORFN
+# else
+# define SWDLLEXPORT
+# define SWDLLEXPORT_DATA(type) type
+# define SWDLLEXPORT_CTORFN
+# endif
#else
# define SWDLLEXPORT
@@ -60,15 +85,12 @@
# define SWDLLEXPORT_CTORFN
#endif
-#else // !Windows
-# define SWDLLEXPORT
-# define SWDLLEXPORT_DATA(type) type
-# define SWDLLEXPORT_CTORFN
-#endif // Win/!Win
-
// For ostream, istream ofstream
#if defined(__BORLANDC__) && defined( _RTLDLL )
# define SWDLLIMPORT __import
#else
# define SWDLLIMPORT
#endif
+
+SWORD_NAMESPACE_END
+#endif //SWORDDEFS_H
diff --git a/include/echomod.h b/include/echomod.h
index 44bedab..7641e60 100644
--- a/include/echomod.h
+++ b/include/echomod.h
@@ -2,7 +2,7 @@
* echomod.h - code for class 'EchoMod' - a test module that just echo back
* text of key.
*
- * $Id: echomod.h,v 1.2 2001/02/09 15:38:51 jansorg Exp $
+ * $Id: echomod.h,v 1.3 2002/10/01 19:52:40 dglassey Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -26,6 +26,8 @@
#include <swtext.h>
#include <versekey.h>
+SWORD_NAMESPACE_START
+
class EchoMod:public SWText
{
public:
@@ -34,5 +36,5 @@ public:
virtual operator const char *();
};
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/encfiltmgr.h b/include/encfiltmgr.h
index f082b98..2bdf4b6 100644
--- a/include/encfiltmgr.h
+++ b/include/encfiltmgr.h
@@ -24,8 +24,9 @@
#include <swfiltermgr.h>
+SWORD_NAMESPACE_START
-/** This class is like a normal @ref SWMgr,
+/** This class is like a normal SWMgr,
* but you can additonally specify which encoding
* you want to use.
*/
@@ -48,9 +49,6 @@ public:
/** Constructor of SWEncodingMgr.
*
- * @param iconfig
- * @param isysconfig
- * @param autoload If this bool is true the constructor starts loading the installed modules. If you reimplemented SWMgr you can set autoload=false to load the modules with your own reimplemented function.
* @param encoding The desired encoding.
*/
EncodingFilterMgr (char encoding = ENC_UTF8);
@@ -62,7 +60,7 @@ public:
/** Markup sets/gets the encoding after initialization
*
- * @param m The new encoding or ENC_UNKNOWN if you just want to get the current markup.
+ * @param enc The new encoding or ENC_UNKNOWN if you just want to get the current markup.
* @return The current (possibly changed) encoding format.
*/
char Encoding(char enc);
@@ -82,4 +80,5 @@ public:
virtual void AddEncodingFilters(SWModule *module, ConfigEntMap &section);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/entriesblk.h b/include/entriesblk.h
index fe7ac1c..61ab35e 100644
--- a/include/entriesblk.h
+++ b/include/entriesblk.h
@@ -2,6 +2,9 @@
#define ENTRIESBLK_H
#include <sysdata.h>
+#include <defs.h>
+
+SWORD_NAMESPACE_START
class EntriesBlock {
static const int METAHEADERSIZE;
@@ -27,4 +30,5 @@ public:
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/filemgr.h b/include/filemgr.h
index 111f916..ea1e1fc 100644
--- a/include/filemgr.h
+++ b/include/filemgr.h
@@ -1,23 +1,23 @@
/******************************************************************************
- * filemgr.h - definition of class FileMgr used for pooling file handles
- *
- * $Id: filemgr.h,v 1.14 2002/03/13 06:55:39 scribe Exp $
- *
- * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
- * CrossWire Bible Society
- * P. O. Box 2528
- * Tempe, AZ 85280-2528
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- */
+* filemgr.h - definition of class FileMgr used for pooling file handles
+*
+* $Id: filemgr.h,v 1.19 2003/08/15 08:52:15 scribe Exp $
+*
+* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+* CrossWire Bible Society
+* P. O. Box 2528
+* Tempe, AZ 85280-2528
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation version 2.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+*/
#ifndef FILEMGR_H
#define FILEMGR_H
@@ -27,56 +27,124 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
class SWDLLEXPORT FileMgr;
-class SWDLLEXPORT FileDesc
-{
+/**
+* This class represents one file. It works with the FileMgr object.
+*/
+class SWDLLEXPORT FileDesc {
+
+ friend class FileMgr;
- friend class FileMgr;
+ long offset;
+ int fd; // -77 closed;
+ FileMgr *parent;
+ FileDesc *next;
- long offset;
- int fd; // -77 closed;
- FileMgr *parent;
- FileDesc *next;
+ FileDesc(FileMgr * parent, const char *path, int mode, int perms, bool tryDowngrade);
+ virtual ~FileDesc();
public:
- FileDesc (FileMgr * parent, char *path, int mode, int perms, bool tryDowngrade);
- virtual ~FileDesc ();
- int getFd ();
- char *path;
- int mode;
- int perms;
- bool tryDowngrade;
+ /** @return File handle.
+ */
+ int getFd();
+ /** Path to file.
+ */
+ char *path;
+ /** File access mode.
+ */
+ int mode;
+ /** File permissions.
+ */
+ int perms;
+ /**
+ */
+ bool tryDowngrade;
};
+/**
+* This class ist used make file access operations easier.
+* It keeps a list of all open files internally and closes them
+* when the destructor is called.
+*/
+class FileMgr {
-class FileMgr
-{
-
- friend class FileDesc;
+ friend class FileDesc;
- FileDesc *files;
- int sysOpen (FileDesc * file);
+ FileDesc *files;
+ int sysOpen(FileDesc * file);
public:
- FileMgr (int maxFiles = 35);
- ~FileMgr ();
- FileDesc *open (char *path, int mode, bool tryDowngrade);
- FileDesc *open (char *path, int mode, int perms = S_IREAD | S_IWRITE, bool tryDowngrade = false);
- void close (FileDesc *);
-
- static signed char existsFile (const char *ipath, const char *ifileName = 0);
- static signed char existsDir (const char *ipath, const char *idirName = 0);
- // to truncate a file at its current position
- // leaving byte at current possition intact
- // deleting everything afterward.
- signed char trunc (FileDesc *);
-
- int maxFiles;
- static FileMgr systemFileMgr;
-};
-
+ /** Maximum number of open files set in the constructor.
+ * determines the max number of real system files that
+ * filemgr will open. Adjust for tuning.
+ */
+ int maxFiles;
+
+ static FileMgr systemFileMgr;
+
+ /** Constructor.
+ * @param maxFiles The number of files that this FileMgr may open in parallel, if necessary.
+ */
+ FileMgr(int maxFiles = 35);
+
+ /**
+ * Destructor. Clean things up. Will close all files opened by this FileMgr object.
+ */
+ ~FileMgr();
+
+ /** Open a file and return a FileDesc for it.
+ * The file itself will only be opened when FileDesc::getFd() is called.
+ * @param path Filename.
+ * @param mode File access mode.
+ * @param tryDowngrade
+ * @return FileDesc object for the requested file.
+ */
+ FileDesc *open(const char *path, int mode, bool tryDowngrade);
+
+ /** Open a file and return a FileDesc for it.
+ * The file itself will only be opened when FileDesc::getFd() is called.
+ * @param path Filename.
+ * @param mode File access mode.
+ * @param perms Permissions.
+ * @param tryDowngrade
+ * @return FileDesc object for the requested file.
+ */
+ FileDesc *open(const char *path, int mode, int perms = S_IREAD | S_IWRITE, bool tryDowngrade = false);
+
+ /** Close a given file and delete its FileDesc object.
+ * Will only close the file if it was created by this FileMgr object.
+ * @param file The file to close.
+ */
+ void close(FileDesc * file);
+
+ /** Checks for the existence of a file.
+ * @param ipath Path to file.
+ * @param ifileName Name of file to check for.
+ */
+ static signed char existsFile(const char *ipath, const char *ifileName = 0);
+
+ /** Checks for the existence of a directory.
+ * @param ipath Path to directory.
+ * @param idirName Name of directory to check for.
+ */
+ static signed char existsDir(const char *ipath, const char *idirName = 0);
+
+ /** Truncate a file at its current position
+ * leaving byte at current possition intact deleting everything afterward.
+ * @param file The file to operate on.
+ */
+ signed char trunc(FileDesc *file);
+
+ static int createParent(const char *pName);
+ static int createPathAndFile(const char *fName);
+ static int copyFile(const char *sourceFile, const char *targetFile);
+ static int removeFile(const char *fName);
+};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/flatapi.h b/include/flatapi.h
index c5628f6..c110c5b 100644
--- a/include/flatapi.h
+++ b/include/flatapi.h
@@ -1,10 +1,11 @@
#ifndef SWORDAPI_H
#define SWORDAPI_H
-#include <swmodule.h>
-#include <swkey.h>
-#include <versekey.h>
-
+//#include <swmodule.h>
+//#include <swkey.h>
+//#include <versekey.h>
+//#include <swmgr.h>
+#include <defs.h>
#ifdef __cplusplus
#endif
@@ -12,63 +13,60 @@ extern "C" {
#define SWHANDLE int
-typedef struct {
- ModMap::iterator it;
- ModMap::iterator end;
-} ModItType;
+//using namespace sword;
//-----------------------------------------------------------------
// stringlist_iterator methods
-void stringlist_iterator_next(SWHANDLE hsli);
-char *stringlist_iterator_val(SWHANDLE hsli);
+void SWDLLEXPORT stringlist_iterator_next(SWHANDLE hsli);
+const char * SWDLLEXPORT stringlist_iterator_val(SWHANDLE hsli);
//-----------------------------------------------------------------
// modmap methods
//
-void ModList_iterator_next(SWHANDLE hmmi);
-SWHANDLE ModList_iterator_val(SWHANDLE hmmi);
+void SWDLLEXPORT ModList_iterator_next(SWHANDLE hmmi);
+SWHANDLE SWDLLEXPORT ModList_iterator_val(SWHANDLE hmmi);
//-----------------------------------------------------------------
// SWMgr methods
//
-SWHANDLE SWMgr_new();
+SWHANDLE SWDLLEXPORT SWMgr_new();
// SWConfig *, SWConfig *, bool, SWFilterMgr *
-SWHANDLE SWMgr_newEx(SWHANDLE hiconfig, SWHANDLE hisysconfig, char autoload, SWHANDLE hfilterMgr);
-void SWMgr_delete(SWHANDLE hmgr);
-SWHANDLE SWMgr_getConfig(SWHANDLE hmgr);
-SWHANDLE SWMgr_getModulesIterator(SWHANDLE hmgr);
-SWHANDLE SWMgr_getModuleByName(SWHANDLE hmgr, char *name);
-char * SWMgr_getPrefixPath(SWHANDLE hmgr);
-char * SWMgr_getConfigPath(SWHANDLE hmgr);
-void SWMgr_setGlobalOption(SWHANDLE hmgr, char *option, char *value);
-char * SWMgr_getGlobalOption(SWHANDLE hmgr, char *option);
-char * SWMgr_getGlobalOptionTip(SWHANDLE hmgr, char *option);
+SWHANDLE SWDLLEXPORT SWMgr_newEx(SWHANDLE hiconfig, SWHANDLE hisysconfig, char autoload, SWHANDLE hfilterMgr);
+void SWDLLEXPORT SWMgr_delete(SWHANDLE hmgr);
+SWHANDLE SWDLLEXPORT SWMgr_getConfig(SWHANDLE hmgr);
+SWHANDLE SWDLLEXPORT SWMgr_getModulesIterator(SWHANDLE hmgr);
+SWHANDLE SWDLLEXPORT SWMgr_getModuleByName(SWHANDLE hmgr, const char *name);
+const char * SWDLLEXPORT SWMgr_getPrefixPath(SWHANDLE hmgr);
+const char * SWDLLEXPORT SWMgr_getConfigPath(SWHANDLE hmgr);
+void SWDLLEXPORT SWMgr_setGlobalOption(SWHANDLE hmgr, const char *option, const char *value);
+const char * SWDLLEXPORT SWMgr_getGlobalOption(SWHANDLE hmgr, const char *option);
+const char * SWDLLEXPORT SWMgr_getGlobalOptionTip(SWHANDLE hmgr, const char *option);
// ret: forward_iterator
-SWHANDLE SWMgr_getGlobalOptionsIterator(SWHANDLE hmgr);
+SWHANDLE SWDLLEXPORT SWMgr_getGlobalOptionsIterator(SWHANDLE hmgr);
// ret: forward_iterator
-SWHANDLE SWMgr_getGlobalOptionValuesIterator(SWHANDLE hmgr, char *option);
-void SWMgr_setCipherKey(SWHANDLE hmgr, char *modName, char *key);
+SWHANDLE SWDLLEXPORT SWMgr_getGlobalOptionValuesIterator(SWHANDLE hmgr, const char *option);
+void SWDLLEXPORT SWMgr_setCipherKey(SWHANDLE hmgr, const char *modName, const char *key);
//-----------------------------------------------------------------
// SWModule methods
-void SWModule_terminateSearch(SWHANDLE hmodule);
-char SWModule_error(SWHANDLE hmodule);
-int SWModule_getEntrySize(SWHANDLE hmodule);
-void SWModule_setKeyText(SWHANDLE hmodule, char *key);
-char *SWModule_getKeyText(SWHANDLE hmodule);
-char *SWModule_getName(SWHANDLE hmodule);
-char *SWModule_getDescription(SWHANDLE hmodule);
-char *SWModule_getType(SWHANDLE hmodule);
-void SWModule_previous(SWHANDLE hmodule);
-void SWModule_next(SWHANDLE hmodule);
-void SWModule_begin(SWHANDLE hmodule);
-char *SWModule_getStripText(SWHANDLE hmodule);
-char *SWModule_getRenderText(SWHANDLE hmodule);
+void SWDLLEXPORT SWModule_terminateSearch(SWHANDLE hmodule);
+char SWDLLEXPORT SWModule_error(SWHANDLE hmodule);
+int SWDLLEXPORT SWModule_getEntrySize(SWHANDLE hmodule);
+void SWDLLEXPORT SWModule_setKeyText(SWHANDLE hmodule, const char *key);
+const char * SWDLLEXPORT SWModule_getKeyText(SWHANDLE hmodule);
+const char * SWDLLEXPORT SWModule_getName(SWHANDLE hmodule);
+const char * SWDLLEXPORT SWModule_getDescription(SWHANDLE hmodule);
+const char * SWDLLEXPORT SWModule_getType(SWHANDLE hmodule);
+void SWDLLEXPORT SWModule_previous(SWHANDLE hmodule);
+void SWDLLEXPORT SWModule_next(SWHANDLE hmodule);
+void SWDLLEXPORT SWModule_begin(SWHANDLE hmodule);
+const char * SWDLLEXPORT SWModule_getStripText(SWHANDLE hmodule);
+const char * SWDLLEXPORT SWModule_getRenderText(SWHANDLE hmodule);
}
#ifdef __cplusplus
diff --git a/include/ftpparse.h b/include/ftpparse.h
new file mode 100644
index 0000000..3da3c1b
--- /dev/null
+++ b/include/ftpparse.h
@@ -0,0 +1,53 @@
+#ifndef FTPPARSE_H
+#define FTPPARSE_H
+
+#include <time.h>
+
+/*
+ftpparse(&fp,buf,len) tries to parse one line of LIST output.
+
+The line is an array of len characters stored in buf.
+It should not include the terminating CR LF; so buf[len] is typically CR.
+
+If ftpparse() can't find a filename, it returns 0.
+
+If ftpparse() can find a filename, it fills in fp and returns 1.
+fp is a struct ftpparse, defined below.
+The name is an array of fp.namelen characters stored in fp.name;
+fp.name points somewhere within buf.
+*/
+
+struct ftpparse {
+ char *name; /* not necessarily 0-terminated */
+ int namelen;
+ int flagtrycwd; /* 0 if cwd is definitely pointless, 1 otherwise */
+ int flagtryretr; /* 0 if retr is definitely pointless, 1 otherwise */
+ int sizetype;
+ long size; /* number of octets */
+ int mtimetype;
+ time_t mtime; /* modification time */
+ int idtype;
+ char *id; /* not necessarily 0-terminated */
+ int idlen;
+} ;
+
+#define FTPPARSE_SIZE_UNKNOWN 0
+#define FTPPARSE_SIZE_BINARY 1 /* size is the number of octets in TYPE I */
+#define FTPPARSE_SIZE_ASCII 2 /* size is the number of octets in TYPE A */
+
+#define FTPPARSE_MTIME_UNKNOWN 0
+#define FTPPARSE_MTIME_LOCAL 1 /* time is correct */
+#define FTPPARSE_MTIME_REMOTEMINUTE 2 /* time zone and secs are unknown */
+#define FTPPARSE_MTIME_REMOTEDAY 3 /* time zone and time of day are unknown */
+/*
+When a time zone is unknown, it is assumed to be GMT. You may want
+to use localtime() for LOCAL times, along with an indication that the
+time is correct in the local time zone, and gmtime() for REMOTE* times.
+*/
+
+#define FTPPARSE_ID_UNKNOWN 0
+#define FTPPARSE_ID_FULL 1 /* unique identifier for files on this FTP server */
+
+extern int ftpparse(struct ftpparse *,char *,int);
+
+#endif
diff --git a/include/gbffootnotes.h b/include/gbffootnotes.h
index 4262538..7900ed5 100644
--- a/include/gbffootnotes.h
+++ b/include/gbffootnotes.h
@@ -1,6 +1,6 @@
-/*
+/***************************************************************************
*
- * $Id: gbffootnotes.h,v 1.9 2001/12/11 22:35:10 scribe Exp $
+ * $Id: gbffootnotes.h,v 1.13 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -21,38 +21,18 @@
#ifndef GBFFOOTNOTES_H
#define GBFFOOTNOTES_H
-#include <swfilter.h>
+#include <swoptfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
/** This Filter shows/hides footnotes in a GBF text
*/
-class SWDLLEXPORT GBFFootnotes:public SWFilter
-{
- bool option;
- static const char on[];
- static const char off[];
- static const char optName[];
- static const char optTip[];
- OptionsList options;
+class SWDLLEXPORT GBFFootnotes : public SWOptionFilter {
public:
- GBFFootnotes ();
- virtual ~ GBFFootnotes ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+ GBFFootnotes();
+ virtual ~GBFFootnotes();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/gbfheadings.h b/include/gbfheadings.h
index da86a33..f9f489f 100644
--- a/include/gbfheadings.h
+++ b/include/gbfheadings.h
@@ -1,6 +1,6 @@
-/*
+/***************************************************************************
*
- * $Id: gbfheadings.h,v 1.2 2001/12/11 22:35:10 scribe Exp $
+ * $Id: gbfheadings.h,v 1.6 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -21,38 +21,18 @@
#ifndef GBFHEADINGS_H
#define GBFHEADINGS_H
-#include <swfilter.h>
+#include <swoptfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
/** This Filter shows/hides headings in a GBF text
*/
-class SWDLLEXPORT GBFHeadings:public SWFilter
-{
- bool option;
- static const char on[];
- static const char off[];
- static const char optName[];
- static const char optTip[];
- OptionsList options;
+class SWDLLEXPORT GBFHeadings : public SWOptionFilter {
public:
- GBFHeadings ();
- virtual ~ GBFHeadings ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+ GBFHeadings();
+ virtual ~GBFHeadings();
+ virtual char processText (SWBuf &text, const SWKey * key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/gbfhtml.h b/include/gbfhtml.h
index 40805aa..da2d07d 100644
--- a/include/gbfhtml.h
+++ b/include/gbfhtml.h
@@ -1,38 +1,46 @@
-/***************************************************************************
- gbfhtml.h - description
- -------------------
- begin : Tue Jun 15 15:34:26 CEST 1999
-
- copyright : (C) 1999 by Torsten Uhlmann
- email : TUhlmann@gmx.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-/* $Header: /usr/local/cvsroot/sword/include/gbfhtml.h,v 1.8 2001/12/11 22:35:10 scribe Exp $ */
-/* $Revision: 1.8 $ */
+/******************************************************************************
+ *
+ * $Id: gbfhtml.h,v 1.14 2003/08/12 05:36:30 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#ifndef GBFHTML_H
#define GBFHTML_H
-#include <swfilter.h>
+#include <swbasicfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
-/** This filter converts GBF Text into HTML
+/** this filter converts GBF text to HTML text
*/
-class SWDLLEXPORT GBFHTML:public SWFilter
-{
+class SWDLLEXPORT GBFHTML : public SWBasicFilter {
+protected:
+ class MyUserData : public BasicFilterUserData {
+ public:
+ MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {}
+ bool hasFootnotePreTag;
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
public:
- GBFHTML ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
+ GBFHTML();
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/gbfhtmlhref.h b/include/gbfhtmlhref.h
index 77952a4..15afdfe 100644
--- a/include/gbfhtmlhref.h
+++ b/include/gbfhtmlhref.h
@@ -1,33 +1,46 @@
-/*-*************************************************************************
- gbfhtmlhref.h - description
- -------------------
- begin : 2001-09-03
- copyright : 2001 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+/******************************************************************************
+ *
+ * $Id: gbfhtmlhref.h,v 1.7 2003/08/12 05:36:30 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#ifndef GBFHTMLHREF_H
#define GBFHTMLHREF_H
#include <swbasicfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
/** this filter converts GBF text to HTML text with hrefs
*/
class SWDLLEXPORT GBFHTMLHREF : public SWBasicFilter {
protected:
- virtual bool handleToken(char **buf, const char *token, DualStringMap &userData);
+ class MyUserData : public BasicFilterUserData {
+ public:
+ MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {}
+ bool hasFootnotePreTag;
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
public:
- GBFHTMLHREF ();
+ GBFHTMLHREF();
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/gbfmorph.h b/include/gbfmorph.h
index f57b3cc..69317b7 100644
--- a/include/gbfmorph.h
+++ b/include/gbfmorph.h
@@ -1,5 +1,6 @@
-/*
+/***************************************************************************
*
+ * $Id: gbfmorph.h,v 1.6 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -20,38 +21,18 @@
#ifndef GBFMORPH_H
#define GBFMORPH_H
-#include <swfilter.h>
+#include <swoptfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
/** This Filter shows/hides morph tags in a GBF text
*/
-class SWDLLEXPORT GBFMorph:public SWFilter
-{
- bool option;
- static const char on[];
- static const char off[];
- static const char optName[];
- static const char optTip[];
- OptionsList options;
+class SWDLLEXPORT GBFMorph : public SWOptionFilter {
public:
- GBFMorph ();
- virtual ~ GBFMorph ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+ GBFMorph();
+ virtual ~GBFMorph();
+ virtual char processText(SWBuf &text, const SWKey * key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/gbfosis.h b/include/gbfosis.h
new file mode 100644
index 0000000..9d6acfc
--- /dev/null
+++ b/include/gbfosis.h
@@ -0,0 +1,69 @@
+/***************************************************************************
+ *
+ * $Id: gbfosis.h,v 1.10 2003/07/05 04:58:42 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFOSIS_H
+#define GBFOSIS_H
+
+#include <swfilter.h>
+#include <stack>
+
+SWORD_NAMESPACE_START
+
+
+class QuoteStack {
+private:
+ class QuoteInstance {
+ public:
+ char startChar;
+ char level;
+ SWBuf uniqueID;
+ char continueCount;
+ QuoteInstance(char startChar = '\"', char level = 1, SWBuf uniqueID = "", char continueCount = 0) {
+ this->startChar = startChar;
+ this->level = level;
+ this->uniqueID = uniqueID;
+ this->continueCount = continueCount;
+ }
+ void pushStartStream(SWBuf &text);
+ };
+
+ typedef std::stack<QuoteInstance> QuoteInstanceStack;
+ QuoteInstanceStack quotes;
+public:
+ QuoteStack();
+ virtual ~QuoteStack();
+ void handleQuote(char *buf, char *quotePos, SWBuf &text);
+ void clear();
+ bool empty() { return quotes.empty(); }
+};
+
+/** this filter converts GBF text to OSIS text
+ */
+class SWDLLEXPORT GBFOSIS : public SWFilter {
+protected:
+ virtual const char *convertToOSIS(const char *, const SWKey *key);
+public:
+ GBFOSIS();
+ virtual ~GBFOSIS();
+ char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif /* THMLOSIS_H */
diff --git a/include/gbfplain.h b/include/gbfplain.h
index 5e24957..c140dfb 100644
--- a/include/gbfplain.h
+++ b/include/gbfplain.h
@@ -1,6 +1,6 @@
-/*
+/***************************************************************************
*
- * $Id: gbfplain.h,v 1.8 2001/12/11 22:35:10 scribe Exp $
+ * $Id: gbfplain.h,v 1.12 2003/02/28 13:31:37 mgruner Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -23,15 +23,15 @@
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This filter converts GBF text into plain text
+ /** This filter converts GBF text to plain text
*/
-class SWDLLEXPORT GBFPlain:public SWFilter
-{
+class SWDLLEXPORT GBFPlain : public SWFilter {
public:
- GBFPlain ();
- virtual char ProcessText (char *text, int maxlen, const SWKey *key, const SWModule * = 0);
+ GBFPlain();
+ virtual char processText (SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/gbfredletterwords.h b/include/gbfredletterwords.h
new file mode 100644
index 0000000..b057e41
--- /dev/null
+++ b/include/gbfredletterwords.h
@@ -0,0 +1,40 @@
+/***************************************************************************
+ *
+ * $Id: gbfredletterwords.h,v 1.4 2003/07/05 04:58:42 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFSREDLETTERWORDS_H
+#define GBFREDLETTERWORDS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides "red letter tags" (marking the
+ * words of Jesus) in a GBF text. Turn this off if you don't want
+ * to have this kind of markup in the text.
+ */
+class SWDLLEXPORT GBFRedLetterWords : public SWOptionFilter {
+public:
+ GBFRedLetterWords();
+ virtual ~GBFRedLetterWords();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule * = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/gbfrtf.h b/include/gbfrtf.h
index f0bbbd6..fd60949 100644
--- a/include/gbfrtf.h
+++ b/include/gbfrtf.h
@@ -1,6 +1,6 @@
-/*
+/***************************************************************************
*
- * $Id: gbfrtf.h,v 1.7 2001/12/11 22:35:10 scribe Exp $
+ * $Id: gbfrtf.h,v 1.10 2003/02/28 13:31:37 mgruner Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -23,15 +23,15 @@
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This filter converts GBF text into RTF text
- */
-class SWDLLEXPORT GBFRTF:public SWFilter
-{
+/** This filter converts GBF text into RTF text
+ */
+class SWDLLEXPORT GBFRTF : public SWFilter {
public:
- GBFRTF ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
+ GBFRTF();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/gbfstrongs.h b/include/gbfstrongs.h
index d23e267..3993ca5 100644
--- a/include/gbfstrongs.h
+++ b/include/gbfstrongs.h
@@ -1,6 +1,6 @@
-/*
+/***************************************************************************
*
- * $Id: gbfstrongs.h,v 1.8 2001/12/11 22:35:10 scribe Exp $
+ * $Id: gbfstrongs.h,v 1.12 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -21,38 +21,18 @@
#ifndef GBFSTRONGS_H
#define GBFSTRONGS_H
-#include <swfilter.h>
+#include <swoptfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This Filter shows/hides strong's numbers in a GBF text
- */
-class SWDLLEXPORT GBFStrongs:public SWFilter
-{
- bool option;
- static const char on[];
- static const char off[];
- static const char optName[];
- static const char optTip[];
- OptionsList options;
+/** This Filter shows/hides strong's numbers in a GBF text
+ */
+class SWDLLEXPORT GBFStrongs : public SWOptionFilter {
public:
- GBFStrongs ();
- virtual ~ GBFStrongs ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+ GBFStrongs();
+ virtual ~GBFStrongs();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/gbfthml.h b/include/gbfthml.h
index f09cf92..ec16e83 100644
--- a/include/gbfthml.h
+++ b/include/gbfthml.h
@@ -1,34 +1,37 @@
/***************************************************************************
- gbfthml.h - description
- -------------------
- begin : 1999-10-28
- copyright : 1999 by Chris Little
- email : chrislit@chiasma.org
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+ *
+ * $Id: gbfthml.h,v 1.6 2003/02/20 07:25:19 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#ifndef GBFTHML_H
#define GBFTHML_H
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** this filter converts GBF text into ThML text
- */
-class SWDLLEXPORT GBFThML:public SWFilter
-{
+/** this filter converts GBF text into ThML text
+ */
+class SWDLLEXPORT GBFThML : public SWFilter {
public:
- GBFThML ();
- virtual char ProcessText (char *text, int maxlen = -1);
+ GBFThML();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/gbfwebif.h b/include/gbfwebif.h
new file mode 100644
index 0000000..3cd6304
--- /dev/null
+++ b/include/gbfwebif.h
@@ -0,0 +1,41 @@
+/******************************************************************************
+ *
+ * $Id: gbfwebif.h,v 1.5 2003/08/12 05:36:30 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef GBFWEBIF_H
+#define GBFWEBIF_H
+
+#include <gbfhtmlhref.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts GBF text to HTML text with hrefs
+ */
+class SWDLLEXPORT GBFWEBIF : public GBFHTMLHREF {
+ const SWBuf baseURL;
+ const SWBuf passageStudyURL;
+
+protected:
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ GBFWEBIF();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/greeklexattribs.h b/include/greeklexattribs.h
index 759aa6d..ba2afaf 100644
--- a/include/greeklexattribs.h
+++ b/include/greeklexattribs.h
@@ -1,6 +1,6 @@
-/*
+/***************************************************************************
*
- * thmlplain.h
+ * $Id: greeklexattribs.h,v 1.3 2003/02/20 07:25:19 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -23,14 +23,15 @@
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** this filter converts ThML text to plain text
- */
-class SWDLLEXPORT GreekLexAttribs:public SWFilter {
+/** this filter converts ThML text to plain text
+ */
+class SWDLLEXPORT GreekLexAttribs : public SWFilter {
public:
GreekLexAttribs();
- virtual char ProcessText(char *text, int maxlen, const SWKey *, const SWModule * = 0);
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/hebrewmcim.h b/include/hebrewmcim.h
index c601751..499639a 100644
--- a/include/hebrewmcim.h
+++ b/include/hebrewmcim.h
@@ -12,7 +12,9 @@
#include <swinputmeth.h>
#include <map>
-using namespace std;
+#include <defs.h>
+SWORD_NAMESPACE_START
+
class HebrewMCIM : public SWInputMethod {
@@ -26,4 +28,5 @@ public:
int *translate(char in);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/hrefcom.h b/include/hrefcom.h
index 64c9003..e3f6b9e 100644
--- a/include/hrefcom.h
+++ b/include/hrefcom.h
@@ -3,7 +3,7 @@
* pointing to actual text desired. Uses standard
* files: ot and nt using indexs ??.bks ??.cps ??.vss
*
- * $Id: hrefcom.h,v 1.5 2002/02/19 01:20:35 scribe Exp $
+ * $Id: hrefcom.h,v 1.8 2003/02/20 07:25:19 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -29,18 +29,24 @@
#include <defs.h>
-class SWDLLEXPORT HREFCom:public RawVerse, public SWCom
-{
- char *prefix;
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT HREFCom:public RawVerse, public SWCom {
+ char *prefix;
public:
-
-
- HREFCom (const char *ipath, const char *prefix, const char *iname =
- 0, const char *idesc = 0, SWDisplay * idisp = 0);
- virtual ~ HREFCom ();
- virtual char *getRawEntry ();
-};
+ HREFCom(const char *ipath, const char *prefix, const char *iname = 0,
+ const char *idesc = 0, SWDisplay * idisp = 0);
+ virtual ~HREFCom();
+ virtual SWBuf &getRawEntryBuf();
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
#endif
diff --git a/include/installmgr.h b/include/installmgr.h
new file mode 100644
index 0000000..949a65b
--- /dev/null
+++ b/include/installmgr.h
@@ -0,0 +1,93 @@
+#ifndef INSTALLMGR_H
+#define INSTALLMGR_H
+
+#include <stdio.h>
+#include <vector>
+#include <defs.h>
+#include <swbuf.h>
+#include <swconfig.h>
+#include <map>
+
+SWORD_NAMESPACE_START
+
+class SWMgr;
+
+// move this include to cpp once struct ftpparse isn't exposed anymore
+extern "C" {
+#include <ftpparse.h>
+}
+
+
+// initialize/cleanup SYSTEMWIDE library with life of this static.
+class InstallMgr_init {
+public:
+ InstallMgr_init();
+ ~InstallMgr_init();
+};
+
+
+struct FtpFile {
+ const char *filename;
+ FILE *stream;
+};
+
+
+class InstallSource {
+ SWMgr *mgr;
+public:
+ InstallSource(const char *type, const char *confEnt = 0);
+ virtual ~InstallSource();
+ SWBuf getConfEnt() {
+ return caption +"|" + source + "|" + directory;
+ }
+ SWBuf type;
+ SWBuf source;
+ SWBuf directory;
+ SWBuf caption;
+ SWBuf localShadow;
+ void *userData;
+ SWMgr *getMgr();
+ void flush();
+};
+
+typedef std::map < SWBuf, InstallSource * >InstallSourceMap;
+
+class InstallMgr {
+
+protected:
+ char *privatePath;
+ // probably change to group these ftp functions into some kind of FTPSession
+ // class, and open/close functions become c_tor/d_tor.
+public:
+ SWConfig *installConf;
+ InstallSourceMap sources;
+ void *FTPOpenSession();
+ void FTPCloseSession(void *session);
+ char FTPURLGetFile(void *session, const char *dest, const char *sourceurl);
+
+ // probably change to not expose struct ftpparse. We probably need our
+ // own FTPFile class or something that contains things like file name,
+ // size, type (dir, file, special). Then change to vector of this class
+ // instead of ftpparse
+ std::vector<struct ftpparse> FTPURLGetDir(void *session, const char *dirurl);
+
+
+public:
+ InstallMgr(const char *privatePath = "./");
+ virtual ~InstallMgr();
+ bool passive;
+ bool terminate;
+ virtual int removeModule(SWMgr *manager, const char *modName);
+ virtual int FTPCopy(InstallSource *is, const char *src, const char *dest, bool dirTransfer = false, const char *suffix = "");
+ virtual int installModule(SWMgr *destMgr, const char *fromLocation, const char *modName, InstallSource *is = 0);
+ virtual int copyFileToSWORDInstall(SWMgr *manager, const char *sourceDir, const char *fName);
+ virtual void refreshRemoteSource(InstallSource *is);
+ virtual void statusUpdate(double dltotal, double dlnow);
+ virtual void preDownloadStatus(long totalBytes, long completedBytes, const char *message);
+ virtual bool getCipherCode(const char *modName, SWConfig *config);
+};
+
+
+SWORD_NAMESPACE_END
+
+#endif
diff --git a/include/latin1utf16.h b/include/latin1utf16.h
index 685adbc..621aabf 100644
--- a/include/latin1utf16.h
+++ b/include/latin1utf16.h
@@ -1,5 +1,6 @@
-/*
+/***************************************************************************
*
+ * $Id: latin1utf16.h,v 1.5 2003/02/20 07:25:19 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -22,14 +23,15 @@
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This filter converts Latin-1 encoded text to UTF-8
- */
-class SWDLLEXPORT Latin1UTF16:public SWFilter {
+/** This filter converts Latin-1 encoded text to UTF-16
+ */
+class SWDLLEXPORT Latin1UTF16 : public SWFilter {
public:
- Latin1UTF16();
- virtual char ProcessText (char *text, int maxlen, const SWKey *key, const SWModule * = 0);
+ Latin1UTF16();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/latin1utf8.h b/include/latin1utf8.h
index 9303d89..5eff93f 100644
--- a/include/latin1utf8.h
+++ b/include/latin1utf8.h
@@ -1,5 +1,6 @@
-/*
+/***************************************************************************
*
+ * $Id: latin1utf8.h,v 1.4 2003/02/20 07:25:19 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -22,14 +23,15 @@
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This filter converts Latin-1 encoded text to UTF-8
- */
-class SWDLLEXPORT Latin1UTF8:public SWFilter {
+/** This filter converts Latin-1 encoded text to UTF-8
+ */
+class SWDLLEXPORT Latin1UTF8 : public SWFilter {
public:
- Latin1UTF8();
- virtual char ProcessText (char *text, int maxlen, const SWKey *key, const SWModule * = 0);
+ Latin1UTF8();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/listkey.h b/include/listkey.h
index 8f1c59c..fda73cd 100644
--- a/include/listkey.h
+++ b/include/listkey.h
@@ -4,7 +4,7 @@
* (e.g. verse, word,
* place, etc.)
*
- * $Id: listkey.h,v 1.13 2001/08/09 10:39:51 scribe Exp $
+ * $Id: listkey.h,v 1.19 2003/08/31 01:58:13 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -29,57 +29,62 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
/** ListKey is the basis for all
* types of keys that have lists of specified indexes
* (e.g. a list of verses, place, etc.)
*/
class SWDLLEXPORT ListKey : public SWKey {
- static SWClass classdef;
- void init ();
+ static SWClass classdef;
+ void init ();
protected:
- int arraypos;
- int arraymax;
- int arraycnt;
- SWKey **array;
+ int arraypos;
+ int arraymax;
+ int arraycnt;
+ SWKey **array;
public:
/** initializes instance of ListKey
*
* @param ikey text key
*/
- ListKey (const char *ikey = 0);
- ListKey (ListKey const &k);
+ ListKey(const char *ikey = 0);
+ ListKey(ListKey const &k);
/** cleans up instance of ListKey
*/
- virtual ~ ListKey ();
+ virtual ~ ListKey();
- virtual SWKey *clone () const;
+ virtual SWKey *clone() const;
/** Clears out elements of list
*/
- virtual void ClearList ();
+ virtual void ClearList();
/** Returns number of elements in list
* @return number of elements in list
*/
- virtual int Count ();
+ virtual int Count();
/** Removes current element from list
*/
- virtual void Remove ();
+ virtual void Remove();
/** Sets key to element number
*
* @param ielement element number to set to
* @return error status
*/
- virtual char SetToElement (int ielement, SW_POSITION = TOP);
+ virtual char SetToElement(int ielement, SW_POSITION = TOP);
/** Gets a key element number
*
* @param pos element number to get (or default current)
* @return Key or null on error
*/
- virtual SWKey *GetElement (int pos = -1);
+ virtual SWKey *getElement(int pos = -1);
+ // deprecated, use above function
+ virtual SWKey *GetElement(int pos = -1) { return getElement(pos); }
+
/** Adds an element to the list
* @param ikey the element to add
*/
- ListKey & operator << (const SWKey &ikey) { add(ikey); return *this; }
+ ListKey & operator <<(const SWKey &ikey) { add(ikey); return *this; }
virtual void add(const SWKey &ikey);
/** Equates this ListKey to another ListKey object
@@ -91,10 +96,10 @@ public:
/** Positions this key
*
- * @param p position
+ * @param pos position
* @return *this
*/
- virtual void setPosition(SW_POSITION);
+ virtual void setPosition(SW_POSITION pos);
/** Decrements a number of elements
*/
virtual void decrement(int step);
@@ -102,18 +107,21 @@ public:
*/
virtual void increment(int step);
- virtual char Traversable () { return 1; }
- virtual long Index () const { return arraypos; }
+ virtual char Traversable() { return 1; }
+ virtual long Index() const { return arraypos; }
+ virtual const char *getRangeText() const;
/**
* Returns the index for the new one given as as parameter.
* The first parameter is the new index.
*/
- virtual long Index (long index) { SetToElement (index); return Index (); }
+ virtual long Index(long index) { SetToElement (index); return Index (); }
+ virtual const char *getText() const;
+ virtual void setText(const char *ikey);
SWKEY_OPERATORS
ListKey & operator =(const ListKey &key) { copyFrom(key); return *this; }
};
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/localemgr.h b/include/localemgr.h
index 65e57e7..c553e7b 100644
--- a/include/localemgr.h
+++ b/include/localemgr.h
@@ -2,7 +2,7 @@
* localemgr.h - definition of class LocaleMgr used to interact with
* registered locales for a sword installation
*
- * $Id: localemgr.h,v 1.8 2001/06/24 01:30:33 scribe Exp $
+ * $Id: localemgr.h,v 1.16 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -23,7 +23,6 @@
#ifndef LOCALEMGR_H
#define LOCALEMGR_H
-#include <string>
#include <map>
#include <list>
#include <swconfig.h>
@@ -31,10 +30,11 @@
#include <defs.h>
-using namespace std;
-
-typedef map < string, SWLocale *, less < string > >LocaleMap;
+SWORD_NAMESPACE_START
+
+typedef std::list<SWBuf> StringList;
+typedef std::map < SWBuf, SWLocale *, std::less < SWBuf > > LocaleMap;
/**
* The LocaleMgr class handles all the different locales of Sword.
* It provides functions to get a list of all available locales,
@@ -46,64 +46,71 @@ typedef map < string, SWLocale *, less < string > >LocaleMap;
* To get the locale for a language name use @see getLocale
* To get a list of availble locales use @see getAvailableLocales
*/
-class SWDLLEXPORT LocaleMgr
-{
+class SWDLLEXPORT LocaleMgr {
private:
- void deleteLocales ();
- char *defaultLocaleName;
+ void deleteLocales();
+ char *defaultLocaleName;
+ LocaleMgr(const LocaleMgr &);
protected:
- LocaleMap locales;
- virtual void loadConfigDir (const char *ipath);
+ LocaleMap *locales;
public:
- /** Default constructor of LocaleMgr
- * You do normally not need this constructor, use LocaleMgr::systemLocaleMgr instead.
- */
- LocaleMgr (const char *iConfigPath = 0);
-
- /**
- * Default destructor of LocaleMgr
- */
- virtual ~ LocaleMgr ();
-
- /** Get the locale connected with the name "name".
- *
- * @param name The name of the locale you want to have. For example use getLocale("de") to get the locale for the German language.
- * @return Returns the locale object if the locale with the name given as parameter was found. If it wasn't found return NULL.
- */
- virtual SWLocale *getLocale (const char *name);
-
- /** Get the list of available locales.
- *
- * @ret Returns a list of strings, which contains the names of the available locales.
- */
- virtual list < string > getAvailableLocales ();
-
- /** Returns translated text.
- * This function uses both parameters to return the translated version of the given text.
- *
- * @param name The name of the locale Sword should use
- * @paran The text to translate into the language given by the first parameter.
- * @return Returns the translated text.
- */
- virtual const char *translate (const char *name, const char *text);
-
- /** Get the default locale name. To set it use @see setDefaultLocaleName
- *
- * @ret Returns the default locale name
- */
- virtual const char *getDefaultLocaleName ();
-
- /** Set the new standard locale of Sword.
- *
- * @param name The name of the new default locale
- */
- virtual void setDefaultLocaleName (const char *name);
-
- /** The LocaleMgr object used globally in the Sword world.
- * Do not create your own LocaleMgr, use this static object instead.
- */
- static LocaleMgr systemLocaleMgr;
+ /** Default constructor of LocaleMgr
+ * You do normally not need this constructor, use LocaleMgr::systemLocaleMgr instead.
+ */
+ LocaleMgr(const char *iConfigPath = 0);
+
+ /**
+ * Default destructor of LocaleMgr
+ */
+ virtual ~LocaleMgr();
+
+ /** Get the locale connected with the name "name".
+ *
+ * @param name The name of the locale you want to have. For example use getLocale("de") to get the locale for the German language.
+ * @return Returns the locale object if the locale with the name given as parameter was found. If it wasn't found return NULL.
+ */
+ virtual SWLocale *getLocale(const char *name);
+
+ /** Get the list of available locales.
+ *
+ * @return Returns a list of strings, which contains the names of the available locales.
+ */
+ virtual StringList getAvailableLocales();
+
+ /** Returns translated text.
+ * This function uses both parameters to return the translated version of the given text.
+ *
+ * @param text The text to translate into the language given by the first parameter.
+ * @param localeName The name of the locale Sword should use
+ * @return Returns the translated text.
+ */
+ virtual const char *translate(const char *text, const char *localeName = 0);
+
+ /** Get the default locale name. To set it use @see setDefaultLocaleName
+ *
+ * @return Returns the default locale name
+ */
+ virtual const char *getDefaultLocaleName();
+
+ /** Set the new standard locale of Sword.
+ *
+ * @param name The name of the new default locale
+ */
+ virtual void setDefaultLocaleName(const char *name);
+
+ /** The LocaleMgr object used globally in the Sword world.
+ * Do not create your own LocaleMgr, use this static object instead.
+ */
+ static LocaleMgr systemLocaleMgr;
+
+
+ /** Augment this localmgr with all locale.conf files in a directory
+ */
+ virtual void loadConfigDir(const char *ipath);
+
};
+
+SWORD_NAMESPACE_END
#endif
diff --git a/include/lzsscomprs.h b/include/lzsscomprs.h
index 0f352e7..d972f88 100644
--- a/include/lzsscomprs.h
+++ b/include/lzsscomprs.h
@@ -1,7 +1,7 @@
/******************************************************************************
* lzsscomprs.h - definition of Class SWCompress used for data compression
*
- * $Id: lzsscomprs.h,v 1.3 2001/02/09 15:38:51 jansorg Exp $
+ * $Id: lzsscomprs.h,v 1.4 2002/10/01 19:52:40 dglassey Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -26,6 +26,8 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
// The following are constant sizes used by the compression algorithm.
//
// N - This is the size of the ring buffer. It is set
@@ -76,4 +78,5 @@ public:
virtual void Decode (void);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/markupfiltmgr.h b/include/markupfiltmgr.h
index 7c9c3c5..cfb90b2 100644
--- a/include/markupfiltmgr.h
+++ b/include/markupfiltmgr.h
@@ -24,10 +24,12 @@
#include <encfiltmgr.h>
-/** This class is like a normal @ref SWEncodingMgr,
- * but you can additonally specify which markup
- * you want to use.
- */
+SWORD_NAMESPACE_START
+
+/** This class is like a normal SWEncodingMgr,
+* but you can additonally specify which markup
+* you want to use.
+*/
class SWDLLEXPORT MarkupFilterMgr : public EncodingFilterMgr {
protected:
SWFilter* fromthml;
@@ -35,18 +37,15 @@ protected:
SWFilter* fromplain;
SWFilter* fromosis;
- /*
- * current markup value
- */
+ /**
+ * current markup value
+ */
char markup;
void CreateFilters(char markup);
public:
/** Constructor of SWMarkupMgr.
*
- * @param iconfig
- * @param isysconfig
- * @param autoload If this bool is true the constructor starts loading the installed modules. If you reimplemented SWMgr you can set autoload=false to load the modules with your own reimplemented function.
* @param encoding The desired encoding.
* @param markup The desired markup format.
*/
@@ -72,4 +71,5 @@ public:
virtual void AddRenderFilters(SWModule *module, ConfigEntMap &section);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/multimapwdef.h b/include/multimapwdef.h
index fbab567..664e21d 100644
--- a/include/multimapwdef.h
+++ b/include/multimapwdef.h
@@ -3,14 +3,21 @@
#include <map>
-using namespace std;
+SWORD_NAMESPACE_START
// multmap that still lets you use [] to reference FIRST
// entry of a key if multiples exist
template <class Key, class T, class Compare>
-class multimapwithdefault : public multimap<Key, T, Compare> {
+class multimapwithdefault : public std::multimap<Key, T, Compare> {
public:
- typedef pair<const Key, T> value_type;
+ typedef std::pair<const Key, T> value_type;
+ T& getWithDefault(const Key& k, const T& defaultValue) {
+ if (find(k) == end()) {
+ insert(value_type(k, defaultValue));
+ }
+ return (*(find(k))).second;
+ }
+
T& operator[](const Key& k) {
if (find(k) == end()) {
insert(value_type(k, T()));
@@ -18,8 +25,8 @@ public:
return (*(find(k))).second;
}
bool has(const Key& k, const T &val) const {
- typename multimap<Key, T, Compare>::const_iterator start = lower_bound(k);
- typename multimap<Key, T, Compare>::const_iterator end = upper_bound(k);
+ typename std::multimap<Key, T, Compare>::const_iterator start = lower_bound(k);
+ typename std::multimap<Key, T, Compare>::const_iterator end = upper_bound(k);
for (; start!=end; start++) {
if (start->second == val)
return true;
@@ -28,4 +35,5 @@ public:
}
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/nullim.h b/include/nullim.h
index ce72090..765db0d 100644
--- a/include/nullim.h
+++ b/include/nullim.h
@@ -2,7 +2,8 @@
#define NULLIM_H
#include <swinputmeth.h>
-
+#include <defs.h>
+SWORD_NAMESPACE_START
class NullIM : public SWInputMethod {
@@ -11,4 +12,5 @@ public:
int * translate(char ch);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/osisfootnotes.h b/include/osisfootnotes.h
new file mode 100644
index 0000000..42196b2
--- /dev/null
+++ b/include/osisfootnotes.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: osisfootnotes.h,v 1.2 2003/07/05 04:58:42 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISFOOTNOTES_H
+#define OSISFOOTNOTES_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides headings in a OSIS text
+ */
+class SWDLLEXPORT OSISFootnotes : public SWOptionFilter {
+public:
+ OSISFootnotes();
+ virtual ~OSISFootnotes();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osisheadings.h b/include/osisheadings.h
new file mode 100644
index 0000000..06a26fc
--- /dev/null
+++ b/include/osisheadings.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: osisheadings.h,v 1.2 2003/07/05 04:58:42 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISHEADINGS_H
+#define OSISHEADINGS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides headings in a OSIS text
+ */
+class SWDLLEXPORT OSISHeadings : public SWOptionFilter {
+public:
+ OSISHeadings();
+ virtual ~OSISHeadings();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osishtmlhref.h b/include/osishtmlhref.h
new file mode 100644
index 0000000..93c7a93
--- /dev/null
+++ b/include/osishtmlhref.h
@@ -0,0 +1,51 @@
+/******************************************************************************
+ *
+ * $Id: osishtmlhref.h,v 1.8 2003/11/22 05:27:39 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISHTMLHREF_H
+#define OSISHTMLHREF_H
+
+#include <swbasicfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts OSIS text to HTML text with hrefs
+ */
+class SWDLLEXPORT OSISHTMLHREF : public SWBasicFilter {
+private:
+protected:
+ class MyUserData : public BasicFilterUserData {
+ public:
+ bool osisQToTick;
+ bool inBold;
+ SWBuf lastTransChange;
+ SWBuf w;
+ SWBuf fn;
+ MyUserData(const SWModule *module, const SWKey *key);
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ OSISHTMLHREF();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osislemma.h b/include/osislemma.h
new file mode 100644
index 0000000..40429cc
--- /dev/null
+++ b/include/osislemma.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: osislemma.h,v 1.2 2003/07/05 04:58:42 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISLEMMA_H
+#define OSISLEMMA_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides headings in a OSIS text
+ */
+class SWDLLEXPORT OSISLemma : public SWOptionFilter {
+public:
+ OSISLemma();
+ virtual ~OSISLemma();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/thmlolb.h b/include/osismorph.h
index 6f6c0f7..4e0c35e 100644
--- a/include/thmlolb.h
+++ b/include/osismorph.h
@@ -1,8 +1,8 @@
-/*
+/***************************************************************************
*
- * thmlolb.h
+ * $Id: osismorph.h,v 1.3 2003/07/05 04:58:42 scribe Exp $
*
- * Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -18,20 +18,21 @@
*
*/
-#ifndef THMLOLB_H
-#define THMLOLB_H
+#ifndef OSISMORPH_H
+#define OSISMORPH_H
-#include <swfilter.h>
+#include <swoptfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** this filter converts ThML text to OLB text
- */
-class SWDLLEXPORT ThMLOLB:public SWFilter
-{
+/** This Filter shows/hides morph tags in a OSIS text
+ */
+class SWDLLEXPORT OSISMorph : public SWOptionFilter {
public:
- ThMLOLB ();
- virtual char ProcessText (char *text, int maxlen = -1);
+ OSISMorph();
+ virtual ~OSISMorph();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/osisplain.h b/include/osisplain.h
new file mode 100644
index 0000000..b633924
--- /dev/null
+++ b/include/osisplain.h
@@ -0,0 +1,47 @@
+/******************************************************************************
+ *
+ * $Id: osisplain.h,v 1.10 2003/08/12 05:36:30 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISPLAIN_H
+#define OSISPLAIN_H
+
+#include <swbasicfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts OSIS text to plain text
+ */
+class SWDLLEXPORT OSISPlain : public SWBasicFilter {
+public:
+protected:
+ class MyUserData : public BasicFilterUserData {
+ public:
+ SWBuf w;
+ MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {}
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ OSISPlain();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osisredletterwords.h b/include/osisredletterwords.h
new file mode 100644
index 0000000..10994c0
--- /dev/null
+++ b/include/osisredletterwords.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: osisredletterwords.h,v 1.2 2003/07/05 04:58:42 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISREDLETTERWORDS_H
+#define OSISREDLETTERWORDS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides headings in a OSIS text
+ */
+class SWDLLEXPORT OSISRedLetterWords : public SWOptionFilter {
+public:
+ OSISRedLetterWords();
+ virtual ~OSISRedLetterWords();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osisrtf.h b/include/osisrtf.h
new file mode 100644
index 0000000..e2e0097
--- /dev/null
+++ b/include/osisrtf.h
@@ -0,0 +1,52 @@
+/******************************************************************************
+ *
+ * $Id: osisrtf.h,v 1.11 2003/12/24 20:51:36 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISRTF_H
+#define OSISRTF_H
+
+#include <swbasicfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts OSIS text to RTF text
+ */
+class SWDLLEXPORT OSISRTF : public SWBasicFilter {
+private:
+
+protected:
+ class MyUserData : public BasicFilterUserData {
+ public:
+ bool osisQToTick;
+ bool BiblicalText;
+ bool inXRefNote;
+ SWBuf w;
+ SWBuf version;
+ MyUserData(const SWModule *module, const SWKey *key);
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ OSISRTF();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osisscripref.h b/include/osisscripref.h
new file mode 100644
index 0000000..6768cfb
--- /dev/null
+++ b/include/osisscripref.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * $Id: osisscripref.h,v 1.2 2003/07/05 04:58:42 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISSCRIPREF_H
+#define OSISSCRIPREF_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides headings in a OSIS text
+ */
+class SWDLLEXPORT OSISScripref : public SWOptionFilter {
+public:
+ OSISScripref();
+ virtual ~OSISScripref();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osisstrongs.h b/include/osisstrongs.h
new file mode 100644
index 0000000..04ea1ca
--- /dev/null
+++ b/include/osisstrongs.h
@@ -0,0 +1,38 @@
+/***************************************************************************
+ *
+ * $Id: osisstrongs.h,v 1.3 2003/07/05 04:58:42 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISSTRONGS_H
+#define OSISSTRONGS_H
+
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
+
+ /** This Filter shows/hides strong's numbers in a OSIS text
+ */
+class SWDLLEXPORT OSISStrongs : public SWOptionFilter {
+public:
+ OSISStrongs();
+ virtual ~OSISStrongs();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/osiswebif.h b/include/osiswebif.h
new file mode 100644
index 0000000..eb3f95d
--- /dev/null
+++ b/include/osiswebif.h
@@ -0,0 +1,41 @@
+/******************************************************************************
+ *
+ * $Id: osiswebif.h,v 1.1 2003/10/24 02:43:46 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef OSISWEBIF_H
+#define OSISWEBIF_H
+
+#include <osishtmlhref.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts OSIS text to HTML text with hrefs
+ */
+class SWDLLEXPORT OSISWEBIF : public OSISHTMLHREF {
+ const SWBuf baseURL;
+ const SWBuf passageStudyURL;
+
+protected:
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+public:
+ OSISWEBIF();
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/plainfootnotes.h b/include/plainfootnotes.h
index 41ed3af..fdf8ba2 100644
--- a/include/plainfootnotes.h
+++ b/include/plainfootnotes.h
@@ -1,62 +1,41 @@
/***************************************************************************
- plainfootnotes.h - description
- -------------------
- begin : Wed Oct 13 1999
- copyright : (C) 1999 by The team of BibleTime
- email : info@bibletime.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-/* $Header: /usr/local/cvsroot/sword/include/plainfootnotes.h,v 1.4 2001/12/11 22:35:10 scribe Exp $ */
-/* $Revision: 1.4 $ */
+ *
+ * $Id: plainfootnotes.h,v 1.7 2003/07/05 04:58:42 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#ifndef PLAINFOOTNOTES_H
#define PLAINFOOTNOTES_H
-#include <defs.h>
+#include <swoptfilter.h>
+
+SWORD_NAMESPACE_START
-class QObject;
-#include <swfilter.h>
class SWKey;
/**Shows or hides footnotes in plain text.
- *@author The team of BibleTime
- */
-class SWDLLEXPORT PLAINFootnotes:public SWFilter
-{
- bool option;
- static const char on[];
- static const char off[];
- static const char optName[];
- static const char optTip[];
- OptionsList options;
-
+ *@author The team of BibleTime
+ */
+class SWDLLEXPORT PLAINFootnotes : public SWOptionFilter {
public:
- PLAINFootnotes ();
- virtual ~ PLAINFootnotes ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+ PLAINFootnotes();
+ virtual ~PLAINFootnotes();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/plainhtml.h b/include/plainhtml.h
index d0eb547..72bd70d 100644
--- a/include/plainhtml.h
+++ b/include/plainhtml.h
@@ -1,38 +1,38 @@
/***************************************************************************
- rwphtml.h - description
- -------------------
- begin : Tue Jun 15 15:34:26 CEST 1999
-
- copyright : (C) 1999 by Torsten Uhlmann
- email : TUhlmann@gmx.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-/* $Header: /usr/local/cvsroot/sword/include/plainhtml.h,v 1.7 2001/12/11 22:35:10 scribe Exp $ */
-/* $Revision: 1.7 $ */
+ *
+ * $Id: plainhtml.h,v 1.9 2003/02/20 07:25:19 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#ifndef PLAINHTML_H
#define PLAINHTML_H
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** this filter converts plain text to HTML text
- */
-class SWDLLEXPORT PLAINHTML:public SWFilter
-{
+/** this filter converts plain text to HTML text
+ * @author Torsten Uhlmann, begin : Tue Jun 15 15:34:26 CEST 1999
+ */
+class SWDLLEXPORT PLAINHTML : public SWFilter {
public:
- PLAINHTML ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
+ PLAINHTML();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/rawcom.h b/include/rawcom.h
index 8670fe8..2793443 100644
--- a/include/rawcom.h
+++ b/include/rawcom.h
@@ -2,7 +2,7 @@
* rawcom.h - code for class 'RawCom'- a module that reads raw commentary
* files: ot and nt using indexs ??.bks ??.cps ??.vss
*
- * $Id: rawcom.h,v 1.14 2002/03/14 16:56:49 scribe Exp $
+ * $Id: rawcom.h,v 1.18 2003/02/20 07:25:19 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -28,28 +28,40 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
class SWDLLEXPORT RawCom:public RawVerse, public SWCom {
+ VerseKey &getVerseKey();
+
+
public:
-
- RawCom (const char *ipath, const char *iname = 0, const char *idesc = 0,
- SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
- const char* ilang = 0);
- virtual ~ RawCom ();
- virtual char *getRawEntry ();
+ RawCom(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
+ const char* ilang = 0);
+ virtual ~RawCom();
+
+ virtual SWBuf &getRawEntryBuf();
- virtual SWModule & operator += (int increment);
- virtual SWModule & operator -= (int decrement) { return this->operator += (-decrement); }
+ virtual void increment(int steps);
+ virtual void decrement(int steps) { increment(-steps); }
// write interface ----------------------------
- virtual bool isWritable () { return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR)); }
- static char createModule (const char *path) { return RawVerse::createModule (path); }
- virtual SWModule & setentry (const char *inbuf, long len); // Modify current module entry
- virtual SWModule & operator << (const char *inbuf); // Modify current module entry
- virtual SWModule & operator << (const SWKey * linkKey); // Link current module entry to other module entry
- virtual void deleteEntry (); // Delete current module entry
+ virtual bool isWritable() {
+ return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR));
+ }
+ static char createModule(const char *path) { return RawVerse::createModule(path); }
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
// end write interface ------------------------
+ SWMODULE_OPERATORS
+
};
+
+SWORD_NAMESPACE_END
+
#endif
diff --git a/include/rawfiles.h b/include/rawfiles.h
index eff348d..48e7908 100644
--- a/include/rawfiles.h
+++ b/include/rawfiles.h
@@ -3,7 +3,7 @@
* pointing to actual text desired. Uses standard
* files: ot and nt using indexs ??.bks ??.cps ??.vss
*
- * $Id: rawfiles.h,v 1.14 2002/03/14 16:56:49 scribe Exp $
+ * $Id: rawfiles.h,v 1.18 2003/02/25 04:12:47 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -29,50 +29,60 @@
#include <defs.h>
-class SWDLLEXPORT RawFiles:public RawVerse, public SWCom
-{
+SWORD_NAMESPACE_START
- char *getnextfilename ();
+class SWDLLEXPORT RawFiles : public RawVerse, public SWCom {
+
+ char *getNextFilename();
public:
-
-
- RawFiles (const char *ipath, const char *iname = 0, const char *idesc =
- 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
- const char* ilang = 0);
- virtual ~RawFiles ();
- virtual char *getRawEntry ();
-
- // write interface ----------------------------
- /** Is the module writable? :)
- * @return yes or no
- */
- virtual bool isWritable () { return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR)); }
-
- /** Creates a new module
- * @param path The first parameter is path of the new module
- * @return error
- */
- static char createModule (const char *);
-
- /** Modify the current module entry text
- * - only if module @ref isWritable
- * @return *this
- */
- virtual SWModule & operator << (const char *);
-
- /** Link the current module entry to another module entry
- * - only if module @ref isWritable
- * @return *this
- */
- virtual SWModule & operator << (const SWKey *);
-
- /** Delete current module entry - only if module @ref isWritable
- *
- */
- virtual void deleteEntry ();
- // end write interface ------------------------
-};
+ RawFiles(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ SWDisplay *idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
+ const char *ilang = 0);
+ virtual ~RawFiles();
+ virtual SWBuf &getRawEntryBuf();
+
+ // write interface ----------------------------
+ /** Is the module writable? :)
+ * @return yes or no
+ */
+ virtual bool isWritable() {
+ return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR));
+ }
+
+ /** Creates a new module
+ * @param path The first parameter is path of the new module
+ * @return error
+ */
+ static char createModule(const char *);
+
+ /** Modify the current module entry text
+ * - only if module @ref isWritable
+ * @return *this
+ */
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+
+ /** Link the current module entry to another module entry
+ * - only if module @ref isWritable
+ * @return *this
+ */
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+
+ /** Delete current module entry - only if module @ref isWritable
+ *
+ */
+ virtual void deleteEntry();
+ // end write interface ------------------------
+
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
#endif
diff --git a/include/rawgbf.h b/include/rawgbf.h
index 8634831..27e76f0 100644
--- a/include/rawgbf.h
+++ b/include/rawgbf.h
@@ -2,7 +2,7 @@
* rawgbf.h - code for class 'RawGBF'- a module that reads raw text files:
* ot and nt using indexs ??.bks ??.cps ??.vss
*
- * $Id: rawgbf.h,v 1.4 2002/02/19 01:20:35 scribe Exp $
+ * $Id: rawgbf.h,v 1.5 2002/10/01 19:52:40 dglassey Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -29,6 +29,8 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
class SWDLLEXPORT RawGBF:public SWText, public RawVerse
{
@@ -41,5 +43,5 @@ public:
virtual operator char *();
};
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/rawgenbook.h b/include/rawgenbook.h
index 6a60810..820d7eb 100644
--- a/include/rawgenbook.h
+++ b/include/rawgenbook.h
@@ -2,7 +2,7 @@
* rawtext.h - code for class 'RawText'- a module that reads raw text files:
* ot and nt using indexs ??.bks ??.cps ??.vss
*
- * $Id: rawgenbook.h,v 1.3 2002/03/14 16:56:49 scribe Exp $
+ * $Id: rawgenbook.h,v 1.7 2003/02/26 04:49:12 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -28,32 +28,38 @@
#include <defs.h>
-class SWDLLEXPORT RawGenBook:public SWGenBook {
- char *entryBuf;
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT RawGenBook : public SWGenBook {
char *path;
FileDesc *bdtfd;
public:
- RawGenBook (const char *ipath, const char *iname = 0, const char *idesc = 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
- virtual ~ RawGenBook ();
- virtual char *getRawEntry ();
-#ifdef _MSC_VER
- virtual SWModule & operator = (SW_POSITION);
-#else
- virtual RawGenBook & operator = (SW_POSITION);
-#endif
+ RawGenBook(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
+ virtual ~RawGenBook();
+ virtual SWBuf &getRawEntryBuf();
// write interface ----------------------------
- virtual bool isWritable () { return ((bdtfd->getFd() > 0) && ((bdtfd->mode & O_RDWR) == O_RDWR)); }
- static char createModule (const char *ipath);
- virtual SWModule & setentry (const char *inbuf, long len); // Modify current module entry
- virtual SWModule & operator << (const char *inbuf); // Modify current module entry
- virtual SWModule & operator << (const SWKey * linkKey); // Link current module entry to other module entry
- virtual void deleteEntry (); // Delete current module entry
- virtual SWKey *CreateKey ();
+ virtual bool isWritable() {
+ return ((bdtfd->getFd() > 0) && ((bdtfd->mode & O_RDWR) == O_RDWR));
+ }
+ static char createModule(const char *ipath);
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey * linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
+ virtual SWKey *CreateKey();
// end write interface ------------------------
-};
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
#endif
diff --git a/include/rawld.h b/include/rawld.h
index 549c99b..c7c1100 100644
--- a/include/rawld.h
+++ b/include/rawld.h
@@ -2,7 +2,7 @@
* rawld.cpp - code for class 'RawLD'- a module that reads raw lexicon and
* dictionary files: *.dat *.idx
*
- * $Id: rawld.h,v 1.14 2002/03/14 16:56:49 scribe Exp $
+ * $Id: rawld.h,v 1.18 2003/02/20 07:25:19 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -28,39 +28,40 @@
#include <defs.h>
-class SWDLLEXPORT RawLD:public RawStr, public SWLD
-{
- void strongsPad (char *buf);
- char getEntry (long away = 0);
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT RawLD : public RawStr, public SWLD {
+ void strongsPad(char *buf);
+ char getEntry(long away = 0);
public:
-
-
- RawLD (const char *ipath, const char *iname = 0, const char *idesc =
- 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
- const char* ilang = 0);
- virtual ~ RawLD ();
- virtual char *getRawEntry ();
- virtual SWModule & operator = (SW_POSITION pos);
- virtual SWModule & operator += (int increment);
- virtual SWModule & operator -= (int decrement)
- {
- return this->operator += (-decrement);
- }
- // write interface ----------------------------
- virtual bool isWritable () { return ((idxfd->getFd() > 0) && ((idxfd->mode & O_RDWR) == O_RDWR)); }
- static char createModule (const char *path)
- {
- return RawStr::createModule (path);
- }
-
- virtual SWModule & setentry (const char *inbuf, long len); // Modify current module entry
- virtual SWModule & operator << (const char *inbuf); // Modify current module entry
- virtual SWModule & operator << (const SWKey * linkKey); // Link current module entry to other module entry
- virtual void deleteEntry (); // Delete current module entry
- // end write interface ------------------------
-};
+ RawLD(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
+
+ virtual ~RawLD();
+ virtual SWBuf &getRawEntryBuf();
+
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
+ // write interface ----------------------------
+ virtual bool isWritable() { return ((idxfd->getFd() > 0) && ((idxfd->mode & O_RDWR) == O_RDWR)); }
+ static char createModule(const char *path) { return RawStr::createModule (path); }
+
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
+ // end write interface ------------------------
+
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/rawld4.h b/include/rawld4.h
index 2a9aa71..2916382 100644
--- a/include/rawld4.h
+++ b/include/rawld4.h
@@ -2,7 +2,7 @@
* rawld.cpp - code for class 'RawLD'- a module that reads raw lexicon and
* dictionary files: *.dat *.idx
*
- * $Id: rawld4.h,v 1.9 2002/03/14 16:56:49 scribe Exp $
+ * $Id: rawld4.h,v 1.12 2003/02/20 07:25:19 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -28,37 +28,42 @@
#include <defs.h>
-class SWDLLEXPORT RawLD4:public RawStr4, public SWLD
-{
- void strongsPad (char *buf);
- char getEntry (long away = 0);
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT RawLD4 : public RawStr4, public SWLD {
+ void strongsPad(char *buf);
+ char getEntry(long away = 0);
public:
-
-
- RawLD4(const char *ipath, const char *iname = 0, const char *idesc =
- 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
- const char* ilang = 0);
- virtual ~RawLD4();
- virtual char *getRawEntry();
- virtual SWModule & operator =(SW_POSITION pos);
- virtual SWModule & operator +=(int increment);
- virtual SWModule & operator -=(int decrement) {
- return this->operator +=(-decrement);
- }
- // write interface ----------------------------
- virtual bool isWritable () { return ((idxfd->getFd() > 0) && ((idxfd->mode & O_RDWR) == O_RDWR)); }
- static char createModule (const char *path) {
- return RawStr4::createModule (path);
+
+ RawLD4(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ SWDisplay *idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char *ilang = 0);
+
+ virtual ~RawLD4();
+ virtual SWBuf &getRawEntryBuf();
+
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
+ // write interface ----------------------------
+ virtual bool isWritable() {
+ return ((idxfd->getFd() > 0) && ((idxfd->mode & O_RDWR) == O_RDWR));
}
+ static char createModule(const char *path) { return RawStr4::createModule(path); }
+
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
+ // end write interface ------------------------
- virtual SWModule & setentry (const char *inbuf, long len); // Modify current module entry
- virtual SWModule & operator << (const char *inbuf); // Modify current module entry
- virtual SWModule & operator << (const SWKey * linkKey); // Link current module entry to other module entry
- virtual void deleteEntry (); // Delete current module entry
- // end write interface ------------------------
-};
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/rawstr.h b/include/rawstr.h
index 3c8f742..38cde9b 100644
--- a/include/rawstr.h
+++ b/include/rawstr.h
@@ -4,7 +4,7 @@
* and provides lookup and parsing functions based on
* class StrKey
*
- * $Id: rawstr.h,v 1.11 2002/03/13 06:55:39 scribe Exp $
+ * $Id: rawstr.h,v 1.16 2003/02/26 03:23:44 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -25,9 +25,11 @@
#ifndef RAWSTR_H
#define RAWSTR_H
+#include <defs.h>
#include <filemgr.h>
+#include <swbuf.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
class SWDLLEXPORT RawStr {
static int instance; // number of instantiated RawStr objects or derivitives
@@ -37,18 +39,19 @@ class SWDLLEXPORT RawStr {
protected:
FileDesc *idxfd;
FileDesc *datfd;
- void settext(const char *key, const char *buf, long len = 0);
- void linkentry(const char *destkey, const char *srckey);
+ void doSetText(const char *key, const char *buf, long len = -1);
+ void doLinkEntry(const char *destkey, const char *srckey);
public:
- static void preptext(char *buf);
+ static void prepText(SWBuf &buf);
static char nl;
RawStr(const char *ipath, int fileMode = -1);
- virtual ~RawStr ();
- void getidxbuf(long ioffset, char **buf);
- void getidxbufdat(long ioffset, char **buf);
- signed char findoffset(const char *key, long *start, unsigned short *size, long away = 0, long *idxoff = 0);
- void gettext(long start, unsigned short size, char *idxbuf, char *buf);
+ virtual ~RawStr();
+ void getIDXBuf(long ioffset, char **buf);
+ void getIDXBufDat(long ioffset, char **buf);
+ signed char findOffset(const char *key, long *start, unsigned short *size, long away = 0, long *idxoff = 0);
+ void readText(long start, unsigned short *size, char **idxbuf, SWBuf &buf);
static signed char createModule(const char *path);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/rawstr4.h b/include/rawstr4.h
index 8a552b3..b67c375 100644
--- a/include/rawstr4.h
+++ b/include/rawstr4.h
@@ -4,7 +4,7 @@
* and provides lookup and parsing functions based on
* class StrKey
*
- * $Id: rawstr4.h,v 1.4 2002/03/13 06:55:39 scribe Exp $
+ * $Id: rawstr4.h,v 1.9 2003/02/27 07:39:37 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -26,31 +26,33 @@
#define RAWSTR4_H
#include <filemgr.h>
-
+#include <swbuf.h>
#include <defs.h>
-class SWDLLEXPORT RawStr4
-{
- static int instance; // number of instantiated RawStr4 objects or derivitives
- char *path;
- long lastoff;
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT RawStr4 {
+ static int instance; // number of instantiated RawStr4 objects or derivitives
+ char *path;
+ long lastoff;
protected:
- FileDesc *idxfd;
- FileDesc *datfd;
- void preptext (char *buf);
- void settext (const char *key, const char *buf, long len = 0);
- void linkentry (const char *destkey, const char *srckey);
+ FileDesc *idxfd;
+ FileDesc *datfd;
+ void prepText(SWBuf &buf);
+ void doSetText(const char *key, const char *buf, long len = -1);
+ void doLinkEntry(const char *destkey, const char *srckey);
public:
- char nl;
- RawStr4(const char *ipath, int fileMode = -1);
- virtual ~ RawStr4();
- void getidxbuf (long ioffset, char **buf);
- void getidxbufdat (long ioffset, char **buf);
- signed char findoffset (const char *key, long *start, unsigned long *size,
- long away = 0, long *idxoff = 0);
- void gettext (long start, unsigned long size, char *idxbuf, char *buf);
- static signed char createModule (const char *path);
+ char nl;
+ RawStr4(const char *ipath, int fileMode = -1);
+ virtual ~RawStr4();
+ void getIDXBuf(long ioffset, char **buf);
+ void getIDXBufDat(long ioffset, char **buf);
+ signed char findOffset(const char *key, long *start, unsigned long *size,
+ long away = 0, long *idxoff = 0);
+ void readText(long start, unsigned long *size, char **idxbuf, SWBuf &buf);
+ static signed char createModule(const char *path);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/rawtext.h b/include/rawtext.h
index 6e054cb..2c9f2b9 100644
--- a/include/rawtext.h
+++ b/include/rawtext.h
@@ -2,7 +2,7 @@
* rawtext.h - code for class 'RawText'- a module that reads raw text files:
* ot and nt using indexs ??.bks ??.cps ??.vss
*
- * $Id: rawtext.h,v 1.23 2002/03/14 16:56:49 scribe Exp $
+ * $Id: rawtext.h,v 1.29 2003/08/29 19:02:44 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -29,36 +29,52 @@
#include <defs.h>
-class SWDLLEXPORT RawText:public SWText, public RawVerse {
+#ifdef USELUCENE
+namespace lucene { namespace index {
+class IndexReader;
+}}
+
+namespace lucene { namespace search {
+class IndexSearcher;
+}}
+#endif
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT RawText : public SWText, public RawVerse {
+
+ VerseKey &getVerseKey();
+#ifdef USELUCENE
+ lucene::index::IndexReader *ir;
+ lucene::search::IndexSearcher *is;
+#else
RawStr *fastSearch[2];
+#endif
+
public:
-
- RawText (const char *ipath, const char *iname = 0, const char *idesc = 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
+ RawText(const char *ipath, const char *iname = 0, const char *idesc = 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
const char* ilang = 0);
- virtual ~ RawText ();
- virtual char *getRawEntry ();
- virtual SWModule & operator += (int increment);
- virtual SWModule & operator -= (int decrement) { return this->operator += (-decrement); }
- virtual signed char createSearchFramework ();
- virtual bool hasSearchFramework () { return true; }
-#ifdef _MSC_VER
- virtual SWModule & operator = (SW_POSITION);
-#else
- virtual RawText & operator = (SW_POSITION);
-#endif
- virtual ListKey & Search (const char *istr, int searchType = 0, int flags = 0, SWKey * scope = 0, bool * justCheckIfSupported = 0, void (*percent) (char, void *) = &SWModule::nullPercent, void *percentUserData = 0);
+ virtual ~RawText();
+ virtual SWBuf &getRawEntryBuf();
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
+ virtual signed char createSearchFramework();
+ virtual bool hasSearchFramework() { return true; }
+ virtual ListKey &search(const char *istr, int searchType = 0, int flags = 0, SWKey * scope = 0, bool * justCheckIfSupported = 0, void (*percent)(char, void *) = &SWModule::nullPercent, void *percentUserData = 0);
// write interface ----------------------------
- virtual bool isWritable () { return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR)); }
- static char createModule (const char *path) { return RawVerse::createModule (path); }
- virtual SWModule & setentry (const char *inbuf, long len); // Modify current module entry
- virtual SWModule & operator << (const char *inbuf); // Modify current module entry
- virtual SWModule & operator << (const SWKey * linkKey); // Link current module entry to other module entry
- virtual void deleteEntry (); // Delete current module entry
+ virtual bool isWritable() { return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR)); }
+ static char createModule(const char *path) { return RawVerse::createModule(path); }
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
// end write interface ------------------------
-};
+ SWMODULE_OPERATORS
+
+};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/rawverse.h b/include/rawverse.h
index 9f9e2c4..a5f3d08 100644
--- a/include/rawverse.h
+++ b/include/rawverse.h
@@ -12,27 +12,29 @@
#include <fcntl.h>
#include <defs.h>
+#include <swbuf.h>
+
+SWORD_NAMESPACE_START
class SWDLLEXPORT RawVerse {
- static int instance; // number of instantiated RawVerse objects or derivitives
+ static int instance; // number of instantiated RawVerse objects or derivitives
protected:
- FileDesc *idxfp[2];
- FileDesc *textfp[2];
+ FileDesc *idxfp[2];
+ FileDesc *textfp[2];
- char *path;
- void preptext (char *buf);
- void settext (char testmt, long idxoff, const char *buf, long len = 0);
- void linkentry (char testmt, long destidxoff, long srcidxoff);
+ char *path;
+ void prepText(SWBuf &buf);
+ void doSetText(char testmt, long idxoff, const char *buf, long len = -1);
+ void doLinkEntry(char testmt, long destidxoff, long srcidxoff);
public:
- char nl;
- RawVerse (const char *ipath, int fileMode = -1);
- virtual ~ RawVerse ();
- void findoffset (char testmt, long idxoff, long *start,
- unsigned short *end);
- void gettext (char testmt, long start, unsigned short size, char *buf);
- static char createModule (const char *path);
+ static const char *nl;
+ RawVerse(const char *ipath, int fileMode = -1);
+ virtual ~RawVerse();
+ void findOffset(char testmt, long idxoff, long *start, unsigned short *end);
+ void readText(char testmt, long start, unsigned short size, SWBuf &buf);
+ static char createModule(const char *path);
};
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/remotesourcemgr.h b/include/remotesourcemgr.h
new file mode 100644
index 0000000..b6d77d5
--- /dev/null
+++ b/include/remotesourcemgr.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * remotesourcemgr.h - definition of class SWCacheMgr used to provide an interface for
+ * caching information of module sources
+ *
+ * $Id: remotesourcemgr.h,v 1.1 2002/10/23 23:13:35 dglassey Exp $
+ *
+ * Copyright 2002 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef REMOTESOURCEMGR_H
+#define REMOTESOURCEMGR_H
+
+ #include <defs.h>
+ #include "swsourcemgr.h"
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT RemoteSourceMgr: public SWSourceMgr {
+public:
+ RemoteSourceMgr(const char *iHost, const char *iConfigPath);
+ char Refresh();
+}
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/roman.h b/include/roman.h
index 92665fe..dd1acbd 100644
--- a/include/roman.h
+++ b/include/roman.h
@@ -18,8 +18,19 @@
*/
#ifndef ROMAN_H
#define ROMAN_H
+
+#include <defs.h>
+SWORD_NAMESPACE_START
+
+/** Checks if a string is a roman numeral.
+*/
char isroman(const char *);
/* char* to_rom(int num, char *p); */
+
+/** Converts a roman numeral to a string.
+* @param s Roman numeral to convert.
+*/
int from_rom(const char *s);
+SWORD_NAMESPACE_END
#endif
diff --git a/include/rtfhtml.h b/include/rtfhtml.h
index 54b8a9f..04d9461 100644
--- a/include/rtfhtml.h
+++ b/include/rtfhtml.h
@@ -1,37 +1,37 @@
/***************************************************************************
- rtfhtml.h - description
- -------------------
- begin : Wed Oct 13 1999
- copyright : (C) 1999 by The team of BibleTime
- email : info@bibletime.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-/* $Header: /usr/local/cvsroot/sword/include/rtfhtml.h,v 1.5 2001/12/11 22:35:10 scribe Exp $ */
-/* $Revision: 1.5 $ */
+ *
+ * $Id: rtfhtml.h,v 1.7 2003/02/20 07:25:19 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#ifndef RTFHTML_H
#define RTFHTML_H
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** this filter converts RTF text into HTML text
- */
-class SWDLLEXPORT RTFHTML:public SWFilter
-{
+/** this filter converts RTF text into HTML text
+ */
+class SWDLLEXPORT RTFHTML : public SWFilter {
public:
- RTFHTML ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
+ RTFHTML();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/rwphtml.h b/include/rwphtml.h
deleted file mode 100644
index 512fa38..0000000
--- a/include/rwphtml.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/***************************************************************************
- rwphtml.h - description
- -------------------
- begin : Tue Jun 15 15:34:26 CEST 1999
-
- copyright : (C) 1999 by Torsten Uhlmann
- email : TUhlmann@gmx.de
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-/* $Header: /usr/local/cvsroot/sword/include/rwphtml.h,v 1.7 2001/12/11 22:35:10 scribe Exp $ */
-/* $Revision: 1.7 $ */
-
-#ifndef RWPHTML_H
-#define RWPHTML_H
-
-#include <swfilter.h>
-
-#include <defs.h>
-
- /** this filter converts RWP text to HTML text
- */
-class SWDLLEXPORT RWPHTML:public SWFilter
-{
-public:
- RWPHTML ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
-};
-
-#endif
diff --git a/include/sapphire.h b/include/sapphire.h
index 9e9f724..a5e21ad 100644
--- a/include/sapphire.h
+++ b/include/sapphire.h
@@ -18,6 +18,11 @@
#ifndef NULL
#define NULL 0
#endif /* */
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
class sapphire
{
@@ -51,3 +56,4 @@ unsigned *keypos); public:sapphire (unsigned char
};
+SWORD_NAMESPACE_END
diff --git a/include/scsuutf8.h b/include/scsuutf8.h
index 4ff28da..1a7793a 100644
--- a/include/scsuutf8.h
+++ b/include/scsuutf8.h
@@ -1,5 +1,6 @@
-/*
+/******************************************************************************
*
+ * $Id: scsuutf8.h,v 1.4 2003/02/20 07:25:20 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -22,20 +23,18 @@
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This filter converts SCSU compressed (encoded) text to UTF-8
- */
-class SWDLLEXPORT SCSUUTF8:public SWFilter {
- private:
- unsigned char* UTF8Output(unsigned long, unsigned char* text);
-
+/** This filter converts SCSU compressed (encoded) text to UTF-8
+ */
+class SWDLLEXPORT SCSUUTF8 : public SWFilter {
unsigned long c, d;
+ unsigned char* UTF8Output(unsigned long, unsigned char* text);
-
- public:
- SCSUUTF8();
- virtual char ProcessText (char *text, int maxlen, const SWKey *key, const SWModule * = 0);
+public:
+ SCSUUTF8();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/strkey.h b/include/strkey.h
index fc8fd58..aa0b4b1 100644
--- a/include/strkey.h
+++ b/include/strkey.h
@@ -1,7 +1,7 @@
/******************************************************************************
* strkey.h - code for class 'strkey'- a standard Biblical verse key
*
- * $Id: strkey.h,v 1.6 2001/08/08 09:17:00 scribe Exp $
+ * $Id: strkey.h,v 1.7 2002/10/01 19:52:40 dglassey Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -28,6 +28,8 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
/** a standard string key class (used
* for modules that index on single strings (eg. cities,
* names, words, etc.)
@@ -49,6 +51,6 @@ public:
SWKEY_OPERATORS
};
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swbasicfilter.h b/include/swbasicfilter.h
index d225d85..2985220 100644
--- a/include/swbasicfilter.h
+++ b/include/swbasicfilter.h
@@ -4,7 +4,7 @@
* many filter will need and can use as a starting
* point.
*
- * $Id: swbasicfilter.h,v 1.7 2002/03/04 01:56:44 scribe Exp $
+ * $Id: swbasicfilter.h,v 1.22 2003/08/12 05:36:30 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -26,50 +26,123 @@
#define SWBASICFILTER_H
#include <swfilter.h>
-
-#include <defs.h>
#include <map>
-using namespace std;
+SWORD_NAMESPACE_START
+
+
+// not a protected inner class because MSVC++ sucks and can't handle it
+class BasicFilterUserData {
+public:
+ BasicFilterUserData(const SWModule *module, const SWKey *key) { this->module = module; this->key = key; suspendTextPassThru = false; supressAdjacentWhitespace = false; }
+ virtual ~BasicFilterUserData() {}
+ const SWModule *module;
+ const SWKey *key;
+ SWBuf lastTextNode;
+ bool suspendTextPassThru;
+ bool supressAdjacentWhitespace;
+};
+/** A filter providing commonly used functionality.
+ * This filter has facilities for handling SGML/HTML/XML like tokens and
+ * escape strings (like SGML entities). It has the facility for just
+ * substituting the given tokens and escape strings to other strings and for
+ * "manual" custom token handling.
+ *
+ * In this class the functions with arguments looking as <code>char
+ * **buf</code> write a character sequnce at address specified by
+ * <code>*buf</code> address and change <code>*buf</code> to point past
+ * the last char of the written sequence.
+ */
class SWDLLEXPORT SWBasicFilter : public SWFilter {
char *tokenStart;
char *tokenEnd;
char *escStart;
char *escEnd;
+ char escStartLen;
+ char escEndLen;
+ char tokenStartLen;
+ char tokenEndLen;
bool escStringCaseSensitive;
bool tokenCaseSensitive;
bool passThruUnknownToken;
bool passThruUnknownEsc;
+ char processStages;
public:
+
SWBasicFilter();
- virtual char ProcessText(char *text, int maxlen, const SWKey *, const SWModule * = 0);
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
virtual ~SWBasicFilter();
protected:
- const SWModule *module;
- const SWKey *key;
- typedef map<string, string> DualStringMap;
+
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new BasicFilterUserData(module, key);
+ }
+
+ // STAGEs
+ static const char INITIALIZE; // flag for indicating processing before char loop
+ static const char PRECHAR; // flag for indicating processing at top in char loop
+ static const char POSTCHAR; // flag for indicating processing at bottom in char loop
+ static const char FINALIZE; // flag for indicating processing after char loop
+
+
+ typedef std::map<SWBuf, SWBuf> DualStringMap;
DualStringMap tokenSubMap;
DualStringMap escSubMap;
+
+ /** Sets the beginning of escape sequence (by default "&").*/
void setEscapeStart(const char *escStart);
+
+ /** Sets the end of escape sequence (by default ";").*/
void setEscapeEnd(const char *escEnd);
+
+ /** Sets the beginning of token start sequence (by default "<").*/
void setTokenStart(const char *tokenStart);
+
+ /** Sets the end of token start sequence (by default ">").*/
void setTokenEnd(const char *tokenEnd);
+
+ /** Sets whether pass thru unknown tokens unchanged or just ignore (remove) them.
+ * Default is false.*/
void setPassThruUnknownToken(bool val);
+
+ /** Sets whether pass thru unknown escape sequences unchanged or just ignore (remove) them.
+ * Default is false.*/
void setPassThruUnknownEscapeString(bool val);
+
void setTokenCaseSensitive(bool val);
void setEscapeStringCaseSensitive(bool val);
+
void addTokenSubstitute(const char *findString, const char *replaceString);
void addEscapeStringSubstitute(const char *findString, const char *replaceString);
- bool substituteToken(char **buf, const char *token);
- bool substituteEscapeString(char **buf, const char *escString);
- void pushString(char **buf, const char *format, ...);
+
+ void replaceTokenSubstitute(const char *findString, const char *replaceString);
+ void replaceEscapeStringSubstitute(const char *findString, const char *replaceString);
+
+ bool substituteToken(SWBuf &buf, const char *token);
+ bool substituteEscapeString(SWBuf &buf, const char *escString);
+
+ /** This function is called for every token encountered in the input text.
+ * @param buf the output buffer (FIXME: what is its size?)
+ * @param token the token (e.g. <code>"p align='left'"</code>
+ * @param userData FIXME: document this
+ * @return <code>false</code> if was not handled and should be handled in
+ * the default way (by just substituting).*/
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+ virtual bool processStage(char stage, SWBuf &text, char *&from, BasicFilterUserData *userData) { return false; }
+ virtual void setStageProcessing(char stages) { processStages = stages; } // see STATICs up above
- virtual bool handleToken(char **buf, const char *token, DualStringMap &userData);
- virtual bool handleEscapeString(char **buf, const char *escString, DualStringMap &userData);
+ /** This function is called for every escape sequence encountered in the input text.
+ * @param buf the output buffer (FIXME: what is its size?)
+ * @param escString the escape sequence (e.g. <code>"amp"</code> for &amp;amp;)
+ * @param userData FIXME: document this
+ * @return <code>false</code> if was not handled and should be handled in
+ * the default way (by just substituting).*/
+ virtual bool handleEscapeString(SWBuf &buf, const char *escString, BasicFilterUserData *userData);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swbuf.h b/include/swbuf.h
new file mode 100644
index 0000000..b36724f
--- /dev/null
+++ b/include/swbuf.h
@@ -0,0 +1,223 @@
+/******************************************************************************
+* swbuf.h - code for SWBuf used as a transport and utility for data buffers
+*
+* $Id: swbuf.h,v 1.27 2003/12/21 10:57:35 scribe Exp $
+*
+* Copyright 2003 CrossWire Bible Society (http://www.crosswire.org)
+* CrossWire Bible Society
+* P. O. Box 2528
+* Tempe, AZ 85280-2528
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation version 2.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+*/
+
+#ifndef SWBUF_H
+#define SWBUF_H
+
+#include <defs.h>
+#include <stdlib.h>
+#include <string.h>
+
+SWORD_NAMESPACE_START
+
+
+#define JUNKBUFSIZE 8191
+
+/**
+* This class is used as a transport and utility for data buffers.
+*/
+class SWDLLEXPORT SWBuf {
+ char *buf;
+ char *end;
+ char *endAlloc;
+ char fillByte;
+ unsigned long allocSize;
+ static char *nullStr;
+ static char junkBuf[JUNKBUFSIZE];
+
+ inline void assureMore(unsigned long pastEnd) {
+ if (endAlloc-end < pastEnd) {
+ long newsize = (end-buf)+pastEnd;
+ allocSize = newsize + 16;
+ long size = (end - buf);
+ buf = (char *)((buf) ? realloc(buf, allocSize) : malloc(allocSize));
+ end = (buf + size);
+ *end = 0;
+ endAlloc = buf + allocSize-1;
+ }
+ }
+ inline void assureSize(unsigned long newsize) {
+ if (newsize > allocSize) {
+ allocSize = newsize + 16;
+ long size = (end - buf);
+ buf = (char *)((buf) ? realloc(buf, allocSize) : malloc(allocSize));
+ end = (buf + size);
+ *end = 0;
+ endAlloc = buf + allocSize-1;
+ }
+ }
+
+ void init(unsigned long initSize);
+
+public:
+ /**
+ * SWBuf Constructor - Creates an empty SWBuf object or an SWBuf initialized
+ * to a value from a const char *
+ *
+ */
+ SWBuf(const char *initVal = 0, unsigned long initSize = 0);
+// SWBuf(unsigned long initSize);
+
+ /**
+ * SWBuf Constructor - Creates an SWBuf initialized
+ * to a value from a char
+ *
+ */
+ SWBuf(char initVal, unsigned long initSize = 0);
+
+ /**
+ * SWBuf Constructor - Creates an SWBuf initialized
+ * to a value from another SWBuf
+ *
+ */
+ SWBuf(const SWBuf &other, unsigned long initSize = 0);
+
+ inline void setFillByte(char ch) { fillByte = ch; }
+ inline char getFillByte() { return fillByte; }
+
+ /**
+ * SWBuf Destructor - Cleans up instance of SWBuf
+ */
+ virtual ~SWBuf();
+
+ /**
+ * @return a pointer to the buffer content (null-terminated string)
+ */
+ inline const char *c_str() const{ return buf; }
+
+ /**
+ * @param pos The position of the requested character.
+ * @return The character at the specified position
+ */
+ inline char &charAt(unsigned long pos) { return ((pos <= (unsigned long)(end - buf)) ? buf[pos] : nullStr[0]); }
+// inline char &charAt(unsigned int pos) { return ((buf+pos)<=end) ? buf[pos] : nullStr[0]; }
+
+ /**
+ * size() and length() return only the number of characters of the string.
+ * Add one for the following null and one for each char to be appended!
+ */
+ inline unsigned long size() const { return length(); }
+
+ /**
+ * size() and length() return only the number of characters of the string.
+ * Add one for the following null and one for each char to be appended!
+ */
+ inline unsigned long length() const { return end - buf; }
+
+ /**
+ * SWBuf::set - sets this buf to a new value.
+ * If the allocated memory is bigger than the new string, it will NOT be resized.
+ * @param newVal the value to set this buffer to.
+ */
+ void set(const char *newVal);
+
+ /**
+ * SWBuf::set - sets this buf to a new value
+ * If the allocated memory is bigger than the new string, it will NOT be resized.
+ * @param newVal the value to set this buffer to.
+ */
+ void set(const SWBuf &newVal);
+
+ /**
+ * SWBuf::setSize - Size this buffer to a specific length.
+ * @param len The new size of the buffer. One byte for the null will be added.
+ */
+ void setSize(unsigned long len);
+ inline void resize(unsigned long len) { setSize(len); }
+
+ /**
+ * SWBuf::append - appends a value to the current value of this SWBuf.
+ * If the allocated memory is not enough, it will be resized accordingly.
+ * @param str Append this.
+ * @param max Append only max chars.
+ */
+ void append(const char *str, long max = -1);
+
+ /**
+ * SWBuf::append - appends a value to the current value of this SWBuf
+ * If the allocated memory is not enough, it will be resized accordingly.
+ * @param str Append this.
+ * @param max Append only max chars.
+ */
+ inline void append(const SWBuf &str, long max = -1) { append(str.c_str(), max); }
+
+ /**
+ * SWBuf::append - appends a value to the current value of this SWBuf
+ * If the allocated memory is not enough, it will be resized accordingly.
+ * @param ch Append this.
+ */
+ inline void append(char ch) {
+ assureMore(1);
+ *end++ = ch;
+ *end = 0;
+ }
+
+ /**
+ * SWBuf::appendFormatted - appends formatted strings to the current value of this SWBuf
+ * WARNING: This function can only write at most
+ * JUNKBUFSIZE to the string per call.
+ * @param format The format string. Same syntax as printf, for example.
+ * @param ... Add all arguments here.
+ */
+ void appendFormatted(const char *format, ...);
+
+ inline char *getRawData() { return buf; } // be careful! Probably setSize needs to be called in conjunction before and maybe after
+
+ inline operator const char *() const { return c_str(); }
+ inline char &operator[](unsigned long pos) { return charAt(pos); }
+ inline char &operator[](long pos) { return charAt((unsigned long)pos); }
+ inline char &operator[](unsigned int pos) { return charAt((unsigned long)pos); }
+ inline char &operator[](int pos) { return charAt((unsigned long)pos); }
+ inline SWBuf &operator =(const char *newVal) { set(newVal); return *this; }
+ inline SWBuf &operator =(const SWBuf &other) { set(other); return *this; }
+ inline SWBuf &operator +=(const char *str) { append(str); return *this; }
+ inline SWBuf &operator +=(char ch) { append(ch); return *this; }
+ inline SWBuf &operator -=(unsigned long len) { setSize(length()-len); return *this; }
+ inline SWBuf &operator --(int) { operator -=(1); return *this; }
+
+ inline SWBuf &operator <<(int n) { n = (n<length())?n:(length()-1); memmove(buf, buf+n, length()-n); (*this)-=n; return *this; }
+ inline SWBuf operator +(const SWBuf &other) const {
+ SWBuf retVal = buf;
+ retVal += other;
+ return retVal;
+ }
+ inline SWBuf operator +(char ch) const { return (*this) + SWBuf(ch); }
+
+ inline int compare(const SWBuf &other) const { return strcmp(c_str(), other.c_str()); }
+ inline bool operator ==(const SWBuf &other) const { return !compare(other); }
+ inline bool operator !=(const SWBuf &other) const { return compare(other); }
+ inline bool operator > (const SWBuf &other) const { return compare(other) > 0; }
+ inline bool operator < (const SWBuf &other) const { return compare(other) < 0; }
+ inline bool operator <=(const SWBuf &other) const { return compare(other) <= 0; }
+ inline bool operator >=(const SWBuf &other) const { return compare(other) >= 0; }
+
+ inline bool operator ==(const char *other) const { return !compare(other); }
+ inline bool operator !=(const char *other) const { return compare(other); }
+ inline bool operator > (const char *other) const { return compare(other) > 0; }
+ inline bool operator < (const char *other) const { return compare(other) < 0; }
+ inline bool operator <=(const char *other) const { return compare(other) <= 0; }
+ inline bool operator >=(const char *other) const { return compare(other) >= 0; }
+};
+
+
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swcacher.h b/include/swcacher.h
index f62adba..d2274b9 100644
--- a/include/swcacher.h
+++ b/include/swcacher.h
@@ -2,7 +2,7 @@
* swcacher.h - definition of class SWCacher used to provide an interface for
* objects that cache and want a standard interface for cleaning up.
*
- * $Id: swcacher.h,v 1.2 2002/03/16 04:10:33 scribe Exp $
+ * $Id: swcacher.h,v 1.5 2003/08/29 06:00:16 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -25,6 +25,11 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
+/** used to provide an interface for objects that cache and want
+ * a standard interface for cleaning up.
+ */
class SWDLLEXPORT SWCacher {
public:
SWCacher();
@@ -34,4 +39,5 @@ public:
virtual long lastAccess();
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swcipher.h b/include/swcipher.h
index 4f1fe21..041860a 100644
--- a/include/swcipher.h
+++ b/include/swcipher.h
@@ -1,7 +1,7 @@
/******************************************************************************
* swcipher.h - definition of Class SWCipher used for data cipher/decipher
*
- * $Id: swcipher.h,v 1.6 2001/11/05 07:59:10 chrislit Exp $
+ * $Id: swcipher.h,v 1.8 2003/08/12 10:37:06 scribe Exp $
*
* Copyright 1999 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -26,6 +26,8 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
class SWDLLEXPORT SWCipher
{
@@ -34,16 +36,17 @@ class SWDLLEXPORT SWCipher
char *buf;
bool cipher;
- int len;
+ unsigned long len;
protected:
public:
SWCipher (unsigned char *key);
virtual void setCipherKey (const char *key);
virtual ~ SWCipher ();
- virtual char *Buf (const char *buf = 0, unsigned int len = 0);
- virtual char *cipherBuf (unsigned int *len, const char *buf = 0);
+ virtual char *Buf (const char *buf = 0, unsigned long len = 0);
+ virtual char *cipherBuf (unsigned long *len, const char *buf = 0);
virtual void Encode (void);
virtual void Decode (void);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swcom.h b/include/swcom.h
index 0bb4952..be521c9 100644
--- a/include/swcom.h
+++ b/include/swcom.h
@@ -2,7 +2,7 @@
* swcom.h - code for base class 'SWCom'. SWCom is the basis for all
* types of commentary modules
*
- * $Id: swcom.h,v 1.9 2001/12/18 04:47:40 chrislit Exp $
+ * $Id: swcom.h,v 1.13 2003/02/28 13:12:43 mgruner Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -28,24 +28,33 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
/** The basis for all commentary modules
*/
class SWDLLEXPORT SWCom : public SWModule {
public:
- /** Initializes data for instance of SWCom
- *
- * @param imodname Internal name for module
- * @param imoddesc Name to display to user for module
- * @param idisp Display object to use for displaying
- */
- SWCom(const char *imodname = 0, const char *imoddesc = 0, SWDisplay * idisp = 0, SWTextEncoding enc = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup mark = FMT_UNKNOWN, const char* ilang = 0);
- virtual ~SWCom();
- virtual SWKey *CreateKey()
- {
- return new VerseKey();
- }
-};
+ /** Initializes data for instance of SWCom
+ */
+ SWCom(const char *imodname = 0, const char *imoddesc = 0,
+ SWDisplay * idisp = 0, SWTextEncoding enc = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup mark = FMT_UNKNOWN, const char* ilang = 0);
+
+ virtual ~SWCom();
+ virtual SWKey *CreateKey() { return new VerseKey(); }
+
+ virtual long Index() const;
+ virtual long Index(long iindex);
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swcomprs.h b/include/swcomprs.h
index 034060e..094c398 100644
--- a/include/swcomprs.h
+++ b/include/swcomprs.h
@@ -1,7 +1,7 @@
/******************************************************************************
* swcomprs.h - definition of Class SWCompress used for data compression
*
- * $Id: swcomprs.h,v 1.7 2001/12/20 10:01:00 scribe Exp $
+ * $Id: swcomprs.h,v 1.8 2002/10/01 19:52:40 dglassey Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -24,6 +24,8 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
class SWDLLEXPORT SWCompress
{
void Init ();
@@ -42,4 +44,5 @@ public:
virtual void Decode (void); // override to provide compression algorythm
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swconfig.h b/include/swconfig.h
index 8e37d2c..f508a53 100644
--- a/include/swconfig.h
+++ b/include/swconfig.h
@@ -2,7 +2,7 @@
* swconfig.h - definition of Class SWConfig used for saving and retrieval
* of configuration information
*
- * $Id: swconfig.h,v 1.16 2002/03/19 23:59:41 scribe Exp $
+ * $Id: swconfig.h,v 1.22 2003/06/27 01:41:06 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -25,67 +25,65 @@
#include <stdio.h>
-#include <string>
#include <map>
#include <defs.h>
#include <multimapwdef.h>
+#include <swbuf.h>
-using namespace std;
+SWORD_NAMESPACE_START
-
-
-typedef multimapwithdefault < string, string, less < string > >ConfigEntMap;
-typedef map < string, ConfigEntMap, less < string > >SectionMap;
+typedef multimapwithdefault < SWBuf, SWBuf, std::less < SWBuf > >ConfigEntMap;
+typedef std::map < SWBuf, ConfigEntMap, std::less < SWBuf > >SectionMap;
/** The class to read and save settings using a file on disk.
*
*/
-class SWDLLEXPORT SWConfig
-{
+class SWDLLEXPORT SWConfig {
private:
- char getline (FILE * fp, string & line);
+ char getline(FILE * fp, SWBuf & line);
public:
- /** The filename used by this SWConfig object
- *
- */
- string filename;
- /** Map of available sections
- * The map of available sections.
- */
- SectionMap Sections;
-
- /** Constructor of SWConfig
- * @param ifilename The file, which should be used for this config.
- */
- SWConfig (const char *ifilename);
- virtual ~ SWConfig ();
+ /** The filename used by this SWConfig object
+ *
+ */
+ SWBuf filename;
+ /** Map of available sections
+ * The map of available sections.
+ */
+ SectionMap Sections;
- /** Load from disk
- * Load the contzent from disk.
- */
- virtual void Load ();
+ /** Constructor of SWConfig
+ * @param ifilename The file, which should be used for this config.
+ */
+ SWConfig(const char *ifilename);
+ virtual ~SWConfig();
- /** Save to disk
- * Save the content of this config object to disk.
- */
- virtual void Save ();
+ /** Load from disk
+ * Load the contzent from disk.
+ */
+ virtual void Load();
- /** Merges the values of addFrom
- * @param The config which values should be merged to this config object. Already existing values will be overwritten.
- */
- virtual SWConfig & operator += (SWConfig & addFrom);
+ /** Save to disk
+ * Save the content of this config object to disk.
+ */
+ virtual void Save();
- /** Get a section
- * This is an easy way to get and store config values.
- * The following will work:\n
- *
- * @code
- * SWConfig config("/home/user/.setttings");
- * config["Colors"]["Background"] = "red";
- * @endcode
- */
- virtual ConfigEntMap & operator [] (const char *section);
-};
+ /** Merges the values of addFrom
+ * @param addFrom The config which values should be merged to this config object. Already existing values will be overwritten.
+ */
+ virtual void augment(SWConfig &addFrom);
+ virtual SWConfig & operator +=(SWConfig &addFrom) { augment(addFrom); return *this; }
+ /** Get a section
+ * This is an easy way to get and store config values.
+ * The following will work:\n
+ *
+ * @code
+ * SWConfig config("/home/user/.setttings");
+ * config["Colors"]["Background"] = "red";
+ * @endcode
+ */
+ virtual ConfigEntMap & operator [](const char *section);
+ };
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swdisp.h b/include/swdisp.h
index 4e3ef61..0a1b468 100644
--- a/include/swdisp.h
+++ b/include/swdisp.h
@@ -2,7 +2,7 @@
* swdisp.h - code for base class 'swdisp'. swdisp is the basis for all
* types of displays (e.g. raw textout, curses, xwindow, etc.)
*
- * $Id: swdisp.h,v 1.5 2001/03/23 22:15:14 jansorg Exp $
+ * $Id: swdisp.h,v 1.8 2002/10/01 19:52:40 dglassey Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -23,17 +23,20 @@
#ifndef SWDISP_H
#define SWDISP_H
+#include <swobject.h>
#include <defs.h>
+SWORD_NAMESPACE_START
+
class SWModule;
/** swdisp is the basis for all types of displays
* (e.g. raw textout, curses, xwindow, etc.)
*/
-class SWDLLEXPORT SWDisplay
-{
+class SWDLLEXPORT SWDisplay : public SWObject {
+ static SWClass classdef;
public:
- SWDisplay () {};
+ SWDisplay () { myclass = &classdef; };
/** casts a module to a character pointer and displays it to
* raw output (overriden for different display types and
* module types if necessary)
@@ -43,4 +46,6 @@ public:
*/
virtual char Display (SWModule & imodule);
};
+
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swdisprtf.h b/include/swdisprtf.h
index 170a674..f8b78e7 100644
--- a/include/swdisprtf.h
+++ b/include/swdisprtf.h
@@ -2,7 +2,7 @@
* swdisprtf.h - definition of Class SWDispRTF-- an SWDisplay used to display
* a verse in Rich Text Format.
*
- * $Id: swdisprtf.h,v 1.8 2001/08/15 02:40:12 dtrotzjr Exp $
+ * $Id: swdisprtf.h,v 1.10 2002/07/30 11:33:17 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -31,9 +31,7 @@
#include <vcl\ComCtrls.hpp>
#include <vcl\StdCtrls.hpp>
#include <swtext.h>
-#ifndef USEOLDRTF
-#include <RxRichEdit.hpp>
-#endif
+#include "RxRichEditX.h"
//---------------------------------------------------------------------------
#define defRTFHeader "{\\rtf1\\ansi{\\fonttbl{\\f0\\froman\\fcharset0\\fprq2 Times New Roman;}{\\f1\\froman\\fcharset0\\fprq2 Times New Roman;}{\\f2\\froman\\fcharset0\\fprq2 Times New Roman;}{\\f3\\froman\\fcharset0\\fprq2 Times New Roman;}{\\f4\\froman\\fcharset0\\fprq2 Times New Roman;}{\\f7\\froman\\fcharset2\\fprq2 Symbol;}{\\f8\\froman\\fcharset2\\fprq2 Symbol;}}{\\colortbl;\\red0\\green0\\blue255;\\red0\\green200\\blue50;\\red0\\green0\\blue255;\\red0\\green200\\blue50;\\red0\\green0\\blue255;\\red255\\green0\\blue0;} "
@@ -49,23 +47,9 @@
#define defRTFVersePre "{\\fs%d" // 24
#define defRTFVersePost " }"
-#ifndef USEOLDRTF
-class SWDispRTF:public TRxRichEdit
-#else
-class SWDispRTF:public TRichEdit
-#endif
-{
+class SWDispRTF : public TRxRichEditX {
protected:
- System::AnsiString FRTFHeader;
- System::AnsiString FRTFHeadMargin;
- System::AnsiString FRTFTrailer;
- System::AnsiString FRTFChapterMarkPre;
- System::AnsiString FRTFChapterMarkPost;
- System::AnsiString FRTFVerseMarkPre;
- System::AnsiString FRTFVerseMarkPost;
- System::AnsiString FRTFVersePre;
- System::AnsiString FRTFVersePost;
bool FExpandNewLine;
CHARRANGE FCharRange;
int fontSize;
@@ -74,38 +58,16 @@ protected:
void __fastcall SetMySelStart (int iselstart);
int __fastcall getFontSize ();
void __fastcall setFontSize (int iFontSize);
- void recalcHeaders ();
protected:
TMemoryStream * RTFStream;
virtual void __fastcall Loaded (void);
public:
- __fastcall SWDispRTF (TComponent * Owner);
+ __fastcall SWDispRTF (TWinControl *Owner);
__fastcall ~ SWDispRTF ();
virtual char Display (SWModule & imodule);
- __published:__property System::AnsiString RTFHeader =
- {
- read = FRTFHeader, write = FRTFHeader};
- __property System::AnsiString RTFHeadMargin = { read =
- FRTFHeadMargin, write = FRTFHeadMargin };
- __property System::AnsiString RTFChapterMarkPre = { read =
- FRTFChapterMarkPre, write = FRTFChapterMarkPre };
- __property System::AnsiString RTFChapterMarkPost = { read =
- FRTFChapterMarkPost, write = FRTFChapterMarkPost };
- __property System::AnsiString RTFVerseMarkPre = { read =
- FRTFVerseMarkPre, write = FRTFVerseMarkPre };
- __property System::AnsiString RTFVerseMarkPost = { read =
- FRTFVerseMarkPost, write = FRTFVerseMarkPost };
- __property System::AnsiString RTFVersePre = { read = FRTFVersePre, write =
- FRTFVersePre };
- __property System::AnsiString RTFVersePost = { read = FRTFVersePost, write =
- FRTFVersePost };
- __property System::AnsiString RTFTrailer = { read = FRTFTrailer, write =
- FRTFTrailer };
- __property bool ExpandNewLine = { read = FExpandNewLine, write =
- FExpandNewLine };
- __property int FontSize = { read = getFontSize, write = setFontSize };
+ __property bool ExpandNewLine = { read = FExpandNewLine, write = FExpandNewLine };
};
//---------------------------------------------------------------------------
diff --git a/include/swdisprtfchap.h b/include/swdisprtfchap.h
index ca7b154..2a0b3d9 100644
--- a/include/swdisprtfchap.h
+++ b/include/swdisprtfchap.h
@@ -2,7 +2,7 @@
* swdisprtfchap.h - definition of class SWDispRTFChap, an SWDisplay used to
* display an entire chapter in Rich Text Format
*
- * $Id: swdisprtfchap.h,v 1.3 2001/11/08 13:20:24 chrislit Exp $
+ * $Id: swdisprtfchap.h,v 1.5 2002/07/30 11:33:17 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -33,33 +33,18 @@
#include <swtext.h>
#include <swdisprtf.h>
//---------------------------------------------------------------------------
-
-class SWDispRTFChap:public SWDispRTF
-{
+class SWDispRTFChap_init;
+class SWDispRTFChap:public SWDispRTF {
protected:
-
- bool FCurVerseMrk;
- bool FCurVersePos;
- bool FMarkCurrentVerse;
- bool FAutoPosition;
-
- char platformID;
-
- virtual void __fastcall Loaded (void);
+ virtual void __fastcall Loaded (void);
public:
- __fastcall SWDispRTFChap (TComponent * Owner);
- __fastcall ~ SWDispRTFChap ();
+ static char platformID;
+ static SWDispRTFChap_init _init;
+
+ __fastcall SWDispRTFChap(TWinControl *Owner);
+ __fastcall ~ SWDispRTFChap();
- virtual char Display (SWModule & imodule);
- __published:__property bool CurVersePos =
- {
- read = FCurVersePos, write = FCurVersePos, default = true};
- __property bool CurVerseMrk = { read = FCurVerseMrk, write =
- FCurVerseMrk, default = true };
- __property bool MarkCurrentVerse = { read = FMarkCurrentVerse, write =
- FMarkCurrentVerse, default = true };
- __property bool AutoPosition = { read = FAutoPosition, write =
- FAutoPosition, default = true };
+ virtual char Display(SWModule & imodule);
};
//---------------------------------------------------------------------------
diff --git a/include/swfilter.h b/include/swfilter.h
index 68a67a4..403e094 100644
--- a/include/swfilter.h
+++ b/include/swfilter.h
@@ -2,7 +2,7 @@
* swfilter.h - definition of class SWFilter used to filter text between
* different formats
*
- * $Id: swfilter.h,v 1.13 2001/12/11 22:35:10 scribe Exp $
+ * $Id: swfilter.h,v 1.17 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -22,87 +22,69 @@
#ifndef SWFILTER_H
#define SWFILTER_H
-#include <string>
+
+#include <defs.h>
+#include <swbuf.h>
#include <list>
#include <swkey.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
/**
* The type definitoin for option types
*/
-typedef std::list < std::string > OptionsList;
+typedef std::list < SWBuf > StringList;
+class SWModule;
/** Base class for all filters in sword.
* Filters are used to filter/convert text between different formats
* like GBF, HTML, RTF ...
*/
-class SWModule;
-
class SWDLLEXPORT SWFilter {
public:
- virtual ~SWFilter() {}
- /** the type definition for option lists,
- * see @ref getOptionValues
- */
-// typedef std::list < std::string > OptionsList;
- /** gets the name of the option of this filter
- * @return option name
- */
- virtual const char * getOptionName ()
- {
- return 0;
- }
- /** gets a short explanation of the option of this filter;
- * it could be presented to the user in frontend programs
- * @return option tip/explanation
- */
- virtual const char * getOptionTip ()
- {
- return 0;
- }
- /** returns a list of the possible option values
- * might be
- * @return list of option values
- */
- virtual OptionsList getOptionValues ()
- {
- OptionsList options;
- return options;
- }
- /** sets the value of the option of this filter,
- * e.g maybe a strong's filter mioght be set to "on" / "off" -
- * that would mean to show or not to show the strongs in the text,
- * see also @ref getOptionValues
- * @param ival the new option valus
- */
- virtual void setOptionValue (const char *)
- {
- }
- virtual const char * getOptionValue ()
- {
- return 0;
- }
- /** This is the main filter function
- * @param text the text to be filtered/converted
- * @param maxlen maximal length of text to be processed
- * @param key sorry I don't know
- * @return 0
- */
- virtual char ProcessText(char *text, int maxlen, const SWKey *, const SWModule * = 0)
- {
- return ProcessText(text, maxlen);
- }
- /** This is the main filter function without the 3rd parameter
- * @param text the text to be filtered/converted
- * @param maxlen maximal length of text to be processed
- * @return 0
- */
- virtual char ProcessText(char *text, int maxlen = -1)
- {
- return ProcessText(text, maxlen, 0);
- }
+ virtual ~SWFilter() {}
+
+ /** gets the name of the option of this filter
+ * @return option name
+ */
+ virtual const char *getOptionName () { return 0; }
+
+ /** gets a short explanation of the option of this filter;
+ * it could be presented to the user in frontend programs
+ * @return option tip/explanation
+ */
+ virtual const char *getOptionTip () { return 0; }
+
+ /** returns a list of the possible option values
+ *
+ * @return list of option values
+ */
+ virtual StringList getOptionValues () {
+ StringList options;
+ return options;
+ }
+
+ /** @return The value of the current option.
+ */
+ virtual const char *getOptionValue () { return 0; }
+
+ /** sets the value of the option of this filter,
+ * e.g maybe a strong's filter mioght be set to "on" / "off" -
+ * that would mean to show or not to show the strongs in the text,
+ * see also getOptionValues()
+ * @param ival the new option valus
+ */
+ virtual void setOptionValue (const char *ival) { }
+
+ /** This is the main filter function
+ * @param text The text to be filtered/converted
+ * @param key Current key That was used.
+ * @param module Current module.
+ * @return 0
+ */
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0) = 0;
};
+ SWORD_NAMESPACE_END
#endif
diff --git a/include/swfiltermgr.h b/include/swfiltermgr.h
index 6de765b..6b93cf3 100644
--- a/include/swfiltermgr.h
+++ b/include/swfiltermgr.h
@@ -2,7 +2,7 @@
* swfiltermgr.h - definition of class SWFilterMgr used as an interface to
* manage filters on a module
*
- * $Id: swfiltermgr.h,v 1.1 2001/11/30 21:05:41 scribe Exp $
+ * $Id: swfiltermgr.h,v 1.3 2003/03/04 11:35:52 mgruner Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -30,9 +30,12 @@
#include <defs.h>
-class SWMgr;
+SWORD_NAMESPACE_START
+class SWMgr;
+/** Class to manage different kinds of filters.
+*/
class SWDLLEXPORT SWFilterMgr {
private:
@@ -78,5 +81,5 @@ public:
virtual void AddRawFilters (SWModule * module, ConfigEntMap & section);
};
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swgenbook.h b/include/swgenbook.h
index b619dca..74047ba 100644
--- a/include/swgenbook.h
+++ b/include/swgenbook.h
@@ -1,8 +1,7 @@
/******************************************************************************
-* swld.h - code for base class 'SWLD'. SWLD is the basis for all
-* types of Lexicon and Dictionary modules (hence the 'LD').
+* swgenbook.h
*
-* $Id: swgenbook.h,v 1.1 2002/01/24 08:55:27 scribe Exp $
+* $Id: swgenbook.h,v 1.5 2003/03/04 22:32:55 mgruner Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -28,24 +27,32 @@
#include <defs.h>
-/** the basis for all types of Lexicon and
-* Dictionary modules (hence the 'LD').
+SWORD_NAMESPACE_START
+
+/** The basis for all Book modules.
*/
-class SWDLLEXPORT SWGenBook:public SWModule {
+class SWDLLEXPORT SWGenBook : public SWModule {
protected:
char *entkeytxt;
public:
- /** Initializes data for instance of SWLD
- *
- * @param imodname Internal name for module
- * @param imoddesc Name to display to user for module
- * @param idisp Display object to use for displaying
+ /** Initializes data for instance of SWGenBook
*/
- SWGenBook(const char *imodname = 0, const char *imoddesc = 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
+ SWGenBook(const char *imodname = 0, const char *imoddesc = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
+
virtual ~SWGenBook();
virtual SWKey *CreateKey() = 0;
+
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swinputmeth.h b/include/swinputmeth.h
index 05eed88..97a67f6 100644
--- a/include/swinputmeth.h
+++ b/include/swinputmeth.h
@@ -10,6 +10,9 @@
#ifndef SWINPUTMETHOD_H
#define SWINPUTMETHOD_H
+#include <defs.h>
+SWORD_NAMESPACE_START
+
class SWInputMethod {
private:
@@ -27,4 +30,5 @@ public:
virtual void clearState();
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/Makefile.in b/include/swinstallmgr.h
index e69de29..e69de29 100644
--- a/include/Makefile.in
+++ b/include/swinstallmgr.h
diff --git a/include/swkey.h b/include/swkey.h
index a4783d7..56ea970 100644
--- a/include/swkey.h
+++ b/include/swkey.h
@@ -3,7 +3,7 @@
* types of keys for indexing into modules (e.g. verse, word,
* place, etc.)
*
- * $Id: swkey.h,v 1.14 2002/03/22 05:26:34 scribe Exp $
+ * $Id: swkey.h,v 1.24 2003/02/28 13:12:43 mgruner Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -28,39 +28,34 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
#define KEYERR_OUTOFBOUNDS 1
#define SWKEY_OPERATORS \
- SWKey & operator = (const char *ikey) { setText(ikey); return *this; } \
- SWKey & operator = (const SWKey &ikey) { copyFrom(ikey); return *this; } \
- SWKey & operator = (SW_POSITION pos) { setPosition(pos); return *this; } \
+ SWKey & operator =(const char *ikey) { setText(ikey); return *this; } \
+ SWKey & operator =(const SWKey &ikey) { copyFrom(ikey); return *this; } \
+ SWKey & operator =(SW_POSITION pos) { setPosition(pos); return *this; } \
operator const char *() const { return getText(); } \
- bool operator == (const SWKey & ikey) { return equals(ikey); } \
- bool operator != (const SWKey & ikey) { return !equals(ikey); } \
- virtual bool operator > (const SWKey & ikey) { return (compare (ikey) > 0); } \
- virtual bool operator < (const SWKey & ikey) { return (compare (ikey) < 0); } \
- virtual bool operator >= (const SWKey & ikey) { return (compare (ikey) > -1); } \
- virtual bool operator <= (const SWKey & ikey) { return (compare (ikey) < 1); } \
- SWKey & operator -= (int steps) { decrement(steps); return *this; } \
- SWKey & operator += (int steps) { increment(steps); return *this; } \
- SWKey & operator++ (int) { return *this += 1; } \
- SWKey & operator-- (int) { return *this -= 1; }
+ bool operator ==(const SWKey & ikey) { return equals(ikey); } \
+ bool operator !=(const SWKey & ikey) { return !equals(ikey); } \
+ virtual bool operator >(const SWKey & ikey) { return (compare(ikey) > 0); } \
+ virtual bool operator <(const SWKey & ikey) { return (compare(ikey) < 0); } \
+ virtual bool operator >=(const SWKey & ikey) { return (compare(ikey) > -1); } \
+ virtual bool operator <=(const SWKey & ikey) { return (compare(ikey) < 1); } \
+ SWKey & operator -=(int steps) { decrement(steps); return *this; } \
+ SWKey & operator +=(int steps) { increment(steps); return *this; } \
+ SWKey & operator++(int) { return *this += 1; } \
+ SWKey & operator--(int) { return *this -= 1; }
// For use with = operator to position key.
-class SW_POSITION
-{
- char pos;
+class SW_POSITION {
+ char pos;
public:
- SW_POSITION (char ipos)
- {
- pos = ipos;
- }
- operator char ()
- {
- return pos;
- }
+ SW_POSITION(char ipos) { pos = ipos; }
+ operator char() { return pos; }
};
#define POS_TOP ((char)1)
@@ -73,140 +68,149 @@ public:
* types of keys for indexing into modules (e.g. verse, word,
* place, etc.)
*/
-class SWDLLEXPORT SWKey:public SWObject
-{
- long index;
- static SWClass classdef;
- void init ();
+class SWDLLEXPORT SWKey : public SWObject {
+ long index;
+ static SWClass classdef;
+ void init();
protected:
- char *keytext;
- char persist;
- char error;
+ char *keytext;
+ mutable char *rangeText;
+ mutable bool boundSet;
+ char persist;
+ char error;
public:
- /** initializes instance of SWKey
- *
- * @param ikey text key
- */
- SWKey (const char *ikey = 0);
-
- /** Copy Constructor
- * @param The SWKey object to copy.
- */
- SWKey (SWKey const &k);
-
- /** Destructor, cleans up this instance of SWKey
- */
- virtual ~ SWKey ();
-
- /** Returns a copy of this SWKey object.
- * This is useful to get a 1:1 copy of an SWKey based object.
- * @return SWKey
- */
- virtual SWKey *clone () const;
-
- /** Gets whether this object itself persists within a
- * module that it was used to SetKey or just a copy.
- * (1 - persists in module; 0 - a copy is attempted
- *
- * @return value of persist
- */
- char Persist () const;
-
- /** Set/gets whether this object itself persists within a
- * module that it was used to SetKey or just a copy.
- * (1 - persists in module; 0 - a copy is attempted
- *
- * @param ipersist value which to set persist;
- * [-1] - only get
- * @return value of persist
- */
- char Persist (signed char ikey);
-
- /** Gets and clears error status
- *
- * @return error status
- */
- virtual char Error ();
-
- /** Equates this SWKey to a character string
- *
- * @param ikey string to set this key to
- */
- virtual void setText(const char *ikey);
-
- /** Equates this SWKey to another SWKey object
- *
- * @param ikey other swkey object
- */
- virtual void copyFrom(const SWKey &ikey);
-
- /** returns text key if (char *) cast is requested
- */
- virtual const char *getText() const;
-
- /** Compares another VerseKey object
- *
- * @param ikey key to compare with this one
- * @return >0 if this key is greater than compare key;
- * <0 if this key is smaller than compare key;
- * 0 if the keys are the same
- */
- virtual int compare (const SWKey & ikey);
-
- /** Compares another VerseKey object
- *
- * @param ikey key to compare with this one
- * @return true if the keys are the same
- */
- virtual bool equals(const SWKey &ikey) { return !compare(ikey); }
-
- virtual void setPosition(SW_POSITION);
-
- /** Decrements key a number of entries
- *
- * @param steps Number of entries to jump backward
- * @return *this
- */
- virtual void decrement(int steps = 1);
-
- /** Increments key a number of entries
- *
- * @param increment Number of entries to jump forward
- * @return *this
- */
- virtual void increment(int steps = 1);
-
- virtual char Traversable () { return 0; }
-
- /** Use this function to get te current position withing a module.
- * Here's a small example how to use this function and @ref Index(long).
- * This function uses the GerLut module and chooses a random verse from the
- * Bible and returns it.
- * @code
- * const char* randomVerse() {
- * VerseKey vk;
- * SWMgr mgr;
- * LocaleMgr::systemLocaleMgr.setDefaultLocaleName("de");
- *
- * SWModule* module = mgr->Modules("GerLut");
- * srand( time(0) );
- * const double newIndex = (double(rand())/RAND_MAX)*(24108+8224);
- * vk.Index(newIndex);
- * module->SetKey(vk);
- *
- * char* text;
- * sprintf(text, "%s: %s",(const char*)vk ,module->StripText(&vk));
- * return text;
- * @endcode
- */
- virtual long Index () const { return index; }
- virtual long Index (long iindex) { index = iindex; return index; }
-
- SWKEY_OPERATORS
-
-};
-
+ // misc pointer for whatever
+ void *userData;
+
+ /** initializes instance of SWKey
+ *
+ * @param ikey Initialize from text key.
+ */
+ SWKey(const char *ikey = 0);
+
+ /** Copy Constructor
+ * @param k The SWKey object to copy.
+ */
+ SWKey(SWKey const &k);
+
+ /** Destructor, cleans up this instance of SWKey
+ */
+ virtual ~SWKey();
+
+ /** Returns a copy of this SWKey object.
+ * This is useful to get a 1:1 copy of an SWKey based object.
+ * @return SWKey
+ */
+ virtual SWKey *clone() const;
+
+ /** Gets whether this object itself persists within a
+ * module that it was used to setKey or just a copy.
+ * (1 - persists in module; 0 - a copy is attempted
+ *
+ * @return value of persist
+ */
+ char Persist() const;
+
+ /** Set/gets whether this object itself persists within a
+ * module that it was used to setKey or just a copy.
+ * (1 - persists in module; 0 - a copy is attempted
+ *
+ * @param ipersist value which to set persist;
+ * [-1] - only get
+ * @return value of persist
+ */
+ char Persist(signed char ipersist);
+
+ /** Gets and clears error status
+ *
+ * @return error status
+ */
+ virtual char Error();
+
+ /** Equates this SWKey to a character string
+ *
+ * @param ikey string to set this key to
+ */
+ virtual void setText(const char *ikey);
+
+ /** Equates this SWKey to another SWKey object
+ *
+ * @param ikey other swkey object
+ */
+ virtual void copyFrom(const SWKey &ikey);
+
+ /** returns text key if (char *) cast is requested
+ */
+ virtual const char *getText() const;
+ virtual const char *getShortText() const { return getText(); }
+ virtual const char *getRangeText() const;
+ virtual bool isBoundSet() const { return boundSet; }
+
+ /** Compares another VerseKey object
+ *
+ * @param ikey key to compare with this one
+ * @return >0 if this key is greater than compare key;
+ * <0 if this key is smaller than compare key;
+ * 0 if the keys are the same
+ */
+ virtual int compare(const SWKey & ikey);
+
+ /** Compares another VerseKey object
+ *
+ * @param ikey key to compare with this one
+ * @return true if the keys are the same
+ */
+ virtual bool equals(const SWKey &ikey) { return !compare(ikey); }
+
+ virtual void setPosition(SW_POSITION);
+
+ /** Decrements key a number of entries
+ *
+ * @param steps Number of entries to jump backward
+ * @return *this
+ */
+ virtual void decrement(int steps = 1);
+
+ /** Increments key a number of entries
+ *
+ * @param steps Number of entries to jump forward
+ * @return *this
+ */
+ virtual void increment(int steps = 1);
+
+ virtual char Traversable() { return 0; }
+
+ /** Use this function to get te current position withing a module.
+ * Here's a small example how to use this function and @ref Index(long).
+ * This function uses the GerLut module and chooses a random verse from the
+ * Bible and returns it.
+ * @code
+ * const char* randomVerse() {
+ * VerseKey vk;
+ * SWMgr mgr;
+ * LocaleMgr::systemLocaleMgr.setDefaultLocaleName("de");
+ *
+ * SWModule* module = mgr->Modules("GerLut");
+ * srand( time(0) );
+ * const double newIndex = (double(rand())/RAND_MAX)*(24108+8224);
+ * vk.Index(newIndex);
+ * module->setKey(vk);
+ *
+ * char* text;
+ * sprintf(text, "%s: %s",(const char*)vk ,module->StripText(&vk));
+ * return text;
+ * @endcode
+ */
+
+ virtual long Index() const { return index; }
+ virtual long Index(long iindex) { index = iindex; return index; }
+
+ SWKEY_OPERATORS
+
+ };
+
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swld.h b/include/swld.h
index aa7d020..a6c8e3a 100644
--- a/include/swld.h
+++ b/include/swld.h
@@ -2,7 +2,7 @@
* swld.h - code for base class 'SWLD'. SWLD is the basis for all
* types of Lexicon and Dictionary modules (hence the 'LD').
*
- * $Id: swld.h,v 1.10 2001/12/18 04:47:40 chrislit Exp $
+ * $Id: swld.h,v 1.14 2003/02/28 13:12:43 mgruner Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -28,34 +28,40 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
/** the basis for all types of Lexicon and
* Dictionary modules (hence the 'LD').
*/
-class SWDLLEXPORT SWLD:public SWModule
-{
+class SWDLLEXPORT SWLD : public SWModule {
protected:
- char *entkeytxt;
+ char *entkeytxt;
public:
- /** Initializes data for instance of SWLD
- *
- * @param imodname Internal name for module
- * @param imoddesc Name to display to user for module
- * @param idisp Display object to use for displaying
- */
- SWLD (const char *imodname = 0, const char *imoddesc = 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
- virtual ~ SWLD ();
- virtual SWKey *CreateKey ()
- {
- return new StrKey ();
- }
- /** Sets/gets module KeyText, getting from saved text if key is persistent
- *
- * @param ikeytext value which to set keytext;
- * [0] - only get
- * @return pointer to keytext
- */
- virtual const char *KeyText (const char *ikeytext);
-};
+ /** Initializes data for instance of SWLD
+ */
+ SWLD(const char *imodname = 0, const char *imoddesc = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
+
+ virtual ~SWLD();
+ virtual SWKey *CreateKey() { return new StrKey(); }
+ /** Sets/gets module KeyText, getting from saved text if key is persistent
+ *
+ * @param ikeytext value which to set keytext;
+ * [0] - only get
+ * @return pointer to keytext
+ */
+ virtual const char *KeyText(const char *ikeytext = 0);
+ virtual void setPosition(SW_POSITION pos);
+
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swlocale.h b/include/swlocale.h
index c35089a..8f50edb 100644
--- a/include/swlocale.h
+++ b/include/swlocale.h
@@ -2,7 +2,7 @@
* swlocale.h - definition of Class SWLocale used for retrieval
* of locale lookups
*
- * $Id: swlocale.h,v 1.6 2001/03/23 22:15:14 jansorg Exp $
+ * $Id: swlocale.h,v 1.11 2003/06/27 01:41:06 scribe Exp $
*
* Copyright 2000 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -23,7 +23,6 @@
#ifndef SWLOCALE_H
#define SWLOCALE_H
-#include <string>
#include <map>
#include <swconfig.h>
@@ -31,9 +30,9 @@
#include <defs.h>
-using namespace std;
+SWORD_NAMESPACE_START
-typedef map < string, string, less < string > >LookupMap;
+typedef std::map < SWBuf, SWBuf, std::less < SWBuf > >LookupMap;
/** SWLocale is used for the localisation of the booknames
* The SWLocale is a class which holds the information of one language.
@@ -41,33 +40,34 @@ typedef map < string, string, less < string > >LookupMap;
* get the name of the Language using @see getname of this class.
* Another functions useful for frontend developers is @see getDescription.
*/
-class SWDLLEXPORT SWLocale
-{
- LookupMap lookupTable;
- SWConfig *localeSource;
- char *name;
- char *description;
- struct abbrev *bookAbbrevs;
- char *BMAX;
- struct sbook **books;
+class SWDLLEXPORT SWLocale {
+ LookupMap lookupTable;
+ SWConfig *localeSource;
+ char *name;
+ char *description;
+ struct abbrev *bookAbbrevs;
+ char *BMAX;
+ struct sbook **books;
public:
- SWLocale (const char *ifilename);
- virtual ~ SWLocale ();
+ SWLocale(const char *ifilename);
+ virtual ~SWLocale();
- /**
- * This function is used to get the name of the languages which this object is handling.
- * @return The name of the managed language. A possible example is "de".
- */
- virtual const char *getName ();
- /**
- * @return The description. A possible example is "German".
- */
- virtual const char *getDescription ();
- virtual const char *translate (const char *text);
- virtual SWLocale & operator += (SWLocale & addFrom);
- virtual const struct abbrev *getBookAbbrevs ();
- virtual void getBooks (char **iBMAX, struct sbook ***ibooks);
+ /**
+ * This function is used to get the name of the languages which this object is handling.
+ * @return The name of the managed language. A possible example is "de".
+ */
+ virtual const char *getName();
+ /**
+ * @return The description. A possible example is "German".
+ */
+ virtual const char *getDescription();
+ virtual const char *translate(const char *text);
+ virtual void augment(SWLocale &addFrom);
+ virtual SWLocale & operator +=(SWLocale &addFrom) { augment(addFrom); return *this; }
+ virtual const struct abbrev *getBookAbbrevs();
+ virtual void getBooks(char **iBMAX, struct sbook ***ibooks);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swlog.h b/include/swlog.h
index 9925a83..a836c8f 100644
--- a/include/swlog.h
+++ b/include/swlog.h
@@ -1,7 +1,7 @@
/******************************************************************************
* swlog.h - definition of class SWLog used for logging messages
*
- * $Id: swlog.h,v 1.3 2001/02/09 15:38:51 jansorg Exp $
+ * $Id: swlog.h,v 1.5 2002/10/01 19:52:40 dglassey Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -26,21 +26,23 @@
#include <defs.h>
-class SWDLLEXPORT SWLog
-{
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT SWLog {
+protected:
+ char logLevel;
+
public:
- static SWLog *systemlog;
+ static SWLog *systemlog;
- bool log;
- SWLog ()
- {
- log = true;
- }
- virtual void LogWarning (char *fmt, ...);
- virtual void LogError (char *fmt, ...);
- virtual void LogTimedInformation (char *fmt, ...);
- virtual void LogInformation (char *fmt, ...);
+ SWLog () { logLevel = 1; /*default to show only errors*/}
+ virtual void setLogLevel(char level) { logLevel = level; }
+ virtual char getLogLevel() { return logLevel; }
+ virtual void LogWarning (char *fmt, ...);
+ virtual void LogError (char *fmt, ...);
+ virtual void LogTimedInformation (char *fmt, ...);
+ virtual void LogInformation (char *fmt, ...);
};
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swmacs.h b/include/swmacs.h
index ea9f8d3..de5fa38 100644
--- a/include/swmacs.h
+++ b/include/swmacs.h
@@ -1,7 +1,7 @@
/******************************************************************************
* swmacs.h - generic macros
*
- * $Id: swmacs.h,v 1.1.1.1 1999/05/04 22:03:36 scribe Exp $
+ * $Id: swmacs.h,v 1.2 2002/10/01 19:52:40 dglassey Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -22,9 +22,11 @@
#ifndef SWMACS_H
#define SWMACS_H
+#include <defs.h>
+SWORD_NAMESPACE_START
// Maximum positive value of a signed numeric type
#define MAXPOS(x) ((x)((unsigned x)(1L << (sizeof(x)*8-1)) - 1))
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swmgr.h b/include/swmgr.h
index 96fbcee..bf79ad0 100644
--- a/include/swmgr.h
+++ b/include/swmgr.h
@@ -1,26 +1,26 @@
/******************************************************************************
- * swmgr.h - definition of class SWMgr used to interact with an install
- * base of sword modules.
- *
- * $Id: swmgr.h,v 1.42 2002/03/22 05:26:34 scribe Exp $
- *
- * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
- * CrossWire Bible Society
- * P. O. Box 2528
- * Tempe, AZ 85280-2528
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- */
+* swmgr.h - definition of class SWMgr used to interact with an install
+* base of sword modules.
+*
+* $Id: swmgr.h,v 1.55 2003/07/05 04:58:42 scribe Exp $
+*
+* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+* CrossWire Bible Society
+* P. O. Box 2528
+* Tempe, AZ 85280-2528
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation version 2.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+*/
-/** @mainpage The Sword Project 1.5.3 - API documentation
+/** @mainpage The Sword Project - API documentation
* This is the API documentation of the Sword project.
* it describes the structure of the Sword library and documents the functions of the classes.
* From time to time this documentation gives programming examples, too.
@@ -33,14 +33,13 @@
* Well knwon frontends are:\n
* -BibleCS for Windows (the sourcecode is availble in the CVS of crosswire.org)\n
* -GnomeSword (http://gnomesword.sourceforge.net/)\n
-* -BibleTime (http://www.bibletime.de/)\n
+* -BibleTime (http://www.bibletime.info/)\n
*/
#ifndef SWMGR_H
#define SWMGR_H
#include <sys/types.h>
-#include <string>
#include <map>
#include <list>
#include <swmodule.h>
@@ -50,241 +49,250 @@
#include <defs.h>
-using namespace std;
+SWORD_NAMESPACE_START
-typedef map < string, SWModule *, less < string > >ModMap;
-typedef list < string > OptionsList;
-typedef map < string, SWFilter * >FilterMap;
+typedef std::map < SWBuf, SWModule *, std::less < SWBuf > >ModMap;
+typedef std::map < SWBuf, SWFilter * >FilterMap;
+typedef std::list < SWBuf >StringList;
/** SWMgr is the main class of the Sword library.
- *
- * SWmgr manages the installed modules, the filters and global options like footnotes or strong numbers.
- * The class SWMgr is the most important class of Sword. It is used to manage the installed modules.
- * It also manages the filters (Render-, Strip- and Rawfilters).
- *
- * To get the SWModule objects of the instalelled modules use @ref Modules for this.
- * @see AddRawFilters(), AddRenderFilters(), AddStripFilters()
- * @version $Id: swmgr.h,v 1.42 2002/03/22 05:26:34 scribe Exp $
- */
+*
+* SWmgr manages the installed modules, the filters and global options like footnotes or strong numbers.
+* The class SWMgr is the most important class of Sword. It is used to manage the installed modules.
+* It also manages the filters (Render-, Strip- and Rawfilters).
+*
+* To get the SWModule objects of the instalelled modules use @ref Modules for this.
+* @see AddRawFilters(), AddRenderFilters(), AddStripFilters()
+* @version $Id: swmgr.h,v 1.55 2003/07/05 04:58:42 scribe Exp $
+*/
class SWDLLEXPORT SWMgr {
private:
- void commonInit(SWConfig * iconfig, SWConfig * isysconfig, bool autoload, SWFilterMgr *filterMgr);
+ void commonInit(SWConfig * iconfig, SWConfig * isysconfig, bool autoload, SWFilterMgr *filterMgr);
protected:
- SWFilterMgr *filterMgr; //made protected because because BibleTime needs it
- SWConfig * myconfig; //made protected because because BibleTime needs it
- SWConfig *mysysconfig;
- SWConfig *homeConfig;
- void CreateMods ();
- SWModule *CreateMod (string name, string driver, ConfigEntMap & section);
- void DeleteMods ();
- char configType; // 0 = file; 1 = directory
- FilterMap optionFilters;
- FilterMap cipherFilters;
- SWFilter *gbfplain;
- SWFilter *thmlplain;
- FilterList cleanupFilters;
- OptionsList options;
- virtual void init (); // use to initialize before loading modules
- virtual char AddModToConfig (int conffd, const char *fname);
- virtual void loadConfigDir (const char *ipath);
- virtual void AddGlobalOptions (SWModule * module, ConfigEntMap & section,
- ConfigEntMap::iterator start,
- ConfigEntMap::iterator end);
- virtual void AddLocalOptions (SWModule * module, ConfigEntMap & section,
- ConfigEntMap::iterator start,
- ConfigEntMap::iterator end);
+ SWFilterMgr *filterMgr; //made protected because because BibleTime needs it
+ SWConfig * myconfig; //made protected because because BibleTime needs it
+ SWConfig *mysysconfig;
+ SWConfig *homeConfig;
+ void CreateMods();
+ SWModule *CreateMod(const char *name, const char *driver, ConfigEntMap & section);
+ void DeleteMods();
+ char configType; // 0 = file; 1 = directory
+ FilterMap optionFilters;
+ FilterMap cipherFilters;
+ SWFilter *gbfplain;
+ SWFilter *thmlplain;
+ SWFilter *osisplain;
+ SWFilter *transliterator;
+ FilterList cleanupFilters;
+ StringList options;
+ virtual void init(); // use to initialize before loading modules
+ virtual char AddModToConfig(int conffd, const char *fname);
+ virtual void loadConfigDir(const char *ipath);
+ virtual void AddGlobalOptions(SWModule * module, ConfigEntMap & section,
+ ConfigEntMap::iterator start,
+ ConfigEntMap::iterator end);
+ virtual void AddLocalOptions(SWModule * module, ConfigEntMap & section,
+ ConfigEntMap::iterator start,
+ ConfigEntMap::iterator end);
+ StringList augPaths;
- /**
- * Adds the encoding filters which are defined in "section" to the SWModule object "module".
- * @param module To this module the encoding filter(s) are added
- * @param section We use this section to get a list of filters we should apply to the module
- */
- virtual void AddEncodingFilters (SWModule * module, ConfigEntMap & section);
- /**
- * Adds the render filters which are defined in "section" to the SWModule object "module".
- * @param module To this module the render filter(s) are added
- * @param section We use this section to get a list of filters we should apply to the module
- */
- virtual void AddRenderFilters (SWModule * module, ConfigEntMap & section);
- /**
- * Adds the strip filters which are defined in "section" to the SWModule object "module".
- * @param module To this module the strip filter(s) are added
- * @param section We use this section to get a list of filters we should apply to the module
- */
- virtual void AddStripFilters (SWModule * module, ConfigEntMap & section);
- /**
- * Adds the raw filters which are defined in "section" to the SWModule object "module".
- * @param module To this module the raw filter(s) are added
- * @param section We use this section to get a list of filters we should apply to the module
- */
- virtual void AddRawFilters (SWModule * module, ConfigEntMap & section);
+ /**
+ * Adds the encoding filters which are defined in "section" to the SWModule object "module".
+ * @param module To this module the encoding filter(s) are added
+ * @param section We use this section to get a list of filters we should apply to the module
+ */
+ virtual void AddEncodingFilters(SWModule * module, ConfigEntMap & section);
+ /**
+ * Adds the render filters which are defined in "section" to the SWModule object "module".
+ * @param module To this module the render filter(s) are added
+ * @param section We use this section to get a list of filters we should apply to the module
+ */
+ virtual void AddRenderFilters(SWModule * module, ConfigEntMap & section);
+ /**
+ * Adds the strip filters which are defined in "section" to the SWModule object "module".
+ * @param module To this module the strip filter(s) are added
+ * @param section We use this section to get a list of filters we should apply to the module
+ */
+ virtual void AddStripFilters(SWModule * module, ConfigEntMap & section);
+ /**
+ * Adds the raw filters which are defined in "section" to the SWModule object "module".
+ * @param module To this module the raw filter(s) are added
+ * @param section We use this section to get a list of filters we should apply to the module
+ */
+ virtual void AddRawFilters(SWModule * module, ConfigEntMap & section);
+
+ virtual void augmentModules(const char *ipath);
public:
- /** Enable / Disable debug output on runtime
- * Set this to true to get more verbose output of SWMgr at runtime. Set it to false to get no debug output.
- * The default is "false".
- */
- static bool debug;
- static const char *globalConfPath;
- /**
- *
- */
- static void findConfig (char *configType, char **prefixPath,
- char **configPath);
- /** The global config object.
- * This is the global config object. It contains all items of all modules,
- * so lookups of entries should use this config object.
- * If you want to save a cipher key or other things to the module config file,
- * DO NOT USE this object, because it would corrupt your config files after config->Save().
- *
- * If you want to write to the modules config file read the informtaion of @ref setCipherKey() for an example of this.
- */
- SWConfig *config;
- /**
- *
- */
- SWConfig *sysconfig;
- /** The map of available modules.
- * This map contains thew list of available modules in Sword.
- * Here's an example how to got through the map and how toc ehck for the module type.
- *
- *@code
- * ModMap::iterator it;
- * SWModule* curMod = 0;
- *
- * for (it = Modules.begin(); it != Modules.end(); it++) {
- * curMod = (*it).second;
- * if (!strcmp(curMod->Type(), "Biblical Texts")) {
- * //do something with curMod
- * }
- * else if (!strcmp(curMod->Type(), "Commentaries")) {
- * //do something with curMod
- * }
- * else if (!strcmp(curMod->Type(), "Lexicons / Dictionaries")) {
- * //do something with curMod
- * }
- * }
- * @endcode
- */
- ModMap Modules;
- /** The path to your Sword directory
- *
- */
- char *prefixPath;
- /**
- *
- */
- char *configPath;
+ /** Enable / Disable debug output on runtime
+ * Set this to true to get more verbose output of SWMgr at runtime. Set it to false to get no debug output.
+ * The default is "false".
+ */
+ static bool debug;
+ static bool isICU;
+ static const char *globalConfPath;
+ /**
+ *
+ */
+ static void findConfig(char *configType, char **prefixPath, char **configPath, StringList *augPaths = 0);
+ /** The global config object.
+ * This is the global config object. It contains all items of all modules,
+ * so lookups of entries should use this config object.
+ * If you want to save a cipher key or other things to the module config file,
+ * DO NOT USE this object, because it would corrupt your config files after config->Save().
+ *
+ * If you want to write to the modules config file read the informtaion of @ref setCipherKey() for an example of this.
+ */
+ SWConfig *config;
+ /**
+ *
+ */
+ SWConfig *sysconfig;
+ /** The map of available modules.
+ * This map contains the list of available modules in Sword.
+ * Here's an example how to got through the map and how toc ehck for the module type.
+ *
+ *@code
+ * ModMap::iterator it;
+ * SWModule* curMod = 0;
+ *
+ * for (it = Modules.begin(); it != Modules.end(); it++) {
+ * curMod = (*it).second;
+ * if (!strcmp(curMod->Type(), "Biblical Texts")) {
+ * //do something with curMod
+ * }
+ * else if (!strcmp(curMod->Type(), "Commentaries")) {
+ * //do something with curMod
+ * }
+ * else if (!strcmp(curMod->Type(), "Lexicons / Dictionaries")) {
+ * //do something with curMod
+ * }
+ * }
+ * @endcode
+ */
+ ModMap Modules;
+ SWModule *getModule(const char *modName) { ModMap::iterator it = Modules.find(modName); return ((it != Modules.end()) ? it->second : 0); }
+ /** The path to your Sword directory
+ *
+ */
+ char *prefixPath;
+ /**
+ *
+ */
+ char *configPath;
- /** Constructor of SWMgr.
- *
- * @param iconfig
- * @param isysconfig
- * @param autoload If this bool is true the constructor starts loading the installed modules. If you reimplemented SWMgr you can set autoload=false to load the modules with your own reimplemented function.
- * @param filterMgr an SWFilterMgr subclass to use to manager filters on modules THIS WILL BE DELETED BY SWMgr
- */
- SWMgr (SWConfig * iconfig = 0, SWConfig * isysconfig = 0, bool autoload = true, SWFilterMgr *filterMgr = 0);
- /**
- *
- * @param filterMgr an SWFilterMgr subclass to use to manager filters on modules THIS WILL BE DELETED BY SWMgr
- */
- SWMgr (SWFilterMgr *filterMgr);
- /**
- *
- * @param autoload If this bool is true the constructor starts loading the
- * installed modules. If you reimplemented SWMgr you can set autoload=false
- * to load the modules with your own reimplemented function.
- * @param filterMgr an SWFilterMgr subclass to use to manager filters on
- * modules THIS WILL BE DELETED BY SWMgr
- *
- */
- SWMgr (const char *iConfigPath, bool autoload = true, SWFilterMgr *filterMgr = 0);
- /** The destructor of SWMgr.
- * This function cleans up the modules and deletes the created object.
- * Destroy the SWMgr at last object in your application, because otherwise you may experience crashes
- * because the SWModule objects become invalid.
- */
- virtual ~SWMgr ();
- /**Installs a scan for modules in the directory givan as parameter.
- * @param dir The directory where new modules should be searched.
- */
- virtual void InstallScan (const char *dir);
- /** Load the modules.
- * Reimplement this function to use your own Load function,
- * for example to use your own filters.
- */
- virtual signed char Load ();
- /** Set a global option
- * Set a global option using the parameters. A global option could be for
- * example footnotes.
- * @param option The name of the option, for which you want to change the
- * value. Well known and often used values are "Footnotes" or "Strongs"
- * @param value The value. Common values are "On" and "Off"
- */
- virtual void setGlobalOption (const char *option, const char *value);
- /** Gives the value of the given option
- * @param The option, which should be used to return the value of it
- * @return The value of the given option
- */
- virtual const char *getGlobalOption (const char *option);
- /** Gives a description for the given option
- * @param option The option, which should be used
- * @return A description of the given option
- * @see setGlobalOption, getGlobalOption, getGlobalOptions
- */
- virtual const char *getGlobalOptionTip (const char *option);
- /** A list of all availble options with the currently set values
- * @return This function returns a list of global options.
- */
- virtual OptionsList getGlobalOptions ();
- /**
- *
- */
- virtual OptionsList getGlobalOptionValues (const char *option);
- /**
- * Sets the cipher key for the given module. This function updates the key
- * at runtime, but it does not write to the config file.
- * To write the new unlock key to the config file use code like this:
- *
- * @code
- * SectionMap::iterator section;
- * ConfigEntMap::iterator entry;
- * DIR *dir = opendir(configPath);
- * struct dirent *ent;
- * char* modFile;
- * if (dir) { // find and update .conf file
- * rewinddir(dir);
- * while ((ent = readdir(dir)))
- * {
- * if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, "..")))
- * {
- * modFile = m_backend->configPath;
- * modFile += "/";
- * modFile += ent->d_name;
- * SWConfig *myConfig = new SWConfig( modFile );
- * section = myConfig->Sections.find( m_module->Name() );
- * if ( section != myConfig->Sections.end() )
- * {
- * entry = section->second.find("CipherKey");
- * if (entry != section->second.end())
- * {
- * entry->second = unlockKey;//set cipher key
- * myConfig->Save();//save config file
- * }
- * }
- * delete myConfig;
- * }
- * }
- * }
- * closedir(dir);
- * @endcode
- *
- * @param modName For this module we change the unlockKey
- * @paran key This is the new unlck key we use for te module.
- */
- virtual signed char setCipherKey (const char *modName, const char *key);
+ /** Constructor of SWMgr.
+ *
+ * @param iconfig
+ * @param isysconfig
+ * @param autoload If this bool is true the constructor starts loading the installed modules. If you reimplemented SWMgr you can set autoload=false to load the modules with your own reimplemented function.
+ * @param filterMgr an SWFilterMgr subclass to use to manager filters on modules THIS WILL BE DELETED BY SWMgr
+ */
+ SWMgr(SWConfig * iconfig = 0, SWConfig * isysconfig = 0, bool autoload = true, SWFilterMgr *filterMgr = 0);
+ /**
+ *
+ * @param filterMgr an SWFilterMgr subclass to use to manager filters on modules THIS WILL BE DELETED BY SWMgr
+ */
+ SWMgr(SWFilterMgr *filterMgr);
+ /**
+ *
+ * @param iConfigPath Path to config files.
+ * @param autoload If this bool is true the constructor starts loading the
+ * installed modules. If you reimplemented SWMgr you can set autoload=false
+ * to load the modules with your own reimplemented function.
+ * @param filterMgr an SWFilterMgr subclass to use to manager filters on
+ * modules THIS WILL BE DELETED BY SWMgr
+ *
+ */
+ SWMgr(const char *iConfigPath, bool autoload = true, SWFilterMgr *filterMgr = 0);
+ /** The destructor of SWMgr.
+ * This function cleans up the modules and deletes the created object.
+ * Destroy the SWMgr at last object in your application, because otherwise you may experience crashes
+ * because the SWModule objects become invalid.
+ */
+ virtual ~SWMgr();
+ /**Installs a scan for modules in the directory givan as parameter.
+ * @param dir The directory where new modules should be searched.
+ */
+ virtual void InstallScan(const char *dir);
+ /** Load the modules.
+ * Reimplement this function to use your own Load function,
+ * for example to use your own filters.
+ */
+ virtual signed char Load();
+ /** Set a global option
+ * Set a global option using the parameters. A global option could be for
+ * example footnotes.
+ * @param option The name of the option, for which you want to change the
+ * value. Well known and often used values are "Footnotes" or "Strongs"
+ * @param value The value. Common values are "On" and "Off"
+ */
+ virtual void setGlobalOption(const char *option, const char *value);
+ /** Gives the value of the given option
+ * @param option The option, which should be used to return the value of it
+ * @return The value of the given option
+ */
+ virtual const char *getGlobalOption(const char *option);
+ /** Gives a description for the given option
+ * @param option The option, which should be used
+ * @return A description of the given option
+ * @see setGlobalOption, getGlobalOption, getGlobalOptions
+ */
+ virtual const char *getGlobalOptionTip(const char *option);
+ /** A list of all availble options with the currently set values
+ * @return This function returns a list of global options.
+ */
+ virtual StringList getGlobalOptions();
+ /**
+ *
+ */
+ virtual StringList getGlobalOptionValues(const char *option);
+ /**
+ * Sets the cipher key for the given module. This function updates the key
+ * at runtime, but it does not write to the config file.
+ * To write the new unlock key to the config file use code like this:
+ *
+ * @code
+ * SectionMap::iterator section;
+ * ConfigEntMap::iterator entry;
+ * DIR *dir = opendir(configPath);
+ * struct dirent *ent;
+ * char* modFile;
+ * if (dir) { // find and update .conf file
+ * rewinddir(dir);
+ * while ((ent = readdir(dir)))
+ * {
+ * if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, "..")))
+ * {
+ * modFile = m_backend->configPath;
+ * modFile += "/";
+ * modFile += ent->d_name;
+ * SWConfig *myConfig = new SWConfig( modFile );
+ * section = myConfig->Sections.find( m_module->Name() );
+ * if ( section != myConfig->Sections.end() )
+ * {
+ * entry = section->second.find("CipherKey");
+ * if (entry != section->second.end())
+ * {
+ * entry->second = unlockKey;//set cipher key
+ * myConfig->Save();//save config file
+ * }
+ * }
+ * delete myConfig;
+ * }
+ * }
+ * }
+ * closedir(dir);
+ * @endcode
+ *
+ * @param modName For this module we change the unlockKey
+ * @param key This is the new unlck key we use for te module.
+ */
+ virtual signed char setCipherKey(const char *modName, const char *key);
};
+
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swmodule.h b/include/swmodule.h
index 56fe02b..4efe974 100644
--- a/include/swmodule.h
+++ b/include/swmodule.h
@@ -1,25 +1,25 @@
/******************************************************************************
- * swmodule.h - code for base class 'module'. Module is the basis for all
- * types of modules (e.g. texts, commentaries, maps, lexicons,
- * etc.)
- *
- * $Id: swmodule.h,v 1.46 2002/03/24 21:37:28 scribe Exp $
- *
- * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
- * CrossWire Bible Society
- * P. O. Box 2528
- * Tempe, AZ 85280-2528
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- */
+* swmodule.h - code for base class 'module'. Module is the basis for all
+* types of modules (e.g. texts, commentaries, maps, lexicons,
+* etc.)
+*
+* $Id: swmodule.h,v 1.69 2003/12/21 10:42:01 scribe Exp $
+*
+* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+* CrossWire Bible Society
+* P. O. Box 2528
+* Tempe, AZ 85280-2528
+*
+* This program is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by the
+* Free Software Foundation version 2.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+*/
#ifndef SWMODULE_H
#define SWMODULE_H
@@ -29,564 +29,555 @@
#include <listkey.h>
#include <swfilter.h>
#include <swconfig.h>
+#include <swbuf.h>
+
#include <swcacher.h>
+#include <swsearchable.h>
+
#include <list>
#include <defs.h>
#include <multimapwdef.h>
-#define FILTERPAD 80
+SWORD_NAMESPACE_START
-using namespace std;
+#define SWMODULE_OPERATORS \
+ operator const char *() { return RenderText(); } \
+ operator SWKey &() { return *getKey(); } \
+ operator SWKey *() { return getKey(); } \
+ SWModule &operator <<(const char *inbuf) { setEntry(inbuf); return *this; } \
+ SWModule &operator <<(const SWKey *sourceKey) { linkEntry(sourceKey); return *this; } \
+ SWModule &operator -=(int steps) { decrement(steps); return *this; } \
+ SWModule &operator +=(int steps) { increment(steps); return *this; } \
+ SWModule &operator ++(int) { return *this += 1; } \
+ SWModule &operator --(int) { return *this -= 1; } \
+ SWModule &operator =(SW_POSITION p) { setPosition(p); return *this; }
-typedef list < SWFilter * >FilterList;
-typedef map < string, string, less < string > > AttributeValue;
-typedef map < string, AttributeValue, less < string > > AttributeList;
-typedef map < string, AttributeList, less < string > > AttributeTypeList;
+typedef std::list < SWFilter * >FilterList;
+typedef std::map < SWBuf, SWBuf, std::less < SWBuf > > AttributeValue;
+typedef std::map < SWBuf, AttributeValue, std::less < SWBuf > > AttributeList;
+typedef std::map < SWBuf, AttributeList, std::less < SWBuf > > AttributeTypeList;
#define SWTextDirection char
#define SWTextEncoding char
#define SWTextMarkup char
enum {DIRECTION_LTR = 0, DIRECTION_RTL, DIRECTION_BIDI};
-enum {FMT_UNKNOWN = 0, FMT_PLAIN, FMT_THML, FMT_GBF, FMT_HTML, FMT_HTMLHREF, FMT_RTF, FMT_OSIS};
+enum {FMT_UNKNOWN = 0, FMT_PLAIN, FMT_THML, FMT_GBF, FMT_HTML, FMT_HTMLHREF, FMT_RTF, FMT_OSIS, FMT_WEBIF};
enum {ENC_UNKNOWN = 0, ENC_LATIN1, ENC_UTF8, ENC_SCSU, ENC_UTF16, ENC_RTF, ENC_HTML};
-/** The class SWModule is the base class for all modules used in Sword.
- * It provides functions to look up a text passage, to search in the module, to switch on/off the state of optional things
- * like Strong's numbers or footnotes.
- *
- * SWModule has also functions to write to the data files. This might be useful in future for frontend authors to support
- * user-created modules.
- */
-
-class SWDLLEXPORT SWModule : public SWCacher {
+/**
+ * The class SWModule is the base class for all modules used in Sword.
+ * It provides functions to look up a text passage, to search in the module,
+ * to switch on/off the state of optional things like Strong's numbers or footnotes.
+ *
+ * SWModule has also functions to write to the data files.
+ */
+
+// TODO: should all SWModule decendents be SWCachers? Only some really
+// cache data. But if we don't do this, then we need another mechanism to
+// check if we are an SWCacher. Maybe make SWModule extend SWObject (which
+// it probably should anyway. But then we need to add all the cheezy
+// heirarchy info to all he decendent classes for our SWDYNAMIC_CAST and
+// then we can see if we implement SWCacher so we know whether or not add
+// to the yet to be developed cachemgr.
+// Just leave for now. This lets us always able to call module->flush()
+// to manually flush a cache, and doesn't hurt if there is no work done.
+
+class SWDLLEXPORT SWModule : public SWCacher, public SWSearchable {
protected:
- ConfigEntMap ownConfig;
- ConfigEntMap *config;
- mutable AttributeTypeList entryAttributes;
- mutable bool procEntAttr;
-
- char error;
- bool skipConsecutiveLinks;
-
- /** the current key */
- SWKey *key;
-
- ListKey listkey;
- char *modname;
- char *moddesc;
- char *modtype;
- char *modlang;
-
- char direction;
- char markup;
- char encoding;
-
- /** this module's display object */
- SWDisplay *disp;
-
- static SWDisplay rawdisp;
- char *entrybuf;
- unsigned long entrybufallocsize;
-
- /** executed to remove all markup (for searches) */
- FilterList *stripFilters;
-
- /** executed immediately upon fileread */
- FilterList *rawFilters;
-
- /** executed to format for display */
- FilterList *renderFilters;
-
- /** executed to change markup to user prefs */
- FilterList *optionFilters;
-
- /** executed to decode text for display */
- FilterList *encodingFilters;
-
- int entrySize;
-
-public:
- /**
- * This is the default callback function for searching.
- * This function is a placeholder and does nothing.
- * You can define your own function for search progress
- * evaluation, and pass it over to @ref Search.
- */
- static void nullPercent (char percent, void *userData);
- /**
- * Set this bool to false to terminate the search which is executed by this module (@ref #Search).
- * This is useful for threaded applications to terminate the search in another thread.
- */
- bool terminateSearch;
- /** Initializes data for instance of SWModule
- *
- * @param imodname Internal name for module; see also @ref Name
- * @param imoddesc Name to display to user for module;
- * see also @ref Description
- * @param idisp Display object to use for displaying
- * see also @ref Disp
- * @param imodtype Type of Module
- * (All modules will be displayed with
- * others of same type under their modtype heading)
- * see also @ref Type
- */
- SWModule (const char *imodname = 0, const char *imoddesc = 0, SWDisplay * idisp = 0, char *imodtype = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN, const char* modlang = 0);
- /** Cleans up instance of SWModule
- */
- virtual ~ SWModule ();
- /** Gets and clears error status
- *
- * @return error status
- */
- virtual char Error ();
- /**
- * @return True if this module is encoded in Unicode, otherwise return false.
- */
- virtual const bool isUnicode() const {return (encoding == (char)ENC_UTF8 || encoding == (char)ENC_SCSU);}
-
- // These methods are useful for modules that come from a standard SWORD install (most do).
- // SWMgr will call setConfig. The user may use getConfig and getConfigEntry (if they
- // are not comfortable with, or don't wish to use stl maps).
- virtual const ConfigEntMap &getConfig() const { return *config; }
- virtual void setConfig(ConfigEntMap *config);
- virtual const char *getConfigEntry(const char *key) const;
-
- /**
- * @return The size of the current entry.
- */
- virtual const int getEntrySize() const {return entrySize;}
- /**
- * Sets a key to this module for position to a
- * particular record or set of records
- *
- * @param ikey key with which to set this module
- * @return error status
- */
- virtual char SetKey (const SWKey *ikey);
- /**
- * Sets the key of this module. Similair to @see SetKey(const SWKey*) .
- * @param ikey The SWKey which should be used as new key.
- * @return Error status
- */
- virtual char SetKey (const SWKey &ikey);
- /** Gets the current module key
- * @return the current key of this module
- */
- virtual SWKey & Key () const {
- return *key;
- }
- /** Sets the current key of the module to ikey, and returns
- * the keytext
- *
- * @param ikey new current key for the module
- * @return the keytext of the current module key
- */
- virtual char Key (const SWKey & ikey) {
- return SetKey (ikey);
- }
- /** Sets/gets module KeyText
- *
- * @param ikeytext value which to set keytext;
- * [0] - only get
- * @return pointer to keytext
- */
- virtual const char *KeyText (const char *imodtype = 0);
- /** Calls this modules display object and passes itself
- *
- * @return error status
- */
- virtual char Display ();
- /** Sets/gets display driver
- *
- * @param idisp value which to set disp;
- * [0] - only get
- * @return pointer to disp
- */
- virtual SWDisplay *Disp (SWDisplay * idisp = 0);
- /** Sets/gets module name
- *
- * @param imodname value which to set modname;
- * [0] - only get
- * @return pointer to modname
- */
- virtual char *Name (const char *imodname = 0);
- /** Sets/gets module description
- *
- * @param imoddesc value which to set moddesc;
- * [0] - only get
- * @return pointer to moddesc
- */
- virtual char *Description (const char *imoddesc = 0);
- /** Sets/gets module type
- *
- * @param imodtype value which to set modtype;
- * [0] - only get
- * @return pointer to modtype
- */
- virtual char *Type (const char *imodtype = 0);
- /** Sets/gets module direction
- *
- * @param newdir value which to set direction;
- * [-1] - only get
- * @return char direction
- */
- virtual char Direction(signed char newdir = -1);
- /** Sets/gets module encoding
- *
- * @param newdir value which to set encoding;
- * [-1] - only get
- * @return char encoding
- */
- virtual char Encoding(signed char enc = -1);
- /** Sets/gets module markup
- *
- * @param newdir value which to set markup;
- * [-1] - only get
- * @return char markup
- */
- virtual char Markup(signed char enc = -1);
- /** Sets/gets module language
- *
- * @param imodlang value which to set modlang;
- * [0] - only get
- * @return pointer to modlang
- */
- virtual char *Lang (const char *imodlang = 0);
-
- // search methods
-
- /** Searches a module for a string
- *
- * @param istr string for which to search
- * @param searchType type of search to perform
- * <=0 ->regex; 1->phrase; 2->multiword;
- * @param flags options flags for search
- * @param justCheckIfSupported if set, don't search,
- * only tell if this function supports requested search.
- *
- * @return listkey set to verses that contain istr
- */
- virtual ListKey & Search (const char *istr, int searchType = 0, int flags = 0,
- SWKey * scope = 0,
- bool * justCheckIfSupported = 0,
- void (*percent) (char, void *) = &nullPercent,
- void *percentUserData = 0);
- /**
- *
- */
- virtual signed char createSearchFramework () {
- return 0;
- } // special search framework
- /**
- *
- */
- virtual bool hasSearchFramework () {
- return false;
- } // special search framework
- /** Check if the search is optimally supported (e.g. if index files are presnt and working)
- * This function checks whether the search framework may work in the best way.
- * @return True if the the search is optimally supported, false if it's not working in the best way.
- */
- virtual bool isSearchOptimallySupported (const char *istr, int searchType,
- int flags, SWKey * scope) {
- bool retVal = false;
- Search (istr, searchType, flags, scope, &retVal);
- return retVal;
- }
- /** Allocates a key of specific type for module
- * The different reimplementatiosn of SWModule (e.g. SWText) support SWKey implementations, which support special.
- * This functions returns a SWKey object which works with the current implementation of SWModule. For example for the SWText class it returns a VerseKey object.
- * @see VerseKey, ListKey, SWText, SWLD, SWCom
- * @return pointer to allocated key
- */
- virtual SWKey *CreateKey ();
- /** Renders and returns the current module text
- * @return the rendered current module text
- */
- virtual operator const char *();
- /** This function is reimplemented by the different kinds
- * of module objects
- * @return the raw module text of the current entry
- */
- virtual char *getRawEntry () = 0;
- /** Cast operator to cast to a @ref SWKey reference.
- * This operator may be used to cast this module to a SWKey
- * object.
- * @see SWKey*()
- */
- virtual operator SWKey & () {
- return *key;
- }
- /** Operator to cast to an SWKey pointer.
- * This function may be used to cast this object to an SWKey pointer.
- * @code
- * //we assume here that SWModule* module is already defined and valid.
- * SWKey* currentKey = (SWKey*)module;
- * // do something with currentKey (e.g. print out on screen)
- * @endcode
- */
- virtual operator SWKey *() {
- return key;
- }
-
-
- // write interface ----------------------------
- /** Is the module writable? :)
- * @return yes or no
- */
- virtual bool isWritable () {
- return false;
- }
- /** Creates a new module
- * @param path The first parameter is path of the new module
- * @return error
- */
- static signed char createModule (const char *) {
- return -1;
- }
- /** Modify the current module entry text
- * - only if module @ref isWritable
- * @return *this
- */
- virtual SWModule & setentry (const char *inbuf, long len) {
- return *this;
- }
- /** Modify the current module entry text
- * - only if module @ref isWritable
- * @return *this
- */
- virtual SWModule & operator << (const char *) {
- return *this;
- }
- /** Link the current module entry to another module entry
- * - only if module @ref isWritable
- * @return *this
- */
- virtual SWModule & operator << (const SWKey *) {
- return *this;
- }
- /** Delete current module entry - only if module @ref isWritable
- *
- */
- virtual void deleteEntry () {
- }
- // end write interface ------------------------
-
- /** Decrements module key a number of entries
- *
- * @param decrement Number of entries to jump backward
- * @return *this
- */
- virtual SWModule & operator -= (int decrement);
- /** Increments module key a number of entries
- *
- * @param increment Number of entries to jump forward
- * @return *this
- */
- virtual SWModule & operator += (int increment);
- /** Increments module key by 1 entry
- *
- */
- virtual SWModule & operator++ (int) {
- return *this += 1;
- }
- /** Decrements module key by 1 entry
- *
- */
- virtual SWModule & operator-- (int) {
- return *this -= 1;
- }
- /** Positions this modules to an entry
- *
- * @param p position (e.g. TOP, BOTTOM)
- * @return *this
- */
- virtual SWModule & operator = (SW_POSITION p);
- /** Adds a RenderFilter to this module's @see renderfilters queue
- * @param newfilter the filter to add
- * @return *this
- */
- virtual SWModule & AddRenderFilter (SWFilter * newfilter) {
- renderFilters->push_back (newfilter);
- return *this;
- }
- /** Removes a RenderFilter from this module's @see renderfilters queue
- * @param oldfilter the filter to remove
- * @return *this
- */
- virtual SWModule & RemoveRenderFilter (SWFilter * oldfilter) {
- renderFilters->remove (oldfilter);
- return *this;
- }
- /** Replaces a RenderFilter in this module's @see renderfilters queue
- * @param oldfilter the filter to remove
- * @param newfilter the filter to add in its place
- * @return *this
- */
- virtual SWModule & ReplaceRenderFilter (SWFilter * oldfilter, SWFilter * newfilter) {
- FilterList::iterator iter;
- for (iter = renderFilters->begin(); iter != renderFilters->end(); iter++)
- if (*iter == oldfilter)
- *iter = newfilter;
- return *this;
- }
- /** RenderFilter a text buffer
- * @param buf the buffer to filter
- * @param size the allocated size of the buffer
- * @param key key location from where this buffer was extracted
- * @return *this
- */
- virtual void renderFilter (char *buf, long size, SWKey *key) {
- filterBuffer(renderFilters, buf, size, key);
- }
- /** Adds an EncodingFilter to this module's @see encodingfilters queue
- * @param newfilter the filter to add
- * @return *this
- */
- virtual SWModule & AddEncodingFilter (SWFilter * newfilter) {
- encodingFilters->push_back (newfilter);
- return *this;
- }
- /** Removes an EncodingFilter from this module's @see encodingfilters queue
- * @param oldfilter the filter to remove
- * @return *this
- */
- virtual SWModule & RemoveEncodingFilter (SWFilter * oldfilter) {
- encodingFilters->remove (oldfilter);
- return *this;
- }
- /** Replaces an EncodingFilter in this module's @see encodingfilters queue
- * @param oldfilter the filter to remove
- * @param newfilter the filter to add in its place
- * @return *this
- */
- virtual SWModule & ReplaceEncodingFilter (SWFilter * oldfilter, SWFilter * newfilter) {
- FilterList::iterator iter;
- for (iter = encodingFilters->begin(); iter != encodingFilters->end(); iter++)
- if (*iter == oldfilter)
- *iter = newfilter;
- return *this;
- }
- /** encodingFilter a text buffer
- * @param buf the buffer to filter
- * @param size the allocated size of the buffer
- * @param key key location from where this buffer was extracted
- * @return *this
- */
- virtual void encodingFilter (char *buf, long size, SWKey *key) {
- filterBuffer(encodingFilters, buf, size, key);
- }
- /** Adds a StripFilter to this module's @ref stripfilters queue
- * @param newfilter the filter to add
- * @return *this
- */
- virtual SWModule & AddStripFilter (SWFilter * newfilter) {
- stripFilters->push_back (newfilter);
- return *this;
- }
- /** StripFilter a text buffer
- * @param buf the buffer to filter
- * @param size the allocated size of the buffer
- * @param key key location from where this buffer was extracted
- * @return *this
- */
- virtual void stripFilter (char *buf, long size, SWKey *key) {
- filterBuffer(stripFilters, buf, size, key);
- }
- /** Adds a RawFilter to this module's @ref rawfilters queue
- * @param newfilter the filter to add
- * @return *this
- */
- virtual SWModule & AddRawFilter (SWFilter * newfilter) {
- rawFilters->push_back (newfilter);
- return *this;
- }
- /** FilterBuffer a text buffer
- * @param filters the FilterList of filters to iterate
- * @param buf the buffer to filter
- * @param size the allocated size of the buffer
- * @param key key location from where this buffer was extracted
- * @return *this
- */
- virtual void filterBuffer (FilterList *filters, char *buf, long size, SWKey *key) {
- FilterList::iterator it;
- for (it = filters->begin(); it != filters->end(); it++) {
- (*it)->ProcessText(buf, size, key, this);
+ ConfigEntMap ownConfig;
+ ConfigEntMap *config;
+ mutable AttributeTypeList entryAttributes;
+ mutable bool procEntAttr;
+
+ char error;
+ bool skipConsecutiveLinks;
+
+ /** the current key */
+ SWKey *key;
+
+ ListKey listkey;
+ char *modname;
+ char *moddesc;
+ char *modtype;
+ char *modlang;
+
+ char direction;
+ char markup;
+ char encoding;
+
+ /** this module's display object */
+ SWDisplay *disp;
+
+ static SWDisplay rawdisp;
+ SWBuf entryBuf;
+
+ /** executed to remove all markup (for searches) */
+ FilterList *stripFilters;
+
+ /** executed immediately upon fileread */
+ FilterList *rawFilters;
+
+ /** executed to format for display */
+ FilterList *renderFilters;
+
+ /** executed to change markup to user prefs */
+ FilterList *optionFilters;
+
+ /** executed to decode text for display */
+ FilterList *encodingFilters;
+
+ int entrySize;
+ mutable long entryIndex; // internal common storage for index
+
+ public:
+ /**
+ * Set this bool to false to terminate the search which is executed by this module (Search()).
+ * This is useful for threaded applications to terminate the search in another thread.
+ */
+ bool terminateSearch;
+ /** Initializes data for instance of SWModule
+ *
+ * @param imodname Internal name for module; see also Name().
+ * @param imoddesc Name to display to user for module; see also Description()
+ * @param idisp Display object to use for displaying; see also Disp()
+ * @param imodtype Type of Module (All modules will be displayed with others of same type under their modtype heading); see also Type()
+ * @param encoding Encoding of the module.
+ * @param dir Direction of text flow.
+ * @param markup Markup of the module.
+ * @param modlang Language of the module.
+ */
+ SWModule(const char *imodname = 0, const char *imoddesc = 0, SWDisplay * idisp = 0, char *imodtype = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN, const char* modlang = 0);
+ /** Cleans up instance of SWModule
+ */
+ virtual ~SWModule();
+ /** Gets and clears error status
+ *
+ * @return error status
+ */
+ virtual char Error();
+ /**
+ * @return True if this module is encoded in Unicode, otherwise return false.
+ */
+ virtual const bool isUnicode() const { return (encoding == (char)ENC_UTF8 || encoding == (char)ENC_SCSU); }
+
+ // These methods are useful for modules that come from a standard SWORD install (most do).
+ // SWMgr will call setConfig. The user may use getConfig and getConfigEntry (if they
+ // are not comfortable with, or don't wish to use stl maps).
+ virtual const ConfigEntMap &getConfig() const { return *config; }
+ virtual void setConfig(ConfigEntMap *config);
+ virtual const char *getConfigEntry(const char *key) const;
+
+ /**
+ * @return The size of the current entry.
+ */
+ virtual const int getEntrySize() const { return entrySize; }
+ /**
+ * Sets a key to this module for position to a
+ * particular record or set of records
+ *
+ * @param ikey key with which to set this module
+ * @return error status
+ * @deprecated Use setKey() instead.
+ */
+ char SetKey(const SWKey *ikey) { return setKey(ikey); }
+ /**
+ * Sets a key to this module for position to a
+ * particular record or set of records
+ *
+ * @param ikey key with which to set this module
+ * @return error status
+ */
+ virtual char setKey(const SWKey *ikey);
+
+
+ virtual long Index() const { return entryIndex; }
+ virtual long Index(long iindex) { entryIndex = iindex; return entryIndex; }
+
+ /**
+ * Sets the key of this module.
+ * @param ikey The SWKey which should be used as new key.
+ * @return Error status
+ * @deprecated Use setKey() instead.
+ */
+ char SetKey(const SWKey &ikey) { return setKey(ikey); }
+ /**
+ * Sets the key of this module.
+ * @param ikey The SWKey which should be used as new key.
+ * @return Error status
+ */
+ char setKey(const SWKey &ikey) { return SetKey(&ikey); }
+
+ /** Gets the current module key
+ * @return the current key of this module
+ */
+ SWKey &Key() const { return *getKey(); }
+ /** Gets the current module key
+ * @return the current key of this module
+ */
+ SWKey *getKey() const;
+
+ /** Sets the current key of the module to ikey, and returns
+ * the keytext
+ *
+ * @param ikey new current key for the module
+ * @return the keytext of the current module key
+ * @deprecated Use setKey() instead.
+ */
+ char Key(const SWKey & ikey) { return setKey(ikey); }
+
+ /**
+ * Sets/gets module KeyText
+ *
+ * @param ikeytext Value which to set keytext; [0]-only get
+ * @return pointer to keytext
+ */
+ virtual const char *KeyText(const char *ikeytext = 0) {
+ if (ikeytext) setKey(ikeytext);
+ return *getKey();
}
- }
- /** RawFilter a text buffer
- * @param buf the buffer to filter
- * @param size the allocated size of the buffer
- * @param key key location from where this buffer was extracted
- * @return *this
- */
- virtual void rawFilter (char *buf, long size, SWKey *key) {
- buf[size] = 0;
- filterBuffer(rawFilters, buf, size, key);
- }
- /** Adds an OptionFilter to this module's @ref optionfilters queue
- * @param newfilter the filter to add
- * @return *this
- */
- virtual SWModule & AddOptionFilter (SWFilter * newfilter) {
- optionFilters->push_back (newfilter);
- return *this;
- }
- /** OptionFilter a text buffer
- * @param buf the buffer to filter
- * @param size the allocated size of the buffer
- * @param key key location from where this buffer was extracted
- * @return *this
- */
- virtual void optionFilter (char *buf, long size, SWKey *key) {
- filterBuffer(optionFilters, buf, size, key);
- }
- /** calls all StripFilters on buffer or current text
- *
- * @param buf buf to massage instead of current module position;
- * if buf is NULL, the current text will be used
- * @param len max len of buf OR current text -- will be applied anyway
- * @return this module's text at specified key location massaged by Strip filters
- */
- virtual const char *StripText (char *buf = 0, int len = -1);
- /** calls all RenderFilters on buffer or current text
- *
- * @param buf buffer to Render instead of current module position;
- * if buf is NULL, the current text will be used
- * @param len max len of buf OR current text -- will be applied anyway
- * @return this module's text at specified key location massaged by Render filters
- */
- virtual const char *RenderText (char *buf = 0, int len = -1, bool render = true);
- /** calls all StripFilters on current text
- *
- * @param tmpKey key to use to grab text
- * @return this module's text at specified key location massaged by Strip filters
- */
- virtual const char *StripText (SWKey * tmpKey);
- /** calls all RenderFilters on current text
- *
- * @param tmpKey key to use to grab text
- * @return this module's text at specified key location massaged by Render filters
- */
- virtual const char *RenderText (SWKey * tmpKey);
-
- /**
- *
- * option to specify behaviour when iterating over consecutive entried linked
- * to same text
- * @param val = true means only include entry once in iteration
- */
- virtual void setSkipConsecutiveLinks(bool val) { skipConsecutiveLinks = val; }
- virtual bool getSkipConsecutiveLinks() { return skipConsecutiveLinks; }
- virtual AttributeTypeList &getEntryAttributes() const { return entryAttributes; }
- virtual void processEntryAttributes(bool val) const { procEntAttr = val; }
- virtual bool isProcessEntryAttributes() const { return procEntAttr; }
-};
+ /** Calls this modules display object and passes itself
+ *
+ * @return error status
+ */
+ virtual char Display();
+
+ /** Sets/gets display driver
+ *
+ * @param idisp Value which to set disp; [0]-only get
+ * @return pointer to disp
+ */
+ virtual SWDisplay *Disp(SWDisplay * idisp = 0);
+ /** Sets/gets module name
+ *
+ * @param imodname Value which to set modname; [0]-only get
+ * @return pointer to modname
+ */
+ virtual char *Name() const;
+ virtual char *Name(const char *imodname);
+ /** Sets/gets module description
+ *
+ * @param imoddesc Value which to set moddesc; [0]-only get
+ * @return pointer to moddesc
+ */
+ virtual char *Description() const;
+ virtual char *Description(const char *imoddesc);
+ /** Sets/gets module type
+ *
+ * @param imodtype Value which to set modtype; [0]-only get
+ * @return pointer to modtype
+ */
+ virtual char *Type() const;
+ virtual char *Type(const char *imodtype);
+ /** Sets/gets module direction
+ *
+ * @param newdir Value which to set direction; [-1]-only get
+ * @return new direction
+ */
+ virtual char Direction(signed char newdir = -1);
+ /** Sets/gets module encoding
+ *
+ * @param enc Value which to set encoding; [-1]-only get
+ * @return Encoding
+ */
+ virtual char Encoding(signed char enc = -1);
+ /** Sets/gets module markup
+ *
+ * @param markup Vvalue which to set markup; [-1]-only get
+ * @return Markup
+ */
+ virtual char Markup(signed char markup = -1);
+ /** Sets/gets module language
+ *
+ * @param imodlang Value which to set modlang; [0]-only get
+ * @return pointer to modlang
+ */
+ virtual char *Lang(const char *imodlang = 0);
+
+
+ // search interface
+ /** Searches a module for a string
+ *
+ * @param istr string for which to search
+ * @param searchType type of search to perform
+ * >=0 ->regex; -1 ->phrase; -2 ->multiword;
+ * @param flags options flags for search
+ * @param scope Key containing the scope. VerseKey or ListKey are useful here.
+ * @param justCheckIfSupported if set, don't search,
+ * only tell if this function supports requested search.
+ * @param percent Callback function to get the current search status in %.
+ * @param percentUserData User data that is given to the callback function as parameter.
+ *
+ * @return listkey set to verses that contain istr
+ */
+ virtual ListKey &search(const char *istr, int searchType = 0, int flags = 0,
+ SWKey * scope = 0,
+ bool * justCheckIfSupported = 0,
+ void (*percent) (char, void *) = &nullPercent,
+ void *percentUserData = 0);
+
+ // for backward compat-- deprecated
+ virtual ListKey &Search(const char *istr, int searchType = 0, int flags = 0,
+ SWKey * scope = 0,
+ bool * justCheckIfSupported = 0,
+ void (*percent) (char, void *) = &nullPercent,
+ void *percentUserData = 0) {
+ return search(istr, searchType, flags, scope, justCheckIfSupported, percent, percentUserData);
+ }
+
+
+ /** Allocates a key of specific type for module
+ * The different reimplementatiosn of SWModule (e.g. SWText) support SWKey implementations, which support special.
+ * This functions returns a SWKey object which works with the current implementation of SWModule. For example for the SWText class it returns a VerseKey object.
+ * @see VerseKey, ListKey, SWText, SWLD, SWCom
+ * @return pointer to allocated key
+ */
+ virtual SWKey *CreateKey();
+ /** This function is reimplemented by the different kinds
+ * of module objects
+ * @return the raw module text of the current entry
+ */
+#ifndef SWIG
+ virtual SWBuf &getRawEntryBuf() = 0;
+#else
+ virtual SWBuf &getRawEntryBuf() {};
+#endif
+
+ virtual const char *getRawEntry() { return getRawEntryBuf().c_str(); }
+
+ // write interface ----------------------------
+ /** Is the module writable? :)
+ * @return yes or no
+ */
+ virtual bool isWritable() { return false; }
+ /** Creates a new module
+ * @param path The first parameter is path of the new module
+ * @return error
+ */
+ static signed char createModule(const char *path) { return -1; }
+ /** Modify the current module entry text - only if module isWritable()
+ * @return *this
+ */
+ virtual void setEntry(const char *inbuf, long len = -1) { }
+ /** Link the current module entry to another module entry - only if module isWritable()
+ */
+ virtual void linkEntry(const SWKey *sourceKey) { }
+ /** Delete current module entry - only if module isWritable()
+ */
+ virtual void deleteEntry() {}
+
+ // end write interface ------------------------
+
+ /** Decrements module key a number of entries
+ *
+ * @param steps Number of entries to jump backward
+ * @return *this
+ */
+ virtual void decrement(int steps = 1);
+ /** Increments module key a number of entries
+ *
+ * @param steps Number of entries to jump forward
+ * @return *this
+ */
+ virtual void increment(int steps = 1);
+ /** Positions this modules to an entry
+ *
+ * @param pos position (e.g. TOP, BOTTOM)
+ * @return *this
+ */
+ virtual void setPosition(SW_POSITION pos);
+ /** Adds a RenderFilter to this module's renderfilters queue
+ * @param newfilter the filter to add
+ * @return *this
+ */
+ virtual SWModule & AddRenderFilter(SWFilter * newfilter) {
+ renderFilters->push_back (newfilter);
+ return *this;
+ }
+ /** Removes a RenderFilter from this module's renderfilters queue
+ * @param oldfilter the filter to remove
+ * @return *this
+ */
+ virtual SWModule & RemoveRenderFilter(SWFilter * oldfilter) {
+ renderFilters->remove (oldfilter);
+ return *this;
+ }
+ /** Replaces a RenderFilter in this module's renderfilters queue
+ * @param oldfilter the filter to remove
+ * @param newfilter the filter to add in its place
+ * @return *this
+ */
+ virtual SWModule & ReplaceRenderFilter(SWFilter * oldfilter, SWFilter * newfilter) {
+ FilterList::iterator iter;
+ for (iter = renderFilters->begin(); iter != renderFilters->end(); iter++) {
+ if (*iter == oldfilter)
+ *iter = newfilter;
+ }
+ return *this;
+ }
+ /** RenderFilter a text buffer
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ * @return *this
+ */
+ virtual void renderFilter(SWBuf &buf, SWKey *key) {
+ filterBuffer(renderFilters, buf, key);
+ }
+ /** Adds an EncodingFilter to this module's @see encodingfilters queue
+ * @param newfilter the filter to add
+ * @return *this
+ */
+ virtual SWModule & AddEncodingFilter(SWFilter * newfilter) {
+ encodingFilters->push_back (newfilter);
+ return *this;
+ }
+ /** Removes an EncodingFilter from this module's encodingfilters queue
+ * @param oldfilter the filter to remove
+ * @return *this
+ */
+ virtual SWModule & RemoveEncodingFilter(SWFilter * oldfilter) {
+ encodingFilters->remove (oldfilter);
+ return *this;
+ }
+ /** Replaces an EncodingFilter in this module's encodingfilters queue
+ * @param oldfilter the filter to remove
+ * @param newfilter the filter to add in its place
+ * @return *this
+ */
+ virtual SWModule & ReplaceEncodingFilter(SWFilter * oldfilter, SWFilter * newfilter) {
+ FilterList::iterator iter;
+ for (iter = encodingFilters->begin(); iter != encodingFilters->end(); iter++) {
+ if (*iter == oldfilter)
+ *iter = newfilter;
+ }
+ return *this;
+ }
+ /** encodingFilter a text buffer
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ * @return *this
+ */
+ virtual void encodingFilter(SWBuf &buf, SWKey *key) {
+ filterBuffer(encodingFilters, buf, key);
+ }
+ /** Adds a StripFilter to this module's stripfilters queue
+ * @param newfilter the filter to add
+ * @return *this
+ */
+ virtual SWModule & AddStripFilter(SWFilter * newfilter) {
+ stripFilters->push_back (newfilter);
+ return *this;
+ }
+ /** StripFilter a text buffer
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ * @return *this
+ */
+ virtual void stripFilter(SWBuf &buf, SWKey *key) {
+ filterBuffer(stripFilters, buf, key);
+ }
+ /** Adds a RawFilter to this module's rawfilters queue
+ * @param newfilter the filter to add
+ * @return *this
+ */
+ virtual SWModule & AddRawFilter(SWFilter * newfilter) {
+ rawFilters->push_back (newfilter);
+ return *this;
+ }
+ /** FilterBuffer a text buffer
+ * @param filters the FilterList of filters to iterate
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ * @return *this
+ */
+ virtual void filterBuffer(FilterList *filters, SWBuf &buf, SWKey *key) {
+ FilterList::iterator it;
+ for (it = filters->begin(); it != filters->end(); it++) {
+ (*it)->processText(buf, key, this);
+ }
+ }
+ /** RawFilter a text buffer
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ * @return *this
+ */
+ virtual void rawFilter(SWBuf &buf, SWKey *key) {
+ filterBuffer(rawFilters, buf, key);
+ }
+ /** Adds an OptionFilter to this module's optionfilters queue
+ * @param newfilter the filter to add
+ * @return *this
+ */
+ virtual SWModule & AddOptionFilter(SWFilter * newfilter) {
+ optionFilters->push_back(newfilter);
+ return *this;
+ }
+ /** OptionFilter a text buffer
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ * @return *this
+ */
+ virtual void optionFilter(SWBuf &buf, SWKey *key) {
+ filterBuffer(optionFilters, buf, key);
+ }
+ /** calls all StripFilters on buffer or current text
+ *
+ * @param buf buf to massage instead of current module position;
+ * if buf is NULL, the current text will be used
+ * @param len max len of buf OR current text -- will be applied anyway
+ * @return this module's text at specified key location massaged by Strip filters
+ */
+ virtual const char *StripText(const char *buf = 0, int len = -1);
+ /** calls all RenderFilters on buffer or current text
+ *
+ * @param buf buffer to Render instead of current module position;
+ * if buf is NULL, the current text will be used
+ * @param len max len of buf OR current text -- will be applied anyway
+ * @param render Perform the rendering.
+ * @return this module's text at specified key location massaged by Render filters
+ */
+ virtual const char *RenderText(const char *buf = 0, int len = -1, bool render = true);
+ /** calls all StripFilters on current text
+ *
+ * @param tmpKey key to use to grab text
+ * @return this module's text at specified key location massaged by Strip filters
+ */
+ virtual const char *StripText(SWKey * tmpKey);
+ /** calls all RenderFilters on current text
+ *
+ * @param tmpKey key to use to grab text
+ * @return this module's text at specified key location massaged by Render filters
+ */
+ virtual const char *RenderText(SWKey * tmpKey);
+ /**
+ *
+ * option to specify behaviour when iterating over consecutive entried linked
+ * to same text
+ * @param val = true means only include entry once in iteration
+ */
+ virtual void setSkipConsecutiveLinks(bool val) { skipConsecutiveLinks = val; }
+ /** DOCS NEEDED.
+ */
+ virtual bool getSkipConsecutiveLinks() { return skipConsecutiveLinks; }
+ /** DOCS NEEDED.
+ */
+ virtual AttributeTypeList &getEntryAttributes() const { return entryAttributes; }
+ /** DOCS NEEDED.
+ */
+ virtual void processEntryAttributes(bool val) const { procEntAttr = val; }
+ /** DOCS NEEDED.
+ */
+ virtual bool isProcessEntryAttributes() const { return procEntAttr; }
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swobject.h b/include/swobject.h
index 974f982..27eafd6 100644
--- a/include/swobject.h
+++ b/include/swobject.h
@@ -8,9 +8,9 @@
#endif
#include <defs.h>
-#include <string.h>
-#define SWDYNAMIC_CAST(className, object) (className *)((object->getClass()->isAssignableFrom(#className))?object:0)
+SWORD_NAMESPACE_START
+#define SWDYNAMIC_CAST(className, object) (className *)((object)?((object->getClass()->isAssignableFrom(#className))?object:0):0)
/**
* Class used for SWDYNAMIC_CAST to save the inheritance order.
@@ -20,13 +20,13 @@ private:
const char **descends;
public:
- SWClass (const char **descends) {
+ SWClass(const char **descends) {
this->descends = descends;
}
- bool isAssignableFrom (const char *className) const {
+ bool isAssignableFrom(const char *className) const {
for (int i = 0; descends[i]; i++) {
- if (!stricmp (descends[i], className))
+ if (!stricmp(descends[i], className))
return true;
}
return false;
@@ -51,4 +51,5 @@ public:
}
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swoptfilter.h b/include/swoptfilter.h
new file mode 100644
index 0000000..53d5079
--- /dev/null
+++ b/include/swoptfilter.h
@@ -0,0 +1,48 @@
+/***************************************************************************
+ *
+ * $Id: swoptfilter.h,v 1.2 2003/07/05 08:53:05 mgruner Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWOPTFILTER_H
+#define SWOPTFILTER_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+ /** Base class for all option filters.
+ */
+class SWDLLEXPORT SWOptionFilter : public SWFilter {
+protected:
+ SWBuf optionValue;
+ const char *optName;
+ const char *optTip;
+ const StringList *optValues;
+ bool option;
+public:
+ SWOptionFilter(const char *oName, const char *oTip, const StringList *oValues);
+ virtual ~SWOptionFilter();
+ virtual const char *getOptionName() { return optName; }
+ virtual const char *getOptionTip() { return optTip; }
+ virtual void setOptionValue(const char *ival);
+ virtual const char *getOptionValue();
+ virtual StringList getOptionValues() { return *optValues; }
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swremotemgr.h b/include/swremotemgr.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/include/swremotemgr.h
diff --git a/include/swsearchable.h b/include/swsearchable.h
new file mode 100644
index 0000000..7882a84
--- /dev/null
+++ b/include/swsearchable.h
@@ -0,0 +1,89 @@
+/******************************************************************************
+ * swsearchable.h - definition of class SWSearchable used to provide an
+ * interface for objects that be searched.
+ *
+ * $Id: swsearchable.h,v 1.1 2003/08/29 06:00:16 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWSEARCHABLE_H
+#define SWSEARCHABLE_H
+
+#include <defs.h>
+#include <listkey.h>
+
+SWORD_NAMESPACE_START
+
+/** used to provide an interface for objects that be searched.
+ */
+class SWDLLEXPORT SWSearchable {
+public:
+ SWSearchable();
+ virtual ~SWSearchable();
+
+ /**
+ * This is the default callback function for searching.
+ * This function is a placeholder and does nothing.
+ * You can define your own function for search progress
+ * evaluation, and pass it over to Search().
+ */
+ static void nullPercent(char percent, void *userData);
+
+ // search methods
+
+ /** Searches a module for a string
+ *
+ * @param istr string for which to search
+ * @param searchType type of search to perform
+ * >=0 ->regex; -1 ->phrase; -2 ->multiword;
+ * @param flags options flags for search
+ * @param scope Key containing the scope. VerseKey or ListKey are useful here.
+ * @param justCheckIfSupported if set, don't search,
+ * only tell if this function supports requested search.
+ * @param percent Callback function to get the current search status in %.
+ * @param percentUserData User data that is given to the callback function as parameter.
+ *
+ * @return listkey set to verses that contain istr
+ */
+ virtual ListKey &search(const char *istr, int searchType = 0, int flags = 0,
+ SWKey * scope = 0,
+ bool * justCheckIfSupported = 0,
+ void (*percent) (char, void *) = &nullPercent,
+ void *percentUserData = 0) = 0;
+
+ /** ask the object to build any framework it need to do it searching.
+ *
+ */
+ virtual signed char createSearchFramework(); // special search framework
+
+ /** does this class have a search framework built?
+ *
+ */
+ virtual bool hasSearchFramework() { return false; } // special search framework
+ /** Check if the search is optimally supported (e.g. if index files are presnt and working)
+ * This function checks whether the search framework may work in the best way.
+ * @return True if the the search is optimally supported, false if it's not working in the best way.
+ */
+ virtual bool isSearchOptimallySupported(const char *istr, int searchType, int flags, SWKey * scope) {
+ bool retVal = false;
+ search(istr, searchType, flags, scope, &retVal);
+ return retVal;
+ }
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swsourcemgr.h b/include/swsourcemgr.h
new file mode 100644
index 0000000..8b263e7
--- /dev/null
+++ b/include/swsourcemgr.h
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * swsourcemgr.h - definition of class SWSourceMgr used to provide an interface for
+ * caching information of module sources
+ *
+ * $Id: swsourcemgr.h,v 1.1 2002/10/23 23:13:35 dglassey Exp $
+ *
+ * Copyright 2002 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef SWSOURCEMGR_H
+#define SWSOURCEMGR_H
+
+ #include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWConfig;
+
+class SWDLLEXPORT SWSourceMgr {
+private:
+ /** The path to the source's directory
+ *
+ */
+ char *prefixPath;
+ /**
+ * The path to the source's config
+ */
+ char *configPath;
+ /**
+ * The type of config 0 = file; 1 = directory
+ */
+ char configType;
+ /** The global config object.
+ * This is the global config object. It contains all items of all modules,
+ * so lookups of entries should use this config object.
+ * If you want to save a cipher key or other things to the module config file,
+ * DO NOT USE this object, because it would corrupt your config files after config->Save().
+ *
+ * If you want to write to the modules config file read the informtaion of @ref setCipherKey() for an example of this.
+ */
+ SWConfig *config;
+ /**
+ * ?
+ */
+ SWConfig * myconfig;
+
+public:
+ SWSourceMgr(const char *iConfigPath);
+ //SWMgr(const char *iConfigPath, bool autoload = true, SWFilterMgr *filterMgr = 0);
+ virtual char Refresh() = 0;
+ void loadConfigDir(const char *ipath);
+};
+
+SWORD_NAMESPACE_END
+#endif
diff --git a/include/swtext.h b/include/swtext.h
index 0c99612..03cc14d 100644
--- a/include/swtext.h
+++ b/include/swtext.h
@@ -2,7 +2,7 @@
* swtext.h - code for base class 'SWText'. SWText is the basis for all
* types of text modules
*
- * $Id: swtext.h,v 1.10 2001/12/18 04:47:40 chrislit Exp $
+ * $Id: swtext.h,v 1.14 2003/02/28 13:12:43 mgruner Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -29,23 +29,34 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
/** The basis for all text modules
*/
-class SWDLLEXPORT SWText:public SWModule
-{
+class SWDLLEXPORT SWText : public SWModule {
public:
- /** Initializes data for instance of SWText
- *
- * @param imodname Internal name for module
- * @param imoddesc Name to display to user for module
- * @param idisp Display object to use for displaying
- */
- SWText (const char *imodname = 0, const char *imoddesc = 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
- virtual ~ SWText ();
- /** Create the correct key (VerseKey) for use with SWText
- */
- virtual SWKey *CreateKey ();
+ /** Initializes data for instance of SWText
+ */
+ SWText(const char *imodname = 0, const char *imoddesc = 0,
+ SWDisplay * idisp = 0,
+ SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
+
+ virtual ~SWText();
+ /** Create the correct key (VerseKey) for use with SWText
+ */
+ virtual SWKey *CreateKey();
+
+ virtual long Index() const;
+ virtual long Index(long iindex);
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swunicod.h b/include/swunicod.h
index af25630..3bf4e95 100644
--- a/include/swunicod.h
+++ b/include/swunicod.h
@@ -20,6 +20,9 @@
#ifndef SWUNICOD_H
#define SWUNICOD_H
+#include <defs.h>
+SWORD_NAMESPACE_START
+
/** Converts a 32-bit unsigned integer UTF-32 value into a UTF-8 encoded 1-6 byte array
* @param utf32 the UTF-32 Unicode code point value
* @param utf8 pointer to an array of 6 unsigned chars to contain the UTF-8 value
@@ -35,4 +38,6 @@ unsigned char* UTF32to8 (unsigned long utf32, unsigned char * utf8);
*/
unsigned long UTF8to32 (unsigned char * utf8, unsigned long utf32);
+SWORD_NAMESPACE_END
+
#endif
diff --git a/include/swversion.h b/include/swversion.h
index 0fdb8a2..896b8fe 100644
--- a/include/swversion.h
+++ b/include/swversion.h
@@ -1,7 +1,7 @@
/******************************************************************************
* swversion.h - definition of class SWVersion used to compare version info
*
- * $Id: swversion.h,v 1.3 2002/01/06 22:26:23 chrislit Exp $
+ * $Id: swversion.h,v 1.15 2003/12/26 05:53:14 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -20,26 +20,50 @@
*/
#ifndef SWORDVER
-#define SWORDVER "1.5.3"
+#define SWORDVER "1.5.7"
#endif
#ifndef SWVERSION_H
#define SWVERSION_H
+#include <defs.h>
+SWORD_NAMESPACE_START
+
+/** A basic tool class to handle program version numbers.
+*/
class SWVersion {
public:
+ /** The different version subnumbers.
+ */
int major, minor, minor2, minor3;
-
+ /**The constructor.
+ * @param version Version string to be parsed.
+ */
SWVersion(const char *version = "0.0");
+ /** Compare 2 Versions with each other.
+ * @param vi Version number to compare with.
+ * @return >0:this>vi; 0:this==vi; <0:this<vi
+ */
int compare(const SWVersion &vi) const;
- operator const char *() const;
+ /** @return The parsed version number text.
+ */
+ const char *getText() const;
+ /** @return The parsed version number text.
+ */
+ operator const char *() const { return getText(); }
bool operator>(const SWVersion &vi) const {return (compare(vi) > 0);}
bool operator<(const SWVersion &vi) const {return (compare(vi) < 0);}
+ bool operator>=(const SWVersion &vi) const {return (compare(vi) >= 0);}
+ bool operator<=(const SWVersion &vi) const {return (compare(vi) <= 0);}
bool operator==(const SWVersion &vi) const {return (compare(vi) == 0);}
- // current sword library version
+ /** Current sword library version.
+ * Use this to check (e.g. at compile time) if the
+ * version of the sword lib is recent enough for your program.
+ */
static SWVersion currentVersion;
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/swwinlog.h b/include/swwinlog.h
index 579e37b..d897fe9 100644
--- a/include/swwinlog.h
+++ b/include/swwinlog.h
@@ -2,7 +2,7 @@
* swwinlog.h - definition of SWWinLog-- a derivitive of SWLog used to
* handle logging in the MSWindows environment
*
- * $Id: swwinlog.h,v 1.2 2001/02/09 15:38:51 jansorg Exp $
+ * $Id: swwinlog.h,v 1.3 2002/10/03 04:26:46 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -27,6 +27,8 @@
#include <swlog.h>
+SWORD_NAMESPACE_START
+
class SWWinLog:public SWLog
{
HWND parent;
@@ -38,5 +40,5 @@ public:
virtual void LogInformation (char *fmt, ...);
};
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/sysdata.h b/include/sysdata.h
index deb2e5c..58b8083 100644
--- a/include/sysdata.h
+++ b/include/sysdata.h
@@ -8,6 +8,7 @@
#include "config.h"
#endif
+
typedef signed char __s8;
typedef unsigned char __u8;
diff --git a/include/tbdisp.h b/include/tbdisp.h
index 8064da5..4358e47 100644
--- a/include/tbdisp.h
+++ b/include/tbdisp.h
@@ -3,7 +3,7 @@
* MSWindows TextBox (or any other control that takes a
* SetDialogItemText
*
- * $Id: tbdisp.h,v 1.2 2001/02/09 15:38:51 jansorg Exp $
+ * $Id: tbdisp.h,v 1.3 2002/10/03 04:26:46 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -25,6 +25,9 @@
#define TBDISP_H
#include <windows.h>
+
+SWORD_NAMESPACE_START
+
class SWModule;
class TBDisp:public SWDisplay
@@ -36,4 +39,7 @@ public:
TBDisp (HWND iwnd, int ictrlid);
virtual char Display (SWModule & imodule);
};
+
+SWORD_NAMESPACE_END
+
#endif
diff --git a/include/thmlfootnotes.h b/include/thmlfootnotes.h
index 871700f..753e549 100644
--- a/include/thmlfootnotes.h
+++ b/include/thmlfootnotes.h
@@ -1,6 +1,6 @@
-/*
+/******************************************************************************
*
- * $Id:
+ * $Id: thmlfootnotes.h,v 1.5 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -21,38 +21,18 @@
#ifndef THMLFOOTNOTES_H
#define THMLFOOTNOTES_H
-#include <swfilter.h>
+#include <swoptfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
/** This Filter shows/hides footnotes in a ThML text
- */
-class SWDLLEXPORT ThMLFootnotes:public SWFilter
-{
- bool option;
- static const char on[];
- static const char off[];
- static const char optName[];
- static const char optTip[];
- OptionsList options;
+ */
+class SWDLLEXPORT ThMLFootnotes : public SWOptionFilter {
public:
- ThMLFootnotes ();
- virtual ~ ThMLFootnotes ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+ ThMLFootnotes();
+ virtual ~ThMLFootnotes();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/thmlgbf.h b/include/thmlgbf.h
index 02ae82e..36e64ea 100644
--- a/include/thmlgbf.h
+++ b/include/thmlgbf.h
@@ -1,6 +1,6 @@
-/*
+/******************************************************************************
*
- * thmlgbf.h
+ * $Id: thmlgbf.h,v 1.7 2003/07/26 23:10:55 chrislit Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -23,15 +23,16 @@
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** this filter converts ThML text to GBF text
- */
-class SWDLLEXPORT ThMLGBF:public SWFilter
-{
+/** this filter converts ThML text to GBF text
+ */
+class SWDLLEXPORT ThMLGBF : public SWFilter {
+protected:
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
public:
- ThMLGBF ();
- virtual char ProcessText (char *text, int maxlen = -1);
+ ThMLGBF();
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/thmlheadings.h b/include/thmlheadings.h
index f159503..b2ba6ee 100644
--- a/include/thmlheadings.h
+++ b/include/thmlheadings.h
@@ -1,6 +1,6 @@
-/*
+/******************************************************************************
*
- * $Id:
+ * $Id: thmlheadings.h,v 1.5 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -21,38 +21,18 @@
#ifndef THMLHEADINGS_H
#define THMLHEADINGS_H
-#include <swfilter.h>
+#include <swoptfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This Filter shows/hides headings in a ThML text
- */
-class SWDLLEXPORT ThMLHeadings:public SWFilter
-{
- bool option;
- static const char on[];
- static const char off[];
- static const char optName[];
- static const char optTip[];
- OptionsList options;
+/** This Filter shows/hides headings in a ThML text
+ */
+class SWDLLEXPORT ThMLHeadings : public SWOptionFilter {
public:
- ThMLHeadings ();
- virtual ~ ThMLHeadings ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+ ThMLHeadings();
+ virtual ~ThMLHeadings();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/thmlhtml.h b/include/thmlhtml.h
index f6c29ad..88b11a1 100644
--- a/include/thmlhtml.h
+++ b/include/thmlhtml.h
@@ -1,35 +1,46 @@
-/***************************************************************************
- thmlhtml.h - description
- -------------------
- begin : 1999-10-28
-
- copyright : 1999 by Chris Little
- email : chrislit@chiasma.org
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+/******************************************************************************
+ *
+ * $Id: thmlhtml.h,v 1.12 2003/08/12 05:36:30 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#ifndef THMLHTML_H
#define THMLHTML_H
#include <swbasicfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
/** this filter converts ThML text to HTML text
*/
class SWDLLEXPORT ThMLHTML : public SWBasicFilter {
protected:
- virtual bool handleToken(char **buf, const char *token, DualStringMap &userData);
+ class MyUserData : public BasicFilterUserData {
+ public:
+ MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {}
+ bool SecHead;
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
public:
ThMLHTML();
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/thmlhtmlhref.h b/include/thmlhtmlhref.h
index dc1d192..e504ae8 100644
--- a/include/thmlhtmlhref.h
+++ b/include/thmlhtmlhref.h
@@ -1,33 +1,50 @@
-/***************************************************************************
- thmlhtmlhref.h - description
- -------------------
- begin : 2001-09-03
- copyright : 2001 by CrossWire Bible Society
- ***************************************************************************/
-
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+/******************************************************************************
+ *
+ * $Id: thmlhtmlhref.h,v 1.10 2003/12/22 04:28:09 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
#ifndef _THMLHTMLHREF_H
#define _THMLHTMLHREF_H
#include <swbasicfilter.h>
+#include <utilxml.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
/** this filter converts ThML text to HTML text with hrefs
*/
class SWDLLEXPORT ThMLHTMLHREF : public SWBasicFilter {
protected:
- virtual bool handleToken(char **buf, const char *token, DualStringMap &userData);
+ class MyUserData : public BasicFilterUserData {
+ public:
+ MyUserData(const SWModule *module, const SWKey *key);//: BasicFilterUserData(module, key) {}
+ SWBuf inscriptRef;
+ bool SecHead;
+ bool BiblicalText;
+ SWBuf version;
+ XMLTag startTag;
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
public:
ThMLHTMLHREF();
};
-
+SWORD_NAMESPACE_END
#endif /* _THMLHTMLHREF_H */
diff --git a/include/thmllemma.h b/include/thmllemma.h
index b2ab320..ce4e161 100644
--- a/include/thmllemma.h
+++ b/include/thmllemma.h
@@ -1,6 +1,6 @@
-/*
+/******************************************************************************
*
- * $Id:
+ * $Id: thmllemma.h,v 1.5 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -21,38 +21,18 @@
#ifndef THMLLEMMA_H
#define THMLLEMMA_H
-#include <swfilter.h>
+#include <swoptfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This Filter shows/hides lemmas in a ThML text
- */
-class SWDLLEXPORT ThMLLemma:public SWFilter
-{
- bool option;
- static const char on[];
- static const char off[];
- static const char optName[];
- static const char optTip[];
- OptionsList options;
+/** This Filter shows/hides lemmas in a ThML text
+ */
+class SWDLLEXPORT ThMLLemma : public SWOptionFilter {
public:
- ThMLLemma ();
- virtual ~ ThMLLemma ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+ ThMLLemma();
+ virtual ~ThMLLemma();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/thmlmorph.h b/include/thmlmorph.h
index c71a380..a808357 100644
--- a/include/thmlmorph.h
+++ b/include/thmlmorph.h
@@ -1,5 +1,6 @@
-/*
- * $Id:
+/******************************************************************************
+ *
+ * $Id: thmlmorph.h,v 1.5 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -20,38 +21,18 @@
#ifndef THMLMORPH_H
#define THMLMORPH_H
-#include <swfilter.h>
+#include <swoptfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This Filter shows/hides morph tags in a ThML text
- */
-class SWDLLEXPORT ThMLMorph:public SWFilter
-{
- bool option;
- static const char on[];
- static const char off[];
- static const char optName[];
- static const char optTip[];
- OptionsList options;
+/** This Filter shows/hides morph tags in a ThML text
+ */
+class SWDLLEXPORT ThMLMorph : public SWOptionFilter {
public:
- ThMLMorph ();
- virtual ~ ThMLMorph ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+ ThMLMorph();
+ virtual ~ThMLMorph();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/thmlosis.h b/include/thmlosis.h
new file mode 100644
index 0000000..5d7bed9
--- /dev/null
+++ b/include/thmlosis.h
@@ -0,0 +1,40 @@
+/******************************************************************************
+ *
+ * $Id: thmlosis.h,v 1.6 2003/02/20 07:25:20 scribe Exp $
+ *
+ * Copyright 2003 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef THMLOSIS_H
+#define THMLOSIS_H
+
+#include <swfilter.h>
+
+SWORD_NAMESPACE_START
+
+/** this filter converts ThML text to OSIS text
+ */
+class SWDLLEXPORT ThMLOSIS : public SWFilter {
+protected:
+ virtual const char *convertToOSIS(const char *, const SWKey *key);
+public:
+ ThMLOSIS();
+ virtual ~ThMLOSIS();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+};
+
+SWORD_NAMESPACE_END
+#endif /* THMLOSIS_H */
diff --git a/include/thmlplain.h b/include/thmlplain.h
index 0a753fe..eb7c88b 100644
--- a/include/thmlplain.h
+++ b/include/thmlplain.h
@@ -1,6 +1,6 @@
-/*
+/******************************************************************************
*
- * thmlplain.h
+ * $Id: thmlplain.h,v 1.7 2003/07/26 23:10:55 chrislit Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -23,15 +23,16 @@
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** this filter converts ThML text to plain text
- */
-class SWDLLEXPORT ThMLPlain:public SWFilter
-{
+/** this filter converts ThML text to plain text
+ */
+class SWDLLEXPORT ThMLPlain : public SWFilter {
+protected:
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
public:
- ThMLPlain ();
- virtual char ProcessText (char *text, int maxlen = -1);
+ ThMLPlain();
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/thmlrtf.h b/include/thmlrtf.h
index 319cf4e..094f6c4 100644
--- a/include/thmlrtf.h
+++ b/include/thmlrtf.h
@@ -1,6 +1,6 @@
-/*
+/******************************************************************************
*
- * thmlrtf.h
+ * $Id: thmlrtf.h,v 1.13 2003/12/22 06:30:44 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -22,17 +22,30 @@
#define THMLRTF_H
#include <swbasicfilter.h>
+#include <utilxml.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** this filter converts ThML text to RTF text
- */
-class SWDLLEXPORT ThMLRTF:public SWBasicFilter
-{
+/** this filter converts ThML text to RTF text
+ */
+class SWDLLEXPORT ThMLRTF : public SWBasicFilter {
protected:
- virtual bool handleToken(char **buf, const char *token, DualStringMap &userData);
+ class MyUserData : public BasicFilterUserData {
+ public:
+ MyUserData(const SWModule *module, const SWKey *key);
+ bool SecHead;
+ SWBuf version;
+ bool BiblicalText;
+ XMLTag startTag;
+ };
+ virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key) {
+ return new MyUserData(module, key);
+ }
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
public:
- ThMLRTF ();
+ ThMLRTF();
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/thmlscripref.h b/include/thmlscripref.h
index da96c42..de45ab1 100644
--- a/include/thmlscripref.h
+++ b/include/thmlscripref.h
@@ -1,6 +1,6 @@
-/*
+/******************************************************************************
*
- * $Id:
+ * $Id: thmlscripref.h,v 1.5 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -21,38 +21,18 @@
#ifndef THMLSCRIPREF_H
#define THMLSCRIPREF_H
-#include <swfilter.h>
+#include <swoptfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
/** This Filter shows/hides scripture references in a ThML text
- */
-class SWDLLEXPORT ThMLScripref:public SWFilter
-{
- bool option;
- static const char on[];
- static const char off[];
- static const char optName[];
- static const char optTip[];
- OptionsList options;
+ */
+class SWDLLEXPORT ThMLScripref : public SWOptionFilter {
public:
- ThMLScripref ();
- virtual ~ ThMLScripref ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+ ThMLScripref();
+ virtual ~ThMLScripref();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/thmlstrongs.h b/include/thmlstrongs.h
index 2b37d87..e07ed8e 100644
--- a/include/thmlstrongs.h
+++ b/include/thmlstrongs.h
@@ -1,6 +1,6 @@
-/*
+/******************************************************************************
*
- * $Id:
+ * $Id: thmlstrongs.h,v 1.5 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -21,38 +21,18 @@
#ifndef THMLSTRONGS_H
#define THMLSTRONGS_H
-#include <swfilter.h>
+#include <swoptfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This Filter shows/hides strong's numbers in a ThML text
- */
-class SWDLLEXPORT ThMLStrongs:public SWFilter
-{
- bool option;
- static const char on[];
- static const char off[];
- static const char optName[];
- static const char optTip[];
- OptionsList options;
+/** This Filter shows/hides strong's numbers in a ThML text
+ */
+class SWDLLEXPORT ThMLStrongs : public SWOptionFilter {
public:
- ThMLStrongs ();
- virtual ~ ThMLStrongs ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+ ThMLStrongs();
+ virtual ~ThMLStrongs();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/thmlvariants.h b/include/thmlvariants.h
index 973b1e3..3fa66b0 100644
--- a/include/thmlvariants.h
+++ b/include/thmlvariants.h
@@ -1,4 +1,6 @@
-/*
+/******************************************************************************
+ *
+ * $Id: thmlvariants.h,v 1.5 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -22,40 +24,31 @@
#include <swfilter.h>
#include <swmodule.h>
-#include <defs.h>
-
- /** This Filter shows/hides textual variants
- */
-class SWDLLEXPORT ThMLVariants : public SWFilter
-{
- char option;
-
- static const char primary[];
- static const char secondary[];
- static const char all[];
-
- static const char optName[];
- static const char optTip[];
- OptionsList options;
-
- public:
- ThMLVariants ();
- virtual ~ ThMLVariants ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+SWORD_NAMESPACE_START
+
+/** This Filter shows/hides textual variants
+ */
+class SWDLLEXPORT ThMLVariants : public SWFilter {
+ char option;
+
+ static const char primary[];
+ static const char secondary[];
+ static const char all[];
+
+ static const char optName[];
+ static const char optTip[];
+ StringList options;
+
+public:
+ ThMLVariants();
+ virtual ~ThMLVariants();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+ virtual const char *getOptionName() { return optName; }
+ virtual const char *getOptionTip() { return optTip; }
+ virtual void setOptionValue(const char *ival);
+ virtual const char *getOptionValue();
+ virtual StringList getOptionValues() { return options; }
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/rwprtf.h b/include/thmlwebif.h
index 5e2452d..7d7fe3a 100644
--- a/include/rwprtf.h
+++ b/include/thmlwebif.h
@@ -1,9 +1,6 @@
/******************************************************************************
- * rwprtf.h - definition of Class RWPRTF, an SWFilter used to convert
- * special tags in Robertsons Word Pictures commentary into
- * Rich Text Format tags
*
- * $Id: rwprtf.h,v 1.7 2001/12/11 22:35:10 scribe Exp $
+ * $Id: thmlwebif.h,v 1.5 2003/08/12 05:36:30 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -21,20 +18,23 @@
*
*/
-#ifndef RWPRTF_H
-#define RWPRTF_H
+#ifndef _ThMLWEBIF_H
+#define _ThMLWEBIF_H
-#include <swfilter.h>
+#include <thmlhtmlhref.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** this filter converts RWP text to RTF text
- */
-class SWDLLEXPORT RWPRTF:public SWFilter
-{
+/** this filter converts ThML text to HTML text with hrefs
+ */
+class SWDLLEXPORT ThMLWEBIF : public ThMLHTMLHREF {
+ const SWBuf baseURL;
+ const SWBuf passageStudyURL;
+
+protected:
+ virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData);
public:
- RWPRTF ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
+ ThMLWEBIF();
};
-
-#endif
+SWORD_NAMESPACE_END
+#endif /* _ThMLWEBIF_H */
diff --git a/include/treekey.h b/include/treekey.h
index a47339c..83393c5 100644
--- a/include/treekey.h
+++ b/include/treekey.h
@@ -1,7 +1,7 @@
/******************************************************************************
* versekey.h - code for class 'versekey'- a standard Biblical verse key
*
- * $Id: treekey.h,v 1.2 2002/01/24 09:49:30 scribe Exp $
+ * $Id: treekey.h,v 1.4 2002/10/01 19:52:40 dglassey Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -28,6 +28,7 @@
#include <defs.h>
+SWORD_NAMESPACE_START
/**
* Class VerseKey
@@ -35,12 +36,13 @@
*/
class SWDLLEXPORT TreeKey : public SWKey {
static SWClass classdef;
+ void init();
public:
// TreeKey (const char *ikey = 0);
// TreeKey (const SWKey * ikey);
// TreeKey (TreeKey const &k);
- TreeKey () {};
+ TreeKey () { init(); };
~TreeKey () {};
@@ -84,5 +86,5 @@ public:
};
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/treekeyidx.h b/include/treekeyidx.h
index 068bc1f..4e5e88a 100644
--- a/include/treekeyidx.h
+++ b/include/treekeyidx.h
@@ -1,7 +1,7 @@
/******************************************************************************
* versekey.h - code for class 'versekey'- a standard Biblical verse key
*
- * $Id: treekeyidx.h,v 1.1 2002/01/24 08:55:27 scribe Exp $
+ * $Id: treekeyidx.h,v 1.5 2002/10/01 19:52:40 dglassey Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -27,6 +27,7 @@
#include <sysdata.h>
#include <filemgr.h>
+SWORD_NAMESPACE_START
/**
* Class VerseKey
@@ -59,12 +60,14 @@ class SWDLLEXPORT TreeKeyIdx : public TreeKey {
char getTreeNodeFromIdxOffset(long ioffset, TreeNode *node) const;
void saveTreeNode(TreeNode *node);
void saveTreeNodeOffsets(TreeNode *node);
+ void init();
public:
TreeKeyIdx(const TreeKeyIdx &ikey);
TreeKeyIdx (const char *idxPath, int fileMode = -1);
~TreeKeyIdx ();
+ virtual SWKey *clone() const;
virtual const char *getLocalName();
virtual const char *setLocalName(const char *);
@@ -93,10 +96,15 @@ public:
virtual void copyFrom(const TreeKeyIdx &ikey);
virtual void copyFrom(const SWKey & ikey);
- virtual SWKey &operator = (const TreeKeyIdx &ikey) { copyFrom(ikey); return *this; }
void setOffset(unsigned long offset);
unsigned long getOffset() const;
+
+
+ // OPERATORS ------------------------------------------------------------
+
+
+ virtual SWKey &operator = (const TreeKeyIdx &ikey) { copyFrom(ikey); return *this; }
SWKEY_OPERATORS
virtual void setText(const char *ikey);
@@ -111,5 +119,6 @@ public:
static signed char create(const char *path);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/unicodertf.h b/include/unicodertf.h
index be72707..bf0171b 100644
--- a/include/unicodertf.h
+++ b/include/unicodertf.h
@@ -1,6 +1,6 @@
-/*
+/******************************************************************************
*
- * $Id: unicodertf.h,v 1.3 2001/12/11 22:35:10 scribe Exp $
+ * $Id: unicodertf.h,v 1.5 2003/02/20 07:25:20 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -23,14 +23,15 @@
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This filter converts UTF-8 text into RTF Unicode tags
- */
-class SWDLLEXPORT UnicodeRTF:public SWFilter {
+/** This filter converts UTF-8 text into RTF Unicode tags
+ */
+class SWDLLEXPORT UnicodeRTF : public SWFilter {
public:
- UnicodeRTF();
- virtual char ProcessText (char *text, int maxlen, const SWKey *key, const SWModule * = 0);
+ UnicodeRTF();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/unixstr.h b/include/unixstr.h
index 87069b7..c48ed56 100644
--- a/include/unixstr.h
+++ b/include/unixstr.h
@@ -1,7 +1,7 @@
// Include only if your UNIX compiler does not include stricmp but does include strcasecmp
/*
*
- * $Id: unixstr.h,v 1.2 2001/02/09 15:38:51 jansorg Exp $
+ * $Id: unixstr.h,v 1.4 2003/06/27 01:41:07 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -21,8 +21,10 @@
#ifndef UNIXSTR_H
#define UNIXSTR_H
-#include <string.h>
+#include <defs.h>
+SWORD_NAMESPACE_START
int stricmp (const char *s1, const char *s2);
+SWORD_NAMESPACE_END
#endif
diff --git a/include/untgz.h b/include/untgz.h
index b91502b..24ac8cf 100644
--- a/include/untgz.h
+++ b/include/untgz.h
@@ -6,4 +6,5 @@
int untargz(int fd, const char *dest);
int untar(gzFile in, const char *dest);
-#endif \ No newline at end of file
+#endif
+
diff --git a/include/utf16utf8.h b/include/utf16utf8.h
index 5481980..4bb725e 100644
--- a/include/utf16utf8.h
+++ b/include/utf16utf8.h
@@ -1,5 +1,6 @@
-/*
+/******************************************************************************
*
+ * $Id: utf16utf8.h,v 1.5 2003/02/20 07:25:20 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -22,14 +23,15 @@
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This filter converts UTF-16 encoded text to UTF-8
- */
-class SWDLLEXPORT UTF16UTF8:public SWFilter {
+/** This filter converts UTF-16 encoded text to UTF-8
+ */
+class SWDLLEXPORT UTF16UTF8 : public SWFilter {
public:
- UTF16UTF8();
- virtual char ProcessText (char *text, int maxlen, const SWKey *key, const SWModule * = 0);
+ UTF16UTF8();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/utf8arshaping.h b/include/utf8arshaping.h
index 980f97c..9a93424 100644
--- a/include/utf8arshaping.h
+++ b/include/utf8arshaping.h
@@ -1,4 +1,6 @@
-/*
+/******************************************************************************
+ *
+ * $Id: utf8arshaping.h,v 1.6 2003/02/20 07:25:20 scribe Exp $
*
* Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -15,7 +17,6 @@
* General Public License for more details.
*
*/
-#ifdef _ICU_
#ifndef UTF8ARSHAPING_H
#define UTF8ARSHAPING_H
@@ -27,22 +28,22 @@
#include <unicode/uchar.h>
#include <unicode/ushape.h>
-#include <defs.h>
-
- /** This Filter shows/hides reorders UTF-8 text according to Unicode BiDi
- */
-class SWDLLEXPORT UTF8arShaping : public SWFilter
-{
- private:
- UConverter* conv;
- UErrorCode err;
- public:
- UTF8arShaping();
- ~UTF8arShaping();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
+SWORD_NAMESPACE_START
+
+/** This Filter controls the arabic shaping of UTF-8 text
+ * FIXME: is that correct? how to control it?
+ */
+class SWDLLEXPORT UTF8arShaping : public SWFilter {
+private:
+ UConverter* conv;
+ UErrorCode err;
+public:
+ UTF8arShaping();
+ ~UTF8arShaping();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
-#endif
diff --git a/include/utf8bidireorder.h b/include/utf8bidireorder.h
index 2aa9ee4..ae31c9d 100644
--- a/include/utf8bidireorder.h
+++ b/include/utf8bidireorder.h
@@ -1,4 +1,6 @@
-/*
+/******************************************************************************
+ *
+ * $Id: utf8bidireorder.h,v 1.7 2003/02/20 07:25:20 scribe Exp $
*
* Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -15,7 +17,6 @@
* General Public License for more details.
*
*/
-#ifdef _ICU_
#ifndef UTF8BIDIREORDER_H
#define UTF8BIDIREORDER_H
@@ -25,24 +26,22 @@
#include <unicode/utypes.h>
#include <unicode/ucnv.h>
#include <unicode/uchar.h>
-#include <unicode/bidi.h>
+#include <unicode/ubidi.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This Filter shows/hides reorders UTF-8 text according to Unicode BiDi
- */
-class SWDLLEXPORT UTF8BiDiReorder : public SWFilter
-{
- private:
- UConverter* conv;
- UErrorCode err;
- public:
- UTF8BiDiReorder();
- ~UTF8BiDiReorder();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
+/** This Filter reorders UTF-8 text according to Unicode BiDi
+ */
+class SWDLLEXPORT UTF8BiDiReorder : public SWFilter {
+private:
+ UConverter* conv;
+ UErrorCode err;
+public:
+ UTF8BiDiReorder();
+ ~UTF8BiDiReorder();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
-#endif
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/utf8cantillation.h b/include/utf8cantillation.h
index c95e0ff..8d2ae9d 100644
--- a/include/utf8cantillation.h
+++ b/include/utf8cantillation.h
@@ -1,5 +1,6 @@
-/*
+/******************************************************************************
*
+ * $Id: utf8cantillation.h,v 1.5 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -20,38 +21,18 @@
#ifndef UTF8CANTILLATION_H
#define UTF8CANTILLATION_H
-#include <swfilter.h>
+#include <swoptfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
/** This Filter shows/hides Hebrew cantillation marks in UTF8 text
*/
-class SWDLLEXPORT UTF8Cantillation:public SWFilter
-{
- bool option;
- static const char on[];
- static const char off[];
- static const char optName[];
- static const char optTip[];
- OptionsList options;
+class SWDLLEXPORT UTF8Cantillation : public SWOptionFilter {
public:
- UTF8Cantillation ();
- virtual ~ UTF8Cantillation ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+ UTF8Cantillation();
+ virtual ~UTF8Cantillation();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/utf8greekaccents.h b/include/utf8greekaccents.h
index c579a18..7f79e1b 100644
--- a/include/utf8greekaccents.h
+++ b/include/utf8greekaccents.h
@@ -1,5 +1,6 @@
-/*
+/******************************************************************************
*
+ * $Id: utf8greekaccents.h,v 1.5 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -20,38 +21,18 @@
#ifndef UTF8GREEKACCENTS_H
#define UTF8GREEKACCENTS_H
-#include <swfilter.h>
+#include <swoptfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
/** This Filter shows/hides Greek Accents marks in UTF8 text
*/
-class SWDLLEXPORT UTF8GreekAccents:public SWFilter
-{
- bool option;
- static const char on[];
- static const char off[];
- static const char optName[];
- static const char optTip[];
- OptionsList options;
+class SWDLLEXPORT UTF8GreekAccents : public SWOptionFilter {
public:
- UTF8GreekAccents ();
- virtual ~ UTF8GreekAccents ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+ UTF8GreekAccents();
+ virtual ~UTF8GreekAccents();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/utf8hebrewpoints.h b/include/utf8hebrewpoints.h
index 288500c..7b3dad9 100644
--- a/include/utf8hebrewpoints.h
+++ b/include/utf8hebrewpoints.h
@@ -1,5 +1,6 @@
-/*
+/******************************************************************************
*
+ * $Id: utf8hebrewpoints.h,v 1.5 2003/07/05 04:58:42 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -20,38 +21,18 @@
#ifndef UTF8HEBREWPOINTS_H
#define UTF8HEBREWPOINTS_H
-#include <swfilter.h>
+#include <swoptfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This Filter shows/hides Hebrew vowel points in UTF8 text
- */
-class SWDLLEXPORT UTF8HebrewPoints:public SWFilter
-{
- bool option;
- static const char on[];
- static const char off[];
- static const char optName[];
- static const char optTip[];
- OptionsList options;
+/** This Filter shows/hides Hebrew vowel points in UTF8 text
+ */
+class SWDLLEXPORT UTF8HebrewPoints : public SWOptionFilter {
public:
- UTF8HebrewPoints ();
- virtual ~ UTF8HebrewPoints ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+ UTF8HebrewPoints();
+ virtual ~UTF8HebrewPoints();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/utf8html.h b/include/utf8html.h
index f292efe..28b2945 100644
--- a/include/utf8html.h
+++ b/include/utf8html.h
@@ -1,5 +1,6 @@
-/*
+/******************************************************************************
*
+ * $Id: utf8html.h,v 1.4 2003/02/20 07:25:20 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -22,14 +23,15 @@
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This filter converts UTF-8 text into HTML escape sequences
- */
-class SWDLLEXPORT UTF8HTML:public SWFilter {
+/** This filter converts UTF-8 text into HTML escape sequences
+ */
+class SWDLLEXPORT UTF8HTML : public SWFilter {
public:
- UTF8HTML();
- virtual char ProcessText (char *text, int maxlen, const SWKey *key, const SWModule * = 0);
+ UTF8HTML();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/utf8latin1.h b/include/utf8latin1.h
index 0b9247b..27b3b78 100644
--- a/include/utf8latin1.h
+++ b/include/utf8latin1.h
@@ -1,5 +1,6 @@
-/*
+/******************************************************************************
*
+ * $Id: utf8latin1.h,v 1.4 2003/02/20 07:25:20 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -22,15 +23,16 @@
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This filter converts UTF-8 encoded text to Latin-1
- */
-class SWDLLEXPORT UTF8Latin1:public SWFilter {
- char replacementChar;
+/** This filter converts UTF-8 encoded text to Latin-1
+ */
+class SWDLLEXPORT UTF8Latin1 : public SWFilter {
+ char replacementChar;
public:
- UTF8Latin1(char rchar = '?');
- virtual char ProcessText (char *text, int maxlen, const SWKey *key, const SWModule * = 0);
+ UTF8Latin1(char rchar = '?');
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/utf8nfc.h b/include/utf8nfc.h
index 8ff5fa9..c18fa84 100644
--- a/include/utf8nfc.h
+++ b/include/utf8nfc.h
@@ -1,4 +1,6 @@
-/*
+/******************************************************************************
+ *
+ * $Id: utf8nfc.h,v 1.6 2003/02/20 07:25:20 scribe Exp $
*
* Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -15,7 +17,6 @@
* General Public License for more details.
*
*/
-#ifdef _ICU_
#ifndef UTF8NFC_H
#define UTF8NFC_H
@@ -27,20 +28,18 @@
#include <unicode/uchar.h>
#include <unicode/unorm.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
-class SWDLLEXPORT UTF8NFC : public SWFilter
-{
- private:
- UConverter* conv;
- UChar *source, *target;
- UErrorCode err;
- public:
- UTF8NFC();
- ~UTF8NFC();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
+class SWDLLEXPORT UTF8NFC : public SWFilter {
+private:
+ UConverter* conv;
+ UChar *source, *target;
+ UErrorCode err;
+public:
+ UTF8NFC();
+ ~UTF8NFC();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
-#endif
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/utf8nfkd.h b/include/utf8nfkd.h
index ccf9aab..f12562a 100644
--- a/include/utf8nfkd.h
+++ b/include/utf8nfkd.h
@@ -1,4 +1,6 @@
-/*
+/******************************************************************************
+ *
+ * $Id: utf8nfkd.h,v 1.6 2003/02/20 07:25:20 scribe Exp $
*
* Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -15,7 +17,6 @@
* General Public License for more details.
*
*/
-#ifdef _ICU_
#ifndef UTF8NFKD_H
#define UTF8NFKD_H
@@ -27,20 +28,18 @@
#include <unicode/uchar.h>
#include <unicode/unorm.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
-class SWDLLEXPORT UTF8NFKD : public SWFilter
-{
- private:
- UConverter* conv;
- UChar *source, *target;
- UErrorCode err;
- public:
- UTF8NFKD();
- ~UTF8NFKD();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
+class SWDLLEXPORT UTF8NFKD : public SWFilter {
+private:
+ UConverter* conv;
+ UChar *source, *target;
+ UErrorCode err;
+public:
+ UTF8NFKD();
+ ~UTF8NFKD();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
-#endif
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/utf8transliterator.h b/include/utf8transliterator.h
index b28d699..0956118 100644
--- a/include/utf8transliterator.h
+++ b/include/utf8transliterator.h
@@ -1,4 +1,6 @@
-/*
+/******************************************************************************
+ *
+ * $Id: utf8transliterator.h,v 1.22 2003/10/05 19:07:35 mgruner Exp $
*
* Copyright 2001 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -15,59 +17,70 @@
* General Public License for more details.
*
*/
-#ifdef _ICU_
#ifndef UTF8TRANSLITERATOR_H
#define UTF8TRANSLITERATOR_H
-enum scriptEnum {SE_OFF, SE_LATIN, /*one-way (to) transliterators*/ SE_BASICLATIN, SE_BETA, SE_BGREEK, /*two-way transliterators*/ SE_GREEK, SE_HEBREW, SE_CYRILLIC, SE_ARABIC, SE_SYRIAC, SE_KATAKANA, SE_HIRAGANA, SE_JAMO, SE_HANGUL, SE_DEVANAGARI, SE_TAMIL, SE_BENGALI, SE_GURMUKHI, SE_GUJARATI, SE_ORIYA, SE_TELUGU, SE_KANNADA, SE_MALAYALAM, SE_THAI, SE_GEORGIAN, SE_ARMENIAN, SE_ETHIOPIC, SE_GOTHIC, SE_UGARITIC, SE_COPTIC, /*one-way (from) transliterators*/ SE_HAN, SE_KANJI};
-#define NUMSCRIPTS 32
-#define NUMTARGETSCRIPTS 5
+enum scriptEnum {SE_OFF, SE_LATIN, /*one-way (to) transliterators*/ SE_IPA, SE_BASICLATIN, SE_SBL, SE_TC, SE_BETA, SE_BGREEK, SE_SERA, SE_HUGOYE, SE_UNGEGN, SE_ISO, SE_ALALC, SE_BGNPCGN, /*two-way transliterators*/ SE_GREEK, SE_HEBREW, SE_CYRILLIC, SE_ARABIC, SE_SYRIAC, SE_KATAKANA, SE_HIRAGANA, SE_HANGUL, SE_DEVANAGARI, SE_TAMIL, SE_BENGALI, SE_GURMUKHI, SE_GUJARATI, SE_ORIYA, SE_TELUGU, SE_KANNADA, SE_MALAYALAM, SE_THAI, SE_GEORGIAN, SE_ARMENIAN, SE_ETHIOPIC, SE_GOTHIC, SE_UGARITIC, SE_COPTIC, SE_MEROITIC, SE_LINEARB, SE_CYPRIOT, SE_RUNIC, SE_OGHAM, SE_THAANA, SE_GLAGOLITIC, SE_TENGWAR, SE_CIRTH, /*one-way (from) transliterators*/ SE_JAMO, SE_HAN, SE_KANJI};
+#define NUMSCRIPTS 50
+#define NUMTARGETSCRIPTS NUMSCRIPTS-3//6
#include <swfilter.h>
#include <swmodule.h>
-#include <unicode/utypes.h>
-#include <unicode/ucnv.h>
-#include <unicode/ustring.h>
-#include <unicode/uchar.h>
-
#include <unicode/unistr.h>
+
#include <unicode/translit.h>
#include <defs.h>
+#include <map>
- /** This Filter shows/hides strong's numbers in a GBF text
- */
-class SWDLLEXPORT UTF8Transliterator : public SWFilter
-{
- char option;
-
- static const char optionstring[NUMTARGETSCRIPTS][16];
-
- static const char optName[];
- static const char optTip[];
- OptionsList options;
-
- public:
- UTF8Transliterator ();
- virtual char ProcessText (char *text, int maxlen, const SWKey * key, const SWModule * = 0);
- virtual const char *getOptionName ()
- {
- return optName;
- }
- virtual const char *getOptionTip ()
- {
- return optTip;
- }
- virtual void setOptionValue (const char *ival);
- virtual const char *getOptionValue ();
- virtual OptionsList getOptionValues ()
- {
- return options;
- }
+SWORD_NAMESPACE_START
+
+struct SWTransData {
+ UnicodeString resource;
+ UTransDirection dir;
};
+typedef std::map <const UnicodeString, SWTransData> SWTransMap;
+typedef std::pair<UnicodeString, SWTransData> SWTransPair;
-#endif
+// Chris, please add more javadoc-style documentation in this header file
+// so that the information will show up in the doxygen-generated
+// api-docs.
+
+/** This Filter uses ICU for transliteration
+*/
+class SWDLLEXPORT UTF8Transliterator : public SWFilter {
+private:
+
+ char option;
+
+ static const char optionstring[NUMTARGETSCRIPTS][16];
+
+ static const char optName[];
+ static const char optTip[];
+ static const char SW_RB_RULE_BASED_IDS[];
+ static const char SW_RB_RULE[];
+ static const char SW_RESDATA[];
+ StringList options;
+ static SWTransMap transMap;
+ UErrorCode utf8status;
+
+ void Load(UErrorCode &status);
+ void registerTrans(const UnicodeString& ID, const UnicodeString& resource, UTransDirection dir, UErrorCode &status);
+ bool addTrans(const char* newTrans, SWBuf* transList);
+ bool checkTrans(const UnicodeString& ID, UErrorCode &status);
+ Transliterator *createTrans(const UnicodeString& ID, UTransDirection dir, UErrorCode &status);
+
+public:
+ UTF8Transliterator();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
+ virtual const char *getOptionName() { return optName; }
+ virtual const char *getOptionTip() { return optTip; }
+ virtual void setOptionValue(const char *ival);
+ virtual const char *getOptionValue();
+ virtual StringList getOptionValues() { return options; }
+};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/utf8utf16.h b/include/utf8utf16.h
index c4010a9..5310c42 100644
--- a/include/utf8utf16.h
+++ b/include/utf8utf16.h
@@ -1,5 +1,6 @@
-/*
+/******************************************************************************
*
+ * $Id: utf8utf16.h,v 1.5 2003/02/20 07:25:20 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -22,14 +23,15 @@
#include <swfilter.h>
-#include <defs.h>
+SWORD_NAMESPACE_START
- /** This filter converts UTF-8 encoded text to UTF-16
- */
-class SWDLLEXPORT UTF8UTF16:public SWFilter {
+/** This filter converts UTF-8 encoded text to UTF-16
+ */
+class SWDLLEXPORT UTF8UTF16 : public SWFilter {
public:
- UTF8UTF16();
- virtual char ProcessText (char *text, int maxlen, const SWKey *key, const SWModule * = 0);
+ UTF8UTF16();
+ virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/utilconf.h b/include/utilconf.h
index 8be0173..d8407c7 100644
--- a/include/utilconf.h
+++ b/include/utilconf.h
@@ -1,8 +1,9 @@
#ifndef UTILCONF_H
#define UTILCONF_H
-
+#include <defs.h>
+SWORD_NAMESPACE_START
char getconfent (char *filename, char *entryname, char *buf, int len);
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/utilfuns.h b/include/utilfuns.h
index 77d913e..0873b7f 100644
--- a/include/utilfuns.h
+++ b/include/utilfuns.h
@@ -1,7 +1,7 @@
/******************************************************************************
* utilfuns.h - utility function prototypes
*
- * $Id: utilfuns.h,v 1.1.1.1 1999/05/04 22:03:36 scribe Exp $
+ * $Id: utilfuns.h,v 1.2 2003/06/01 14:32:09 joachim Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -24,6 +24,6 @@
#include <utilstr.h>
#include <utilconf.h>
-
+#include <utilweb.h>
#endif
diff --git a/include/utilstr.h b/include/utilstr.h
index 4f6c192..867c396 100644
--- a/include/utilstr.h
+++ b/include/utilstr.h
@@ -1,7 +1,7 @@
/******************************************************************************
* utilstr.h - prototypes for string utility functions
*
- * $Id: utilstr.h,v 1.8 2001/11/02 18:35:42 chrislit Exp $
+ * $Id: utilstr.h,v 1.11 2003/06/22 23:50:23 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -22,14 +22,19 @@
#ifndef UTILSTR_H
#define UTILSTR_H
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
/** Use stdstr to copy a const char* to a char*
*/
-char *stdstr (char **iistr, const char *istr);
+char *stdstr (char **iistr, const char *istr, unsigned int memPadFactor = 1);
char *strstrip (char *istr);
const char *stristr (const char *s1, const char *s2);
const char strnicmp(const char *s1, const char *s2, int len);
unsigned int strlenw(const char *s1);
char *toupperstr(char *buf);
+char *toupperstr_utf8(char *buf, unsigned int max = 0);
/*
extern "C" {
@@ -80,4 +85,5 @@ static const unsigned char SW_toupper_array[256] =
#define SW_toupper(c) SW_toupper_array[(unsigned char)c]
+SWORD_NAMESPACE_END
#endif
diff --git a/include/utilweb.h b/include/utilweb.h
new file mode 100644
index 0000000..e80fd7e
--- /dev/null
+++ b/include/utilweb.h
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * utilxml.h - definition of class that deal with xml constructs
+ *
+ * $Id: utilweb.h,v 1.2 2003/06/27 01:41:07 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTILWEB_H
+#define UTILWEB_H
+
+#include <defs.h>
+#include <swbuf.h>
+
+SWORD_NAMESPACE_START
+
+/** Encodes and URL
+* Encodes a string into a valid URL, e.g. changes http://www.crosswire.org/test.jsp?force=1&help=1 into
+* http://www.crosswire.org/test.jsp?force=1&amp;help=1
+* This function works on the data of the buf parameter.
+*/
+const SWBuf encodeURL( const SWBuf& buf );
+
+SWORD_NAMESPACE_END
+
+#endif
+
diff --git a/include/utilxml.h b/include/utilxml.h
new file mode 100644
index 0000000..f66e11b
--- /dev/null
+++ b/include/utilxml.h
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * utilxml.h - definition of class that deal with xml constructs
+ *
+ * $Id: utilxml.h,v 1.7 2003/07/16 04:55:43 scribe Exp $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef UTILXML_H
+#define UTILXML_H
+
+#include <defs.h>
+#include <swbuf.h>
+#include <list>
+#include <map>
+
+SWORD_NAMESPACE_START
+
+typedef std::map<SWBuf, SWBuf> StringPairMap;
+typedef std::list<SWBuf> StringList;
+
+/** Simple XML helper class.
+*/
+class SWDLLEXPORT XMLTag {
+private:
+ mutable char *buf;
+ char *name;
+ mutable bool parsed;
+ mutable bool empty;
+ mutable bool endTag;
+ mutable StringPairMap attributes;
+ mutable SWBuf junkBuf;
+
+ void parse() const;
+ const char *getPart(const char *buf, int partNum = 0, char partSplit = '|') const;
+
+public:
+ XMLTag(const char *tagString = 0);
+ ~XMLTag();
+
+ void setText(const char *tagString);
+ inline const char *getName() const { return name; }
+
+ inline bool isEmpty() const {
+ if (!parsed)
+ parse();
+
+ return empty;
+ }
+ inline void setEmpty(bool value) {
+ if (!parsed)
+ parse();
+ empty = value;
+ }
+
+ inline bool isEndTag() const { return endTag; }
+
+ const StringList getAttributeNames() const;
+ int getAttributePartCount(const char *attribName, char partSplit = '|') const;
+ const char *getAttribute(const char *attribName, int partNum = -1, char partSplit = '|') const;
+ const char *setAttribute(const char *attribName, const char *attribValue);
+ const char *toString() const;
+ inline operator const char *() const { return toString(); }
+ inline XMLTag & operator =(const char *tagString) { setText(tagString); return *this; }
+ inline XMLTag & operator =(const XMLTag &other) { setText(other.toString()); return *this; }
+};
+
+SWORD_NAMESPACE_END
+#endif
+
diff --git a/include/versekey.h b/include/versekey.h
index 1d554d3..1cc5bf2 100644
--- a/include/versekey.h
+++ b/include/versekey.h
@@ -1,7 +1,7 @@
/******************************************************************************
* versekey.h - code for class 'versekey'- a standard Biblical verse key
*
- * $Id: versekey.h,v 1.24 2002/03/22 05:26:34 scribe Exp $
+ * $Id: versekey.h,v 1.30 2003/08/13 05:27:02 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -30,6 +30,8 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
#define POS_MAXVERSE ((char)3)
#define POS_MAXCHAPTER ((char)4)
#define POS_MAXBOOK ((char)5)
@@ -69,24 +71,20 @@ class SWLocale;
* Class VerseKey
* The SWKey implementation used for verse based modules like Bibles or commentaries.
*/
-class SWDLLEXPORT VerseKey:public SWKey
-{
- class LocaleCache
- {
+class SWDLLEXPORT VerseKey:public SWKey {
+ class LocaleCache {
public:
char *name;
unsigned int abbrevsCnt;
SWLocale *locale;
- LocaleCache()
- {
+ LocaleCache() {
name = 0;
abbrevsCnt = 0;
locale = 0;
}
- virtual ~LocaleCache()
- {
+ virtual ~LocaleCache() {
if (name)
- delete[]name;
+ delete[]name;
}
};
@@ -162,7 +160,7 @@ public:
* VerseKey Constructor - initializes Instance of VerseKey
*
* @param ikey text key (will take various forms of 'BOOK CH:VS'.
- * See @ref #parse for more detailed information)
+ * See parse() for more detailed information)
*/
VerseKey(const char *ikey = 0);
@@ -170,13 +168,13 @@ public:
* VerseKey Constructor - initializes instance of VerseKey
*
* @param ikey base key (will take various forms of 'BOOK CH:VS'.
- * See @ref #parse for more detailed information)
+ * See parse() for more detailed information)
*/
VerseKey(const SWKey * ikey);
/** VerseKey Constructor - initializes instance of VerseKey
- * with boundariess - see also @ref #LowerBound
- * and @ref #UpperBound
+ * with boundariess - see also LowerBound()
+ * and UpperBound()
* @param min the lower boundary of the new VerseKey
* @param max the upper boundary of the new VerseKey
*/
@@ -204,7 +202,7 @@ public:
/** sets the upper boundary for this VerseKey
* and returns the new boundary
- * @param lb the new upper boundary for this VerseKey
+ * @param ub the new upper boundary for this VerseKey
* @return the upper boundary the key was set to
*/
VerseKey & UpperBound(const char *ub);
@@ -242,24 +240,24 @@ public:
/** Positions this key
*
- * @param p position
+ * @param newpos Position to set to.
* @return *this
*/
- virtual void setPosition(SW_POSITION);
+ virtual void setPosition(SW_POSITION newpos);
/** Decrements key a number of verses
*
- * @param decrement Number of verses to jump backward
+ * @param steps Number of verses to jump backward
* @return *this
*/
- virtual void decrement(int step);
+ virtual void decrement(int steps);
/** Increments key a number of verses
*
- * @param increment Number of verses to jump forward
+ * @param steps Number of verses to jump forward
* @return *this
*/
- virtual void increment(int step);
+ virtual void increment(int steps);
virtual char Traversable() { return 1; }
virtual const char *getBookName() const;
@@ -367,7 +365,10 @@ public:
*/
virtual long Index(long iindex);
+ virtual const char *getOSISRef() const;
+
virtual ListKey ParseVerseList(const char *buf, const char *defaultKey = "Genesis 1:1", bool expandRange = false);
+ virtual const char *getRangeText() const;
/** Compares another SWKey object
*
* @param ikey key to compare with this one
@@ -391,10 +392,15 @@ public:
virtual void setLocale(const char *name);
virtual const char *getLocale() const { return locale; }
+
+
+ // OPERATORS --------------------------------------------------------------------
+
+
SWKEY_OPERATORS
virtual SWKey & operator = (const VerseKey & ikey) { copyFrom(ikey); return *this; }
};
-
+SWORD_NAMESPACE_END
#endif
diff --git a/include/zcom.h b/include/zcom.h
index 3e6aaad..17ad46d 100644
--- a/include/zcom.h
+++ b/include/zcom.h
@@ -2,7 +2,7 @@
* zcom.h - code for class 'zCom'- a module that reads compressed text
* files: ot and nt using indexs ??.vss
*
- * $Id: zcom.h,v 1.14 2002/03/16 04:18:34 scribe Exp $
+ * $Id: zcom.h,v 1.19 2003/02/20 07:25:20 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -29,41 +29,50 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
class SWDLLEXPORT zCom:public zVerse, public SWCom {
- VerseKey *lastWriteKey;
- bool sameBlock (VerseKey * lastWriteKey, VerseKey * key);
- int blockType;
+
+ VerseKey *lastWriteKey;
+ bool sameBlock(VerseKey * lastWriteKey, VerseKey * key);
+ int blockType;
+ VerseKey &getVerseKey();
+
+
public:
-
-
- zCom (const char *ipath, const char *iname = 0, const char *idesc =
- 0, int blockType = CHAPTERBLOCKS, SWCompress * icomp =
- 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
- const char* ilang = 0);
- virtual ~ zCom ();
- virtual char *getRawEntry ();
- virtual SWModule & operator += (int increment);
- virtual SWModule & operator -= (int decrement)
- {
- return this->operator += (-decrement);
- }
-
- // write interface ----------------------------
- virtual bool isWritable () { return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR)); }
- static char createModule (const char *path, int blockBound)
- {
- return zVerse::createModule (path, blockBound);
- }
- virtual SWModule & setentry (const char *inbuf, long len); // Modify current module entry
- virtual SWModule & operator << (const char *inbuf); // Modify current module entry
- virtual SWModule & operator << (const SWKey * linkKey); // Link current module entry to other module entry
- virtual void deleteEntry (); // Delete current module entry
- // end write interface ------------------------
-
- // swcacher interface ----------------------
+
+ zCom(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ int blockType = CHAPTERBLOCKS, SWCompress * icomp = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
+ virtual ~zCom();
+ virtual SWBuf &getRawEntryBuf();
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
+
+ // write interface ----------------------------
+ virtual bool isWritable() {
+ return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR));
+ }
+ static char createModule(const char *path, int blockBound) {
+ return zVerse::createModule(path, blockBound);
+ }
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey * linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
+ // end write interface ------------------------
+
+ virtual void rawZFilter(SWBuf &buf, char direction = 0) { rawFilter(buf, (SWKey *)(long)direction); }// hack, use key as direction for enciphering
+
+ // swcacher interface ----------------------
virtual void flush() { flushCache(); }
- // end swcacher interface ----------------------
+ // end swcacher interface ----------------------
+
+ SWMODULE_OPERATORS
+
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/zconf.h b/include/zconf.h
index 85fc50c..764cf4f 100644
--- a/include/zconf.h
+++ b/include/zconf.h
@@ -1,9 +1,9 @@
/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-1998 Jean-loup Gailly.
+ * Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
-/* @(#) $Id: zconf.h,v 1.1 2001/03/23 09:00:15 scribe Exp $ */
+/* @(#) $Id: zconf.h,v 1.4 2003/07/07 02:50:05 scribe Exp $ */
#ifndef _ZCONF_H
#define _ZCONF_H
@@ -220,7 +220,7 @@ typedef unsigned long uLong; /* 32 bits or more */
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
- typedef Byte FAR Bytef;
+ typedef unsigned char FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
diff --git a/include/zipcomprs.h b/include/zipcomprs.h
index 0e36396..4a8b04f 100644
--- a/include/zipcomprs.h
+++ b/include/zipcomprs.h
@@ -1,7 +1,7 @@
/******************************************************************************
* swcomprs.h - definition of Class SWCompress used for data compression
*
- * $Id: zipcomprs.h,v 1.3 2001/02/09 15:38:51 jansorg Exp $
+ * $Id: zipcomprs.h,v 1.4 2002/10/01 19:52:40 dglassey Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -26,6 +26,8 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
class SWDLLEXPORT ZipCompress:public SWCompress
{
protected:
@@ -36,4 +38,5 @@ public:
virtual void Decode (void);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/zld.h b/include/zld.h
index 716625b..0ec75f3 100644
--- a/include/zld.h
+++ b/include/zld.h
@@ -2,7 +2,7 @@
* zld.cpp - code for class 'zLD'- a module that reads compressed lexicon and
* dictionary files.
*
- * $Id: zld.h,v 1.4 2002/03/16 04:18:34 scribe Exp $
+ * $Id: zld.h,v 1.8 2003/02/20 07:25:20 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -28,10 +28,12 @@
#include <defs.h>
-class SWDLLEXPORT zLD:public zStr, public SWLD {
+SWORD_NAMESPACE_START
- void strongsPad (char *buf);
- char getEntry (long away = 0);
+class SWDLLEXPORT zLD : public zStr, public SWLD {
+
+ void strongsPad(char *buf);
+ char getEntry(long away = 0);
public:
@@ -39,29 +41,36 @@ public:
zLD(const char *ipath, const char *iname = 0, const char *idesc = 0, long blockCount = 200, SWCompress *icomp = 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
const char* ilang = 0);
virtual ~zLD();
- virtual char *getRawEntry();
+ virtual SWBuf &getRawEntryBuf();
+
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
- virtual SWModule & operator =(SW_POSITION pos);
- virtual SWModule & operator +=(int increment);
- virtual SWModule & operator -=(int decrement) {
- return this->operator +=(-decrement);
- }
// write interface ----------------------------
- virtual bool isWritable () { return ((idxfd->getFd() > 0) && ((idxfd->mode & O_RDWR) == O_RDWR)); }
- static char createModule (const char *path) {
- return zStr::createModule (path);
+ virtual bool isWritable() {
+ return ((idxfd->getFd() > 0) && ((idxfd->mode & O_RDWR) == O_RDWR));
+ }
+ static char createModule(const char *path) {
+ return zStr::createModule(path);
}
- virtual SWModule & setentry (const char *inbuf, long len); // Modify current module entry
- virtual SWModule & operator << (const char *inbuf); // Modify current module entry
- virtual SWModule & operator << (const SWKey * linkKey); // Link current module entry to other module entry
- virtual void deleteEntry (); // Delete current module entry
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
// end write interface ------------------------
+
+ virtual void rawZFilter(SWBuf &buf, char direction = 0) { rawFilter(buf, (SWKey *)(long)direction); }// hack, use key as direction for enciphering
// swcacher interface ----------------------
virtual void flush() { flushCache(); }
// end swcacher interface ----------------------
-};
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
#endif
diff --git a/include/zlib.h b/include/zlib.h
index 49f56b4..52cb529 100644
--- a/include/zlib.h
+++ b/include/zlib.h
@@ -1,7 +1,7 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.1.3, July 9th, 1998
+ version 1.1.4, March 11th, 2002
- Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler
+ Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -37,7 +37,7 @@
extern "C" {
#endif
-#define ZLIB_VERSION "1.1.3"
+#define ZLIB_VERSION "1.1.4"
/*
The 'zlib' compression library provides in-memory compression and
diff --git a/include/zstr.h b/include/zstr.h
index c0d4993..6cbb116 100644
--- a/include/zstr.h
+++ b/include/zstr.h
@@ -4,7 +4,7 @@
* and provides lookup and parsing functions based on
* class StrKey
*
- * $Id: zstr.h,v 1.3 2002/03/13 06:55:39 scribe Exp $
+ * $Id: zstr.h,v 1.8 2003/08/12 05:36:30 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -26,9 +26,11 @@
#define ZSTR_H
#include <filemgr.h>
-
+#include <swbuf.h>
#include <defs.h>
+SWORD_NAMESPACE_START
+
class SWCompress;
class EntriesBlock;
@@ -54,7 +56,7 @@ protected:
void getCompressedText(long block, long entry, char **buf);
void flushCache();
- void prepText(char *buf);
+ void prepText(SWBuf &buf);
void getKeyFromDatOffset(long ioffset, char **buf);
void getKeyFromIdxOffset(long ioffset, char **buf);
@@ -64,9 +66,11 @@ public:
virtual ~zStr();
signed char findKeyIndex(const char *ikey, long *idxoff, long away = 0);
void getText(long index, char **idxbuf, char **buf);
- void setText(const char *ikey, const char *buf, long len = 0);
+ void setText(const char *ikey, const char *buf, long len = -1);
void linkEntry(const char *destkey, const char *srckey);
+ virtual void rawZFilter(SWBuf &buf, char direction = 0) {}
static signed char createModule (const char *path);
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/ztext.h b/include/ztext.h
index db1b76e..ee38b77 100644
--- a/include/ztext.h
+++ b/include/ztext.h
@@ -2,7 +2,7 @@
* ztext.h - code for class 'zText'- a module that reads compressed text
* files: ot and nt using indexs ??.vss
*
- * $Id: ztext.h,v 1.22 2002/03/16 04:18:34 scribe Exp $
+ * $Id: ztext.h,v 1.29 2003/08/29 06:00:16 scribe Exp $
*
* Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
@@ -24,47 +24,75 @@
#define ZTEXT_H
#include <zverse.h>
+#include <rawstr.h>
#include <swtext.h>
//#include <swcomprs.h>
#include <defs.h>
+namespace lucene { namespace index {
+class IndexReader;
+}}
+
+namespace lucene { namespace search {
+class IndexSearcher;
+}}
+
+SWORD_NAMESPACE_START
+
/*** SWModule implementation for compressed modules
* This class handles compressed modules.
* It should not be used in frontends, unless you are doing very special things.
*/
class SWDLLEXPORT zText:public zVerse, public SWText {
- VerseKey *lastWriteKey;
- bool sameBlock (VerseKey * lastWriteKey, VerseKey * key);
+
+ VerseKey *lastWriteKey;
+ bool sameBlock(VerseKey * lastWriteKey, VerseKey * key);
int blockType;
+ lucene::index::IndexReader *ir;
+ lucene::search::IndexSearcher *is;
+ VerseKey &getVerseKey();
+
+
public:
-
- zText(const char *ipath, const char *iname = 0, const char *idesc =
- 0, int blockType = CHAPTERBLOCKS, SWCompress * icomp =
- 0, SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
- const char* ilang = 0);
- virtual ~zText ();
- virtual char *getRawEntry();
+ zText(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ int blockType = CHAPTERBLOCKS, SWCompress * icomp = 0,
+ SWDisplay * idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR,
+ SWTextMarkup markup = FMT_UNKNOWN, const char* ilang = 0);
- virtual SWModule & operator += (int increment);
- virtual SWModule & operator -= (int decrement) { return this->operator += (-decrement); }
+ virtual ~zText();
+ virtual SWBuf &getRawEntryBuf();
+
+ virtual void increment(int steps = 1);
+ virtual void decrement(int steps = 1) { increment(-steps); }
// write interface ----------------------------
- virtual bool isWritable () { return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR)); }
- static char createModule (const char *path, int blockBound) {
- return zVerse::createModule (path, blockBound);
+ virtual bool isWritable() { return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & O_RDWR) == O_RDWR)); }
+ static char createModule(const char *path, int blockBound) {
+ return zVerse::createModule(path, blockBound);
}
- virtual SWModule & setentry (const char *inbuf, long len); // Modify current module entry
- virtual SWModule & operator << (const char *inbuf); // Modify current module entry
- virtual SWModule & operator << (const SWKey * linkKey); // Link current module entry to other module entry
- virtual void deleteEntry (); // Delete current module entry
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+ virtual void deleteEntry(); // Delete current module entry
// end write interface ------------------------
+ virtual void rawZFilter(SWBuf &buf, char direction = 0) { rawFilter(buf, (SWKey *)(long)direction); }// hack, use key as direction for enciphering
+
// swcacher interface ----------------------
virtual void flush() { flushCache(); }
// end swcacher interface ----------------------
+
+ virtual signed char createSearchFramework();
+ virtual bool hasSearchFramework() { return true; }
+ virtual ListKey &search(const char *istr, int searchType = 0, int flags = 0, SWKey * scope = 0, bool * justCheckIfSupported = 0, void (*percent)(char, void *) = &SWModule::nullPercent, void *percentUserData = 0);
+
+
+ SWMODULE_OPERATORS
+
};
+SWORD_NAMESPACE_END
#endif
diff --git a/include/zverse.h b/include/zverse.h
index ba29b8d..b5df882 100644
--- a/include/zverse.h
+++ b/include/zverse.h
@@ -1,5 +1,5 @@
/******************************************************************************
- * rawverse.h - code for class 'RawVerse'- a module that reads raw text
+ * rawverse.h - code for class 'zVerse'- a module that reads raw text
* files: ot and nt using indexs ??.bks ??.cps ??.vss
* and provides lookup and parsing functions based on
* class VerseKey
@@ -15,21 +15,22 @@
#include <defs.h>
+SWORD_NAMESPACE_START
+
class SWDLLEXPORT zVerse {
SWCompress *compressor;
protected:
- static int instance; // number of instantiated RawVerse objects or derivitives
+ static int instance; // number of instantiated zVerse objects or derivitives
FileDesc *idxfp[2];
FileDesc *textfp[2];
FileDesc *compfp[2];
char *path;
- void preptext (char *buf);
- void settext (char testmt, long idxoff, const char *buf, long len = 0);
- void linkentry (char testmt, long destidxoff, long srcidxoff);
- void flushCache ();
- //RawVerse();
+ void prepText(SWBuf &buf);
+ void doSetText(char testmt, long idxoff, const char *buf, long len = 0);
+ void doLinkEntry(char testmt, long destidxoff, long srcidxoff);
+ void flushCache();
char *cacheBuf;
char cacheTestament;
long cacheBufIdx;
@@ -45,12 +46,13 @@ public:
char nl;
- zVerse (const char *ipath, int fileMode = O_RDONLY, int blockType = CHAPTERBLOCKS, SWCompress * icomp = 0);
- virtual ~ zVerse ();
- void findoffset (char testmt, long idxoff, long *start, unsigned short *end);
- void swgettext (char testmt, long start, unsigned short size, char *buf);
- static char createModule (const char *path, int blockBound);
+ zVerse(const char *ipath, int fileMode = O_RDONLY, int blockType = CHAPTERBLOCKS, SWCompress * icomp = 0);
+ virtual ~zVerse();
+ void findOffset(char testmt, long idxoff, long *start, unsigned short *end);
+ void zReadText(char testmt, long start, unsigned short size, SWBuf &buf);
+ virtual void rawZFilter(SWBuf &buf, char direction = 0) {}
+ static char createModule(const char *path, int blockBound);
};
-
+SWORD_NAMESPACE_END
#endif