[sword-cvs] sword/bindings/corba/orbitcpp swordorb-impl.cpp,1.11,1.12 swordorb-impl.hpp,1.8,1.9

sword@www.crosswire.org sword@www.crosswire.org
Mon, 24 Nov 2003 02:18:38 -0700


Update of /usr/local/cvsroot/sword/bindings/corba/orbitcpp
In directory www:/tmp/cvs-serv1633/bindings/corba/orbitcpp

Modified Files:
	swordorb-impl.cpp swordorb-impl.hpp 
Log Message:
Added getEntryAttribute to support preverse headings in web interface


Index: swordorb-impl.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/bindings/corba/orbitcpp/swordorb-impl.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- swordorb-impl.cpp	30 Oct 2003 19:06:13 -0000	1.11
+++ swordorb-impl.cpp	24 Nov 2003 09:18:36 -0000	1.12
@@ -96,7 +96,6 @@
 	return retVal;
 }
 
-
 void SWMgr_impl::terminate() throw(CORBA::SystemException) {
 	exit(0);
 }
@@ -141,6 +140,38 @@
 		(*retVal)[i].key = CORBA::string_dup((const char *)result);
 		(*retVal)[i++].score = (long)result.getElement()->userData;
 	}
+
+	return retVal;
+}
+
+
+
+StringList *SWModule_impl::getEntryAttribute(const char *level1, const char *level2, const char *level3) throw(CORBA::SystemException) {
+	delegate->RenderText();	// force parse
+	sword::AttributeTypeList &entryAttribs = delegate->getEntryAttributes();
+	sword::AttributeTypeList::iterator i1 = entryAttribs.find(level1);
+	sword::AttributeList::iterator i2;
+	sword::AttributeValue::iterator i3, j3;
+	StringList *retVal = new StringList;
+	int count = 0;
+
+	if (i1 != entryAttribs.end()) {
+		i2 = i1->second.find(level2);
+		if (i2 != i1->second.end()) {
+			i3 = i2->second.find(level3);
+			if (i3 != i2->second.end()) {
+				for (j3 = i3; j3 != i2->second.end(); j3++)
+					count++;
+				retVal->length(count);
+				count = 0;
+				for (j3 = i3; j3 != i2->second.end(); j3++) {
+					(*retVal)[count++] = CORBA::string_dup(i3->second.c_str());
+				}
+			}
+		}
+	}
+	if (!count)
+		retVal->length(count);
 
 	return retVal;
 }

Index: swordorb-impl.hpp
===================================================================
RCS file: /usr/local/cvsroot/sword/bindings/corba/orbitcpp/swordorb-impl.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- swordorb-impl.hpp	31 Aug 2003 01:58:13 -0000	1.8
+++ swordorb-impl.hpp	24 Nov 2003 09:18:36 -0000	1.9
@@ -33,6 +33,7 @@
 	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()); }
+	StringList *getEntryAttribute(const char *level1, const char *level2, const char *level3) throw(CORBA::SystemException);
 	char *getRenderText() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->RenderText()); }
 	char *getConfigEntry(const char *key) throw(CORBA::SystemException) { return CORBA::string_dup(((char *)delegate->getConfigEntry(key)) ? (char *)delegate->getConfigEntry(key):SWNULL); }