From: Christian P. <cp...@se...> - 2004-12-31 14:23:16
|
Current CVS version gives this error: /home/cproch/src/pclasses2/src/Util/SimpleArgvParser.cpp: In constructor ` P::Phoenix<BaseType, ContextType, InitializerType>::Phoenix() [with BaseType = P::Util::SimpleArgvParser, ContextType = P::Util::SimpleArgvParserSharingContext, InitializerType = P::DefaultPhoenixInitializer]': /home/cproch/src/pclasses2/include/pclasses/Phoenix.h:161: instantiated from `static BaseType& P::Phoenix<BaseType, ContextType, InitializerType>::instance() [with BaseType = P::Util::SimpleArgvParser, ContextType = P::Util::SimpleArgvParserSharingContext, InitializerType = P::DefaultPhoenixInitializer]' /home/cproch/src/pclasses2/src/Util/SimpleArgvParser.cpp:122: instantiated from here /home/cproch/src/pclasses2/src/Util/SimpleArgvParser.cpp:10: error: ` P::Util::SimpleArgvParser::SimpleArgvParser()' is private /home/cproch/src/pclasses2/include/pclasses/Phoenix.h:188: error: within this context Greetings Am Freitag 31 Dezember 2004 03:45 schrieb stephan beal: > Update of /cvsroot/pclasses/pclasses2/src/Util > In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16410/src/Util > > Modified Files: > SimpleArgvParser.cpp > Log Message: > Added API docs. > Fixed (argc,argv) ctor to actually use it's args. > Values may now be quoted strings. > > Index: SimpleArgvParser.cpp > =================================================================== > RCS file: /cvsroot/pclasses/pclasses2/src/Util/SimpleArgvParser.cpp,v > retrieving revision 1.2 > retrieving revision 1.3 > diff -u -d -r1.2 -r1.3 > --- SimpleArgvParser.cpp 31 Dec 2004 02:19:37 -0000 1.2 > +++ SimpleArgvParser.cpp 31 Dec 2004 02:45:09 -0000 1.3 > @@ -1,7 +1,9 @@ > #include <vector> > #include <list> > #include <pclasses/Util/SimpleArgvParser.h> > +#include <pclasses/Util/StringTool.h> > #include <pclasses/Phoenix.h> > + > namespace P { namespace Util { > > SimpleArgvParser::SimpleArgvParser() > @@ -9,13 +11,17 @@ > } > SimpleArgvParser::SimpleArgvParser( int argc, char ** argv ) > { > - > + this->parse( argc, argv ); > } > > SimpleArgvParser::~SimpleArgvParser() > { > } > > + /** > + Internal helper function to change a char** into an STL > + container of strings. > + */ > template <typename ListT> > size_t toList( ListT & tgt, int argc, char ** argv ) > { > @@ -25,7 +31,7 @@ > } > } > > - std::string strip_dashes( const std::string & s ) > + std::string internal_strip_leading_dashes( const std::string & s ) > { > if( 0 != s.find( "-" ) ) return s; > std::string::size_type first = s.find_first_not_of( "-" ); > @@ -52,12 +58,13 @@ > k = alist[at]; > if( IS_ARG(k) ) > { > - k = strip_dashes( k ); > + k = internal_strip_leading_dashes( k ); > > if( std::string::npos != (eqat = k.find( '=' )) ) > { > ++ret; > nextarg = k.substr( eqat+1 ); > + ::P::StringTool::normalizeString( nextarg ); // remove > leading/trailing quotes k = k.substr( 0, eqat ); > this->set( k, nextarg ); > continue; > @@ -78,11 +85,16 @@ > else > { > ++ret; > + ::P::StringTool::normalizeString( nextarg ); // remove > leading/trailing quotes this->set( k, nextarg ); > skipnext = true; > continue; > } > } > + else > + { > + // do nothing - we're not interesting in non-dashed args. > + } > } > return ret; > #undef IS_ARG > @@ -99,9 +111,15 @@ > return s; > } > > + //! Internal marker class > + struct SimpleArgvParserSharingContext {}; > + > SimpleArgvParser & SimpleArgvParser::args() > { > - return ArgvPhoenix::instance(); > + return ::P::Phoenix< > + SimpleArgvParser, > + SimpleArgvParserSharingContext > + >::instance(); > } > > > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > pclasses-cvs mailing list > pcl...@li... > https://lists.sourceforge.net/lists/listinfo/pclasses-cvs |