diff options
Diffstat (limited to 'bindings/corba/omniorbcpp/swordorb-impl.cpp')
-rw-r--r-- | bindings/corba/omniorbcpp/swordorb-impl.cpp | 125 |
1 files changed, 80 insertions, 45 deletions
diff --git a/bindings/corba/omniorbcpp/swordorb-impl.cpp b/bindings/corba/omniorbcpp/swordorb-impl.cpp index d36c6a8..a6572ac 100644 --- a/bindings/corba/omniorbcpp/swordorb-impl.cpp +++ b/bindings/corba/omniorbcpp/swordorb-impl.cpp @@ -1,5 +1,10 @@ -/* - * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) +/****************************************************************************** + * + * swordorb-impl.cpp - omniorb bindings + * + * $Id: swordorb-impl.cpp 2967 2013-08-18 16:15:46Z scribe $ + * + * Copyright 2009-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -21,6 +26,7 @@ #include <swordorb-impl.hpp> #include <swmgr.h> +#include <installmgr.h> #include <versekey.h> #include <treekeyidx.h> #include <swbuf.h> @@ -58,22 +64,22 @@ swordorb::SearchHitList* swordorb_SWModule_i::search(const char* istr, swordorb: sword::ListKey result; if ((scope) && (strlen(scope)) > 0) { - sword::SWKey *p = delegate->CreateKey(); + sword::SWKey *p = delegate->createKey(); sword::VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p); if (!parser) { delete p; parser = new VerseKey(); } *parser = delegate->getKeyText(); - lscope = parser->ParseVerseList(scope, *parser, true); - result = delegate->Search(istr, stype, flags, &lscope); + lscope = parser->parseVerseList(scope, *parser, true); + result = delegate->search(istr, stype, flags, &lscope); delete parser; } - else result = delegate->Search(istr, stype, flags); + else result = delegate->search(istr, stype, flags); swordorb::SearchHitList *retVal = new swordorb::SearchHitList; int count = 0; - for (result = sword::TOP; !result.Error(); result++) count++; + for (result = sword::TOP; !result.popError(); result++) count++; retVal->length(count); int i = 0; @@ -82,8 +88,8 @@ swordorb::SearchHitList* swordorb_SWModule_i::search(const char* istr, swordorb: if ((count) && (long)result.getElement()->userData) result.sort(); - for (result = sword::TOP; !result.Error(); result++) { - (*retVal)[i].modName = CORBA::string_dup(assureValidUTF8(delegate->Name())); + for (result = sword::TOP; !result.popError(); result++) { + (*retVal)[i].modName = CORBA::string_dup(assureValidUTF8(delegate->getName())); (*retVal)[i].key = CORBA::string_dup(assureValidUTF8((const char *)result)); (*retVal)[i++].score = (long)result.getElement()->userData; } @@ -92,7 +98,7 @@ swordorb::SearchHitList* swordorb_SWModule_i::search(const char* istr, swordorb: } ::CORBA::Char swordorb_SWModule_i::error() { - return delegate->Error(); + return delegate->popError(); } ::CORBA::Long swordorb_SWModule_i::getEntrySize(){ @@ -100,7 +106,7 @@ swordorb::SearchHitList* swordorb_SWModule_i::search(const char* istr, swordorb: } swordorb::StringList* swordorb_SWModule_i::getEntryAttribute(const char* level1, const char* level2, const char* level3, ::CORBA::Boolean filtered){ - delegate->RenderText(); // force parse + delegate->renderText(); // force parse std::vector<SWBuf> results; swordorb::StringList *retVal = new swordorb::StringList; @@ -113,35 +119,35 @@ swordorb::StringList* swordorb_SWModule_i::getEntryAttribute(const char* level1, i1Start = entryAttribs.find(level1); i1End = i1Start; if (i1End != entryAttribs.end()) - i1End++; + ++i1End; } else { i1Start = entryAttribs.begin(); i1End = entryAttribs.end(); } - for (;i1Start != i1End; i1Start++) { + for (;i1Start != i1End; ++i1Start) { if ((level2) && (*level2)) { i2Start = i1Start->second.find(level2); i2End = i2Start; if (i2End != i1Start->second.end()) - i2End++; + ++i2End; } else { i2Start = i1Start->second.begin(); i2End = i1Start->second.end(); } - for (;i2Start != i2End; i2Start++) { + for (;i2Start != i2End; ++i2Start) { if ((level3) && (*level3)) { i3Start = i2Start->second.find(level3); i3End = i3Start; if (i3End != i2Start->second.end()) - i3End++; + ++i3End; } else { i3Start = i2Start->second.begin(); i3End = i2Start->second.end(); } - for (;i3Start != i3End; i3Start++) { + for (;i3Start != i3End; ++i3Start) { results.push_back(i3Start->second); } if (i3Start != i3End) @@ -154,7 +160,7 @@ swordorb::StringList* swordorb_SWModule_i::getEntryAttribute(const char* level1, retVal->length(results.size()); for (int i = 0; i < results.size(); i++) { if (filtered) { - (*retVal)[i] = CORBA::string_dup(assureValidUTF8(delegate->RenderText(results[i].c_str()))); + (*retVal)[i] = CORBA::string_dup(assureValidUTF8(delegate->renderText(results[i].c_str()))); } else { (*retVal)[i] = CORBA::string_dup(assureValidUTF8(results[i].c_str())); @@ -169,15 +175,15 @@ swordorb::StringList* swordorb_SWModule_i::parseKeyList(const char* keyText){ swordorb::StringList *retVal = new swordorb::StringList; if (parser) { sword::ListKey result; - result = parser->ParseVerseList(keyText, *parser, true); + result = parser->parseVerseList(keyText, *parser, true); int count = 0; - for (result = sword::TOP; !result.Error(); result++) { + for (result = sword::TOP; !result.popError(); result++) { count++; } retVal->length(count); count = 0; - for (result = sword::TOP; !result.Error(); result++) { - (*retVal)[count++] = CORBA::string_dup(assureValidUTF8((const char *)result)); + for (result = sword::TOP; !result.popError(); result++) { + (*retVal)[count++] = CORBA::string_dup(assureValidUTF8(VerseKey(result).getOSISRef())); } } else { @@ -203,18 +209,18 @@ void swordorb_SWModule_i::setKeyText(const char* keyText) { } } else if (*keyText=='=') { - vkey->Headings(true); - vkey->AutoNormalize(false); + vkey->setIntros(true); + vkey->setAutoNormalize(false); vkey->setText(keyText+1); return; } } - delegate->KeyText(keyText); + delegate->setKey(keyText); } char* swordorb_SWModule_i::getKeyText(){ - return CORBA::string_dup(assureValidUTF8((char *)delegate->KeyText())); + return CORBA::string_dup(assureValidUTF8((char *)delegate->getKeyText())); } ::CORBA::Boolean swordorb_SWModule_i::hasKeyChildren(){ @@ -236,7 +242,7 @@ swordorb::StringList* swordorb_SWModule_i::getKeyChildren(){ sword::VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key); if (vkey) { - retVal->length(7); + retVal->length(8); SWBuf num; num.appendFormatted("%d", vkey->getTestament()); (*retVal)[0] = CORBA::string_dup(num.c_str()); @@ -256,6 +262,7 @@ swordorb::StringList* swordorb_SWModule_i::getKeyChildren(){ num.appendFormatted("%d", vkey->getVerseMax()); (*retVal)[5] = CORBA::string_dup(num.c_str()); (*retVal)[6] = CORBA::string_dup(vkey->getBookName()); + (*retVal)[7] = CORBA::string_dup(vkey->getOSISRef()); } else { TreeKeyIdx *tkey = SWDYNAMIC_CAST(TreeKeyIdx, key); @@ -295,15 +302,15 @@ char* swordorb_SWModule_i::getKeyParent(){ } char* swordorb_SWModule_i::getName(){ - return CORBA::string_dup(assureValidUTF8((char *)delegate->Name())); + return CORBA::string_dup(assureValidUTF8((char *)delegate->getName())); } char* swordorb_SWModule_i::getDescription(){ - return CORBA::string_dup(assureValidUTF8((char *)delegate->Description())); + return CORBA::string_dup(assureValidUTF8((char *)delegate->getDescription())); } char* swordorb_SWModule_i::getCategory(){ - SWBuf type = delegate->Type(); + SWBuf type = delegate->getType(); SWBuf cat = delegate->getConfigEntry("Category"); if (cat.length() > 0) type = cat; @@ -323,15 +330,19 @@ void swordorb_SWModule_i::begin(){ } char* swordorb_SWModule_i::getStripText(){ - return CORBA::string_dup(assureValidUTF8((char *)delegate->StripText())); + return CORBA::string_dup(assureValidUTF8((const char *)delegate->stripText())); } char* swordorb_SWModule_i::getRenderText(){ - return CORBA::string_dup(assureValidUTF8((char *)delegate->RenderText())); + return CORBA::string_dup(assureValidUTF8((const char *)delegate->renderText())); +} + +char* swordorb_SWModule_i::getRenderHeader(){ + return CORBA::string_dup(assureValidUTF8(((const char *)(delegate->getRenderHeader() ? delegate->getRenderHeader():"")))); } char* swordorb_SWModule_i::getRawEntry(){ - return CORBA::string_dup(assureValidUTF8((char *)delegate->getRawEntry())); + return CORBA::string_dup(assureValidUTF8((const char *)delegate->getRawEntry())); } void swordorb_SWModule_i::setRawEntry(const char* entryBuffer){ @@ -366,7 +377,7 @@ swordorb::ModInfoList* swordorb_SWMgr_i::getModInfoList() { sword::SWModule *module = 0; int size = 0; - for (sword::ModMap::iterator it = delegate->Modules.begin(); it != delegate->Modules.end(); it++) { + for (sword::ModMap::iterator it = delegate->Modules.begin(); it != delegate->Modules.end(); ++it) { if ((!(it->second->getConfigEntry("CipherKey"))) || (*(it->second->getConfigEntry("CipherKey")))) size++; } @@ -374,17 +385,17 @@ swordorb::ModInfoList* swordorb_SWMgr_i::getModInfoList() { // if (size > 183) size = 183; milist->length(size); int i = 0; - for (sword::ModMap::iterator it = delegate->Modules.begin(); it != delegate->Modules.end(); it++) { + for (sword::ModMap::iterator it = delegate->Modules.begin(); it != delegate->Modules.end(); ++it) { module = it->second; if ((!(module->getConfigEntry("CipherKey"))) || (*(module->getConfigEntry("CipherKey")))) { - SWBuf type = module->Type(); + SWBuf type = module->getType(); SWBuf cat = module->getConfigEntry("Category"); if (cat.length() > 0) type = cat; - (*milist)[i].name = CORBA::string_dup(assureValidUTF8(module->Name())); - (*milist)[i].description = CORBA::string_dup(assureValidUTF8(module->Description())); + (*milist)[i].name = CORBA::string_dup(assureValidUTF8(module->getName())); + (*milist)[i].description = CORBA::string_dup(assureValidUTF8(module->getDescription())); (*milist)[i].category = CORBA::string_dup(assureValidUTF8(type.c_str())); - (*milist)[i++].language = CORBA::string_dup(assureValidUTF8(module->Lang())); + (*milist)[i++].language = CORBA::string_dup(assureValidUTF8(module->getLanguage())); if (i >= size) break; } } @@ -437,12 +448,12 @@ swordorb::StringList* swordorb_SWMgr_i::getGlobalOptions(){ sword::StringList options = delegate->getGlobalOptions(); swordorb::StringList *retVal = new swordorb::StringList; int count = 0; - for (sword::StringList::iterator it = options.begin(); it != options.end(); it++) { + for (sword::StringList::iterator it = options.begin(); it != options.end(); ++it) { count++; } retVal->length(count); count = 0; - for (sword::StringList::iterator it = options.begin(); it != options.end(); it++) { + for (sword::StringList::iterator it = options.begin(); it != options.end(); ++it) { (*retVal)[count++] = CORBA::string_dup(assureValidUTF8(it->c_str())); } return retVal; @@ -452,12 +463,12 @@ swordorb::StringList* swordorb_SWMgr_i::getGlobalOptionValues(const char* option sword::StringList options = delegate->getGlobalOptionValues(option); swordorb::StringList *retVal = new swordorb::StringList; int count = 0; - for (sword::StringList::iterator it = options.begin(); it != options.end(); it++) { + for (sword::StringList::iterator it = options.begin(); it != options.end(); ++it) { count++; } retVal->length(count); count = 0; - for (sword::StringList::iterator it = options.begin(); it != options.end(); it++) { + for (sword::StringList::iterator it = options.begin(); it != options.end(); ++it) { (*retVal)[count++] = CORBA::string_dup(assureValidUTF8(it->c_str())); } return retVal; @@ -483,12 +494,12 @@ swordorb::StringList* swordorb_SWMgr_i::getAvailableLocales(){ sword::StringList localeNames = LocaleMgr::getSystemLocaleMgr()->getAvailableLocales(); swordorb::StringList *retVal = new swordorb::StringList; int count = 0; - for (sword::StringList::iterator it = localeNames.begin(); it != localeNames.end(); it++) { + for (sword::StringList::iterator it = localeNames.begin(); it != localeNames.end(); ++it) { count++; } retVal->length(count); count = 0; - for (sword::StringList::iterator it = localeNames.begin(); it != localeNames.end(); it++) { + for (sword::StringList::iterator it = localeNames.begin(); it != localeNames.end(); ++it) { (*retVal)[count++] = CORBA::string_dup(assureValidUTF8(it->c_str())); } return retVal; @@ -499,3 +510,27 @@ void swordorb_SWMgr_i::setDefaultLocale(const char* name){ } +char* swordorb_SWMgr_i::translate(const char* text, const char* localeName) { + return CORBA::string_dup(LocaleMgr::getSystemLocaleMgr()->translate(text, localeName)); +} + +swordorb::StringList* swordorb_SWMgr_i::getRepos() { + swordorb::StringList *retVal = new swordorb::StringList; + int count = 0; + sword::InstallMgr *installMgr = new sword::InstallMgr(); + for (InstallSourceMap::iterator it = installMgr->sources.begin(); it != installMgr->sources.end(); ++it) { + count++; + } + retVal->length(count); + count = 0; + for (InstallSourceMap::iterator it = installMgr->sources.begin(); it != installMgr->sources.end(); ++it) { + (*retVal)[count++] = CORBA::string_dup(assureValidUTF8(it->second->caption.c_str())); + } + delete installMgr; + return retVal; +} + +// Don't call me yet +swordorb::_objref_SWMgr* swordorb_SWMgr_i::getShadowMgr(const char*) { + return 0; +} |