Demonstrates how to use the element filter class to search the model for elements with specific attributes .
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
{
public:
{
}
virtual bool filter(
const SBase* element)
{
return false;
cout << " found : "
<< element->
getId() << endl;
else
cout << " found : "
<< "element without id" << endl;
return true;
}
};
int
main (int argc, char* argv[])
{
if (argc != 2)
{
cout << endl << "Usage: getAllElementsWithNotes filename" << endl << endl;
return 1;
}
const char* filename = argv[1];
#ifdef __BORLANDC__
unsigned long start, stop;
#else
unsigned long long start, stop;
#endif
start = getCurrentMillis();
stop = getCurrentMillis();
cout << endl;
cout << " filename: " << filename << endl;
cout << " read time (ms): " << stop - start << endl;
if (errors > 0)
{
cout << " error(s): " << errors << endl;
delete document;
return errors;
}
start = stop;
NotesFilter filter;
cout << " searching ......:" << endl;
stop = getCurrentMillis();
cout << " search time (ms): " << stop - start << endl;
cout <<
" elements with notes: " << allElements->
getSize() << endl;
delete document;
return errors;
}