[sword-svn] r1819 - in trunk: . examples/cmdline include tests
scribe at crosswire.org
scribe at crosswire.org
Sat May 28 00:07:41 MST 2005
Author: scribe
Date: 2005-05-28 00:07:40 -0700 (Sat, 28 May 2005)
New Revision: 1819
Modified:
trunk/CODINGSTYLE
trunk/ChangeLog
trunk/configure.ac
trunk/examples/cmdline/lookup.cpp
trunk/examples/cmdline/search.cpp
trunk/examples/cmdline/threaded_search.cpp
trunk/include/swkey.h
trunk/include/swmgr.h
trunk/include/swmodule.h
trunk/tests/modtest.cpp
trunk/usrinst.sh
Log:
Updated docs for main classes.
Modified: trunk/CODINGSTYLE
===================================================================
--- trunk/CODINGSTYLE 2005-05-25 11:56:49 UTC (rev 1818)
+++ trunk/CODINGSTYLE 2005-05-28 07:07:40 UTC (rev 1819)
@@ -40,15 +40,42 @@
class ClassDef {
private:
protected:
- void method(int param1, char param2);
+
+ /** This method does something
+ * @param paramName1 the first parameter name
+ * @param param2 the second parameter name
+ * @return error status
+ */
+ char methodName(int paramName1, char param2 = -1);
+
+ /** This method does something too
+ */
+ void anotherMethodName() { someShortExpression; }
+
public:
ClassDef();
};
+ char ClassDef::methodName(int paramName1, char param2) {
+ char retVal = 0;
+ // do something;
+ return retVal;
+ }
+
ClassDef classDef;
- classDef.method(1, '2');
+ classDef.methodName(1, '2');
- var1 = 1;
- variable2 = 2;
- var3 = 3;
+ if (((reallyLongCondition) && (moreLogic)) ||
+ (otherCondition)) {
+ expression;
+ }
+
+ int varName1 = 1;
+ char *variable2 = "2";
+ int &var3 = varName1;
+ int variable4, variable5, var6, var7;
+
variable4 = 4;
+ variable5 = 5;
+ var6 = 6;
+ var7 = 7;
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2005-05-25 11:56:49 UTC (rev 1818)
+++ trunk/ChangeLog 2005-05-28 07:07:40 UTC (rev 1819)
@@ -1,6 +1,11 @@
-API ChangeLog (see the ChangeLog in each 'apps' directory for
+API ChangeLog (see the ChangeLog in each 'apps' directory for
app specific changes
+* Release 1.5.8 *
+
+27-May-2005 Troy A. Griffitts <scribe at crosswire.org>
+ Clean up and package for 1.5.8
+
16-May-2005 Troy A. Griffitts <scribe at crosswire.org>
Changed Strongs to Lemma and added LemmaClass for
EntryAttributes
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2005-05-25 11:56:49 UTC (rev 1818)
+++ trunk/configure.ac 2005-05-28 07:07:40 UTC (rev 1819)
@@ -5,7 +5,7 @@
# Version change: Change line 8 only !
# Change it immediately after a release
-AC_INIT(sword, 1.5.7.103, sword-bugs at crosswire.org)
+AC_INIT(sword, 1.5.8, sword-bugs at crosswire.org)
AC_CONFIG_SRCDIR(sword.bmp)
AC_PREREQ(2.52)
AC_REVISION($Revision: 1.45 $)
Modified: trunk/examples/cmdline/lookup.cpp
===================================================================
--- trunk/examples/cmdline/lookup.cpp 2005-05-25 11:56:49 UTC (rev 1818)
+++ trunk/examples/cmdline/lookup.cpp 2005-05-28 07:07:40 UTC (rev 1819)
@@ -20,7 +20,9 @@
ModMap::iterator it;
if (argc != 3) {
- fprintf(stderr, "usage: %s <modname> <\"lookup key\">\n", argv[0]);
+ fprintf(stderr, "\nusage: %s <modname> <\"lookup key\">\n"
+ "\tExample: lookup KJV \"James 1:19\"\n\n", argv[0]);
+
exit(-1);
}
Modified: trunk/examples/cmdline/search.cpp
===================================================================
--- trunk/examples/cmdline/search.cpp 2005-05-25 11:56:49 UTC (rev 1818)
+++ trunk/examples/cmdline/search.cpp 2005-05-28 07:07:40 UTC (rev 1819)
@@ -36,7 +36,9 @@
ModMap::iterator it;
if ((argc != 3) && (argc != 4)) {
- fprintf(stderr, "usage: %s <modname> <\"search string\"> [\"search_scope\"]\n", argv[0]);
+ fprintf(stderr, "\nusage: %s <modname> <\"search string\"> [\"search_scope\"]\n"
+ "\tExample: search KJV \"swift hear slow speak\"\n\n", argv[0]);
+
exit(-1);
}
@@ -59,7 +61,7 @@
std::cout << "[0=================================50===============================100]\n ";
char lineLen = 70;
- listkey = target->Search(argv[2], -2, SEARCHFLAG_MATCHWHOLEENTRY/*REG_ICASE*/, 0, 0, &percentUpdate, &lineLen);
+ listkey = target->Search(argv[2], -2, /*SEARCHFLAG_MATCHWHOLEENTRY*/ REG_ICASE, 0, 0, &percentUpdate, &lineLen);
std::cout << "\n";
while (!listkey.Error()) {
std::cout << (const char *)listkey << std::endl;
Modified: trunk/examples/cmdline/threaded_search.cpp
===================================================================
--- trunk/examples/cmdline/threaded_search.cpp 2005-05-25 11:56:49 UTC (rev 1818)
+++ trunk/examples/cmdline/threaded_search.cpp 2005-05-28 07:07:40 UTC (rev 1819)
@@ -18,23 +18,23 @@
int cms_currentProgress;
-class CSwordModuleSearch {
+class SearchThread {
public:
- CSwordModuleSearch();
- ~CSwordModuleSearch();
+ SearchThread();
+ ~SearchThread();
- char* m_searchedText;
- SWModule* m_module;
- ListKey m_searchResult;
- bool m_isSearching;
+ char* searchedText;
+ SWModule* module;
+ ListKey searchResult;
+ bool isSearching;
void startThread();
void search();
};
void* dummy(void* p) {
- CSwordModuleSearch* moduleSearch = (CSwordModuleSearch*)p;
- moduleSearch->search();
+ SearchThread* searchThread = (SearchThread*)p;
+ searchThread->search();
return NULL;
}
@@ -44,17 +44,17 @@
std::cout << cms_currentProgress << "% ";
}
-CSwordModuleSearch::CSwordModuleSearch() {
- m_isSearching = false;
- m_module = 0;
- m_searchedText = 0;
+SearchThread::SearchThread() {
+ isSearching = false;
+ module = 0;
+ searchedText = 0;
cms_currentProgress = -1;
}
-CSwordModuleSearch::~CSwordModuleSearch() {
+SearchThread::~SearchThread() {
}
-void CSwordModuleSearch::startThread() {
+void SearchThread::startThread() {
std::cout << "startThread" << std::endl;
std::cout.flush();
@@ -63,16 +63,16 @@
pthread_attr_setdetachstate(attr, PTHREAD_CREATE_DETACHED);
pthread_t *thread= new pthread_t;
- m_isSearching = true;
+ isSearching = true;
int i = pthread_create(thread, attr, &dummy, this);
std::cout << "Created the thread: " << i << std::endl;
std::cout.flush();
}
-void CSwordModuleSearch::search() {
+void SearchThread::search() {
- if (!m_module) {
+ if (!module) {
std::cout << "Return." << std::endl;
return;
}
@@ -83,11 +83,11 @@
}
SWKey* scope = &scopeList;
- m_searchResult = m_module->Search(m_searchedText, -2, REG_ICASE, scope, 0, &percentUpdate);
+ searchResult = module->Search(searchedText, -2, REG_ICASE, scope, 0, &percentUpdate);
if (!scope)
std::cout << "bad scope!" << std::endl;
- m_isSearching = false;
+ isSearching = false;
}
int main(int argc, char **argv) {
@@ -95,7 +95,7 @@
ModMap::iterator it;
int oldProgress = 0;
- CSwordModuleSearch* moduleSearch = new CSwordModuleSearch();
+ SearchThread* searchThread = new SearchThread();
if (argc != 3) {
fprintf(stderr, "usage: %s <modname> <searched text>\n", argv[0]);
@@ -111,24 +111,24 @@
exit(-1);
}
- moduleSearch->m_searchedText = argv[2];
- moduleSearch->m_module = (*it).second;
- moduleSearch->startThread();
+ searchThread->searchedText = argv[2];
+ searchThread->module = (*it).second;
+ searchThread->startThread();
std::cout << "Start loop" << std::endl;
std::cout.flush();
while (true) {
- if (!moduleSearch->m_isSearching)
+ if (!searchThread->isSearching)
break;
else
std::cout.flush();
};
- std::cout << std::endl << "Number of found items: " << moduleSearch->m_searchResult.Count() << std::endl;
+ std::cout << std::endl << "Number of found items: " << searchThread->searchResult.Count() << std::endl;
std::cout << "Finished program" << std::endl;
std::cout.flush();
- delete moduleSearch;
+ delete searchThread;
exit(0);
}
Modified: trunk/include/swkey.h
===================================================================
--- trunk/include/swkey.h 2005-05-25 11:56:49 UTC (rev 1818)
+++ trunk/include/swkey.h 2005-05-28 07:07:40 UTC (rev 1819)
@@ -33,24 +33,24 @@
#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.
-
+/** For use with = operator to position key.
+*/
class SW_POSITION {
char pos;
public:
@@ -64,10 +64,10 @@
#define TOP SW_POSITION(POS_TOP)
#define BOTTOM SW_POSITION(POS_BOTTOM)
-/** SWKey is the basis for all
-* types of keys for indexing into modules (e.g. verse, word,
-* place, etc.)
-*/
+/** SWKey is used for positioning an SWModule to a specific entry.
+ * It always represents a possible location into a module and can additionally represent
+ * a domain of entries (e.g. "John 3:16" in the domain "John 1:1 - Mark 5:25")
+ */
class SWDLLEXPORT SWKey : public SWObject {
long index;
static SWClass classdef;
@@ -85,133 +85,125 @@
// misc pointer for whatever
void *userData;
- /** initializes instance of SWKey
- *
- * @param ikey Initialize from text key.
- */
+ /** initializes instance of SWKey from a string
+ * All keys can be reduced to a string representation which should be able
+ * to be used to again set the key to the same position
+ * @param ikey string to use for initializing this new key
+ */
SWKey(const char *ikey = 0);
/** Copy Constructor
- * @param k The SWKey object to copy.
- */
+ * @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
- */
+ /** Returns a new exact clone of this SWKey object. This allocates
+ * a new SWKey which must be deleted by the caller
+ * @return new clone of this key
+ */
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
- */
+ /** Gets whether this key should persist in any module to which it is set
+ * otherwise just a copy will be used in the module.
+ * @return 1 - persists in module; 0 - a copy is attempted
+ */
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
- */
+ /** Sets whether this key should persist in any module to which it is set
+ * otherwise just a copy will be used in the module.
+ * @param ipersist value which to set persist;
+ * @return 1 - persists in module; 0 - a copy is attempted
+ */
char Persist(signed char ipersist);
/** Gets and clears error status
- *
- * @return error status
- */
+ * @return error status
+ */
virtual char Error();
- /** Equates this SWKey to a character string
- *
- * @param ikey string to set this key to
- */
+ /** Sets this SWKey with a character string
+ * @param ikey string used to set this key
+ */
virtual void setText(const char *ikey);
- /** Equates this SWKey to another SWKey object
- *
- * @param ikey other swkey object
- */
+ /** Copies as much info (position, range, etc.) as possible from another SWKey object
+ * @param ikey other SWKey object from which to copy
+ */
virtual void copyFrom(const SWKey &ikey);
- /** returns text key if (char *) cast is requested
- */
+ /** returns string representation of this key
+ */
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 this key object to another SWKey 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
- */
+ /** test equality of this SWKey object's position with another SWKey
+ * @param ikey key to compare with this one
+ * @return true if the key positions are equal
+ */
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
- */
+ /** Decrements key a number of entry positions
+ * This is only valid if isTraversable is true
+ * @param steps Number of entries to jump backward
+ */
virtual void decrement(int steps = 1);
- /** Increments key a number of entries
- *
- * @param steps Number of entries to jump forward
- * @return *this
- */
+ /** Increments key a number of entry positions
+ * This is only valid if isTraversable is true
+ * @param steps Number of entries to jump forward
+ */
virtual void increment(int steps = 1);
/** Increments key a number of entries
- * deprecated, use isTraversible
- */
+ * deprecated, use isTraversible
+ */
char Traversable() { return (isTraversable()) ? 1:0; }
+ /** Whether or not this key can be ++ -- incremented
+ */
virtual bool isTraversable() { return false; }
- /** Use this function to get te current position within 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::getSystemLocaleMgr()->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
- */
+ /** Use this function to get an index position within 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::getSystemLocaleMgr()->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; }
+
/** See documentation for @ref Index()
- */
+ */
virtual long Index(long iindex) { index = iindex; return index; }
SWKEY_OPERATORS
Modified: trunk/include/swmgr.h
===================================================================
--- trunk/include/swmgr.h 2005-05-25 11:56:49 UTC (rev 1818)
+++ trunk/include/swmgr.h 2005-05-28 07:07:40 UTC (rev 1819)
@@ -1,40 +1,52 @@
/******************************************************************************
-* swmgr.h - definition of class SWMgr used to interact with an install
-* base of sword modules.
-*
-* $Id$
-*
-* 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$
+ *
+ * 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 - 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.
-*
-* Sword provides an interface to different modules (Bibles/Commentaries/Lexicons)
-* on disk. The object to work directly with the modules is SWModule.
-* Use the class SWMgr to manage the modules.
-*
-* If you want to write your own frontend for Sword please have a look at the already existing ones.
-* Well known 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.info/)\n
-*/
+/** @mainpage The SWORD Project - API documentation
+ * This is the API documentation for 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.
+ *
+ * SWORD provides a simple to use engine for working with many types of texts including Bibles,
+ * commentaries, lexicons, glossaries, daily devotionals, and others.
+ *
+ * Some main classes:
+ *
+ * SWMgr makes an installed library of modules (works) available.
+ * SWModule represents an individual work
+ * SWKey represents a location into a work (e.g. "John 3:16")
+ *
+ * An API Primer can be found at:
+ *
+ * http://crosswire.org/sword/develop/swordapi/apiprimer.jsp
+ *
+ * If you're interested in working on a client which uses SWORD, please first have a look at
+ * some of the existing ones. They can always use help, and will also prove to be good examples
+ * if you decide to start a new project.
+ *
+ * Well known frontends are:\n
+ * -SWORD for Windows (http://crosswire.org/sword/software/biblecs/)\n
+ * -GnomeSword (http://gnomesword.sourceforge.net/)\n
+ * -BibleTime (http://www.bibletime.info/)\n
+ */
#ifndef SWMGR_H
#define SWMGR_H
@@ -55,16 +67,13 @@
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 exposes an installed module set
+ *
+ * SWMgr exposes an installed module set and can be asked to configure the desired
+ * markup and options which modules will produce.
+ *
+ * @version $Id$
+ */
class FileDesc;
@@ -73,11 +82,11 @@
private:
bool mgrModeMultiMod;
bool augmentHome;
- void commonInit(SWConfig * iconfig, SWConfig * isysconfig, bool autoload, SWFilterMgr *filterMgr, bool multiMod = false);
+ void commonInit(SWConfig *iconfig, SWConfig *isysconfig, bool autoload, SWFilterMgr *filterMgr, bool multiMod = false);
protected:
SWFilterMgr *filterMgr; //made protected because because BibleTime needs it
- SWConfig * myconfig; //made protected because because BibleTime needs it
+ SWConfig *myconfig; //made protected because because BibleTime needs it
SWConfig *mysysconfig;
SWConfig *homeConfig;
void CreateMods(bool multiMod = false);
@@ -95,221 +104,232 @@
virtual void init(); // use to initialize before loading modules
virtual char AddModToConfig(FileDesc *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);
+ virtual void AddGlobalOptions(SWModule *module, ConfigEntMap §ion, ConfigEntMap::iterator start, ConfigEntMap::iterator end);
+ virtual void AddLocalOptions(SWModule *module, ConfigEntMap §ion, 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);
+ * Called to add appropriate Encoding Filters to a module. Override to do special actions,
+ * if desired. See the module.conf Encoding= entry.
+ * @param module module to which to add Encoding Filters
+ * @param section configuration information from module.conf
+ */
+ virtual void AddEncodingFilters(SWModule *module, ConfigEntMap §ion);
+
/**
- * 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);
+ * Called to add appropriate Render Filters to a module. Override to do special actions,
+ * if desired. See the module.conf SourceType= entry.
+ * @param module module to which to add Render Filters
+ * @param section configuration information from module.conf
+ */
+ virtual void AddRenderFilters(SWModule *module, ConfigEntMap §ion);
+
/**
- * 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);
+ * Called to add appropriate Strip Filters to a module. Override to do special actions,
+ * if desired. See the module.conf SourceType= entry.
+ * @param module module to which to add Strip Filters
+ * @param section configuration information from module.conf
+ */
+ virtual void AddStripFilters(SWModule *module, ConfigEntMap §ion);
+
/**
- * 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);
+ * Called to add appropriate Raw Filters to a module. Override to do special actions,
+ * if desired. See the module.conf CipherKey= entry.
+ * @param module module to which to add Raw Filters
+ * @param section configuration information from module.conf
+ */
+ virtual void AddRawFilters(SWModule *module, ConfigEntMap §ion);
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".
- */
+ /** Enable / Disable debug output at runtime
+ * Set this to true to get more verbose output from 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 path to main module set and locales
+ */
+ char *prefixPath;
+
+ /** path to main module set configuration
+ */
+ char *configPath;
+
/** 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
- */
+ * This map exposes the installed modules.
+ * Here's an example how to iterate over the map and check the module type of each module.
+ *
+ *@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;
+
+ /** Gets a specific module by name. e.g. SWModule *kjv = myManager.getModule("KJV");
+ * @param modName the name of the module to retrieve
+ * @return the module, if found, otherwise 0
+ */
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, bool multiMod = false);
+ /** Constructs an instance of SWMgr
+ *
+ * @param iconfig manually supply a configuration. If not supplied, SWMgr will look on the system
+ * using a complex hierarchical search. See README for detailed specifics.
+ * @param isysconfig
+ * @param autoload whether or not to immediately load modules on construction of this SWMgr.
+ * If you reimplemented SWMgr you can set this to false and call SWMgr::Load() after you have
+ * completed the contruction and setup of your SWMgr subclass.
+ * @param filterMgr an SWFilterMgr subclass to use to manager filters on modules
+ * SWMgr TAKES OWNERSHIP FOR DELETING THIS OBJECT
+ * For example, this will create an SWMgr and cause its modules to produce HTMLHREF formatted output
+ * when asked for renderable text:
+ *
+ * SWMgr *myMgr = new SWMgr(0, 0, false, new MarkupFilterMgr(FMT_HTMLHREF));
+ */
+ SWMgr(SWConfig *iconfig = 0, SWConfig *isysconfig = 0, bool autoload = true, SWFilterMgr *filterMgr = 0, bool multiMod = false);
+
/**
- *
- * @param filterMgr an SWFilterMgr subclass to use to manager filters on modules THIS WILL BE DELETED BY SWMgr
- */
+ */
SWMgr(SWFilterMgr *filterMgr, bool multiMod = false);
/**
- *
- * @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 iConfigPath explicit path to use where modules exist
- * @param filterMgr an SWFilterMgr subclass to use to manager filters on
- * modules THIS WILL BE DELETED BY SWMgr
- * @param augmentHome whether or not to augment ~/.sword personal modules
- * default is to augment modules,
- *
- */
+ * @param iConfigPath provide a custom path to use for module set location, instead of
+ * searching the system for it.
+ */
SWMgr(const char *iConfigPath, bool autoload = true, SWFilterMgr *filterMgr = 0, bool multiMod = false, bool augmentHome = true);
/** 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.
- */
+ * This function cleans up the modules and deletes the created object.
+ * Destroying the SWMgr causes all retrieved SWModule object to be invalid, so
+ * be sure to destroy only when retrieved objects are no longer needed.
+ */
virtual ~SWMgr();
/**
- * Adds books from a new path to the library
- * @param path the path in which to search for books
- * @param multiMod whether or not to keep multiple copies of the same book if found in different paths
- * default - false, uses last found version of the book
- */
+ * Adds books from a new path to the library
+ * @param path the path in which to search for books
+ * @param multiMod whether or not to keep multiple copies of the same book if found in different paths
+ * default - false, uses last found version of the book
+ */
virtual void augmentModules(const char *path, bool multiMod = false);
+
void deleteModule(const char *);
- /**Installs a scan for modules in the directory givan as parameter.
- * @param dir The directory where new modules should be searched.
- */
+ /** Looks for any newly installed module.conf file in the path provided,
+ * displays the copyright information to the user, and then copies the
+ * module.conf to the main module set's mods.d directory
+ * @param dir where to search for new modules
+ */
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.
- */
+
+ /** Load all modules. Should only be manually called if SWMgr was constructed
+ * without autoload; otherwise, this will be called on SWMgr construction
+ * Reimplement this function to supply special functionality when modules are
+ * initially loaded.
+ */
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"
- */
+
+ /** Change the values of global options (e.g. Footnotes, Strong's Number, etc.)
+ * @param option The name of the option, for which you want to change the
+ * value. Well known and often used values are "Footnotes" or "Strong's Numbers"
+ * @param value new 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
- */
+
+ /** Get the current value of the given option
+ * @param option the name of the option, who's value is desired
+ * @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
- */
+
+ /** Gets a brief description for the given option
+ * @param option the name of the option, who's tip is desired
+ * @return description text
+ * @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.
- */
+
+ /** Gets a list of all available option names
+ * @return list of option names
+ */
virtual StringList getGlobalOptions();
- /**
- *
- */
+
+ /** Gets a list of legal values to which a specific option
+ * may be set
+ * @param option the name of the option, who's legal values are desired
+ * @return a list of legal values for the given option
+ */
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.
- */
+ * 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);
};
Modified: trunk/include/swmodule.h
===================================================================
--- trunk/include/swmodule.h 2005-05-25 11:56:49 UTC (rev 1818)
+++ trunk/include/swmodule.h 2005-05-28 07:07:40 UTC (rev 1819)
@@ -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$
-*
-* 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$
+ *
+ * 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
@@ -68,7 +68,8 @@
/**
* 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.
+ * 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.
*/
@@ -268,84 +269,93 @@
return getDisplay();
}
-
/** Gets module name
- *
- * @return pointer to modname
- */
+ *
+ * @return pointer to modname
+ */
virtual char *Name() const;
+
/** Sets module name
- *
- * @param imodname Value which to set modname; [0]-only get
- * @return pointer to modname
- */
+ *
+ * @param imodname Value which to set modname; [0]-only get
+ * @return pointer to modname
+ */
virtual char *Name(const char *imodname);
+
/** Gets module description
- *
- * @return pointer to moddesc
- */
+ *
+ * @return pointer to moddesc
+ */
virtual char *Description() const;
+
/** Sets module description
- *
- * @param imoddesc Value which to set moddesc; [0]-only get
- * @return pointer to moddesc
- */
+ *
+ * @param imoddesc Value which to set moddesc; [0]-only get
+ * @return pointer to moddesc
+ */
virtual char *Description(const char *imoddesc);
+
/** Gets module type
- *
- * @return pointer to modtype
- */
+ *
+ * @return pointer to modtype
+ */
virtual char *Type() const;
+
/** Sets module type
- *
- * @param imodtype Value which to set modtype; [0]-only get
- * @return pointer to modtype
- */
+ *
+ * @param imodtype Value which to set modtype; [0]-only get
+ * @return pointer to modtype
+ */
virtual char *Type(const char *imodtype);
+
/** Sets/gets module direction
- *
- * @param newdir Value which to set direction; [-1]-only get
- * @return new 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
- */
+ *
+ * @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
- */
+ *
+ * @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
- */
+ *
+ * @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
- * -3 - entryAttrib (eg. Word//Strongs/G1234/)
- * @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
- */
+ // 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
+ * -3 - entryAttrib (eg. Word//Strongs/G1234/)
+ * @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,
@@ -363,16 +373,17 @@
/** 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
- */
+ * 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
- */
+ * of module objects
+ * @return the raw module text of the current entry
+ */
#ifndef SWIG
virtual SWBuf &getRawEntryBuf() = 0;
#else
@@ -383,67 +394,84 @@
// write interface ----------------------------
/** Is the module writable? :)
- * @return yes or no
- */
+ * @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
- */
+
+ /** Creates a new, empty module
+ * @param path path where to create 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()
- */
+
+ /** 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
- */
+ * @param steps Number of entries to jump backward
+ */
virtual void decrement(int steps = 1);
+
/** Increments module key a number of entries
- *
- * @param steps Number of entries to jump forward
- * @return *this
- */
+ * @param steps Number of entries to jump forward
+ */
virtual void increment(int steps = 1);
- /** Positions this modules to an entry
- *
- * @param pos position (e.g. TOP, BOTTOM)
- * @return *this
- */
+
+ /** Positions this modules to a logical position entry
+ * @param pos position (e.g. TOP, BOTTOM)
+ */
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);
+
+ /** 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
+ */
+ 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);
+ }
+ }
+
+ /** Adds a RenderFilter to this module's renderFilters queue.
+ * Render Filters are called when the module is asked to produce
+ * renderable text.
+ * @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);
+
+ /** 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) {
+ * @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)
@@ -451,36 +479,42 @@
}
return *this;
}
- /** RenderFilter a text buffer
- * @param buf the buffer to filter
- * @param key key location from where this buffer was extracted
- * @return *this
- */
+
+ /** RenderFilter run a buf through this module's Render Filters
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ */
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);
+
+ /** Adds an EncodingFilter to this module's @see encodingFilters queue.
+ * Encoding Filters are called immediately when the module is read
+ * from data source, to assure we have desired internal data stream
+ * (e.g. UTF-8 for text modules)
+ * @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);
+
+ /** 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) {
+ * @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)
@@ -488,121 +522,132 @@
}
return *this;
}
- /** encodingFilter a text buffer
- * @param buf the buffer to filter
- * @param key key location from where this buffer was extracted
- * @return *this
- */
+
+ /** encodingFilter run a buf through this module's Encoding Filters
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ */
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);
+
+ /** Adds a StripFilter to this module's stripFilters queue.
+ * Strip filters are called when a module is asked to render
+ * an entry without any markup (like when searching).
+ * @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
- */
+
+ /** 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;
+ }
+
+ /** StripFilter run a buf through this module's Strip Filters
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ */
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
- */
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ */
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) {
+
+ /** Adds an OptionFilter to this module's optionFilters queue.
+ * Option Filters are used to turn options in the text on
+ * or off, or so some other state (e.g. Strong's Number,
+ * Footnotes, Cross References, etc.)
+ * @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
- */
+ * @param buf the buffer to filter
+ * @param key key location from where this buffer was extracted
+ */
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
- */
+
+ /** Produces plain text, without markup, of the current module entry,
+ * or supplied text
+ *
+ * @param buf buf to massage instead of current module entry;
+ * if buf is 0, the current text will be used
+ * @param len max len to process
+ * @return result buffer
+ */
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 0, the current module position 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
- */
+
+ /** Produces renderable text of the current module entry or supplied text
+ *
+ * @param buf buffer to massage instead of current module entry;
+ * if buf is 0, the current module position text will be used
+ * @param len max len to process
+ * @param render for internal use
+ * @return result buffer
+ */
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
- */
+
+ /** Produces plain text, without markup, of the module entry at the supplied key
+ * @param tmpKey desired module entry
+ * @return result buffer
+ */
+ virtual const char *StripText(SWKey *tmpKey);
+
+ /** Produces renderable text of the module entry at the supplied key
+ * @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);
+
+ /** Whether or not to only hit one entry when iterating encounters
+ * consecutive links when iterating
+ * @param val = true means only include entry once in iteration
+ */
virtual void setSkipConsecutiveLinks(bool val) { skipConsecutiveLinks = val; }
- /** DOCS NEEDED.
- */
+
+ /** Whether or not to only hit one entry when iterating encounters
+ * consecutive links when iterating
+ */
virtual bool getSkipConsecutiveLinks() { return skipConsecutiveLinks; }
- /** DOCS NEEDED.
- */
+
+ /** Entry Attributes are special data pertaining to the current entry.
+ * To see what Entry Attributes exists for a specific entry of a module,
+ * the example examples/cmdline/lookup.cpp is a good utility which
+ * displays this information. It is also useful as an example of how
+ * to access such.
+ */
virtual AttributeTypeList &getEntryAttributes() const { return entryAttributes; }
- /** DOCS NEEDED.
- */
+
+ /** Processing Entry Attributes can be expensive. This method allows
+ * turning the processing off if they are not desired. Some internal
+ * engine processing turns them off (like searching) temporarily for
+ * optimization.
+ */
virtual void processEntryAttributes(bool val) const { procEntAttr = val; }
- /** DOCS NEEDED.
- */
+
+ /** Whether or not we're processing Entry Attributes
+ */
virtual bool isProcessEntryAttributes() const { return procEntAttr; }
// OPERATORS -----------------------------------------------------------------
Modified: trunk/tests/modtest.cpp
===================================================================
--- trunk/tests/modtest.cpp 2005-05-25 11:56:49 UTC (rev 1818)
+++ trunk/tests/modtest.cpp 2005-05-28 07:07:40 UTC (rev 1819)
@@ -8,7 +8,7 @@
int main(int argc, char **argv) {
SWMgr mymgr;
ModMap::iterator it;
- SWModule *module = mymgr.Modules["RWP"];
+ SWModule *module = mymgr.Modules["KJV"];
VerseKey parser;
ListKey lk = parser.ParseVerseList("mal4:6-rev", parser, true);
lk.Persist(1);
Modified: trunk/usrinst.sh
===================================================================
--- trunk/usrinst.sh 2005-05-25 11:56:49 UTC (rev 1818)
+++ trunk/usrinst.sh 2005-05-28 07:07:40 UTC (rev 1819)
@@ -1,17 +1,17 @@
#!/bin/sh
OPTIONS="--prefix=/usr $OPTIONS"
-#OPTIONS="--disable-shared $OPTIONS"
+OPTIONS="--disable-shared $OPTIONS"
OPTIONS="--without-conf $OPTIONS"
OPTIONS="--sysconfdir=/etc $OPTIONS"
#OPTIONS="--with-icu $OPTIONS"
#OPTIONS="--with-vcl $OPTIONS"
-#OPTIONS="--enable-debug $OPTIONS"
+OPTIONS="--enable-debug $OPTIONS"
#OPTIONS="--enable-profile $OPTIONS"
#OPTIONS="--with-lucene $OPTIONS"
#OPTIONS="--without-curl $OPTIONS"
#OPTIONS="--enable-tests $OPTIONS"
-#OPTIONS="--disable-utilities $OPTIONS"
+OPTIONS="--disable-utilities $OPTIONS"
CPPFLAGS="$CFLAGS $CPPFLAGS -DUSBINARY" ./configure $OPTIONS $*
More information about the sword-cvs
mailing list