24 std::cout <<
"fts2ftx: " << message << std::endl;
25 std::cout <<
"" << std::endl;
28 std::cout <<
"fts2ftx: version" <<
VersionString() << std::endl;
29 std::cout <<
"" << std::endl;
30 std::cout <<
"usage: fts2ftx [-t <ftype>] [-l <label>] [-o <outfile>] <infile>" << std::endl;
31 std::cout <<
"where " << std::endl;
32 std::cout <<
" <infile>: faudes token stream to convert" << std::endl;
33 std::cout <<
"" << std::endl;
34 std::cout <<
" -t <ftype>: faudes type of infile" << std::endl;
35 std::cout <<
" -l <label>: section label to read (defaults to entire file)" << std::endl;
36 std::cout <<
" -o <outfile>: file to write (defaults to infile with .ftx suffix)" << std::endl;
37 std::cout <<
"" << std::endl;
59 int main(
int argc,
char *argv[]) {
72 for(
int i=1; i<argc; i++) {
73 std::string option(argv[i]);
75 if((option==
"-t") || (option==
"--ftype")) {
81 if((option==
"-l") || (option==
"--lable")) {
87 if((option==
"-o") || (option==
"--outfile")) {
93 if((option==
"-v") || (option==
"--verify")) {
108 if((option==
"-?") || (option==
"--help")) {
113 if(option.c_str()[0]==
'-') {
119 usage_exit(
"more than one filname specified");
130 if(basename.find_last_of(
".") !=std::string::npos) {
131 basename.resize(basename.find_last_of(
"."));
134 mOutFile= basename+
".ftx";
139 fobject->
Read(mInFile,mLabel);
143 std::cout <<
"fts2ftx: reporting faudes object of type " << mType <<
" (id " <<
typeid(*fobject).name() <<
")" << std::endl;
154 fobject->
XWrite(mOutFile);
160 std::cout <<
"fts2ftx: reading back ftx output" << std::endl;
161 Type* readback = fobject->
New();
162 readback->
Read(mOutFile);
163 if(!(*fobject==*readback))
164 std::cout <<
"fts2ftx: warning: objects dont match (!)" << std::endl;
static TypeRegistry * G()
Method to access the single global instance of the registry.
Base class of all libFAUDES objects that participate in the run-time interface.
void Read(const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
Read configuration data from file with label specified.
virtual void XWrite(const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0) const
Write configuration data to an XML file.
virtual Type * New(void) const
Construct on heap.
void Write(const Type *pContext=0) const
Write configuration data to console.
Includes all libFAUDES headers, no plugins.
int main(int argc, char *argv[])
void usage_exit(const std::string &message="")
Type * NewFaudesObject(const std::string &rTypeName)
Instantiate faudes typed objects by type name.
libFAUDES resides within the namespace faudes.
std::string VersionString()
Return FAUDES_VERSION as std::string.
std::string ExtractFilename(const std::string &rFullPath)
Extract file name from full path.