Changeset 8316 in orxonox.OLD for trunk/src/lib/parser/preferences
- Timestamp:
- Jun 11, 2006, 1:57:27 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/parser/preferences/cmd_line_prefs_reader.cc
r7261 r8316 43 43 { 44 44 CallbackData * cbd = (CallbackData *)data; 45 45 46 46 switch ( entry.id ) 47 47 { … … 54 54 key.erase( 0, key.find(".")+1 ); 55 55 //PRINTF(0)("SECTION '%s', KEY '%s'\n", section.c_str(), key.c_str()); 56 56 57 57 if ( key == "" || section == "" || argArgs.size() != 1 ) 58 58 { … … 60 60 return false; 61 61 } 62 62 63 63 //Preferences::getInstance()->setMultiType( section, key, argArgs[0], true ); 64 64 cbd->iniEntries.push_back( IniEntry() ); … … 72 72 return true; 73 73 } 74 75 if ( entry.id >= ID_PREFS && entry.id - ID_PREFS < regArgs.size())74 75 if ( entry.id >= ID_PREFS && entry.id < regArgs.size() + ID_PREFS) 76 76 { 77 77 if ( regArgs[entry.id - ID_PREFS].value == "%arg%" ) 78 78 { 79 79 assert( argArgs.size() == 1 ); 80 80 81 81 cbd->iniEntries.push_back( IniEntry() ); 82 82 cbd->iniEntries.back().section = regArgs[entry.id - ID_PREFS].section; … … 96 96 assert(false); 97 97 } 98 98 99 99 return true; 100 100 } … … 104 104 { 105 105 CmdLineParser parser; 106 106 107 107 parser.add( ID_HELP, "help", 'h', 0, "", "Shows this help and exits"); 108 109 for ( int i = 0; i<regArgs.size(); i++ )108 109 for (unsigned int i = 0; i<regArgs.size(); i++ ) 110 110 { 111 111 if ( regArgs[i].value == "%arg%" ) … … 118 118 } 119 119 } 120 120 121 121 parser.add( ID_SET_INI, "set-%", '\0', 1, "value", "Override a configuration element." ); 122 122 123 123 CallbackData cbd; 124 124 125 125 cbd.parser = &parser; 126 126 127 127 if ( parser.parse( &callBack, &cbd, argc, argv ) ) 128 128 { … … 137 137 exit(EXIT_FAILURE); 138 138 } 139 139 140 140 return true; 141 141 } … … 144 144 { 145 145 RegistredArgument arg; 146 146 147 147 arg.longOption = longOption; 148 148 while ( arg.longOption.find("_") != std::string::npos ) … … 158 158 arg.section = section; 159 159 arg.key = key; 160 160 161 161 regArgs.push_back( arg ); 162 return true; 162 163 } 163 164
Note: See TracChangeset
for help on using the changeset viewer.