[sword-svn] r2067 - in trunk: . examples/cmdline include

scribe at www.crosswire.org scribe at www.crosswire.org
Thu Aug 30 23:24:39 MST 2007


Author: scribe
Date: 2007-08-30 23:24:38 -0700 (Thu, 30 Aug 2007)
New Revision: 2067

Modified:
   trunk/examples/cmdline/search.cpp
   trunk/include/swbuf.h
   trunk/usrinst.sh
Log:
added new replaceBytes method to SWBuf


Modified: trunk/examples/cmdline/search.cpp
===================================================================
--- trunk/examples/cmdline/search.cpp	2007-08-30 07:08:28 UTC (rev 2066)
+++ trunk/examples/cmdline/search.cpp	2007-08-31 06:24:38 UTC (rev 2067)
@@ -75,7 +75,7 @@
 	 *			-3  - entryAttrib (eg. Word//Lemma/G1234/)
 	 *			-4  - Lucene
    */
-	listkey = target->Search(searchTerm.c_str(), -1, /*SEARCHFLAG_MATCHWHOLEENTRY*/ REG_ICASE, 0, 0, &percentUpdate, &lineLen);
+	listkey = target->Search(searchTerm.c_str(), -2, /*SEARCHFLAG_MATCHWHOLEENTRY*/ REG_ICASE, 0, 0, &percentUpdate, &lineLen);
 	std::cout << "\n";
 	listkey.sort();
 	while (!listkey.Error()) {

Modified: trunk/include/swbuf.h
===================================================================
--- trunk/include/swbuf.h	2007-08-30 07:08:28 UTC (rev 2066)
+++ trunk/include/swbuf.h	2007-08-31 06:24:38 UTC (rev 2067)
@@ -332,6 +332,8 @@
 	inline SWBuf &trimStart() { while (size() && (strchr("\t\r\n ", *(buf)))) *this << 1; return *this; }
 	inline SWBuf &trimEnd() { while (size() && (strchr("\t\r\n ", *(end-1)))) setSize(size()-1); return *this; }
 	inline SWBuf &trim() { trimStart(); return trimEnd(); }
+	// this could be nicer, like replacing a contiguous series of target bytes with single replacement; offering replacement const char *
+	inline SWBuf &replaceBytes(const char *targets, char newByte) { for (unsigned int i = 0; (i < size()); i++) { if (strchr(targets, buf[i])) buf[i] = newByte; } return *this; }
 
 	inline bool startsWith(const SWBuf &prefix) const { return !strncmp(c_str(), prefix.c_str(), prefix.size()); }
 	inline bool endsWith(const SWBuf &postfix) const { return (size() >= postfix.size())?!strncmp(end-postfix.size(), postfix.c_str(), postfix.size()):false; }

Modified: trunk/usrinst.sh
===================================================================
--- trunk/usrinst.sh	2007-08-30 07:08:28 UTC (rev 2066)
+++ trunk/usrinst.sh	2007-08-31 06:24:38 UTC (rev 2067)
@@ -7,9 +7,9 @@
 #OPTIONS="--with-vcl $OPTIONS"
 OPTIONS="--enable-debug $OPTIONS"
 #OPTIONS="--enable-profile $OPTIONS"
-#OPTIONS="--with-icu $OPTIONS"
+OPTIONS="--with-icu $OPTIONS"
 #OPTIONS="--without-clucene $OPTIONS"
-OPTIONS="--without-curl $OPTIONS"
+#OPTIONS="--without-curl $OPTIONS"
 OPTIONS="--enable-tests $OPTIONS"
 #OPTIONS="--disable-utilities $OPTIONS"
 




More information about the sword-cvs mailing list