summaryrefslogtreecommitdiff
path: root/tests/filtertest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/filtertest.cpp')
-rw-r--r--tests/filtertest.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/filtertest.cpp b/tests/filtertest.cpp
index 8aa750c..c6cfd4e 100644
--- a/tests/filtertest.cpp
+++ b/tests/filtertest.cpp
@@ -1,5 +1,10 @@
-/*
- * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+/******************************************************************************
+ *
+ * filtertest.cpp -
+ *
+ * $Id: filtertest.cpp 2833 2013-06-29 06:40:28Z chrislit $
+ *
+ * Copyright 2001-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -20,6 +25,7 @@
#include <filemgr.h>
#include <papyriplain.h>
#include <utf8utf16.h>
+#include <rtfhtml.h>
#include <sysdata.h>
//#include <swmgr.h>
#ifndef NO_SWORD_NAMESPACE
@@ -29,12 +35,13 @@ using namespace std;
int main(int argc, char **argv) {
- UTF8UTF16 filter;
+// UTF8UTF16 filter;
+ RTFHTML filter;
// PapyriPlain filter;
//
FileDesc *fd = (argc > 1) ? FileMgr::getSystemFileMgr()->open(argv[1], FileMgr::RDONLY) : 0;
- SWBuf lineBuffer = "This is t<e>xt which has papy-\nri markings in it.\n L[et's be] sure it gets--\n cleaned up well for s(earching)";
+ SWBuf lineBuffer = "T\\u12345?his is t<e>xt which has papy-\nri markings in it.\n L[et's be] sure it gets--\n cleaned up well for s(earching)";
if (argc > 1 && !strcmp(argv[1], "-v")) {
std::cout << "Original:\n\n";
@@ -52,23 +59,24 @@ int main(int argc, char **argv) {
fd = FileMgr::getSystemFileMgr()->open(argv[1], FileMgr::RDONLY);
}
- cout << "\xff\xfe"; // UTF16LE file signature
+// cout << "\xff\xfe"; // UTF16LE file signature
while (!fd || FileMgr::getLine(fd, lineBuffer)) {
lineBuffer += "\n";
filter.processText(lineBuffer);
-/* Simply way to output byte stream
+// Simply way to output byte stream
for (unsigned int i = 0; i < lineBuffer.size(); ++i) {
std::cout << lineBuffer[i];
}
-*/
+/*
// Example showing safe to cast to u16 stream
unsigned int size = lineBuffer.size() / 2;
__u16 *wcharBuf = (__u16 *)lineBuffer.getRawData();
for (unsigned int i = 0; i < size; ++i) {
std::wcout << (wchar_t)wcharBuf[i]; // must cast for correct output and because wchar_t is different size on linux we couldn't declare out wcharBuf a wchar_t *
}
+*/
if (!fd) break;
}