Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 704


Ignore:
Timestamp:
Dec 28, 2007, 12:56:17 AM (16 years ago)
Author:
landauf
Message:

added a new class: Language
it's a manager for different language files to store translations of ingame text (it uses the default text, defined in the code, if no translation in the configured language is available)

Location:
code/branches/FICN/src/orxonox/core
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/core/CMakeLists.txt

    r684 r704  
    1313  DebugLevel.cc
    1414  OutputHandler.cc
     15  Language.cc
    1516)
    1617
  • code/branches/FICN/src/orxonox/core/ClassFactory.h

    r694 r704  
    6060            ClassFactory() {}                               // Don't create
    6161            ClassFactory(const ClassFactory& factory) {}    // Don't copy
    62             ~ClassFactory() {}                              // Don't delete
     62            virtual ~ClassFactory() {}                      // Don't delete
    6363
    6464            static T* createNewObject();
  • code/branches/FICN/src/orxonox/core/ConfigValueContainer.cc

    r703 r704  
    647647
    648648    /**
    649         @brief Sets the value of the variable back to the default value.
     649        @brief Sets the value of the variable back to the default value and resets the config-file entry.
    650650    */
    651651    void ConfigValueContainer::resetConfigValue()
    652652    {
    653         parseSting(this->defvalueString_);
     653        this->parseSting(this->defvalueString_);
     654        this->resetConfigFileEntry();
    654655    }
    655656
     
    854855    void ConfigValueContainer::readConfigFile(const std::string& filename)
    855856    {
    856         ConfigValueContainer::finishedReadingConfigFile(true);
    857 
    858857        // This creates the file if it's not existing
    859858        std::ofstream createFile;
     
    865864        file.open(filename.c_str(), std::fstream::in);
    866865
     866        if (!file.is_open())
     867        {
     868            COUT(1) << "Error: Couldn't open config-file " << filename << " to read the config values!" << std::endl;
     869            return;
     870        }
     871
    867872        char line[1024];
    868873
     
    887892
    888893        file.close();
     894
     895        ConfigValueContainer::finishedReadingConfigFile(true);
    889896    }
    890897
     
    903910        file.open(filename.c_str(), std::fstream::out);
    904911
     912        if (!file.is_open())
     913        {
     914            COUT(1) << "Error: Couldn't open config-file " << filename << " to write the config values!" << std::endl;
     915            return;
     916        }
     917
    905918        // Iterate through the list an write the lines into the file
    906919        std::list<std::string>::iterator it;
    907         for(it = ConfigValueContainer::getConfigFileLines().begin(); it != ConfigValueContainer::getConfigFileLines().end(); ++it)
     920        for (it = ConfigValueContainer::getConfigFileLines().begin(); it != ConfigValueContainer::getConfigFileLines().end(); ++it)
    908921        {
    909922            file << (*it) << std::endl;
  • code/branches/FICN/src/orxonox/core/ConfigValueContainer.h

    r703 r704  
    135135            void resetConfigValue();
    136136
     137            static std::string getStrippedLine(const std::string& line);
     138            static bool isEmpty(const std::string& line);
     139            static bool isComment(const std::string& line);
     140
    137141        private:
    138142            bool parseSting(const std::string& input, int defvalue);
     
    155159            std::string parseValueString(bool bStripped = true);
    156160
    157             static std::string getStrippedLine(const std::string& line);
    158             static bool isEmpty(const std::string& line);
    159             static bool isComment(const std::string& line);
    160161            static void readConfigFile(const std::string& filename);
    161162            static void writeConfigFile(const std::string& filename);
  • code/branches/FICN/src/orxonox/core/CoreIncludes.h

    r703 r704  
    144144
    145145/**
    146     @brief Sets the variable back to the previously defined default-value.
     146    @brief Sets the variable and the config-file entry back to the previously defined default-value.
    147147    @param varname The name of the variable
    148148*/
     
    152152    { \
    153153        container##varname##reset->resetConfigValue(); \
    154         varname = container##varname->getValue(varname); \
     154        varname = container##varname##reset->getValue(varname); \
    155155    } \
    156156    else \
  • code/branches/FICN/src/orxonox/core/DebugLevel.h

    r699 r704  
    5353            explicit DebugLevel(bool& bReturnSoftDebugLevel);
    5454            DebugLevel(const DebugLevel& dl) {} // don't copy
    55             ~DebugLevel() {}                    // don't delete
     55            virtual ~DebugLevel() {}            // don't delete
    5656
    5757            int softDebugLevel_;                            //!< The debug level
  • code/branches/FICN/src/orxonox/core/MetaObjectList.h

    r682 r704  
    6565        public:
    6666            MetaObjectListElement(ObjectList<T>* list, ObjectListElement<T>* element);
    67             ~MetaObjectListElement();
     67            virtual ~MetaObjectListElement();
    6868
    6969            ObjectListElement<T>* element_;         //!< The list element, containing the object
  • code/branches/FICN/src/orxonox/core/OutputHandler.h

    r699 r704  
    110110            explicit OutputHandler(const std::string& logfilename);
    111111            OutputHandler(const OutputHandler& oh) {}; // don't copy
    112             ~OutputHandler();
     112            virtual ~OutputHandler();
    113113            std::ofstream logfile_;     //!< The logfile where the output is logged
    114114            std::string logfilename_;   //!< The name of the logfile
Note: See TracChangeset for help on using the changeset viewer.