Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1795


Ignore:
Timestamp:
Sep 17, 2008, 11:49:08 PM (16 years ago)
Author:
rgrieder
Message:

changed return type of ConfigFileManager::getInstance() to ConfigFileManager& (from pointer before).

Location:
code/trunk/src
Files:
5 edited

Legend:

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

    r1784 r1795  
    7373    void reloadConfig()
    7474    {
    75         ConfigFileManager::getInstance()->load();
     75        ConfigFileManager::getInstance().load();
    7676    }
    7777
    7878    void cleanConfig()
    7979    {
    80         ConfigFileManager::getInstance()->clean(false);
     80        ConfigFileManager::getInstance().clean(false);
    8181    }
    8282
    8383    void loadSettings(const std::string& filename)
    8484    {
    85         ConfigFileManager::getInstance()->setFile(CFT_Settings, filename, false);
     85        ConfigFileManager::getInstance().setFile(CFT_Settings, filename, false);
    8686    }
    8787
    8888    void loadKeybindings(const std::string& filename)
    8989    {
    90         ConfigFileManager::getInstance()->setFile(CFT_Keybindings, filename);
     90        ConfigFileManager::getInstance().setFile(CFT_Keybindings, filename);
    9191    }
    9292
     
    461461    }
    462462
    463     ConfigFileManager* ConfigFileManager::getInstance()
     463    ConfigFileManager& ConfigFileManager::getInstance()
    464464    {
    465465        static ConfigFileManager instance;
    466         return (&instance);
     466        return instance;
    467467    }
    468468
  • code/trunk/src/core/ConfigFileManager.h

    r1784 r1795  
    4444    {
    4545        CFT_Settings,
    46         CFT_Keybindings
     46        CFT_Keybindings,
     47        CFT_JoyStickCalibration,
     48        CFT_KeyNames
    4749    };
    4850
     
    256258    {
    257259        public:
    258             static ConfigFileManager* getInstance();
     260            static ConfigFileManager& getInstance();
    259261
    260262            void setFile(ConfigFileType type, const std::string& filename, bool bCreateIfNotExisting = true);
  • code/trunk/src/core/ConfigValueContainer.cc

    r1791 r1795  
    8383        for (unsigned int i = 0; i < this->valueVector_.size(); i++)
    8484        {
    85             ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_string));
     85            ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_string));
    8686            this->defvalueStringVector_.push_back(this->valueVector_[i]);
    8787        }
     
    114114            if (this->tset(input))
    115115            {
    116                 ConfigFileManager::getInstance()->setValue(this->type_, this->sectionname_, this->varname_, input, this->value_.isType(MT_string));
     116                ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, input, this->value_.isType(MT_string));
    117117                return true;
    118118            }
     
    133133            if (this->tset(index, input))
    134134            {
    135                 ConfigFileManager::getInstance()->setValue(this->type_, this->sectionname_, this->varname_, index, input, this->value_.isType(MT_string));
     135                ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, index, input, this->value_.isType(MT_string));
    136136                return true;
    137137            }
     
    233233                this->valueVector_.erase(this->valueVector_.begin() + index);
    234234                for (unsigned int i = index; i < this->valueVector_.size(); i++)
    235                     ConfigFileManager::getInstance()->setValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_string));
    236                 ConfigFileManager::getInstance()->deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->valueVector_.size());
     235                    ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_string));
     236                ConfigFileManager::getInstance().deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->valueVector_.size());
    237237
    238238                return true;
     
    258258                if (!this->set(i, this->defvalueStringVector_[i]))
    259259                    success = false;
    260             ConfigFileManager::getInstance()->deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->defvalueStringVector_.size());
     260            ConfigFileManager::getInstance().deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->defvalueStringVector_.size());
    261261            return success;
    262262        }
     
    269269    {
    270270        if (!this->bIsVector_)
    271             this->value_ = ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, this->defvalueString_, this->value_.isType(MT_string));
     271            this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, this->defvalueString_, this->value_.isType(MT_string));
    272272        else
    273273        {
    274274            this->valueVector_.clear();
    275             for (unsigned int i = 0; i < ConfigFileManager::getInstance()->getVectorSize(this->type_, this->sectionname_, this->varname_); i++)
     275            for (unsigned int i = 0; i < ConfigFileManager::getInstance().getVectorSize(this->type_, this->sectionname_, this->varname_); i++)
    276276            {
    277277                if (i < this->defvalueStringVector_.size())
    278278                {
    279                     this->value_ = ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isType(MT_string));
     279                    this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isType(MT_string));
    280280                }
    281281                else
    282282                {
    283                     this->value_ = ConfigFileManager::getInstance()->getValue(this->type_, this->sectionname_, this->varname_, i, MultiType(), this->value_.isType(MT_string));
     283                    this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, MultiType(), this->value_.isType(MT_string));
    284284                }
    285285
  • code/trunk/src/core/input/KeyBinder.cc

    r1755 r1795  
    3939#include "core/ConfigValueIncludes.h"
    4040#include "core/CoreIncludes.h"
     41#include "core/ConfigFileManager.h"
    4142#include "InputCommands.h"
    4243
     
    222223        if (!infile)
    223224        {
    224             ConfigFileManager::getInstance()->setFile(CFT_Keybindings, "def_keybindings.ini");
    225             ConfigFileManager::getInstance()->save(CFT_Keybindings, "keybindings.ini");
     225            ConfigFileManager::getInstance().setFile(CFT_Keybindings, "def_keybindings.ini");
     226            ConfigFileManager::getInstance().save(CFT_Keybindings, "keybindings.ini");
    226227        }
    227228        else
    228229            infile.close();
    229         ConfigFileManager::getInstance()->setFile(CFT_Keybindings, "keybindings.ini");
     230        ConfigFileManager::getInstance().setFile(CFT_Keybindings, "keybindings.ini");
    230231
    231232        // parse key bindings
  • code/trunk/src/orxonox/gamestates/GSRoot.cc

    r1792 r1795  
    9898    {
    9999#if ORXONOX_DEBUG_MODE == 1
    100         ConfigFileManager::getInstance()->setFile(CFT_Settings, "orxonox_d.ini");
     100        ConfigFileManager::getInstance().setFile(CFT_Settings, "orxonox_d.ini");
    101101#else
    102         ConfigFileManager::getInstance()->setFile(CFT_Settings, "orxonox.ini");
     102        ConfigFileManager::getInstance().setFile(CFT_Settings, "orxonox.ini");
    103103#endif
    104104
Note: See TracChangeset for help on using the changeset viewer.