[sword-cvs] sword/bindings/corba/orbitcpp Makefile,1.3,1.4 swordorb-impl.cpp,1.4,1.5 swordorb-impl.hpp,1.2,1.3 testclient.cpp,1.4,1.5
sword@www.crosswire.org
sword@www.crosswire.org
Mon, 5 May 2003 20:27:58 -0700
Update of /usr/local/cvsroot/sword/bindings/corba/orbitcpp
In directory www:/tmp/cvs-serv2027/bindings/corba/orbitcpp
Modified Files:
Makefile swordorb-impl.cpp swordorb-impl.hpp testclient.cpp
Log Message:
Index: Makefile
===================================================================
RCS file: /usr/local/cvsroot/sword/bindings/corba/orbitcpp/Makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Makefile 4 May 2003 01:16:44 -0000 1.3
--- Makefile 6 May 2003 03:27:56 -0000 1.4
***************
*** 1,9 ****
all: server testclient
! server: server.cpp swordorb-impl.cpp swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o swordorb-cpp-skels.o swordorb-skels.o
! g++ -I. -I../../../include -I/usr/include/orbitcpp-2.0/ `orbit2-config --cflags` -o server server.cpp swordorb-impl.cpp swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o swordorb-cpp-skels.o swordorb-skels.o `orbit2-config --libs` -lORBit-2-cpp -lsword -lz
testclient: testclient.cpp swordorb-impl.cpp swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o swordorb-skels.o swordorb-cpp-skels.o
g++ -I. -I../../../include -I/usr/include/orbitcpp-2.0/ `orbit2-config --cflags` -o testclient testclient.cpp swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o swordorb-skels.o swordorb-cpp-skels.o `orbit2-config --libs` -lORBit-2-cpp
swordorb-common.o: swordorb-common.c
--- 1,15 ----
all: server testclient
! server: swordorb-common.o server.cpp swordorb-impl.o swordorb-cpp.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o swordorb-cpp-skels.o swordorb-skels.o swordorb-cpp.o
! g++ -g -I. -I../../../include -I/usr/include/orbitcpp-2.0/ `orbit2-config --cflags` -o server server.cpp swordorb-impl.o swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o swordorb-cpp-skels.o swordorb-skels.o `orbit2-config --libs` -lORBit-2-cpp -lsword -lz
testclient: testclient.cpp swordorb-impl.cpp swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o swordorb-skels.o swordorb-cpp-skels.o
g++ -I. -I../../../include -I/usr/include/orbitcpp-2.0/ `orbit2-config --cflags` -o testclient testclient.cpp swordorb-common.o swordorb-cpp-common.o swordorb-stubs.o swordorb-cpp-stubs.o swordorb-skels.o swordorb-cpp-skels.o `orbit2-config --libs` -lORBit-2-cpp
+
+ swordorb-cpp.o: swordorb-cpp.cc
+ g++ -I. -I../../../include -I/usr/include/orbitcpp-2.0/ `orbit2-config --cflags` -g -c swordorb-cpp.cc
+
+ swordorb-impl.o: swordorb-impl.cpp
+ g++ -g -I. -I../../../include -I/usr/include/orbitcpp-2.0/ `orbit2-config --cflags` -g -c swordorb-impl.cpp
swordorb-common.o: swordorb-common.c
Index: swordorb-impl.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/bindings/corba/orbitcpp/swordorb-impl.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** swordorb-impl.cpp 5 May 2003 19:07:38 -0000 1.4
--- swordorb-impl.cpp 6 May 2003 03:27:56 -0000 1.5
***************
*** 2,5 ****
--- 2,6 ----
#include <iostream>
#include <swmgr.h>
+ #include <versekey.h>
/*
***************
*** 12,15 ****
--- 13,17 ----
namespace swordorb {
ModInfoList *SWMgr_impl::getModInfoList() throw(CORBA::SystemException) {
+
ModInfoList *milist = new ModInfoList;
sword::SWModule *module = 0;
***************
*** 45,52 ****
! StringList *SWMgr_impl::getGlobalOptionsIterator() throw(CORBA::SystemException) {
}
! StringList *SWMgr_impl::getGlobalOptionValuesIterator(const char *option) throw(CORBA::SystemException) {
}
--- 47,54 ----
! StringList *SWMgr_impl::getGlobalOptions() throw(CORBA::SystemException) {
}
! StringList *SWMgr_impl::getGlobalOptionValues(const char *option) throw(CORBA::SystemException) {
}
***************
*** 54,56 ****
--- 56,90 ----
exit(0);
}
+
+ StringList *SWModule_impl::search(const char *istr, SearchType searchType, CORBA::Long flags, const char *scope) throw(CORBA::SystemException) {
+ int stype = 2;
+ sword::ListKey lscope;
+ sword::VerseKey parser;
+ if (searchType == REGEX) stype = 0;
+ if (searchType == PHRASE) stype = -1;
+ if (searchType == MULTIWORD) stype = -2;
+ sword::ListKey result;
+
+ if ((scope) && (strlen(scope)) > 0) {
+ lscope = parser.ParseVerseList(scope, parser, true);
+ result = delegate->Search(istr, stype, flags, &lscope);
+ }
+ else result = delegate->Search(istr, stype, flags);
+
+ StringList *retVal = new StringList;
+ int count = 0;
+ for (result = sword::TOP; !result.Error(); result++) count++;
+ retVal->length(count);
+ int i = 0;
+ for (result = sword::TOP; !result.Error(); result++)
+ (*retVal)[i++] = CORBA::string_dup((const char *)result);
+
+ return retVal;
+ }
+
+
+
+
+
+
}
Index: swordorb-impl.hpp
===================================================================
RCS file: /usr/local/cvsroot/sword/bindings/corba/orbitcpp/swordorb-impl.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** swordorb-impl.hpp 5 May 2003 19:07:38 -0000 1.2
--- swordorb-impl.hpp 6 May 2003 03:27:56 -0000 1.3
***************
*** 16,32 ****
SWModule_impl(sword::SWModule *delegate) { this->delegate = delegate; }
void terminateSearch() throw(CORBA::SystemException) { delegate->terminateSearch = true; }
char error() throw(CORBA::SystemException) { return delegate->Error(); }
CORBA::Long getEntrySize() throw(CORBA::SystemException) { return delegate->getEntrySize(); }
void setKeyText(const char *key) throw(CORBA::SystemException) { delegate->KeyText(key); }
! char *getKeyText() throw(CORBA::SystemException) { return (char *)delegate->KeyText(); }
! char *getName() throw(CORBA::SystemException) { return (char *)delegate->Name(); }
! char *getDescription() throw(CORBA::SystemException) { return (char *)delegate->Description(); }
! char *getType() throw(CORBA::SystemException) { return (char *)delegate->Type(); }
void previous() throw(CORBA::SystemException) { delegate->decrement(); }
void next() throw(CORBA::SystemException) { delegate->increment(); }
void begin() throw(CORBA::SystemException) { delegate->setPosition(sword::TOP); }
! char *getStripText() throw(CORBA::SystemException) { return (char *)delegate->StripText(); }
! char *getRenderText() throw(CORBA::SystemException) { return (char *)delegate->RenderText(); }
};
--- 16,33 ----
SWModule_impl(sword::SWModule *delegate) { this->delegate = delegate; }
+ StringList *search(const char *istr, SearchType searchType, CORBA::Long flags, const char *scope) throw(CORBA::SystemException);
void terminateSearch() throw(CORBA::SystemException) { delegate->terminateSearch = true; }
char error() throw(CORBA::SystemException) { return delegate->Error(); }
CORBA::Long getEntrySize() throw(CORBA::SystemException) { return delegate->getEntrySize(); }
void setKeyText(const char *key) throw(CORBA::SystemException) { delegate->KeyText(key); }
! char *getKeyText() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->KeyText()); }
! char *getName() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->Name()); }
! char *getDescription() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->Description()); }
! char *getType() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->Type()); }
void previous() throw(CORBA::SystemException) { delegate->decrement(); }
void next() throw(CORBA::SystemException) { delegate->increment(); }
void begin() throw(CORBA::SystemException) { delegate->setPosition(sword::TOP); }
! char *getStripText() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->StripText()); }
! char *getRenderText() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->RenderText()); }
};
***************
*** 41,51 ****
ModInfoList *getModInfoList() throw(CORBA::SystemException);
SWModule_ptr getModuleByName(const char *name) throw(CORBA::SystemException);
! char *getPrefixPath() throw(CORBA::SystemException) { return delegate->prefixPath; }
! char *getConfigPath() throw(CORBA::SystemException) { return delegate->configPath; }
void setGlobalOption(const char *option, const char *value) throw(CORBA::SystemException) { delegate->setGlobalOption(option, value); }
! char *getGlobalOption(const char *option) throw(CORBA::SystemException) { return (char *)delegate->getGlobalOption(option); }
! char *getGlobalOptionTip(const char *option) throw(CORBA::SystemException) { return (char *)delegate->getGlobalOptionTip(option); }
! StringList *getGlobalOptionsIterator() throw(CORBA::SystemException);
! StringList *getGlobalOptionValuesIterator(const char *option) throw(CORBA::SystemException);
void setCipherKey(const char *modName, const char *key) throw(CORBA::SystemException) { delegate->setCipherKey(modName, key); }
void terminate() throw(CORBA::SystemException);
--- 42,52 ----
ModInfoList *getModInfoList() throw(CORBA::SystemException);
SWModule_ptr getModuleByName(const char *name) throw(CORBA::SystemException);
! char *getPrefixPath() throw(CORBA::SystemException) { return CORBA::string_dup(delegate->prefixPath); }
! char *getConfigPath() throw(CORBA::SystemException) { return CORBA::string_dup(delegate->configPath); }
void setGlobalOption(const char *option, const char *value) throw(CORBA::SystemException) { delegate->setGlobalOption(option, value); }
! char *getGlobalOption(const char *option) throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->getGlobalOption(option)); }
! char *getGlobalOptionTip(const char *option) throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->getGlobalOptionTip(option)); }
! StringList *getGlobalOptions() throw(CORBA::SystemException);
! StringList *getGlobalOptionValues(const char *option) throw(CORBA::SystemException);
void setCipherKey(const char *modName, const char *key) throw(CORBA::SystemException) { delegate->setCipherKey(modName, key); }
void terminate() throw(CORBA::SystemException);
Index: testclient.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/bindings/corba/orbitcpp/testclient.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** testclient.cpp 5 May 2003 19:07:38 -0000 1.4
--- testclient.cpp 6 May 2003 03:27:56 -0000 1.5
***************
*** 25,28 ****
--- 25,29 ----
swordorb::SWMgr_var mgr = swordorb::SWMgr::_narrow(obj);
+ swordorb::SWModule_ptr module;
swordorb::ModInfoList *modInfoList;
***************
*** 31,35 ****
modInfoList = mgr->getModInfoList();
std::cout << "sequence length: " << modInfoList->length() << "\n";
- swordorb::SWModule_ptr module;
for (int i = 0; i < modInfoList->length(); i++) {
std::cout << (*modInfoList)[i].name << ": " << (*modInfoList)[i].type << ": " << (*modInfoList)[i].lang << "\n";
--- 32,35 ----
***************
*** 38,41 ****
--- 38,49 ----
std::cout << module->getRenderText() << "\n";
}
+ module = mgr->getModuleByName((*modInfoList)[0].name);
+ swordorb::StringList *searchResults;
+ searchResults = module->search("God love world", swordorb::MULTIWORD, 0, "act-Rev");
+ for (int i = 0; i < searchResults->length(); i++) {
+ std::cout << (*searchResults)[i] << "\n";
+ }
+
+
} catch(const CORBA::Exception& ex) {