Update of /cvsroot/pclasses/pclasses2/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22607/test
Added Files:
SimpleArgvParserTest.cpp
Log Message:
egg. Doesn't yet do equals-sign parsing, but basically works.
--- NEW FILE: SimpleArgvParserTest.cpp ---
#include <pclasses/Util/SimpleArgvParser.h>
#include <iostream>
#ifndef CERR
#define CERR std::cerr << __FILE__ << ":" << std::dec << __LINE__ << " : "
#endif
int test_args()
{
using namespace P::Util;
SimpleArgvParser & a= SimpleArgvParser::args();
if( 0 == a.argc() )
{
CERR << "No args passed in.\n";
return 1;
}
typedef SimpleArgvParser::const_iterator CIT;
CIT it = a.begin();
CIT et = a.end();
int at = 0;
for( ; et != it; ++it )
{
CERR << "argv["<<at<<"] "<<(*it).first<<" = "<<(*it).second<<"\n";
++at;
}
if( a.isSet( "v" ) )
{
CERR << "If you passed in -v you will see this line.\n";
}
if( 1 == a.get( "debug" ) )
{
CERR << "Debuggering enabled...\n";
}
return 0;
}
int main( int argc, char ** argv )
{
P::Util::SimpleArgvParser::args( argc, argv );
return test_args();
}
|