Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 1, 2008, 3:54:20 PM (16 years ago)
Author:
rgrieder
Message:
  • @everyone: Do not create a branch until I've added the svn:eol-style property correctly. Otherwise this would cost me another 4 hours or so when we want to merge back.
  • merged network branch back to trunk
  • I had to omit the changes from last evening concerning the line endings
  • might not work yet because of the line endings
  • @beni: script branch is the only branch still open. you probably will have to apply a patch because of inconsistent new lines
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/core/ConfigFileManager.cc

    r1056 r1502  
    3838namespace orxonox
    3939{
    40     ConsoleCommandShortcutExtern(reloadConfig, AccessLevel::None);
    41     ConsoleCommandShortcutExtern(cleanConfig, AccessLevel::None);
    42     ConsoleCommandShortcutExtern(loadSettings, AccessLevel::None);
    43     ConsoleCommandShortcutExtern(loadKeybindings, AccessLevel::None);
     40    SetConsoleCommandShortcutExtern(config).setArgumentCompleter(0, autocompletion::configvalueclasses()).setArgumentCompleter(1, autocompletion::configvalues()).setArgumentCompleter(2, autocompletion::configvalue());
     41    SetConsoleCommandShortcutExtern(tconfig).setArgumentCompleter(0, autocompletion::configvalueclasses()).setArgumentCompleter(1, autocompletion::configvalues()).setArgumentCompleter(2, autocompletion::configvalue());
     42    SetConsoleCommandShortcutExtern(reloadConfig);
     43    SetConsoleCommandShortcutExtern(cleanConfig);
     44    SetConsoleCommandShortcutExtern(loadSettings).setArgumentCompleter(0, autocompletion::files());
     45    SetConsoleCommandShortcutExtern(loadKeybindings).setArgumentCompleter(0, autocompletion::files());
     46
     47    bool config(const std::string& classname, const std::string& varname, const std::string& value)
     48    {
     49        std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getLowercaseIdentifierMap().find(getLowercase(classname));
     50        if (identifier != Identifier::getLowercaseIdentifierMapEnd())
     51        {
     52            std::map<std::string, ConfigValueContainer*>::const_iterator variable = (*identifier).second->getLowercaseConfigValueMap().find(getLowercase(varname));
     53            if (variable != (*identifier).second->getLowercaseConfigValueMapEnd())
     54                return (*variable).second->set(value);
     55        }
     56        return false;
     57    }
     58
     59    bool tconfig(const std::string& classname, const std::string& varname, const std::string& value)
     60    {
     61        std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getLowercaseIdentifierMap().find(getLowercase(classname));
     62        if (identifier != Identifier::getLowercaseIdentifierMapEnd())
     63        {
     64            std::map<std::string, ConfigValueContainer*>::const_iterator variable = (*identifier).second->getLowercaseConfigValueMap().find(getLowercase(varname));
     65            if (variable != (*identifier).second->getLowercaseConfigValueMapEnd())
     66                return (*variable).second->tset(value);
     67        }
     68        return false;
     69    }
    4470
    4571    void reloadConfig()
     
    336362
    337363        COUT(4) << "Saved config file \"" << this->filename_ << "\"." << std::endl;
     364    }
     365
     366    void ConfigFile::save(const std::string& filename)
     367    {
     368        std::string temp = this->filename_;
     369        this->filename_ = filename;
     370        this->save();
     371        this->filename_ = temp;
    338372    }
    339373
     
    473507    }
    474508
     509    void ConfigFileManager::save(ConfigFileType type, const std::string& filename)
     510    {
     511        this->getFile(type)->save(filename);
     512    }
     513
    475514    void ConfigFileManager::clean(ConfigFileType type, bool bCleanComments)
    476515    {
Note: See TracChangeset for help on using the changeset viewer.