Changeset 8316 in orxonox.OLD for trunk/src/lib/parser/cmdline_parser
- Timestamp:
- Jun 11, 2006, 1:57:27 PM (19 years ago)
- Location:
- trunk/src/lib/parser/cmdline_parser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/parser/cmdline_parser/cmdline_parser.cc
r7319 r8316 52 52 else 53 53 argTable.push_front( entry ); 54 return true; 54 55 } 55 56 … … 70 71 if ( s.length() > 2 && s[0] == '-' && s[1] != '-' ) 71 72 { 72 for ( int j = 1; j < s.length(); j++ )73 for (unsigned int j = 1; j < s.length(); j++ ) 73 74 { 74 75 std::string t = "-"; … … 95 96 } 96 97 97 int i = 0;98 unsigned int i = 0; 98 99 99 100 ArgTable::iterator it; … … 110 111 found = true; 111 112 112 int posArgs = 1;113 unsigned int posArgs = 1; 113 114 114 115 while ( i + posArgs < args.size() ) … … 130 131 std::vector<MultiType> argArgs; 131 132 132 for ( int j = 1; j <= it->numArgs; j++ )133 for (unsigned int j = 1; j <= it->numArgs; j++ ) 133 134 argArgs.push_back( args[i+j] ); 134 135 … … 219 220 assert( it->numArgs == substr.size() ); 220 221 221 for ( int i = 0; i<it->numArgs; i++ )222 for (unsigned int i = 0; i<it->numArgs; i++ ) 222 223 { 223 224 args += " [" + substr[i] + "]"; … … 251 252 output.reverse(); 252 253 253 int maxShort = 0;254 int maxLong = 0;254 unsigned int maxShort = 0; 255 unsigned int maxLong = 0; 255 256 256 257 std::list<std::vector<std::string> >::const_iterator it; … … 269 270 printf("%s ", (*it)[0].c_str()); 270 271 271 for ( int i = 0; i<maxShort-(*it)[0].length(); i++ )272 for (unsigned int i = 0; i<maxShort-(*it)[0].length(); i++ ) 272 273 printf(" "); 273 274 274 275 printf("%s ", (*it)[1].c_str()); 275 276 276 for ( int i = 0; i<maxLong-(*it)[1].length(); i++ )277 for (unsigned int i = 0; i<maxLong-(*it)[1].length(); i++ ) 277 278 printf(" "); 278 279 -
trunk/src/lib/parser/cmdline_parser/cmdline_parser.h
r7256 r8316 17 17 struct ArgTableEntry 18 18 { 19 intid;20 std::string longOption;21 char shortOption;22 intnumArgs;23 std::string argNames;24 std::string help;19 unsigned int id; 20 std::string longOption; 21 char shortOption; 22 unsigned int numArgs; 23 std::string argNames; 24 std::string help; 25 25 }; 26 26 … … 36 36 CmdLineParser(); 37 37 virtual ~CmdLineParser(); 38 38 39 39 bool add( int id, const std::string& longOption, char shortOption, int numArgs, const std::string & argNames, const std::string& help, bool back=false ); 40 40 41 41 bool parse( ArgParserCallback cb, void* data, int argc, char** argv ); 42 42 43 43 void showHelp(); 44 44 45 45 private: 46 46 ArgTable argTable; 47 47 std::string exeName; 48 48 49 49 inline bool matches( ArgTableEntry entry, std::string arg, bool & finish ); 50 50
Note: See TracChangeset
for help on using the changeset viewer.