Tools.h++ Class Reference

Table Of Contents
TestBrute() { }
virtual void doLoop(unsigned long n);
virtual void idleLoop(unsigned long n);
virtual void what(ostream& s) const
{ s << "Brute force string search: \n"; }
};
class TestRW : public RWBench {
public:
TestRW() { }
virtual void doLoop(unsigned long n);
virtual void idleLoop(unsigned long n);
virtual void what(ostream& s) const
{ s << "Rogue Wave search: \n"; }
};
main(int argc, char* argv[]){
cout << "Testing string \n\"" << cs << "\"\n";
// Test brute force string search algorithm:
TestBrute other;
other.parse(argc, argv);
other.go();
other.report(cout);
// Test RW searching w/regular expressions:
TestRW rw;
rw.parse(argc, argv);
rw.go();
rw.report(cout);
return 0;
}
void TestBrute::doLoop(unsigned long n){
RWCString string(cs);
RWCTokenizer *tokener;
RWCString token;
tokener = new RWCTokenizer(string);
while(n--){
if((token = (*tokener)()).isNull())
{
delete tokener;
tokener = new RWCTokenizer(string);
token = (*tokener)();
}
size_t j = 0;
for(size_t i = 0; i < string.length() && j != token.length();
i++)
{
j = 0;
while((j < token.length()) && (string[i+j]==token[j]))