Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 2, 2008, 12:09:55 AM (16 years ago)
Author:
rgrieder
Message:

Finally managed to have a master InputState which enables:

  • Console always opens
  • Debug overlay toggles visibility in gui mode too

Had to change several other code:

  • ConfigFileManager uses special class instead of enum for ConfigFileType
  • You can add an arbitrary config file and get the ConfigFileType
  • ConfigFileManager is an Ogre singleton too. Created in Main.cc
  • CommandLineArgument "optionsFile" specifies another file for command line arguments
  • CommandLineArgument "settingsFile" declares the file used for settings (orxonox.ini)
  • changed all fileNames to filenames
  • "Loaded config file blah" now uses COUT(3) instead of COUT(0)
  • fixed a bug in ConfigFileManager::load() that cause orxonox.ini to double its size after every call
Location:
code/branches/objecthierarchy/src
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/audio/AudioBuffer.cc

    r1784 r2101  
    3131namespace audio
    3232{
    33     AudioBuffer::AudioBuffer(std::string fileName)
     33    AudioBuffer::AudioBuffer(std::string filename)
    3434    {
    3535        // Load wav data into buffers.
     
    4040
    4141        //FIXME deprecated; seems unneeded
    42 //        alutLoadWAVFile((ALbyte*)fileName.c_str(), &format, &data, &size, &freq, &loop);
     42//        alutLoadWAVFile((ALbyte*)filename.c_str(), &format, &data, &size, &freq, &loop);
    4343        alBufferData(buffer, format, data, size, freq);
    4444        //FIXME deprecated; seems unneeded
  • code/branches/objecthierarchy/src/audio/AudioBuffer.h

    r1784 r2101  
    4040    {
    4141    public:
    42         AudioBuffer(std::string fileName);
     42        AudioBuffer(std::string filename);
    4343        ~AudioBuffer();
    4444
  • code/branches/objecthierarchy/src/core/CommandLine.cc

    r2003 r2101  
    3030
    3131#include "util/String.h"
     32#include "util/SubString.h"
    3233
    3334namespace orxonox
    3435{
     36    SetCommandLineArgument(optionsFile, "start.ini").shortcut("o");
     37
    3538    /**
    3639    @brief
     
    274277        }
    275278    }
     279
     280    /**
     281    @brief
     282        Parses both command line and start.ini for CommandLineArguments.
     283    */
     284    void CommandLine::_parseAll(int argc, char** argv)
     285    {
     286        // parse command line first
     287        std::vector<std::string> args;
     288        for (int i = 1; i < argc; ++i)
     289            args.push_back(argv[i]);
     290        this->_parse(args);
     291
     292        // look for additional arguments in given file or start.ini as default
     293        // They will not overwrite the arguments given directly
     294        std::ifstream file;
     295        std::string filename = CommandLine::getValue("optionsFile").getString();
     296        file.open(filename.c_str());
     297        args.clear();
     298        if (file)
     299        {
     300            while (!file.eof())
     301            {
     302                std::string line;
     303                std::getline(file, line);
     304                line = removeTrailingWhitespaces(line);
     305                //if (!(line[0] == '#' || line[0] == '%'))
     306                //{
     307                SubString tokens(line, " ", " ", false, 92, false, 34, false, 40, 41, false, '#');
     308                for (unsigned i = 0; i < tokens.size(); ++i)
     309                    if (tokens[i][0] != '#')
     310                        args.push_back(tokens[i]);
     311                //args.insert(args.end(), tokens.getAllStrings().begin(), tokens.getAllStrings().end());
     312                //}
     313            }
     314            file.close();
     315        }
     316        else
     317        {
     318            COUT(2) << "Warning: Could not find " << filename
     319                    << " to get additional command line arguments." << std::endl;
     320        }
     321
     322        try
     323        {
     324            _parse(args);
     325        }
     326        catch (orxonox::ArgumentException& ex)
     327        {
     328            COUT(1) << "An Exception occured while parsing " << filename << std::endl;
     329            throw(ex);
     330        }
     331    }
    276332}
  • code/branches/objecthierarchy/src/core/CommandLine.h

    r2005 r2101  
    3838
    3939#define SetCommandLineArgument(name, defaultValue) \
    40     CommandLineArgument& CmdArgumentDummyBoolVar##name \
     40    orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
    4141    = orxonox::CommandLine::addArgument(#name, defaultValue)
    4242#define SetCommandLineSwitch(name) \
    43     CommandLineArgument& CmdArgumentDummyBoolVar##name \
     43    orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
    4444    = orxonox::CommandLine::addArgument(#name, false)
    4545
     
    135135
    136136        //! Parse redirection to internal member method.
    137         static void parse(const std::vector<std::string>& arguments) { _getInstance()._parse(arguments); }
     137        static void parseAll(int argc, char** argv) { _getInstance()._parseAll(argc, argv); }
    138138
    139139        static std::string getUsageInformation();
     
    165165        static CommandLine& _getInstance();
    166166
     167        void _parseAll(int argc, char** argv);
    167168        void _parse(const std::vector<std::string>& arguments);
    168169        void checkFullArgument(const std::string& name, const std::string& value);
  • code/branches/objecthierarchy/src/core/ConfigFileManager.cc

    r1889 r2101  
    2828
    2929#include "ConfigFileManager.h"
    30 #include "ConfigValueContainer.h"
    31 #include "ConsoleCommand.h"
    32 #include "Identifier.h"
     30
     31#include <cassert>
    3332#include "util/Convert.h"
    3433#include "util/String.h"
    35 
     34#include "ConsoleCommand.h"
     35#include "ConfigValueContainer.h"
    3636
    3737namespace orxonox
     
    3939    const int CONFIG_FILE_MAX_LINELENGHT  = 1024;
    4040    const char* const DEFAULT_CONFIG_FILE = "default.ini";
     41
     42    ConfigFileManager* ConfigFileManager::singletonRef_s = 0;
    4143
    4244    SetConsoleCommandShortcutExtern(config).argumentCompleter(0, autocompletion::configvalueclasses()).argumentCompleter(1, autocompletion::configvalues()).argumentCompleter(2, autocompletion::configvalue());
     
    4547    SetConsoleCommandShortcutExtern(cleanConfig);
    4648    SetConsoleCommandShortcutExtern(loadSettings).argumentCompleter(0, autocompletion::files());
    47     SetConsoleCommandShortcutExtern(loadKeybindings).argumentCompleter(0, autocompletion::files());
    4849
    4950    bool config(const std::string& classname, const std::string& varname, const std::string& value)
     
    8384    void loadSettings(const std::string& filename)
    8485    {
    85         ConfigFileManager::getInstance().setFile(CFT_Settings, filename, false);
    86     }
    87 
    88     void loadKeybindings(const std::string& filename)
    89     {
    90         ConfigFileManager::getInstance().setFile(CFT_Keybindings, filename);
    91     }
    92 
     86        ConfigFileManager::getInstance().setFilename(ConfigFileType::Settings, filename);
     87    }
    9388
    9489    //////////////////////////
     
    121116
    122117
    123     ///////////////////////////////
     118    ////////////////////////////////
    124119    // ConfigFileEntryVectorValue //
    125     ///////////////////////////////
     120    ////////////////////////////////
    126121    std::string ConfigFileEntryVectorValue::getFileEntry() const
    127122    {
     
    217212    ConfigFile::~ConfigFile()
    218213    {
    219         for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); )
    220             delete (*(it++));
     214        this->clear();
    221215    }
    222216
    223217    void ConfigFile::load(bool bCreateIfNotExisting)
    224218    {
    225         if (bCreateIfNotExisting)
    226         {
    227             // This creates the default config file if it's not existing
    228             std::ofstream createFile;
    229             createFile.open(this->filename_.c_str(), std::fstream::app);
    230             createFile.close();
    231         }
     219        // Be sure we start from new
     220        this->clear();
     221
     222        // This creates the config file if it's not existing
     223        std::ofstream createFile;
     224        createFile.open(this->filename_.c_str(), std::fstream::app);
     225        createFile.close();
    232226
    233227        // Open the file
     
    329323        file.close();
    330324
    331         COUT(0) << "Loaded config file \"" << this->filename_ << "\"." << std::endl;
     325        COUT(3) << "Loaded config file \"" << this->filename_ << "\"." << std::endl;
    332326
    333327        // Save the file in case something changed (like stripped whitespaces)
    334328        this->save();
     329
     330        // Update all ConfigValueContainers
     331        this->updateConfigValues();
    335332    }
    336333
     
    366363    }
    367364
    368     void ConfigFile::save(const std::string& filename)
     365    void ConfigFile::saveAs(const std::string& filename)
    369366    {
    370367        std::string temp = this->filename_;
     
    415412    }
    416413
     414    void ConfigFile::clear()
     415    {
     416        for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); )
     417            delete (*(it++));
     418        this->sections_.clear();
     419    }
     420
    417421    ConfigFileSection* ConfigFile::getSection(const std::string& section)
    418422    {
     
    446450    }
    447451
     452    void ConfigFile::updateConfigValues()
     453    {
     454        if (this->type_ == ConfigFileType::Settings)
     455        {
     456            for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getIdentifierMapBegin(); it != Identifier::getIdentifierMapEnd(); ++it)
     457            {
     458                if (it->second->hasConfigValues())
     459                {
     460                    for (std::map<std::string, ConfigValueContainer*>::const_iterator it2 = (*it).second->getConfigValueMapBegin(); it2 != (*it).second->getConfigValueMapEnd(); ++it2)
     461                        it2->second->update();
     462
     463                    it->second->updateConfigValues();
     464                }
     465            }
     466        }
     467    }
     468
    448469
    449470    ///////////////////////
    450471    // ConfigFileManager //
    451472    ///////////////////////
     473
    452474    ConfigFileManager::ConfigFileManager()
    453     {
    454         this->setFile(CFT_Settings, DEFAULT_CONFIG_FILE);
     475         : mininmalFreeType_(ConfigFileType::numberOfReservedTypes)
     476    {
     477        assert(singletonRef_s == 0);
     478        singletonRef_s = this;
    455479    }
    456480
     
    458482    {
    459483        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); )
    460             delete (*(it++)).second;
    461     }
    462 
    463     ConfigFileManager& ConfigFileManager::getInstance()
    464     {
    465         static ConfigFileManager instance;
    466         return instance;
    467     }
    468 
    469     void ConfigFileManager::setFile(ConfigFileType type, const std::string& filename, bool bCreateIfNotExisting)
     484            delete (it++)->second;
     485
     486        assert(singletonRef_s != 0);
     487        singletonRef_s = 0;
     488    }
     489
     490    void ConfigFileManager::setFilename(ConfigFileType type, const std::string& filename)
    470491    {
    471492        std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.find(type);
    472493        if (it != this->configFiles_.end())
    473             if ((*it).second != 0)
    474                 delete (*it).second;
    475 
    476         this->configFiles_[type] = new ConfigFile(this->getFilePath(filename));
    477         this->load(type, bCreateIfNotExisting);
    478     }
    479 
    480     void ConfigFileManager::load(bool bCreateIfNotExisting)
     494        {
     495            assert(it->second);
     496            delete it->second;
     497        }
     498        this->configFiles_[type] = new ConfigFile(filename, type);
     499        this->load(type);
     500    }
     501
     502    void ConfigFileManager::load()
    481503    {
    482504        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
    483             (*it).second->load(bCreateIfNotExisting);
    484 
    485         this->updateConfigValues();
     505            it->second->load();
    486506    }
    487507
     
    489509    {
    490510        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
    491             (*it).second->save();
     511            it->second->save();
    492512    }
    493513
     
    495515    {
    496516        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
    497             this->clean((*it).first, bCleanComments);
    498     }
    499 
    500     void ConfigFileManager::load(ConfigFileType type, bool bCreateIfNotExisting)
    501     {
    502         this->getFile(type)->load(bCreateIfNotExisting);
    503         this->updateConfigValues(type);
     517            this->clean(it->first, bCleanComments);
     518    }
     519
     520    void ConfigFileManager::load(ConfigFileType type)
     521    {
     522        this->getFile(type)->load();
    504523    }
    505524
     
    509528    }
    510529
    511     void ConfigFileManager::save(ConfigFileType type, const std::string& filename)
    512     {
    513         this->getFile(type)->save(filename);
     530    void ConfigFileManager::saveAs(ConfigFileType type, const std::string& saveFilename)
     531    {
     532        this->getFile(type)->saveAs(saveFilename);
    514533    }
    515534
     
    519538    }
    520539
    521     void ConfigFileManager::updateConfigValues() const
     540    void ConfigFileManager::updateConfigValues()
    522541    {
    523542        for(std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
    524             this->updateConfigValues((*it).first);
    525     }
    526 
    527     void ConfigFileManager::updateConfigValues(ConfigFileType type) const
    528     {
    529         if (type == CFT_Settings)
    530         {
    531             for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getIdentifierMapBegin(); it != Identifier::getIdentifierMapEnd(); ++it)
    532             {
    533                 if ((*it).second->hasConfigValues() /* && (*it).second != ClassIdentifier<KeyBinder>::getIdentifier()*/)
    534                 {
    535                     for (std::map<std::string, ConfigValueContainer*>::const_iterator it2 = (*it).second->getConfigValueMapBegin(); it2 != (*it).second->getConfigValueMapEnd(); ++it2)
    536                         (*it2).second->update();
    537 
    538                     (*it).second->updateConfigValues();
    539                 }
    540             }
    541         }
    542         else if (type == CFT_Keybindings)
    543         {
    544             // todo
    545         }
     543            it->second->updateConfigValues();
     544    }
     545
     546    void ConfigFileManager::updateConfigValues(ConfigFileType type)
     547    {
     548        this->getFile(type)->updateConfigValues();
     549    }
     550
     551    const std::string& ConfigFileManager::getFilename(ConfigFileType type)
     552    {
     553        std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.find(type);
     554        if (it != this->configFiles_.end())
     555            return it->second->getFilename();
     556        else
     557            return BLANKSTRING;
    546558    }
    547559
    548560    ConfigFile* ConfigFileManager::getFile(ConfigFileType type)
    549561    {
    550         std::map<ConfigFileType, ConfigFile*>::iterator it = this->configFiles_.find(type);
     562        std::map<ConfigFileType, ConfigFile*>::const_iterator it = this->configFiles_.find(type);
    551563        if (it != this->configFiles_.end())
    552             return (*it).second;
    553 
    554         if (type == CFT_Settings)
    555             return this->configFiles_[type] = new ConfigFile(DEFAULT_CONFIG_FILE);
    556         else
    557             return this->configFiles_[type] = new ConfigFile("");
    558     }
    559 
    560     std::string ConfigFileManager::getFilePath(const std::string& name) const
    561     {
    562         return name;
     564            return it->second;
     565        else
     566        {
     567            COUT(1) << "ConfigFileManager: Can't find a config file for type with ID " << (int)type << std::endl;
     568            COUT(1) << "Using " << DEFAULT_CONFIG_FILE << " file." << std::endl;
     569            this->setFilename(type, DEFAULT_CONFIG_FILE);
     570            return getFile(type);
     571        }
    563572    }
    564573}
  • code/branches/objecthierarchy/src/core/ConfigFileManager.h

    r1887 r2101  
    4141namespace orxonox
    4242{
    43     enum _CoreExport ConfigFileType
    44     {
    45         CFT_Settings,
    46         CFT_Keybindings,
    47         CFT_JoyStickCalibration
    48     };
    49 
     43    // Use unsigned int as config file type to have an arbitrary number of files
     44    class ConfigFileType
     45    {
     46    public:
     47        ConfigFileType() { }
     48        ConfigFileType(unsigned int type)              { type_ = type; }
     49        ConfigFileType(const ConfigFileType& instance) { type_ = instance.type_; }
     50
     51        operator unsigned int() { return type_; }
     52        ConfigFileType& operator =(unsigned int type) { type_ = type; return *this; }
     53        bool operator <(const ConfigFileType& right) const   { return (type_ < right.type_); }
     54
     55        /* *** Put the different config file types here *** */
     56        static const unsigned int NoType              = 0;
     57        static const unsigned int Settings            = 1;
     58        static const unsigned int JoyStickCalibration = 2;
     59
     60        static const unsigned int numberOfReservedTypes = 1024;
     61
     62    private:
     63        unsigned int type_;
     64    };
    5065
    5166    bool config(const std::string& classname, const std::string& varname, const std::string& value);
     
    5570    void cleanConfig();
    5671    void loadSettings(const std::string& filename);
    57     void loadKeybindings(const std::string& filename);
    5872
    5973
     
    218232    {
    219233        public:
    220             inline ConfigFile(const std::string& filename) : filename_(filename), bUpdated_(false) {}
     234            inline ConfigFile(const std::string& filename, ConfigFileType type)
     235                : filename_(filename)
     236                , type_(type)
     237                , bUpdated_(false)
     238            { }
    221239            ~ConfigFile();
    222240
    223241            void load(bool bCreateIfNotExisting = true);
    224242            void save() const;
    225             void save(const std::string& filename);
     243            void saveAs(const std::string& filename);
    226244            void clean(bool bCleanComments = false);
     245            void clear();
     246
     247            const std::string& getFilename() { return this->filename_; }
    227248
    228249            inline void setValue(const std::string& section, const std::string& name, const std::string& value, bool bString)
     
    241262                { return this->getSection(section)->getVectorSize(name); }
    242263
     264            void updateConfigValues();
     265
    243266        private:
    244267            ConfigFileSection* getSection(const std::string& section);
     
    246269
    247270            std::string filename_;
     271            ConfigFileType type_;
    248272            std::list<ConfigFileSection*> sections_;
    249273            bool bUpdated_;
     
    257281    {
    258282        public:
    259             static ConfigFileManager& getInstance();
    260 
    261             void setFile(ConfigFileType type, const std::string& filename, bool bCreateIfNotExisting = true);
    262 
    263             void load(bool bCreateIfNotExisting = true);
     283            ConfigFileManager();
     284            ~ConfigFileManager();
     285
     286            void load();
    264287            void save();
    265288            void clean(bool bCleanComments = false);
    266289
    267             void load(ConfigFileType type, bool bCreateIfNotExisting = true);
     290            void setFilename(ConfigFileType type, const std::string& filename);
     291            const std::string& getFilename(ConfigFileType type);
     292
     293            ConfigFileType getNewConfigFileType() { return mininmalFreeType_++; }
     294
     295            void load(ConfigFileType type);
    268296            void save(ConfigFileType type);
    269             void save(ConfigFileType type, const std::string& filename);
     297            void saveAs(ConfigFileType type, const std::string& saveFilename);
    270298            void clean(ConfigFileType type, bool bCleanComments = false);
    271299
     
    285313                { return this->getFile(type)->getVectorSize(section, name); }
    286314
    287             void updateConfigValues() const;
    288             void updateConfigValues(ConfigFileType type) const;
    289 
    290         private:
    291             ConfigFileManager();
    292             ConfigFileManager(const ConfigFileManager& other);
    293             ~ConfigFileManager();
     315            void updateConfigValues();
     316            void updateConfigValues(ConfigFileType type);
     317
     318            static ConfigFileManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
     319
     320        private:
     321            ConfigFileManager(const ConfigFileManager&);
    294322
    295323            ConfigFile* getFile(ConfigFileType type);
    296324
    297             std::string getFilePath(const std::string& name) const;
    298 
    299325            std::map<ConfigFileType, ConfigFile*> configFiles_;
     326            unsigned int mininmalFreeType_;
     327
     328            static ConfigFileManager* singletonRef_s;
    300329    };
    301330}
  • code/branches/objecthierarchy/src/core/ConfigValueIncludes.h

    r1887 r2101  
    5252    if (!container##varname) \
    5353    { \
    54         container##varname = new orxonox::ConfigValueContainer(CFT_Settings, identifier##varname, identifier##varname->getName(), #varname, defvalue, varname); \
     54        container##varname = new orxonox::ConfigValueContainer(ConfigFileType::Settings, identifier##varname, identifier##varname->getName(), #varname, defvalue, varname); \
    5555        identifier##varname->addConfigValueContainer(#varname, container##varname); \
    5656    } \
    5757    container##varname->getValue(&varname, this)
    5858
    59 #define SetConfigValue(varname, defvalue) SetConfigValueGeneric(CFT_Settings, varname, defvalue)
    60 #define SetKeybindingValue(varname, defvalue) SetConfigValueGeneric(CFT_Keybindings, varname, defvalue)
     59#define SetConfigValue(varname, defvalue) SetConfigValueGeneric(ConfigFileType::Settings, varname, defvalue)
    6160
    6261
     
    7170    if (!container##varname) \
    7271    { \
    73         container##varname = new orxonox::ConfigValueContainer(CFT_Settings, identifier##varname, identifier##varname->getName(), #varname, defvalue); \
     72        container##varname = new orxonox::ConfigValueContainer(ConfigFileType::Settings, identifier##varname, identifier##varname->getName(), #varname, defvalue); \
    7473        identifier##varname->addConfigValueContainer(#varname, container##varname); \
    7574    } \
    7675    container##varname->getValue(&varname, this)
    7776
    78 #define SetConfigValueVector(varname, defvalue) SetConfigValueVectorGeneric(CFT_Settings, varname, defvalue)
    79 #define SetKeybindingValueVector(varname, defvalue) SetConfigValueVectorGeneric(CFT_Keybindings, varname, defvalue)
     77#define SetConfigValueVector(varname, defvalue) SetConfigValueVectorGeneric(ConfigFileType::Settings, varname, defvalue)
    8078
    8179
  • code/branches/objecthierarchy/src/core/CoreIncludes.h

    r2084 r2101  
    135135#define RegisterConstructionCallback(ThisClassName, TargetClassName, FunctionName) \
    136136    orxonox::ClassIdentifier<TargetClassName>::getIdentifier()->addConstructionCallback( \
    137         createFunctor(&ThisClassName::FunctionName)->setObject(this))
     137        orxonox::createFunctor(&ThisClassName::FunctionName)->setObject(this))
    138138
    139139#endif /* _CoreIncludes_H__ */
  • code/branches/objecthierarchy/src/core/Identifier.h

    r2086 r2101  
    485485        You can only assign an Identifier that belongs to a class T (or derived) to a SubclassIdentifier<T>.
    486486        If you assign something else, the program aborts.
    487         Because we know the minimal type, a dynamic_cast is done, which makes it easier to create a new object.
     487        Because we know the minimum type, a dynamic_cast is done, which makes it easier to create a new object.
    488488    */
    489489    template <class T>
  • code/branches/objecthierarchy/src/core/Language.cc

    r1747 r2101  
    137137        }
    138138
    139         COUT(2) << "Warning: Language entry " << label << " is duplicate in " << getFileName(this->defaultLanguage_) << "!" << std::endl;
     139        COUT(2) << "Warning: Language entry " << label << " is duplicate in " << getFilename(this->defaultLanguage_) << "!" << std::endl;
    140140        return it->second;
    141141    }
     
    194194        @return The filename
    195195    */
    196     const std::string Language::getFileName(const std::string& language)
     196    const std::string Language::getFilename(const std::string& language)
    197197    {
    198198        return std::string("translation_" + language + ".lang");
     
    208208        // This creates the file if it's not existing
    209209        std::ofstream createFile;
    210         createFile.open(getFileName(this->defaultLanguage_).c_str(), std::fstream::app);
     210        createFile.open(getFilename(this->defaultLanguage_).c_str(), std::fstream::app);
    211211        createFile.close();
    212212
    213213        // Open the file
    214214        std::ifstream file;
    215         file.open(getFileName(this->defaultLanguage_).c_str(), std::fstream::in);
     215        file.open(getFilename(this->defaultLanguage_).c_str(), std::fstream::in);
    216216
    217217        if (!file.is_open())
    218218        {
    219219            COUT(1) << "An error occurred in Language.cc:" << std::endl;
    220             COUT(1) << "Error: Couldn't open file " << getFileName(this->defaultLanguage_) << " to read the default language entries!" << std::endl;
     220            COUT(1) << "Error: Couldn't open file " << getFilename(this->defaultLanguage_) << " to read the default language entries!" << std::endl;
    221221            return;
    222222        }
     
    240240                else
    241241                {
    242                     COUT(2) << "Warning: Invalid language entry \"" << lineString << "\" in " << getFileName(this->defaultLanguage_) << std::endl;
     242                    COUT(2) << "Warning: Invalid language entry \"" << lineString << "\" in " << getFilename(this->defaultLanguage_) << std::endl;
    243243                }
    244244            }
     
    257257        // Open the file
    258258        std::ifstream file;
    259         file.open(getFileName(Core::getLanguage()).c_str(), std::fstream::in);
     259        file.open(getFilename(Core::getLanguage()).c_str(), std::fstream::in);
    260260
    261261        if (!file.is_open())
    262262        {
    263263            COUT(1) << "An error occurred in Language.cc:" << std::endl;
    264             COUT(1) << "Error: Couldn't open file " << getFileName(Core::getLanguage()) << " to read the translated language entries!" << std::endl;
     264            COUT(1) << "Error: Couldn't open file " << getFilename(Core::getLanguage()) << " to read the translated language entries!" << std::endl;
    265265            Core::resetLanguage();
    266266            COUT(3) << "Info: Reset language to " << this->defaultLanguage_ << "." << std::endl;
     
    294294                else
    295295                {
    296                     COUT(2) << "Warning: Invalid language entry \"" << lineString << "\" in " << getFileName(Core::getLanguage()) << std::endl;
     296                    COUT(2) << "Warning: Invalid language entry \"" << lineString << "\" in " << getFilename(Core::getLanguage()) << std::endl;
    297297                }
    298298            }
     
    311311        // Open the file
    312312        std::ofstream file;
    313         file.open(getFileName(this->defaultLanguage_).c_str(), std::fstream::out);
     313        file.open(getFilename(this->defaultLanguage_).c_str(), std::fstream::out);
    314314
    315315        if (!file.is_open())
    316316        {
    317317            COUT(1) << "An error occurred in Language.cc:" << std::endl;
    318             COUT(1) << "Error: Couldn't open file " << getFileName(this->defaultLanguage_) << " to write the default language entries!" << std::endl;
     318            COUT(1) << "Error: Couldn't open file " << getFilename(this->defaultLanguage_) << " to write the default language entries!" << std::endl;
    319319            return;
    320320        }
  • code/branches/objecthierarchy/src/core/Language.h

    r1747 r2101  
    128128            void readTranslatedLanguageFile();
    129129            void writeDefaultLanguageFile() const;
    130             static const std::string getFileName(const std::string& language);
     130            static const std::string getFilename(const std::string& language);
    131131            LanguageEntry* createEntry(const LanguageEntryLabel& label, const std::string& entry);
    132132
  • code/branches/objecthierarchy/src/core/RootGameState.cc

    r2003 r2101  
    2929#include "RootGameState.h"
    3030
    31 #include "util/String.h"
    32 #include "util/SubString.h"
    3331#include "util/Debug.h"
    3432#include "util/Exception.h"
     
    130128        State to start with (usually main menu or specified by command line)
    131129    */
    132     void RootGameState::start(int argc, char** argv)
     130    void RootGameState::start()
    133131    {
    134132#ifdef NDEBUG
     
    141139            // create the Core settings to configure the output level
    142140            Core::getInstance();
    143 
    144             parseArguments(argc, argv);
    145141
    146142            this->activate();
     
    168164            COUT(1) << ex.what() << std::endl;
    169165            COUT(1) << "Program aborted." << std::endl;
    170             abort();
    171166        }
    172167        // anything that doesn't inherit from std::exception
     
    174169        {
    175170            COUT(1) << "An unidentifiable exception has occured. Program aborted." << std::endl;
    176             abort();
    177171        }
    178172#endif
    179173    }
    180 
    181     /**
    182     @brief
    183         Parses both command line and start.ini for CommandLineArguments.
    184     */
    185     void RootGameState::parseArguments(int argc, char** argv)
    186     {
    187         // parse command line first
    188         std::vector<std::string> args;
    189         for (int i = 1; i < argc; ++i)
    190             args.push_back(argv[i]);
    191 
    192         try
    193         {
    194             orxonox::CommandLine::parse(args);
    195         }
    196         catch (orxonox::ArgumentException& ex)
    197         {
    198             COUT(1) << ex.what() << std::endl;
    199             COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl;
    200         }
    201 
    202         // look for additional arguments in start.ini
    203         std::ifstream file;
    204         file.open("start.ini");
    205         args.clear();
    206         if (file)
    207         {
    208             while (!file.eof())
    209             {
    210                 std::string line;
    211                 std::getline(file, line);
    212                 line = removeTrailingWhitespaces(line);
    213                 //if (!(line[0] == '#' || line[0] == '%'))
    214                 //{
    215                 SubString tokens(line, " ", " ", false, 92, false, 34, false, 40, 41, false, '#');
    216                 for (unsigned i = 0; i < tokens.size(); ++i)
    217                     if (tokens[i][0] != '#')
    218                         args.push_back(tokens[i]);
    219                 //args.insert(args.end(), tokens.getAllStrings().begin(), tokens.getAllStrings().end());
    220                 //}
    221             }
    222             file.close();
    223         }
    224 
    225         try
    226         {
    227             orxonox::CommandLine::parse(args);
    228         }
    229         catch (orxonox::ArgumentException& ex)
    230         {
    231             COUT(1) << "An Exception occured while parsing start.ini" << std::endl;
    232             COUT(1) << ex.what() << std::endl;
    233             COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl;
    234         }
    235     }
    236174}
  • code/branches/objecthierarchy/src/core/RootGameState.h

    r1755 r2101  
    4242
    4343        void requestState(const std::string& name);
    44         void start(int argc, char** argv);
     44        void start();
    4545
    4646    private:
    4747        void makeTransition(GameStateBase* source, GameStateBase* destination);
    4848        void gotoState(const std::string& name);
    49 
    50         void parseArguments(int argc, char** argv);
    5149
    5250        std::string           stateRequest_;
  • code/branches/objecthierarchy/src/core/input/Button.cc

    r2001 r2101  
    8282    }
    8383
    84     void Button::readConfigValue()
     84    void Button::readConfigValue(ConfigFileType configFile)
    8585    {
    8686        // create/get ConfigValueContainer
    8787        if (!configContainer_)
    8888        {
    89             configContainer_ = new ConfigValueContainer(CFT_Keybindings, 0, groupName_, name_, "", name_);
     89            configContainer_ = new ConfigValueContainer(configFile, 0, groupName_, name_, "", name_);
    9090            configContainer_->callback(this, &Button::parse);
    9191        }
  • code/branches/objecthierarchy/src/core/input/Button.h

    r1887 r2101  
    4141#include <vector>
    4242#include "InputCommands.h"
     43#include "core/ConfigFileManager.h"
    4344
    4445namespace orxonox
     
    5253        virtual bool addParamCommand(ParamCommand* command) { return false; }
    5354        void parse();
    54         void readConfigValue();
     55        void readConfigValue(ConfigFileType configFile);
    5556        bool execute(KeybindMode::Enum mode, float abs = 1.0f, float rel = 1.0f);
    5657
  • code/branches/objecthierarchy/src/core/input/InputManager.cc

    r1887 r2101  
    395395            if (!cont)
    396396            {
    397                 cont = new ConfigValueContainer(CFT_Settings, getIdentifier(), getIdentifier()->getName(), "CoeffPos", coeffPos);
     397                cont = new ConfigValueContainer(ConfigFileType::Settings, getIdentifier(), getIdentifier()->getName(), "CoeffPos", coeffPos);
    398398                getIdentifier()->addConfigValueContainer("CoeffPos", cont);
    399399            }
     
    403403            if (!cont)
    404404            {
    405                 cont = new ConfigValueContainer(CFT_Settings, getIdentifier(), getIdentifier()->getName(), "CoeffNeg", coeffNeg);
     405                cont = new ConfigValueContainer(ConfigFileType::Settings, getIdentifier(), getIdentifier()->getName(), "CoeffNeg", coeffNeg);
    406406                getIdentifier()->addConfigValueContainer("CoeffNeg", cont);
    407407            }
     
    411411            if (!cont)
    412412            {
    413                 cont = new ConfigValueContainer(CFT_Settings, getIdentifier(), getIdentifier()->getName(), "Zero", zero);
     413                cont = new ConfigValueContainer(ConfigFileType::Settings, getIdentifier(), getIdentifier()->getName(), "Zero", zero);
    414414                getIdentifier()->addConfigValueContainer("Zero", cont);
    415415            }
  • code/branches/objecthierarchy/src/core/input/KeyBinder.cc

    r2004 r2101  
    106106        }
    107107
     108        // Get a new ConfigFileType from the ConfigFileManager
     109        this->configFile_ = ConfigFileManager::getInstance().getNewConfigFileType();
     110
    108111        // initialise joy sticks separatly to allow for reloading
    109112        numberOfJoySticks_ = InputManager::getInstance().numberOfJoySticks();
     
    133136    void KeyBinder::setConfigValues()
    134137    {
    135         SetConfigValue(defaultKeybindings_, "def_keybindings.ini")
    136             .description("Filename of default keybindings.");
    137138        SetConfigValue(analogThreshold_, 0.05f)
    138139            .description("Threshold for analog axes until which the state is 0.");
     
    173174
    174175        // load the bindings if required
    175         if (!configFile_.empty())
     176        if (configFile_ != ConfigFileType::NoType)
    176177        {
    177178            for (unsigned int iDev = oldValue; iDev < numberOfJoySticks_; ++iDev)
    178179            {
    179180                for (unsigned int i = 0; i < JoyStickButtonCode::numberOfButtons; ++i)
    180                     joyStickButtons_[iDev][i].readConfigValue();
     181                    joyStickButtons_[iDev][i].readConfigValue(this->configFile_);
    181182                for (unsigned int i = 0; i < JoyStickAxisCode::numberOfAxes * 2; ++i)
    182                     joyStickAxes_[iDev][i].readConfigValue();
     183                    joyStickAxes_[iDev][i].readConfigValue(this->configFile_);
    183184            }
    184185        }
     
    250251        True if loading succeeded.
    251252    */
    252     void KeyBinder::loadBindings(const std::string& filename)
     253    void KeyBinder::loadBindings(const std::string& filename, const std::string& defaultFilename)
    253254    {
    254255        COUT(3) << "KeyBinder: Loading key bindings..." << std::endl;
    255256
    256         configFile_ = filename;
    257         if (configFile_.empty())
     257        if (filename.empty())
    258258            return;
    259259
    260260        // get bindings from default file if filename doesn't exist.
    261261        std::ifstream infile;
    262         infile.open(configFile_.c_str());
     262        infile.open(filename.c_str());
    263263        if (!infile)
    264264        {
    265             ConfigFileManager::getInstance().setFile(CFT_Keybindings, defaultKeybindings_);
    266             ConfigFileManager::getInstance().save(CFT_Keybindings, configFile_);
     265            ConfigFileManager::getInstance().setFilename(this->configFile_, defaultFilename);
     266            ConfigFileManager::getInstance().saveAs(this->configFile_, filename);
    267267        }
    268268        else
    269269            infile.close();
    270         ConfigFileManager::getInstance().setFile(CFT_Keybindings, configFile_);
     270        ConfigFileManager::getInstance().setFilename(this->configFile_, filename);
    271271
    272272        // Parse bindings and create the ConfigValueContainers if necessary
    273273        clearBindings();
    274274        for (std::map<std::string, Button*>::const_iterator it = allButtons_.begin(); it != allButtons_.end(); ++it)
    275             it->second->readConfigValue();
     275            it->second->readConfigValue(this->configFile_);
    276276
    277277        COUT(3) << "KeyBinder: Loading key bindings done." << std::endl;
  • code/branches/objecthierarchy/src/core/input/KeyBinder.h

    r2001 r2101  
    4444#include "InputCommands.h"
    4545#include "JoyStickDeviceNumberListener.h"
     46#include "core/ConfigFileManager.h"
    4647
    4748namespace orxonox
     
    5960        virtual ~KeyBinder();
    6061
    61         void loadBindings(const std::string& filename);
     62        void loadBindings(const std::string& filename, const std::string& defaultFilename);
    6263        void clearBindings();
    6364        bool setBinding(const std::string& binding, const std::string& name, bool bTemporary = false);
     
    142143        float deriveTime_;
    143144
    144         //! Config file used. "" in case of KeyDetector. Also indicates whether we've already loaded.
    145         std::string configFile_;
     145        //! Config file used. ConfigFileType::NoType in case of KeyDetector. Also indicates whether we've already loaded.
     146        ConfigFileType configFile_;
    146147
    147148    private:
    148149        //##### ConfigValues #####
    149         //! Filename of default keybindings.
    150         std::string defaultKeybindings_;
    151150        //! Whether to filter small value analog input
    152151        bool bFilterAnalogNoise_;
  • code/branches/objecthierarchy/src/orxonox/Main.cc

    r2030 r2101  
    4242#include "util/SignalHandler.h"
    4343#include "core/ConfigFileManager.h"
     44#include "core/CommandLine.h"
    4445
    4546#include "gamestates/GSRoot.h"
     
    5152#include "gamestates/GSGUI.h"
    5253#include "gamestates/GSIOConsole.h"
    53 
    54 using namespace orxonox;
    5554
    5655#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
     
    8685//#endif
    8786
     87SetCommandLineArgument(settingsFile, "orxonox.ini");
     88
    8889int main(int argc, char** argv)
    8990{
     91    using namespace orxonox;
     92
    9093    // create a signal handler (only works for linux)
    9194    SignalHandler::getInstance()->doCatch(argv[0], "orxonox.log");
    9295
    93     // Specifiy config file before creating the GameStates in order to have
     96    // Parse command line arguments
     97    try
     98    {
     99        CommandLine::parseAll(argc, argv);
     100    }
     101    catch (ArgumentException& ex)
     102    {
     103        COUT(1) << ex.what() << std::endl;
     104        COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl;
     105    }
     106
     107    // Create the ConfigFileManager before creating the GameStates in order to have
    94108    // setConfigValues() in the constructor (required).
    95     ConfigFileManager::getInstance().setFile(CFT_Settings, "orxonox.ini");
     109    ConfigFileManager* configFileManager = new ConfigFileManager();
     110    configFileManager->setFilename(ConfigFileType::Settings, CommandLine::getValue("settingsFile").getString());
    96111
    97112    // create the gamestates
     
    115130
    116131    // Here happens the game
    117     root.start(argc, argv);
     132    root.start();
     133
     134    // Destroy ConfigFileManager again.
     135    delete configFileManager;
    118136
    119137    return 0;
  • code/branches/objecthierarchy/src/orxonox/gamestates/GSGraphics.cc

    r2084 r2101  
    9393    void GSGraphics::setConfigValues()
    9494    {
    95         SetConfigValue(resourceFile_, "resources.cfg").description("Location of the resources file in the data path.");
    96         SetConfigValue(ogreConfigFile_,  "ogre.cfg").description("Location of the Ogre config file");
    97         SetConfigValue(ogrePluginsFile_, "plugins.cfg").description("Location of the Ogre plugins file");
    98         SetConfigValue(ogreLogFile_,     "ogre.log").description("Logfile for messages from Ogre. \
    99                                                                  Use \"\" to suppress log file creation.");
    100         SetConfigValue(ogreLogLevelTrivial_ , 5).description("Corresponding orxonox debug level for ogre Trivial");
    101         SetConfigValue(ogreLogLevelNormal_  , 4).description("Corresponding orxonox debug level for ogre Normal");
    102         SetConfigValue(ogreLogLevelCritical_, 2).description("Corresponding orxonox debug level for ogre Critical");
    103         SetConfigValue(statisticsRefreshCycle_, 200000).description("Sets the time in microseconds interval at \
    104                                                                     which average fps, etc. get updated.");
     95        SetConfigValue(resourceFile_,    "resources.cfg")
     96            .description("Location of the resources file in the data path.");
     97        SetConfigValue(ogreConfigFile_,  "ogre.cfg")
     98            .description("Location of the Ogre config file");
     99        SetConfigValue(ogrePluginsFile_, "plugins.cfg")
     100            .description("Location of the Ogre plugins file");
     101        SetConfigValue(ogreLogFile_,     "ogre.log")
     102            .description("Logfile for messages from Ogre. Use \"\" to suppress log file creation.");
     103        SetConfigValue(ogreLogLevelTrivial_ , 5)
     104            .description("Corresponding orxonox debug level for ogre Trivial");
     105        SetConfigValue(ogreLogLevelNormal_  , 4)
     106            .description("Corresponding orxonox debug level for ogre Normal");
     107        SetConfigValue(ogreLogLevelCritical_, 2)
     108            .description("Corresponding orxonox debug level for ogre Critical");
     109        SetConfigValue(statisticsRefreshCycle_, 200000)
     110            .description("Sets the time in microseconds interval at which average fps, etc. get updated.");
     111        SetConfigValue(defaultMasterKeybindings_, "def_masterKeybindings.ini")
     112            .description("Filename of default master keybindings.");
    105113    }
    106114
     
    136144        inputManager_->initialise(windowHnd, renderWindow_->getWidth(), renderWindow_->getHeight(), true);
    137145        // Configure master input state with a KeyBinder
    138         //masterKeyBinder_ = new KeyBinder();
    139         //masterKeyBinder_->loadBindings("master_keybindings.ini");
    140         //inputManager_->getMasterInputState()->addKeyHandler(masterKeyBinder_);
     146        masterKeyBinder_ = new KeyBinder();
     147        masterKeyBinder_->loadBindings("masterKeybindings.ini", defaultMasterKeybindings_);
     148        inputManager_->getMasterInputState()->addKeyHandler(masterKeyBinder_);
    141149
    142150        // Load the InGameConsole
     
    172180
    173181        //inputManager_->getMasterInputState()->removeKeyHandler(this->masterKeyBinder_);
    174         //delete this->masterKeyBinder_;
     182        delete this->masterKeyBinder_;
    175183        delete this->inputManager_;
    176184
  • code/branches/objecthierarchy/src/orxonox/gamestates/GSGraphics.h

    r2084 r2101  
    103103
    104104        // config values
    105         std::string           resourceFile_;          //!< resources file name
    106         std::string           ogreConfigFile_;        //!< ogre config file name
    107         std::string           ogrePluginsFile_;       //!< ogre plugins file name
    108         std::string           ogreLogFile_;           //!< log file name for Ogre log messages
    109         int                   ogreLogLevelTrivial_;   //!< Corresponding Orxonx debug level for LL_TRIVIAL
    110         int                   ogreLogLevelNormal_;    //!< Corresponding Orxonx debug level for LL_NORMAL
    111         int                   ogreLogLevelCritical_;  //!< Corresponding Orxonx debug level for LL_CRITICAL
    112         unsigned int          detailLevelParticle_;   //!< Detail level of particle effects (0: off, 1: low, 2: normal, 3: high)
     105        std::string           resourceFile_;             //!< resources file name
     106        std::string           ogreConfigFile_;           //!< ogre config file name
     107        std::string           ogrePluginsFile_;          //!< ogre plugins file name
     108        std::string           ogreLogFile_;              //!< log file name for Ogre log messages
     109        int                   ogreLogLevelTrivial_;      //!< Corresponding Orxonx debug level for LL_TRIVIAL
     110        int                   ogreLogLevelNormal_;       //!< Corresponding Orxonx debug level for LL_NORMAL
     111        int                   ogreLogLevelCritical_;     //!< Corresponding Orxonx debug level for LL_CRITICAL
     112        unsigned int          detailLevelParticle_;      //!< Detail level of particle effects (0: off, 1: low, 2: normal, 3: high)
     113        std::string           defaultMasterKeybindings_; //!< Filename of default master keybindings.
    113114    };
    114115}
  • code/branches/objecthierarchy/src/orxonox/gamestates/GSLevel.cc

    r2084 r2101  
    7171    {
    7272        SetConfigValue(keyDetectorCallbackCode_, "KeybindBindingStringKeyName=");
     73        SetConfigValue(defaultKeybindings_, "def_keybindings.ini")
     74            .description("Filename of default keybindings.");
    7375    }
    7476
     
    7981            inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game", 20);
    8082            keyBinder_ = new KeyBinder();
    81             keyBinder_->loadBindings("keybindings.ini");
     83            keyBinder_->loadBindings("keybindings.ini", defaultKeybindings_);
    8284            inputState_->setHandler(keyBinder_);
    8385
  • code/branches/objecthierarchy/src/orxonox/gamestates/GSLevel.h

    r2073 r2101  
    7171        LevelManager*         levelManager_;
    7272
    73         // config values
     73        //##### ConfigValues #####
    7474        std::string           keyDetectorCallbackCode_;
     75        //! Filename of default keybindings.
     76        std::string           defaultKeybindings_;
    7577
    7678    private:
  • code/branches/objecthierarchy/src/util/Exception.cc

    r1810 r2101  
    3838{
    3939    Exception::Exception(const std::string& description, int lineNumber,
    40                          const char* fileName, const char* functionName)
     40                         const char* filename, const char* functionName)
    4141        : description_(description)
    4242        , lineNumber_(lineNumber)
    4343        , functionName_(functionName)
    44         , fileName_(fileName)
     44        , filename_(filename)
    4545    { }
    4646
     
    4949        , lineNumber_(0)
    5050        , functionName_("")
    51         , fileName_("")
     51        , filename_("")
    5252    { }
    5353
     
    6060            fullDesc << this->getTypeName() << "_EXCEPTION";
    6161
    62             if (this->fileName_ != "")
     62            if (this->filename_ != "")
    6363            {
    64                 fullDesc << " in " << this->fileName_;
     64                fullDesc << " in " << this->filename_;
    6565                if (this->lineNumber_)
    6666                    fullDesc << "(" << this->lineNumber_ << ")";
  • code/branches/objecthierarchy/src/util/Exception.h

    r1810 r2101  
    6767
    6868        Exception(const std::string& description, int lineNumber,
    69                   const char* fileName, const char* functionName);
     69                  const char* filename, const char* functionName);
    7070        Exception(const std::string& description);
    7171
     
    8787        int lineNumber_;
    8888        std::string functionName_;
    89         std::string fileName_;
     89        std::string filename_;
    9090        // mutable because "what()" is a const method
    9191        mutable std::string fullDescription_;
     
    9898    public:
    9999        SpecificException(const std::string& description, int lineNumber,
    100                   const char* fileName, const char* functionName)
    101                   : Exception(description, lineNumber, fileName, functionName)
     100                  const char* filename, const char* functionName)
     101                  : Exception(description, lineNumber, filename, functionName)
    102102        {
    103103            // let the catcher decide whether to display the message below level 4
  • code/branches/objecthierarchy/src/util/SignalHandler.cc

    r2030 r2101  
    5858 * register signal handlers for SIGSEGV and SIGABRT
    5959 * @param appName path to executable eg argv[0]
    60  * @param fileName filename to append backtrace to
    61  */
    62 void SignalHandler::doCatch( const std::string & appName, const std::string & fileName )
     60 * @param filename filename to append backtrace to
     61 */
     62void SignalHandler::doCatch( const std::string & appName, const std::string & filename )
    6363{
    6464  this->appName = appName;
    65   this->fileName = fileName;
     65  this->filename = filename;
    6666
    6767  // prepare for restoring XAutoKeyRepeat
     
    326326  bt.insert(0, timeString);
    327327
    328   FILE * f = fopen( getInstance()->fileName.c_str(), "a" );
     328  FILE * f = fopen( getInstance()->filename.c_str(), "a" );
    329329
    330330  if ( !f )
    331331  {
    332     perror( ( std::string( "could not append to " ) + getInstance()->fileName ).c_str() );
     332    perror( ( std::string( "could not append to " ) + getInstance()->filename ).c_str() );
    333333    exit(EXIT_FAILURE);
    334334  }
     
    336336  if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() )
    337337  {
    338     COUT(0) << "could not write " << bt.length() << " byte to " << getInstance()->fileName << std::endl;
     338    COUT(0) << "could not write " << bt.length() << " byte to " << getInstance()->filename << std::endl;
    339339    exit(EXIT_FAILURE);
    340340  }
  • code/branches/objecthierarchy/src/util/SignalHandler.h

    r2030 r2101  
    7171    void registerCallback( SignalCallback cb, void * someData );
    7272
    73     void doCatch( const std::string & appName, const std::string & fileName );
     73    void doCatch( const std::string & appName, const std::string & filename );
    7474    void dontCatch();
    7575
     
    8585
    8686    std::string appName;
    87     std::string fileName;
     87    std::string filename;
    8888
    8989    // used to turn on KeyAutoRepeat if OIS crashes
     
    9797  public:
    9898    inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; };
    99     void doCatch( const std::string & appName, const std::string & fileName ) {};
     99    void doCatch( const std::string & appName, const std::string & filename ) {};
    100100    void dontCatch() {};
    101101    void registerCallback( SignalCallback cb, void * someData ) {};
Note: See TracChangeset for help on using the changeset viewer.