lbm_reference
parsertest.cpp
Go to the documentation of this file.
1 //! \file parsertest.cpp
2 //! Test setup for the ConfParser
3 
4 //! \date Jan 19, 2009
5 //! \author Florian Rathgeber
6 
7 #include <cstdlib>
8 #include <iostream>
9 #include <string>
10 
11 #include "ConfParser.h"
12 #include "ConfBlock.h"
13 
14 using namespace std;
15 using namespace confparser;
16 
17 int main( int argc, char** argv ) {
18 
19  if ( argc < 2 ) {
20  cerr << "Usage: " << argv[0] << " <config_file> [<config_file> ...]" << endl;
21  return -1;
22  }
23 
24  ConfParser p;
25 
26  for ( int i = 1; i < argc; ++i ) {
27  try {
28  ConfBlock& b = p.parse( argv[i] );
29  b.writeConfigFile( string( argv[i] ) + ".out" );
30  } catch ( std::exception& e ) {
31  cerr << e.what() << endl;
32  }
33  }
34 
35  return 0;
36 }