File: striptest.cpp

package info (click to toggle)
sword 1.6.2%2Bdfsg-5
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 12,512 kB
  • sloc: cpp: 39,310; sh: 10,791; ansic: 5,043; makefile: 1,258; objc: 1,209; java: 818; perl: 784; pascal: 681; tcl: 350
file content (32 lines) | stat: -rw-r--r-- 1,191 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <swmgr.h>
#include <swmodule.h>
#include <iostream>

using namespace sword;

using std::cout;
using std::endl;

int main(int argc, char **argv) {

	SWBuf modName = (argc > 1) ? argv[2] : "WLC";
	SWBuf keyText = (argc > 2) ? argv[3] : "Gen.1.9";
	SWBuf searchText = (argc > 3) ? argv[4] : "מתחת";
	SWMgr library;
	SWModule *book = library.getModule(modName);
	StringList filters = library.getGlobalOptions();
	for (StringList::iterator it = filters.begin(); it != filters.end(); ++it) {
	    // blindly turn off all filters.  Some filters don't support "Off", but that's ok, we should just silently fail on those.
	    library.setGlobalOption(*it, "Off");
	}
	book->setKey(keyText.c_str());
	SWBuf entryStripped = book->StripText();
	cout << "Module: " << book->Description() << "\t Key: " << book->getKeyText() << "\n";
	cout << "RawEntry:\n" << book->getRawEntry() << "\n";
	cout << "StripText:\n" << entryStripped << "\n";
	cout << "Search Target: " << searchText << "\n";
	cout << "Search Target StripText: " << book->StripText(searchText) << "\n";
	cout << "Found: " << ((strstr(entryStripped.c_str(), book->StripText(searchText))) ? "true":"false") << endl; 

	return 0;
}