Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 24, 2006, 4:28:02 PM (18 years ago)
Author:
rennerc
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/preferences/src/lib/parser/preferences/cmd_line_prefs_reader.cc

    r7241 r7243  
    1818#include "cmd_line_prefs_reader.h"
    1919
     20#include "preferences.h"
     21
    2022using namespace std;
    2123
     
    3638}
    3739
    38 bool CmdLinePrefsReader::callBack( ArgTableEntry entry, void * data, const std::string & arg, const std::vector< std::string > & argArgs )
     40bool CmdLinePrefsReader::callBack( ArgTableEntry entry, void * data, const std::string & arg, const std::vector<MultiType> & argArgs )
    3941{
     42  switch ( entry.id )
     43  {
     44    case ID_SET_INI:
     45    {
     46      std::string section = arg;
     47      section.erase( 0, entry.longOption.length()+1 );
     48      std::string key = section;
     49      section.erase( section.find(".") );
     50      key.erase( 0, key.find(".")+1 );
     51      //PRINTF(0)("SECTION '%s', KEY '%s'\n", section.c_str(), key.c_str());
     52     
     53      if ( key == "" || section == "" || argArgs.size() != 1 )
     54      {
     55        PRINTF(1)("usage: --set-section.key=value\n");
     56        return false;
     57      }
     58     
     59      Preferences::getInstance()->setMultiType( section, key, argArgs[0], true );
     60      break;
     61    }
     62    default:
     63      assert(false);
     64  }
     65 
     66  return true;
    4067}
    4168
     
    4370{
    4471  CmdLineParser parser;
     72 
     73  parser.add( ID_SET_INI, "set-%", '\0', 1 );
     74 
     75  parser.parse( &callBack, NULL, argc, argv );
    4576}
    4677
Note: See TracChangeset for help on using the changeset viewer.