summaryrefslogtreecommitdiff
path: root/bindings/flatapi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/flatapi.cpp')
-rw-r--r--bindings/flatapi.cpp77
1 files changed, 44 insertions, 33 deletions
diff --git a/bindings/flatapi.cpp b/bindings/flatapi.cpp
index 4611a28..bb9ae3f 100644
--- a/bindings/flatapi.cpp
+++ b/bindings/flatapi.cpp
@@ -14,8 +14,19 @@
#include <versekey.h>
#include <swmgr.h>
#include <markupfiltmgr.h>
-
+#ifndef NO_SWORD_NAMESPACE
+using namespace sword;
+#endif
+extern "C" {
#include "flatapi.h"
+}
+
+typedef struct {
+ ModMap::iterator it;
+// void *it;
+ ModMap::iterator end;
+// void *end;
+} ModItType;
//-----------------------------------------------------------------
@@ -61,47 +72,47 @@ SWHANDLE SWMgr_getModulesIterator(SWHANDLE hmgr) {
}
-SWHANDLE SWMgr_getModuleByName(SWHANDLE hmgr, char *name) {
+SWHANDLE SWMgr_getModuleByName(SWHANDLE hmgr, const char *name) {
SWMgr *mgr = (SWMgr *)hmgr;
return (mgr) ? (SWHANDLE) mgr->Modules[name] : 0;
}
-char *SWMgr_getPrefixPath(SWHANDLE hmgr) {
+const char *SWMgr_getPrefixPath(SWHANDLE hmgr) {
SWMgr *mgr = (SWMgr *)hmgr;
return (mgr) ? mgr->prefixPath : 0;
}
-char *SWMgr_getConfigPath(SWHANDLE hmgr) {
+const char *SWMgr_getConfigPath(SWHANDLE hmgr) {
SWMgr *mgr = (SWMgr *)hmgr;
return (mgr) ? mgr->configPath : 0;
}
-void SWMgr_setGlobalOption(SWHANDLE hmgr, char *option, char *value) {
+void SWMgr_setGlobalOption(SWHANDLE hmgr, const char *option, const char *value) {
SWMgr *mgr = (SWMgr *)hmgr;
if (mgr)
mgr->setGlobalOption(option, value);
}
-char *SWMgr_getGlobalOption(SWHANDLE hmgr, char *option) {
+const char *SWMgr_getGlobalOption(SWHANDLE hmgr, const char *option) {
SWMgr *mgr = (SWMgr *)hmgr;
- return (mgr) ? (char *)mgr->getGlobalOption(option) : 0;
+ return (mgr) ? (const char *)mgr->getGlobalOption(option) : 0;
}
-char *SWMgr_getGlobalOptionTip(SWHANDLE hmgr, char *option) {
+const char *SWMgr_getGlobalOptionTip(SWHANDLE hmgr, const char *option) {
SWMgr *mgr = (SWMgr *)hmgr;
- return (mgr) ? (char *)mgr->getGlobalOptionTip(option) : 0;
+ return (mgr) ? (const char *)mgr->getGlobalOptionTip(option) : 0;
}
// ret: forward_iterator
SWHANDLE SWMgr_getGlobalOptionsIterator(SWHANDLE hmgr) {
SWMgr *mgr = (SWMgr *)hmgr;
- static OptionsList::iterator it;
+ static StringList::iterator it;
if (mgr)
it = mgr->getGlobalOptions().begin();
@@ -110,9 +121,9 @@ SWHANDLE SWMgr_getGlobalOptionsIterator(SWHANDLE hmgr) {
// ret: forward_iterator
-SWHANDLE SWMgr_getGlobalOptionValuesIterator(SWHANDLE hmgr, char *option) {
+SWHANDLE SWMgr_getGlobalOptionValuesIterator(SWHANDLE hmgr, const char *option) {
SWMgr *mgr = (SWMgr *)hmgr;
- static OptionsList::iterator it;
+ static StringList::iterator it;
if (mgr)
it = mgr->getGlobalOptionValues(option).begin();
@@ -120,7 +131,7 @@ SWHANDLE SWMgr_getGlobalOptionValuesIterator(SWHANDLE hmgr, char *option) {
}
-void SWMgr_setCipherKey(SWHANDLE hmgr, char *modName, char *key) {
+void SWMgr_setCipherKey(SWHANDLE hmgr, const char *modName, const char *key) {
SWMgr *mgr = (SWMgr *)hmgr;
if (mgr)
mgr->setCipherKey(modName, key);
@@ -137,7 +148,7 @@ void SWModule_terminateSearch(SWHANDLE hmodule) {
module->terminateSearch = true;
}
-// 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);
+// 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 ();
/** Gets and clears error status
@@ -156,39 +167,39 @@ int SWModule_getEntrySize(SWHANDLE hmodule) {
}
-void SWModule_setKeyText(SWHANDLE hmodule, char *key) {
+void SWModule_setKeyText(SWHANDLE hmodule, const char *key) {
SWModule *module = (SWModule *)hmodule;
if (module)
- module->Key(key);
+ module->setKey(key);
}
-// virtual char SetKey (const SWKey &ikey);
+// virtual char setKey (const SWKey &ikey);
// virtual SWKey & Key () const {
-char *SWModule_getKeyText(SWHANDLE hmodule) {
+const char *SWModule_getKeyText(SWHANDLE hmodule) {
SWModule *module = (SWModule *)hmodule;
- return (char *)((module) ? module->KeyText() : 0);
+ return (const char *)((module) ? module->KeyText() : 0);
}
// virtual char Display ();
// virtual SWDisplay *Disp (SWDisplay * idisp = 0);
-char *SWModule_getName(SWHANDLE hmodule) {
+const char *SWModule_getName(SWHANDLE hmodule) {
SWModule *module = (SWModule *)hmodule;
- return (char *)((module) ? module->Name() : 0);
+ return (const char *)((module) ? module->Name() : 0);
}
-char *SWModule_getDescription(SWHANDLE hmodule) {
+const char *SWModule_getDescription(SWHANDLE hmodule) {
SWModule *module = (SWModule *)hmodule;
- return (char *)((module) ? module->Description() : 0);
+ return (const char *)((module) ? module->Description() : 0);
}
-char *SWModule_getType(SWHANDLE hmodule) {
+const char *SWModule_getType(SWHANDLE hmodule) {
SWModule *module = (SWModule *)hmodule;
- return (char *)((module) ? module->Type() : 0);
+ return (const char *)((module) ? module->Type() : 0);
}
@@ -213,15 +224,15 @@ void SWModule_begin(SWHANDLE hmodule) {
}
-char *SWModule_getStripText(SWHANDLE hmodule) {
+const char *SWModule_getStripText(SWHANDLE hmodule) {
SWModule *module = (SWModule *)hmodule;
- return (char *)((module) ? module->StripText() : 0);
+ return (const char *)((module) ? module->StripText() : 0);
}
-char *SWModule_getRenderText(SWHANDLE hmodule) {
+const char *SWModule_getRenderText(SWHANDLE hmodule) {
SWModule *module = (SWModule *)hmodule;
- return (char *)((module) ? module->RenderText() : 0);
+ return (const char *)((module) ? module->RenderText() : 0);
}
@@ -230,14 +241,14 @@ char *SWModule_getRenderText(SWHANDLE hmodule) {
// stringlist_iterator methods
void stringlist_iterator_next(SWHANDLE hsli) {
- OptionsList::iterator *sli = (OptionsList::iterator *)hsli;
+ StringList::iterator *sli = (StringList::iterator *)hsli;
(*sli)++;
}
-char *stringlist_iterator_val(SWHANDLE hsli) {
- OptionsList::iterator *sli = (OptionsList::iterator *)hsli;
- return (char *)(*sli)->c_str();
+const char *stringlist_iterator_val(SWHANDLE hsli) {
+ StringList::iterator *sli = (StringList::iterator *)hsli;
+ return (const char *)(*sli)->c_str();
}