[sword-cvs] sword/bindings flatapi.cpp,1.7,1.8

sword@www.crosswire.org sword@www.crosswire.org
Thu, 15 Jan 2004 20:47:44 -0700


Update of /cvs/core/sword/bindings
In directory www:/tmp/cvs-serv22942

Modified Files:
	flatapi.cpp 
Log Message:
work on flatapi

Index: flatapi.cpp
===================================================================
RCS file: /cvs/core/sword/bindings/flatapi.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- flatapi.cpp	5 Jul 2003 04:58:42 -0000	1.7
+++ flatapi.cpp	16 Jan 2004 03:47:42 -0000	1.8
@@ -5,7 +5,7 @@
 
 #include <string.h>
 #include <stdio.h>
-
+ 
 #include <rawtext.h>
 #include <rawcom.h>
 #include <rawld.h>
@@ -32,8 +32,8 @@
 //-----------------------------------------------------------------
 // SWMgr methods
 //
-extern "C" SWHANDLE SWMgr_new() {
-	return (SWHANDLE) new SWMgr(new MarkupFilterMgr());
+extern "C" SWHANDLE SWMgr_new(char filterType) { 
+	return (SWHANDLE) new SWMgr(new MarkupFilterMgr(filterType));
 }
 
 
@@ -113,9 +113,11 @@
 SWHANDLE SWMgr_getGlobalOptionsIterator(SWHANDLE hmgr) {
 	SWMgr *mgr = (SWMgr *)hmgr;
 	static StringList::iterator it;
-	
-	if (mgr) 
-		it = mgr->getGlobalOptions().begin();
+	static StringList optionslist;
+	if (mgr) {
+		optionslist = mgr->getGlobalOptions();
+		it = optionslist.begin();
+	}
 	return (SWHANDLE)&it;
 }
 
@@ -151,6 +153,19 @@
 // SWModule (const const char *imodname = 0, const const char *imoddesc = 0, SWDisplay * idisp = 0, const char *imodtype = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN, const char* modlang = 0);
 // virtual ~ SWModule ();
 
+SWHANDLE SWModule_doSearch(SWHANDLE hmodule, const char *searchString, int type, int params ,void (*percent) (char, void *), void *percentUserData) {
+	
+	static ListKey results;
+	SWKey * scope = 0;
+	SWModule *module = (SWModule *)hmodule;
+	if (!module) 	
+		return -1;
+	
+	results.ClearList();
+	results = module->Search(searchString, type, params, scope, 0, percent, (void *) &percentUserData);
+	
+	return (SWHANDLE)&results;
+}
   /** Gets and clears error status
   *
   * @return error status
@@ -254,6 +269,24 @@
 
 
 //-----------------------------------------------------------------
+// listkey_iterator methods
+
+void listkey_iterator_next(SWHANDLE lki) {
+	ListKey *lk = (ListKey*)lki;
+	(*lk)++;
+}
+
+
+const char *listkey_iterator_val(SWHANDLE lki) {	
+	ListKey *lk = (ListKey*)lki;
+	if(!lk->Error())
+		return (const char *) lk->getText();
+	return NULL;
+}
+
+
+
+//-----------------------------------------------------------------
 // modmap methods
 
 void ModList_iterator_next(SWHANDLE hmmi) {
@@ -267,4 +300,3 @@
 	ModItType *it  = (ModItType *)hmmi;
 	return (it->it != it->end) ? (SWHANDLE)it->it->second : 0;
 }
-