Program that changes all objects' "name" attribute values to match their "id" attribute values.
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
class NameIdTransformer : public IdentifierTransformer
{
public:
NameIdTransformer()
: IdentifierTransformer()
{
}
int transform(
SBase* element)
{
}
};
int
main (int argc, char* argv[])
{
if (argc != 3)
{
cout << endl << "Usage: setNamesFromIds filename output" << endl << endl;
return 1;
}
const char* filename = argv[1];
const char* output = argv[2];
#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;
NameIdTransformer trans;
document->
getModel()->renameIDs(allElements, &trans);
stop = getCurrentMillis();
cout << " rename time (ms): " << stop - start << endl;
start = stop;
stop = getCurrentMillis();
cout << " write time (ms): " << stop - start << endl;
cout << endl;
delete document;
return errors;
}