Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 28, 2007, 10:30:29 PM (17 years ago)
Author:
rgrieder
Message:
  • added Vector2, Vector3, Matrix3, ColourValue, Quaternion and String to the misc folder as header files (each of them contains #include <string> … typedef std::string String , etc.)
  • please use String from now on by including <misc/String.h"
  • removed #include <OgreVector3.h", etc. from "CoreIncludes.h" (adjusted all source files)
  • adjusted all the source files (except network, that keeps <string> for the moment) (what a mess..)
  • moved usleep hack to misc/Sleep.h
  • relative include paths for files from other root directories (like misc, network, etc.) (but it stills writes "../Orxonox.h" when in folder orxonox/objects)
  • "OgreSceneManager.h" —> <OgreSceneManager.h>
  • included OrxonoxPrereqs in every file in folder orxonox
  • moved HUD and ParticleInterface to namespace orxonox
  • removed some using namespace Ogre/std when appropriate
  • I hope I haven't forgotten important points..
Location:
code/branches/FICN/src/orxonox/core
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/core/ArgReader.cc

    r668 r708  
    4545  }
    4646
    47   void ArgReader::checkArgument(std::string option, std::string &string, bool must)
     47  void ArgReader::checkArgument(String option, String &string, bool must)
    4848  {
    4949    int argpos = checkOption(option) + 1;
     
    6262  }
    6363
    64   void ArgReader::checkArgument(std::string option, int &integer, bool must)
     64  void ArgReader::checkArgument(String option, int &integer, bool must)
    6565  {
    6666    int argpos = checkOption(option) + 1;
     
    7878  }
    7979
    80   void ArgReader::checkArgument(std::string option, float &floating, bool must)
     80  void ArgReader::checkArgument(String option, float &floating, bool must)
    8181  {
    8282    int argpos = checkOption(option) + 1;
     
    9494  }
    9595
    96   int ArgReader::checkOption(std::string option)
     96  int ArgReader::checkOption(String option)
    9797  {
    9898    for(int i = 1; i < counter_; i++)
  • code/branches/FICN/src/orxonox/core/ArgReader.h

    r682 r708  
    3535#define _ArgReader_H__
    3636
    37 #include <string>
     37#include "CorePrereqs.h"
    3838
    39 #include "CorePrereqs.h"
     39#include "misc/String.h"
    4040
    4141namespace orxonox {
     
    4545    public:
    4646      ArgReader(int argc, char **argv);
    47       void checkArgument(std::string option, std::string& string, bool must=false);
    48       void checkArgument(std::string option, int& integer, bool must=false);
    49       void checkArgument(std::string option, float& floating, bool must=false);
     47      void checkArgument(String option, String& string, bool must=false);
     48      void checkArgument(String option, int& integer, bool must=false);
     49      void checkArgument(String option, float& floating, bool must=false);
    5050      bool errorHandling();
    5151    private:
    52       int checkOption(std::string option);
     52      int checkOption(String option);
    5353
    5454    private:
     
    5656      char **arguments_;
    5757      bool fail_;
    58       std::string errorStr_;
     58      String errorStr_;
    5959  };
    6060
  • code/branches/FICN/src/orxonox/core/ClassFactory.h

    r704 r708  
    3636#define _ClassFactory_H__
    3737
    38 #include <string>
    39 
    4038#include "CorePrereqs.h"
    4139
     40#include "misc/String.h"
    4241#include "Factory.h"
    4342#include "Identifier.h"
     
    5453    {
    5554        public:
    56             static bool create(const std::string& name);
     55            static bool create(const String& name);
    5756            BaseObject* fabricate();
    5857
     
    7069    */
    7170    template <class T>
    72     bool ClassFactory<T>::create(const std::string& name)
     71    bool ClassFactory<T>::create(const String& name)
    7372    {
    7473        COUT(4) << "*** Create entry for " << name << " in Factory." << std::endl;
  • code/branches/FICN/src/orxonox/core/ConfigValueContainer.cc

    r705 r708  
    2828#include <fstream>
    2929
    30 #include "../../misc/Tokenizer.h"
    31 #include "../../misc/String2Number.h"
     30#include "misc/Tokenizer.h"
     31#include "misc/String2Number.h"
    3232#include "ConfigValueContainer.h"
    3333
     
    4343        @param defvalue The default-value
    4444    */
    45     ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, int defvalue)
     45    ConfigValueContainer::ConfigValueContainer(const String& classname, const String& varname, int defvalue)
    4646    {
    4747        this->bAddedDescription_ = false;
     
    5353        this->searchConfigFileLine();                                               // Search the entry in the config-file
    5454
    55         std::string valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
    56         if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
    57             this->resetConfigFileEntry();                                           // The conversion failed
    58     }
    59 
    60     /**
    61         @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
    62         @param value This is only needed to determine the right type.
    63         @param classname The name of the class the variable belongs to
    64         @param varname The name of the variable
    65         @param defvalue The default-value
    66     */
    67     ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, unsigned int defvalue)
     55        String valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
     56        if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
     57            this->resetConfigFileEntry();                                           // The conversion failed
     58    }
     59
     60    /**
     61        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
     62        @param value This is only needed to determine the right type.
     63        @param classname The name of the class the variable belongs to
     64        @param varname The name of the variable
     65        @param defvalue The default-value
     66    */
     67    ConfigValueContainer::ConfigValueContainer(const String& classname, const String& varname, unsigned int defvalue)
    6868    {
    6969        this->bAddedDescription_ = false;
     
    7575        this->searchConfigFileLine();                                               // Search the entry in the config-file
    7676
    77         std::string valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
    78         if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
    79             this->resetConfigFileEntry();                                           // The conversion failed
    80     }
    81 
    82     /**
    83         @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
    84         @param value This is only needed to determine the right type.
    85         @param classname The name of the class the variable belongs to
    86         @param varname The name of the variable
    87         @param defvalue The default-value
    88     */
    89     ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, char defvalue)
     77        String valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
     78        if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
     79            this->resetConfigFileEntry();                                           // The conversion failed
     80    }
     81
     82    /**
     83        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
     84        @param value This is only needed to determine the right type.
     85        @param classname The name of the class the variable belongs to
     86        @param varname The name of the variable
     87        @param defvalue The default-value
     88    */
     89    ConfigValueContainer::ConfigValueContainer(const String& classname, const String& varname, char defvalue)
    9090    {
    9191        this->bAddedDescription_ = false;
     
    9797        this->searchConfigFileLine();                                               // Search the entry in the config-file
    9898
    99         std::string valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
    100         if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
    101             this->resetConfigFileEntry();                                           // The conversion failed
    102     }
    103 
    104     /**
    105         @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
    106         @param value This is only needed to determine the right type.
    107         @param classname The name of the class the variable belongs to
    108         @param varname The name of the variable
    109         @param defvalue The default-value
    110     */
    111     ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, unsigned char defvalue)
     99        String valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
     100        if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
     101            this->resetConfigFileEntry();                                           // The conversion failed
     102    }
     103
     104    /**
     105        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
     106        @param value This is only needed to determine the right type.
     107        @param classname The name of the class the variable belongs to
     108        @param varname The name of the variable
     109        @param defvalue The default-value
     110    */
     111    ConfigValueContainer::ConfigValueContainer(const String& classname, const String& varname, unsigned char defvalue)
    112112    {
    113113        this->bAddedDescription_ = false;
     
    119119        this->searchConfigFileLine();                                               // Search the entry in the config-file
    120120
    121         std::string valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
    122         if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
    123             this->resetConfigFileEntry();                                           // The conversion failed
    124     }
    125 
    126     /**
    127         @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
    128         @param value This is only needed to determine the right type.
    129         @param classname The name of the class the variable belongs to
    130         @param varname The name of the variable
    131         @param defvalue The default-value
    132     */
    133     ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, float defvalue)
     121        String valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
     122        if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
     123            this->resetConfigFileEntry();                                           // The conversion failed
     124    }
     125
     126    /**
     127        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
     128        @param value This is only needed to determine the right type.
     129        @param classname The name of the class the variable belongs to
     130        @param varname The name of the variable
     131        @param defvalue The default-value
     132    */
     133    ConfigValueContainer::ConfigValueContainer(const String& classname, const String& varname, float defvalue)
    134134    {
    135135        this->bAddedDescription_ = false;
     
    141141        this->searchConfigFileLine();                                               // Search the entry in the config-file
    142142
    143         std::string valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
    144         if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
    145             this->resetConfigFileEntry();                                           // The conversion failed
    146     }
    147 
    148     /**
    149         @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
    150         @param value This is only needed to determine the right type.
    151         @param classname The name of the class the variable belongs to
    152         @param varname The name of the variable
    153         @param defvalue The default-value
    154     */
    155     ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, double defvalue)
     143        String valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
     144        if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
     145            this->resetConfigFileEntry();                                           // The conversion failed
     146    }
     147
     148    /**
     149        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
     150        @param value This is only needed to determine the right type.
     151        @param classname The name of the class the variable belongs to
     152        @param varname The name of the variable
     153        @param defvalue The default-value
     154    */
     155    ConfigValueContainer::ConfigValueContainer(const String& classname, const String& varname, double defvalue)
    156156    {
    157157        this->bAddedDescription_ = false;
     
    163163        this->searchConfigFileLine();                                               // Search the entry in the config-file
    164164
    165         std::string valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
    166         if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
    167             this->resetConfigFileEntry();                                           // The conversion failed
    168     }
    169 
    170     /**
    171         @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
    172         @param value This is only needed to determine the right type.
    173         @param classname The name of the class the variable belongs to
    174         @param varname The name of the variable
    175         @param defvalue The default-value
    176     */
    177     ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, long double defvalue)
     165        String valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
     166        if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
     167            this->resetConfigFileEntry();                                           // The conversion failed
     168    }
     169
     170    /**
     171        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
     172        @param value This is only needed to determine the right type.
     173        @param classname The name of the class the variable belongs to
     174        @param varname The name of the variable
     175        @param defvalue The default-value
     176    */
     177    ConfigValueContainer::ConfigValueContainer(const String& classname, const String& varname, long double defvalue)
    178178    {
    179179        this->bAddedDescription_ = false;
     
    185185        this->searchConfigFileLine();                                               // Search the entry in the config-file
    186186
    187         std::string valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
    188         if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
    189             this->resetConfigFileEntry();                                           // The conversion failed
    190     }
    191 
    192     /**
    193         @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
    194         @param value This is only needed to determine the right type.
    195         @param classname The name of the class the variable belongs to
    196         @param varname The name of the variable
    197         @param defvalue The default-value
    198     */
    199     ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, bool defvalue)
     187        String valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
     188        if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
     189            this->resetConfigFileEntry();                                           // The conversion failed
     190    }
     191
     192    /**
     193        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
     194        @param value This is only needed to determine the right type.
     195        @param classname The name of the class the variable belongs to
     196        @param varname The name of the variable
     197        @param defvalue The default-value
     198    */
     199    ConfigValueContainer::ConfigValueContainer(const String& classname, const String& varname, bool defvalue)
    200200    {
    201201        this->bAddedDescription_ = false;
     
    211211
    212212        this->searchConfigFileLine();                                               // Search the entry in the config-file
    213         std::string valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
    214         if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
    215             this->resetConfigFileEntry();                                           // The conversion failed
    216     }
    217 
    218     /**
    219         @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
    220         @param value This is only needed to determine the right type.
    221         @param classname The name of the class the variable belongs to
    222         @param varname The name of the variable
    223         @param defvalue The default-value
    224     */
    225     ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, const std::string& defvalue)
    226     {
    227         this->bAddedDescription_ = false;
    228         this->classname_ = classname;
    229         this->varname_ = varname;
    230         this->type_ = String;
     213        String valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
     214        if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
     215            this->resetConfigFileEntry();                                           // The conversion failed
     216    }
     217
     218    /**
     219        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
     220        @param value This is only needed to determine the right type.
     221        @param classname The name of the class the variable belongs to
     222        @param varname The name of the variable
     223        @param defvalue The default-value
     224    */
     225    ConfigValueContainer::ConfigValueContainer(const String& classname, const String& varname, const String& defvalue)
     226    {
     227        this->bAddedDescription_ = false;
     228        this->classname_ = classname;
     229        this->varname_ = varname;
     230        this->type_ = _String;
    231231
    232232        this->defvalueString_ = "\"" + defvalue + "\"";                             // Convert the string to a "config-file-string" with quotes
    233233        this->searchConfigFileLine();                                               // Search the entry in the config-file
    234         std::string valueString = this->parseValueString(false);                    // Parses the value string from the config-file-entry
    235         if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
    236             this->resetConfigFileEntry();                                           // The conversion failed
    237     }
    238 
    239     /**
    240         @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
    241         @param value This is only needed to determine the right type.
    242         @param classname The name of the class the variable belongs to
    243         @param varname The name of the variable
    244         @param defvalue The default-value
    245     */
    246     ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, const char* defvalue)
     234        String valueString = this->parseValueString(false);                    // Parses the value string from the config-file-entry
     235        if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
     236            this->resetConfigFileEntry();                                           // The conversion failed
     237    }
     238
     239    /**
     240        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
     241        @param value This is only needed to determine the right type.
     242        @param classname The name of the class the variable belongs to
     243        @param varname The name of the variable
     244        @param defvalue The default-value
     245    */
     246    ConfigValueContainer::ConfigValueContainer(const String& classname, const String& varname, const char* defvalue)
    247247    {
    248248        this->bAddedDescription_ = false;
     
    251251        this->type_ = ConstChar;
    252252
    253         this->defvalueString_ = "\"" + std::string(defvalue) + "\"";                // Convert the string to a "config-file-string" with quotes
    254         this->searchConfigFileLine();                                               // Search the entry in the config-file
    255         std::string valueString = this->parseValueString(false);                    // Parses the value string from the config-file-entry
    256         if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
    257             this->resetConfigFileEntry();                                           // The conversion failed
    258     }
    259 
    260     /**
    261         @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
    262         @param value This is only needed to determine the right type.
    263         @param classname The name of the class the variable belongs to
    264         @param varname The name of the variable
    265         @param defvalue The default-value
    266     */
    267     ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::Vector2 defvalue)
    268     {
    269         this->bAddedDescription_ = false;
    270         this->classname_ = classname;
    271         this->varname_ = varname;
    272         this->type_ = Vector2;
     253        this->defvalueString_ = "\"" + String(defvalue) + "\"";                // Convert the string to a "config-file-string" with quotes
     254        this->searchConfigFileLine();                                               // Search the entry in the config-file
     255        String valueString = this->parseValueString(false);                    // Parses the value string from the config-file-entry
     256        if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
     257            this->resetConfigFileEntry();                                           // The conversion failed
     258    }
     259
     260    /**
     261        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
     262        @param value This is only needed to determine the right type.
     263        @param classname The name of the class the variable belongs to
     264        @param varname The name of the variable
     265        @param defvalue The default-value
     266    */
     267    ConfigValueContainer::ConfigValueContainer(const String& classname, const String& varname, Vector2 defvalue)
     268    {
     269        this->bAddedDescription_ = false;
     270        this->classname_ = classname;
     271        this->varname_ = varname;
     272        this->type_ = _Vector2;
    273273
    274274        // Try to convert the default-value from Vector2 to string
     
    280280
    281281        this->searchConfigFileLine();                                               // Search the entry in the config-file
    282         std::string valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
    283         if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
    284             this->resetConfigFileEntry();                                           // The conversion failed
    285     }
    286 
    287     /**
    288         @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
    289         @param value This is only needed to determine the right type.
    290         @param classname The name of the class the variable belongs to
    291         @param varname The name of the variable
    292         @param defvalue The default-value
    293     */
    294     ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::Vector3 defvalue)
    295     {
    296         this->bAddedDescription_ = false;
    297         this->classname_ = classname;
    298         this->varname_ = varname;
    299         this->type_ = Vector3;
     282        String valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
     283        if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
     284            this->resetConfigFileEntry();                                           // The conversion failed
     285    }
     286
     287    /**
     288        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
     289        @param value This is only needed to determine the right type.
     290        @param classname The name of the class the variable belongs to
     291        @param varname The name of the variable
     292        @param defvalue The default-value
     293    */
     294    ConfigValueContainer::ConfigValueContainer(const String& classname, const String& varname, Vector3 defvalue)
     295    {
     296        this->bAddedDescription_ = false;
     297        this->classname_ = classname;
     298        this->varname_ = varname;
     299        this->type_ = _Vector3;
    300300
    301301        // Try to convert the default-value from Vector3 to string
     
    307307
    308308        this->searchConfigFileLine();                                               // Search the entry in the config-file
    309         std::string valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
    310         if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
    311             this->resetConfigFileEntry();                                           // The conversion failed
    312     }
    313 
    314     /**
    315         @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
    316         @param value This is only needed to determine the right type.
    317         @param classname The name of the class the variable belongs to
    318         @param varname The name of the variable
    319         @param defvalue The default-value
    320     */
    321     ConfigValueContainer::ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::ColourValue defvalue)
    322     {
    323         this->bAddedDescription_ = false;
    324         this->classname_ = classname;
    325         this->varname_ = varname;
    326         this->type_ = ColourValue;
     309        String valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
     310        if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
     311            this->resetConfigFileEntry();                                           // The conversion failed
     312    }
     313
     314    /**
     315        @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
     316        @param value This is only needed to determine the right type.
     317        @param classname The name of the class the variable belongs to
     318        @param varname The name of the variable
     319        @param defvalue The default-value
     320    */
     321    ConfigValueContainer::ConfigValueContainer(const String& classname, const String& varname, ColourValue defvalue)
     322    {
     323        this->bAddedDescription_ = false;
     324        this->classname_ = classname;
     325        this->varname_ = varname;
     326        this->type_ = _ColourValue;
    327327
    328328        // Try to convert the default-value from ColourValue to string
     
    334334
    335335        this->searchConfigFileLine();                                               // Search the entry in the config-file
    336         std::string valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
    337         if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
    338             this->resetConfigFileEntry();                                           // The conversion failed
    339     }
    340 
    341     /**
    342         @brief Parses a given std::string into a value of the type of the associated variable and assigns it.
    343         @param input The string to convert
    344         @return True if the string was successfully parsed
    345     */
    346     bool ConfigValueContainer::parseSting(const std::string& input)
     336        String valueString = this->parseValueString();                         // Parses the value string from the config-file-entry
     337        if (!this->parseSting(valueString, defvalue))                               // Try to convert the string to a value
     338            this->resetConfigFileEntry();                                           // The conversion failed
     339    }
     340
     341    /**
     342        @brief Parses a given String into a value of the type of the associated variable and assigns it.
     343        @param input The string to convert
     344        @return True if the string was successfully parsed
     345    */
     346    bool ConfigValueContainer::parseSting(const String& input)
    347347    {
    348348        if (this->type_ == ConfigValueContainer::Int)
     
    362362        else if (this->type_ == ConfigValueContainer::Bool)
    363363            return this->parseSting(input, this->value_.value_bool_);
    364         else if (this->type_ == ConfigValueContainer::String)
     364        else if (this->type_ == ConfigValueContainer::_String)
    365365            return this->parseSting(input, this->value_string_);
    366366        else if (this->type_ == ConfigValueContainer::ConstChar)
    367367            return this->parseSting(input, this->value_string_);
    368         else if (this->type_ == ConfigValueContainer::Vector2)
     368        else if (this->type_ == ConfigValueContainer::_Vector2)
    369369            return this->parseSting(input, this->value_vector2_);
    370         else if (this->type_ == ConfigValueContainer::Vector3)
     370        else if (this->type_ == ConfigValueContainer::_Vector3)
    371371            return this->parseSting(input, this->value_vector3_);
    372         else if (this->type_ == ConfigValueContainer::ColourValue)
     372        else if (this->type_ == ConfigValueContainer::_ColourValue)
    373373            return this->parseSting(input, this->value_colourvalue_);
    374374
     
    377377
    378378    /**
    379         @brief Parses a given std::string into a value of the type int and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
    380         @param input The string to convert
    381         @param defvalue The default-value
    382         @return True if the string was successfully parsed
    383     */
    384     bool ConfigValueContainer::parseSting(const std::string& input, int defvalue)
     379        @brief Parses a given String into a value of the type int and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
     380        @param input The string to convert
     381        @param defvalue The default-value
     382        @return True if the string was successfully parsed
     383    */
     384    bool ConfigValueContainer::parseSting(const String& input, int defvalue)
    385385    {
    386386        return string2Number(this->value_.value_int_, input, defvalue);
     
    388388
    389389    /**
    390         @brief Parses a given std::string into a value of the type unsigned int and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
    391         @param input The string to convert
    392         @param defvalue The default-value
    393         @return True if the string was successfully parsed
    394     */
    395     bool ConfigValueContainer::parseSting(const std::string& input, unsigned int defvalue)
     390        @brief Parses a given String into a value of the type unsigned int and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
     391        @param input The string to convert
     392        @param defvalue The default-value
     393        @return True if the string was successfully parsed
     394    */
     395    bool ConfigValueContainer::parseSting(const String& input, unsigned int defvalue)
    396396    {
    397397        return string2Number(this->value_.value_uint_, input, defvalue);
     
    399399
    400400    /**
    401         @brief Parses a given std::string into a value of the type char and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
    402         @param input The string to convert
    403         @param defvalue The default-value
    404         @return True if the string was successfully parsed
    405     */
    406     bool ConfigValueContainer::parseSting(const std::string& input, char defvalue)
     401        @brief Parses a given String into a value of the type char and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
     402        @param input The string to convert
     403        @param defvalue The default-value
     404        @return True if the string was successfully parsed
     405    */
     406    bool ConfigValueContainer::parseSting(const String& input, char defvalue)
    407407    {
    408408        // I used value_int_ instead of value_char_ to avoid number <-> char confusion in the config-file
     
    411411
    412412    /**
    413         @brief Parses a given std::string into a value of the type unsigned char and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
    414         @param input The string to convert
    415         @param defvalue The default-value
    416         @return True if the string was successfully parsed
    417     */
    418     bool ConfigValueContainer::parseSting(const std::string& input, unsigned char defvalue)
     413        @brief Parses a given String into a value of the type unsigned char and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
     414        @param input The string to convert
     415        @param defvalue The default-value
     416        @return True if the string was successfully parsed
     417    */
     418    bool ConfigValueContainer::parseSting(const String& input, unsigned char defvalue)
    419419    {
    420420        // I used value_uint_ instead of value_uchar_ to avoid number <-> char confusion in the config-file
     
    423423
    424424    /**
    425         @brief Parses a given std::string into a value of the type float and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
    426         @param input The string to convert
    427         @param defvalue The default-value
    428         @return True if the string was successfully parsed
    429     */
    430     bool ConfigValueContainer::parseSting(const std::string& input, float defvalue)
     425        @brief Parses a given String into a value of the type float and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
     426        @param input The string to convert
     427        @param defvalue The default-value
     428        @return True if the string was successfully parsed
     429    */
     430    bool ConfigValueContainer::parseSting(const String& input, float defvalue)
    431431    {
    432432        return string2Number(this->value_.value_float_, input, defvalue);
     
    434434
    435435    /**
    436         @brief Parses a given std::string into a value of the type double and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
    437         @param input The string to convert
    438         @param defvalue The default-value
    439         @return True if the string was successfully parsed
    440     */
    441     bool ConfigValueContainer::parseSting(const std::string& input, double defvalue)
     436        @brief Parses a given String into a value of the type double and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
     437        @param input The string to convert
     438        @param defvalue The default-value
     439        @return True if the string was successfully parsed
     440    */
     441    bool ConfigValueContainer::parseSting(const String& input, double defvalue)
    442442    {
    443443        return string2Number(this->value_.value_double_, input, defvalue);
     
    445445
    446446    /**
    447         @brief Parses a given std::string into a value of the type long double and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
    448         @param input The string to convert
    449         @param defvalue The default-value
    450         @return True if the string was successfully parsed
    451     */
    452     bool ConfigValueContainer::parseSting(const std::string& input, long double defvalue)
     447        @brief Parses a given String into a value of the type long double and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
     448        @param input The string to convert
     449        @param defvalue The default-value
     450        @return True if the string was successfully parsed
     451    */
     452    bool ConfigValueContainer::parseSting(const String& input, long double defvalue)
    453453    {
    454454        return string2Number(this->value_.value_long_double_, input, defvalue);
     
    456456
    457457    /**
    458         @brief Parses a given std::string into a value of the type bool and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
    459         @param input The string to convert
    460         @param defvalue The default-value
    461         @return True if the string was successfully parsed
    462     */
    463     bool ConfigValueContainer::parseSting(const std::string& input, bool defvalue)
     458        @brief Parses a given String into a value of the type bool and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
     459        @param input The string to convert
     460        @param defvalue The default-value
     461        @return True if the string was successfully parsed
     462    */
     463    bool ConfigValueContainer::parseSting(const String& input, bool defvalue)
    464464    {
    465465        // Try to parse the value-string - is it a word?
     
    484484
    485485    /**
    486         @brief Parses a given std::string into a value of the type std::string and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
    487         @param input The string to convert
    488         @param defvalue The default-value
    489         @return True if the string was successfully parsed
    490     */
    491     bool ConfigValueContainer::parseSting(const std::string& input, const std::string& defvalue)
     486        @brief Parses a given String into a value of the type String and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
     487        @param input The string to convert
     488        @param defvalue The default-value
     489        @return True if the string was successfully parsed
     490    */
     491    bool ConfigValueContainer::parseSting(const String& input, const String& defvalue)
    492492    {
    493493        // Strip the quotes
     
    509509
    510510    /**
    511         @brief Parses a given std::string into a value of the type const char* and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
    512         @param input The string to convert
    513         @param defvalue The default-value
    514         @return True if the string was successfully parsed
    515     */
    516     bool ConfigValueContainer::parseSting(const std::string& input, const char* defvalue)
     511        @brief Parses a given String into a value of the type const char* and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
     512        @param input The string to convert
     513        @param defvalue The default-value
     514        @return True if the string was successfully parsed
     515    */
     516    bool ConfigValueContainer::parseSting(const String& input, const char* defvalue)
    517517    {
    518518        // Strip the quotes
     
    534534
    535535    /**
    536         @brief Parses a given std::string into a value of the type Ogre::Vector2 and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
    537         @param input The string to convert
    538         @param defvalue The default-value
    539         @return True if the string was successfully parsed
    540     */
    541     bool ConfigValueContainer::parseSting(const std::string& input, const Ogre::Vector2& defvalue)
     536        @brief Parses a given String into a value of the type _Vector2 and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
     537        @param input The string to convert
     538        @param defvalue The default-value
     539        @return True if the string was successfully parsed
     540    */
     541    bool ConfigValueContainer::parseSting(const String& input, const Vector2& defvalue)
    542542    {
    543543        // Strip the value-string
     
    548548        if (pos1 < input.length() && pos2 < input.length() && pos1 < pos2)
    549549        {
    550             std::vector<std::string> tokens = tokenize(input.substr(pos1, pos2 - pos1), ",");
     550            std::vector<String> tokens = tokenize(input.substr(pos1, pos2 - pos1), ",");
    551551            if (!string2Number(this->value_vector2_.x, tokens[0], defvalue.x))
    552552            {
     
    568568
    569569    /**
    570         @brief Parses a given std::string into a value of the type Ogre::Vector3 and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
    571         @param input The string to convert
    572         @param defvalue The default-value
    573         @return True if the string was successfully parsed
    574     */
    575     bool ConfigValueContainer::parseSting(const std::string& input, const Ogre::Vector3& defvalue)
     570        @brief Parses a given String into a value of the type Vector3 and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
     571        @param input The string to convert
     572        @param defvalue The default-value
     573        @return True if the string was successfully parsed
     574    */
     575    bool ConfigValueContainer::parseSting(const String& input, const Vector3& defvalue)
    576576    {
    577577        // Strip the value-string
     
    582582        if (pos1 < input.length() && pos2 < input.length() && pos1 < pos2)
    583583        {
    584             std::vector<std::string> tokens = tokenize(input.substr(pos1, pos2 - pos1), ",");
     584            std::vector<String> tokens = tokenize(input.substr(pos1, pos2 - pos1), ",");
    585585            if (!string2Number(this->value_vector3_.x, tokens[0], defvalue.x))
    586586            {
     
    607607
    608608    /**
    609         @brief Parses a given std::string into a value of the type Ogre::ColourValue and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
    610         @param input The string to convert
    611         @param defvalue The default-value
    612         @return True if the string was successfully parsed
    613     */
    614     bool ConfigValueContainer::parseSting(const std::string& input, const Ogre::ColourValue& defvalue)
     609        @brief Parses a given String into a value of the type ColourValue and assigns it to the right variable. If the conversion failed, the default-value gets assigned.
     610        @param input The string to convert
     611        @param defvalue The default-value
     612        @return True if the string was successfully parsed
     613    */
     614    bool ConfigValueContainer::parseSting(const String& input, const ColourValue& defvalue)
    615615    {
    616616        // Strip the value-string
     
    621621        if (pos1 < input.length() && pos2 < input.length() && pos1 < pos2)
    622622        {
    623             std::vector<std::string> tokens = tokenize(input.substr(pos1, pos2 - pos1), ",");
     623            std::vector<String> tokens = tokenize(input.substr(pos1, pos2 - pos1), ",");
    624624            if (!string2Number(this->value_colourvalue_.r, tokens[0], defvalue.r))
    625625            {
     
    678678
    679679        // The string of the section we're searching
    680         std::string section = "";
     680        String section = "";
    681681        section.append("[");
    682682        section.append(this->classname_);
     
    685685        // Iterate through all config-file-lines
    686686        bool success = false;
    687         std::list<std::string>::iterator it1;
     687        std::list<String>::iterator it1;
    688688        for(it1 = ConfigValueContainer::getConfigFileLines().begin(); it1 != ConfigValueContainer::getConfigFileLines().end(); ++it1)
    689689        {
     
    696696                // We found the right section
    697697                bool bLineIsEmpty = false;
    698                 std::list<std::string>::iterator positionToPutNewLineAt;
     698                std::list<String>::iterator positionToPutNewLineAt;
    699699
    700700                // Iterate through all lines in the section
    701                 std::list<std::string>::iterator it2;
     701                std::list<String>::iterator it2;
    702702                for(it2 = ++it1; it2 != ConfigValueContainer::getConfigFileLines().end(); ++it2)
    703703                {
     
    777777        @return True = it's a comment
    778778    */
    779     bool ConfigValueContainer::isComment(const std::string& line)
     779    bool ConfigValueContainer::isComment(const String& line)
    780780    {
    781781        // Strip the line, whitespaces are disturbing
    782         std::string teststring = getStrippedLine(line);
     782        String teststring = getStrippedLine(line);
    783783
    784784        // There are four possible comment-symbols:
     
    798798        @return True = it's empty
    799799    */
    800     bool ConfigValueContainer::isEmpty(const std::string& line)
     800    bool ConfigValueContainer::isEmpty(const String& line)
    801801    {
    802802        return getStrippedLine(line) == "";
     
    808808        @return The stripped line
    809809    */
    810     std::string ConfigValueContainer::getStrippedLine(const std::string& line)
    811     {
    812         std::string output = line;
     810    String ConfigValueContainer::getStrippedLine(const String& line)
     811    {
     812        String output = line;
    813813        unsigned int pos;
    814814        while ((pos = output.find(" ")) < output.length())
     
    825825        @return The value-string
    826826    */
    827     std::string ConfigValueContainer::parseValueString(bool bStripped)
    828     {
    829         std::string output;
     827    String ConfigValueContainer::parseValueString(bool bStripped)
     828    {
     829        String output;
    830830        if (bStripped)
    831831            output = this->getStrippedLine(*this->configFileLine_);
     
    839839        @returns a list, containing all entrys in the config-file.
    840840    */
    841     std::list<std::string>& ConfigValueContainer::getConfigFileLines()
     841    std::list<String>& ConfigValueContainer::getConfigFileLines()
    842842    {
    843843        // This is done to avoid problems while executing this code before main()
    844         static std::list<std::string> configFileLinesStaticReference = std::list<std::string>();
     844        static std::list<String> configFileLinesStaticReference = std::list<String>();
    845845        return configFileLinesStaticReference;
    846846    }
     
    866866        @param filename The name of the config-file
    867867    */
    868     void ConfigValueContainer::readConfigFile(const std::string& filename)
     868    void ConfigValueContainer::readConfigFile(const String& filename)
    869869    {
    870870        // This creates the file if it's not existing
     
    913913        @param filename The name of the config-file
    914914    */
    915     void ConfigValueContainer::writeConfigFile(const std::string& filename)
     915    void ConfigValueContainer::writeConfigFile(const String& filename)
    916916    {
    917917        // Make sure we stored the config-file in the list
     
    930930
    931931        // Iterate through the list an write the lines into the file
    932         std::list<std::string>::iterator it;
     932        std::list<String>::iterator it;
    933933        for (it = ConfigValueContainer::getConfigFileLines().begin(); it != ConfigValueContainer::getConfigFileLines().end(); ++it)
    934934        {
     
    943943        @param description The description
    944944    */
    945     void ConfigValueContainer::description(const std::string& description)
     945    void ConfigValueContainer::description(const String& description)
    946946    {
    947947        if (!this->bAddedDescription_)
    948948        {
    949             this->description_ = std::string("ConfigValueDescription::" + this->classname_ + "::" + this->varname_);
     949            this->description_ = String("ConfigValueDescription::" + this->classname_ + "::" + this->varname_);
    950950            Language::getLanguage().addEntry(description_, description);
    951951            this->bAddedDescription_ = true;
  • code/branches/FICN/src/orxonox/core/ConfigValueContainer.h

    r705 r708  
    4343#define _ConfigValueContainer_H__
    4444
    45 #include <string>
    4645#include <list>
    4746
    4847#include "CorePrereqs.h"
    4948
    50 #include "OgreVector2.h"
    51 #include "OgreVector3.h"
    52 #include "OgreColourValue.h"
     49#include "misc/Vector2.h"
     50#include "misc/Vector3.h"
     51#include "misc/Matrix3.h"
     52#include "misc/Quaternion.h"
     53#include "misc/String.h"
     54#include "misc/ColourValue.h"
    5355#include "Language.h"
    5456
     
    8587                Bool,
    8688                ConstChar,
    87                 String,
    88                 Vector2,
    89                 Vector3,
    90                 ColourValue
     89                _String,
     90                _Vector2,
     91                _Vector3,
     92                _ColourValue
    9193            };
    9294
    93             ConfigValueContainer(const std::string& classname, const std::string& varname, int defvalue);
    94             ConfigValueContainer(const std::string& classname, const std::string& varname, unsigned int defvalue);
    95             ConfigValueContainer(const std::string& classname, const std::string& varname, char defvalue);
    96             ConfigValueContainer(const std::string& classname, const std::string& varname, unsigned char defvalue);
    97             ConfigValueContainer(const std::string& classname, const std::string& varname, float defvalue);
    98             ConfigValueContainer(const std::string& classname, const std::string& varname, double defvalue);
    99             ConfigValueContainer(const std::string& classname, const std::string& varname, long double defvalue);
    100             ConfigValueContainer(const std::string& classname, const std::string& varname, bool defvalue);
    101             ConfigValueContainer(const std::string& classname, const std::string& varname, const std::string& defvalue);
    102             ConfigValueContainer(const std::string& classname, const std::string& varname, const char* defvalue);
    103             ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::Vector2 defvalue);
    104             ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::Vector3 defvalue);
    105             ConfigValueContainer(const std::string& classname, const std::string& varname, Ogre::ColourValue defvalue);
     95            ConfigValueContainer(const String& classname, const String& varname, int defvalue);
     96            ConfigValueContainer(const String& classname, const String& varname, unsigned int defvalue);
     97            ConfigValueContainer(const String& classname, const String& varname, char defvalue);
     98            ConfigValueContainer(const String& classname, const String& varname, unsigned char defvalue);
     99            ConfigValueContainer(const String& classname, const String& varname, float defvalue);
     100            ConfigValueContainer(const String& classname, const String& varname, double defvalue);
     101            ConfigValueContainer(const String& classname, const String& varname, long double defvalue);
     102            ConfigValueContainer(const String& classname, const String& varname, bool defvalue);
     103            ConfigValueContainer(const String& classname, const String& varname, const String& defvalue);
     104            ConfigValueContainer(const String& classname, const String& varname, const char* defvalue);
     105            ConfigValueContainer(const String& classname, const String& varname, Vector2 defvalue);
     106            ConfigValueContainer(const String& classname, const String& varname, Vector3 defvalue);
     107            ConfigValueContainer(const String& classname, const String& varname, ColourValue defvalue);
    106108
    107109            /** @returns the value. @param value This is only needed to determine the right type. */
     
    122124            inline ConfigValueContainer& getValue(bool& value)                          { value = this->value_.value_bool_; return *this; }
    123125            /** @returns the value. @param value This is only needed to determine the right type. */
    124             inline ConfigValueContainer& getValue(std::string& value)                   { value = this->value_string_; return *this; }
     126            inline ConfigValueContainer& getValue(String& value)                   { value = this->value_string_; return *this; }
    125127            /** @returns the value. @param value This is only needed to determine the right type. */
    126128            inline ConfigValueContainer& getValue(const char* value)                    { value = this->value_string_.c_str(); return *this; }
    127129            /** @returns the value. @param value This is only needed to determine the right type. */
    128             inline ConfigValueContainer& getValue(Ogre::Vector2& value)                 { value = this->value_vector2_; return *this; }
     130            inline ConfigValueContainer& getValue(Vector2& value)                 { value = this->value_vector2_; return *this; }
    129131            /** @returns the value. @param value This is only needed to determine the right type. */
    130             inline ConfigValueContainer& getValue(Ogre::Vector3& value)                 { value = this->value_vector3_; return *this; }
     132            inline ConfigValueContainer& getValue(Vector3& value)                 { value = this->value_vector3_; return *this; }
    131133            /** @returns the value. @param value This is only needed to determine the right type. */
    132             inline ConfigValueContainer& getValue(Ogre::ColourValue& value)             { value = this->value_colourvalue_; return *this; }
     134            inline ConfigValueContainer& getValue(ColourValue& value)             { value = this->value_colourvalue_; return *this; }
    133135
    134             void description(const std::string& description);
     136            void description(const String& description);
    135137
    136             bool parseSting(const std::string& input);
     138            bool parseSting(const String& input);
    137139            void resetConfigFileEntry();
    138140            void resetConfigValue();
    139141
    140             static std::string getStrippedLine(const std::string& line);
    141             static bool isEmpty(const std::string& line);
    142             static bool isComment(const std::string& line);
     142            static String getStrippedLine(const String& line);
     143            static bool isEmpty(const String& line);
     144            static bool isComment(const String& line);
    143145
    144146        private:
    145             bool parseSting(const std::string& input, int defvalue);
    146             bool parseSting(const std::string& input, unsigned int defvalue);
    147             bool parseSting(const std::string& input, char defvalue);
    148             bool parseSting(const std::string& input, unsigned char defvalue);
    149             bool parseSting(const std::string& input, float defvalue);
    150             bool parseSting(const std::string& input, double defvalue);
    151             bool parseSting(const std::string& input, long double defvalue);
    152             bool parseSting(const std::string& input, bool defvalue);
    153             bool parseSting(const std::string& input, const std::string& defvalue);
    154             bool parseSting(const std::string& input, const char* defvalue);
    155             bool parseSting(const std::string& input, const Ogre::Vector2& defvalue);
    156             bool parseSting(const std::string& input, const Ogre::Vector3& defvalue);
    157             bool parseSting(const std::string& input, const Ogre::ColourValue& defvalue);
     147            bool parseSting(const String& input, int defvalue);
     148            bool parseSting(const String& input, unsigned int defvalue);
     149            bool parseSting(const String& input, char defvalue);
     150            bool parseSting(const String& input, unsigned char defvalue);
     151            bool parseSting(const String& input, float defvalue);
     152            bool parseSting(const String& input, double defvalue);
     153            bool parseSting(const String& input, long double defvalue);
     154            bool parseSting(const String& input, bool defvalue);
     155            bool parseSting(const String& input, const String& defvalue);
     156            bool parseSting(const String& input, const char* defvalue);
     157            bool parseSting(const String& input, const Vector2& defvalue);
     158            bool parseSting(const String& input, const Vector3& defvalue);
     159            bool parseSting(const String& input, const ColourValue& defvalue);
    158160
    159             static std::list<std::string>& getConfigFileLines();
     161            static std::list<String>& getConfigFileLines();
    160162            static bool finishedReadingConfigFile(bool finished = false);
    161163            void searchConfigFileLine();
    162             std::string parseValueString(bool bStripped = true);
     164            String parseValueString(bool bStripped = true);
    163165
    164             static void readConfigFile(const std::string& filename);
    165             static void writeConfigFile(const std::string& filename);
     166            static void readConfigFile(const String& filename);
     167            static void writeConfigFile(const String& filename);
    166168
    167             std::string         classname_;                     //!< The name of the class the variable belongs to
    168             std::string         varname_;                       //!< The name of the variable
    169             std::string         defvalueString_;                //!< The string of the default-variable
     169            String         classname_;                     //!< The name of the class the variable belongs to
     170            String         varname_;                       //!< The name of the variable
     171            String         defvalueString_;                //!< The string of the default-variable
    170172
    171173            union MultiType
     
    181183            } value_;                                           //!< The value of the variable
    182184
    183             std::string         value_string_;                  //!< The value, if the variable is of the type string
    184             Ogre::Vector2       value_vector2_;                 //!< The value, if the variable is of the type Vector2
    185             Ogre::Vector3       value_vector3_;                 //!< The value, if the variable is of the type Vector3
    186             Ogre::ColourValue   value_colourvalue_;             //!< The value, if the variable is of the type ColourValue
     185            String         value_string_;                  //!< The value, if the variable is of the type string
     186            Vector2       value_vector2_;                 //!< The value, if the variable is of the type Vector2
     187            Vector3       value_vector3_;                 //!< The value, if the variable is of the type Vector3
     188            ColourValue   value_colourvalue_;             //!< The value, if the variable is of the type ColourValue
    187189
    188             std::list<std::string>::iterator configFileLine_;   //!< An iterator, pointing to the entry of the variable in the config-file
     190            std::list<String>::iterator configFileLine_;   //!< An iterator, pointing to the entry of the variable in the config-file
    189191
    190192            VariableType type_;                                 //!< The type of the variable
  • code/branches/FICN/src/orxonox/core/CoreIncludes.h

    r705 r708  
    5050#include "ConfigValueContainer.h"
    5151#include "Debug.h"
    52 
    53 #include "OgreVector2.h"
    54 #include "OgreVector3.h"
    55 #include "OgreColourValue.h"
    56 #include "OgreQuaternion.h"
    57 #include "OgreMatrix3.h"
    58 
    59 
    60 // Some typedefs
    61 namespace orxonox
    62 {
    63     typedef Ogre::Vector2 Vector2;
    64     typedef Ogre::Vector3 Vector3;
    65     typedef Ogre::ColourValue ColourValue;
    66     typedef Ogre::Radian Radian;
    67     typedef Ogre::Degree Degree;
    68     typedef Ogre::Real Real;
    69     typedef Ogre::Quaternion Quaternion;
    70     typedef Ogre::Matrix3 Matrix3;
    71 }
    72 
    7352
    7453/**
  • code/branches/FICN/src/orxonox/core/CorePrereqs.h

    r705 r708  
    3434#define _CorePrereqs_H__
    3535
    36 #include "../OrxonoxPlatform.h"
     36#include "orxonox/OrxonoxPlatform.h"
    3737
    3838//-----------------------------------------------------------------------
  • code/branches/FICN/src/orxonox/core/Debug.h

    r699 r708  
    3737
    3838#include <stdio.h>
     39
     40#include "CorePrereqs.h"
     41
    3942#include "OutputHandler.h"
    40 
    41 #include "CorePrereqs.h"
    4243
    4344extern "C" _CoreExport int getSoftDebugLevel();
  • code/branches/FICN/src/orxonox/core/DebugLevel.h

    r704 r708  
    3838
    3939#include "CorePrereqs.h"
     40
    4041#include "OrxonoxClass.h"
    4142#include "OutputHandler.h"
  • code/branches/FICN/src/orxonox/core/Error.cc

    r670 r708  
    2626 */
    2727
     28#include "Debug.h"
    2829#include "Error.h"
    29 #include "Debug.h"
    3030
    3131namespace orxonox
     
    3636        }
    3737
    38         Error::Error(std::string errorMsg, int errorCode)
     38        Error::Error(String errorMsg, int errorCode)
    3939        {
    4040                Error(errorCode, errorMsg);
    4141        }
    4242
    43         Error::Error(int errorCode, std::string errorMsg)
     43        Error::Error(int errorCode, String errorMsg)
    4444        {
    4545                COUT(1) << "############################ "<< std::endl
  • code/branches/FICN/src/orxonox/core/Error.h

    r684 r708  
    2929#define _Error_H__
    3030
    31 #include <string>
     31#include "CorePrereqs.h"
    3232
    33 #include "CorePrereqs.h"
     33#include "misc/String.h"
    3434
    3535namespace orxonox
     
    3939        public:
    4040                Error();
    41                 Error(std::string errorMsg, int errorCode=0);
    42                 Error(int errorCode, std::string errorMsg="");
     41                Error(String errorMsg, int errorCode = 0);
     42                Error(int errorCode, String errorMsg = "");
    4343        private:
    4444
  • code/branches/FICN/src/orxonox/core/Factory.cc

    r698 r708  
    4242        @param name The name of the wanted Identifier
    4343    */
    44     Identifier* Factory::getIdentifier(const std::string& name)
     44    Identifier* Factory::getIdentifier(const String& name)
    4545    {
    4646        return getFactoryPointer()->identifierStringMap_[name];
     
    6161        @param identifier The identifier to add
    6262    */
    63     void Factory::add(const std::string& name, Identifier* identifier)
     63    void Factory::add(const String& name, Identifier* identifier)
    6464    {
    6565        getFactoryPointer()->identifierStringMap_[name] = identifier;
     
    8585    {
    8686        COUT(3) << "*** Factory -> Create class-hierarchy" << std::endl;
    87         std::map<std::string, Identifier*>::iterator it;
     87        std::map<String, Identifier*>::iterator it;
    8888        it = getFactoryPointer()->identifierStringMap_.begin();
    8989        (*getFactoryPointer()->identifierStringMap_.begin()).second->startCreatingHierarchy();
  • code/branches/FICN/src/orxonox/core/Factory.h

    r682 r708  
    4545
    4646#include <map>
    47 #include <string>
    4847
    4948#include "CorePrereqs.h"
     49
     50#include "misc/String.h"
    5051
    5152namespace orxonox
     
    6061    {
    6162        public:
    62             static Identifier* getIdentifier(const std::string& name);
     63            static Identifier* getIdentifier(const String& name);
    6364            static Identifier* getIdentifier(const unsigned int id);
    64             static void add(const std::string& name, Identifier* identifier);
     65            static void add(const String& name, Identifier* identifier);
    6566            static void changeNetworkID(Identifier* identifier, const unsigned int oldID, const unsigned int newID);
    6667            static void createClassHierarchy();
    6768
    68             static Factory* getFactoryPointer();// avoid overriding pointer_s in the static intialisation process
     69            static Factory* getFactoryPointer();    // avoid overriding order problem in the static intialisation process
    6970
    7071        private:
     
    7374            ~Factory() {}                           // don't delete
    7475
    75             std::map<std::string, Identifier*> identifierStringMap_;            //!< The map, mapping the name with the Identifier
     76            std::map<String, Identifier*> identifierStringMap_;            //!< The map, mapping the name with the Identifier
    7677            std::map<unsigned int, Identifier*> identifierNetworkIDMap_;        //!< The map, mapping the network ID with the Identifier
    7778    };
  • code/branches/FICN/src/orxonox/core/Identifier.cc

    r698 r708  
    118118        @returns a reference to the Identifier map, containing all Identifiers.
    119119    */
    120     std::map<std::string, Identifier*>& Identifier::getIdentifierMap()
     120    std::map<String, Identifier*>& Identifier::getIdentifierMap()
    121121    {
    122         static std::map<std::string, Identifier*> identifierMapStaticReference = std::map<std::string, Identifier*>();
     122        static std::map<String, Identifier*> identifierMapStaticReference = std::map<String, Identifier*>();
    123123        return identifierMapStaticReference;
    124124    }
  • code/branches/FICN/src/orxonox/core/Identifier.h

    r700 r708  
    5252#define _Identifier_H__
    5353
    54 #include <string>
    5554#include <map>
    5655
    5756#include "CorePrereqs.h"
    5857
     58#include "misc/String.h"
    5959#include "ObjectList.h"
    6060#include "IdentifierList.h"
     
    112112
    113113            /** @returns the name of the class the Identifier belongs to. */
    114             inline const std::string& getName() const { return this->name_; }
     114            inline const String& getName() const { return this->name_; }
    115115
    116116            /** @returns the parents of the class the Identifier belongs to. */
     
    130130
    131131            /** @returns the ConfigValueContainer of a variable, given by the string of its name. @param varname The name of the variable */
    132             inline ConfigValueContainer* getConfigValueContainer(const std::string& varname)
     132            inline ConfigValueContainer* getConfigValueContainer(const String& varname)
    133133                { return this->configValues_[varname]; }
    134134
    135135            /** @brief Sets the ConfigValueContainer of a variable, given by the string of its name. @param varname The name of the variablee @param container The container */
    136             inline void setConfigValueContainer(const std::string& varname, ConfigValueContainer* container)
     136            inline void setConfigValueContainer(const String& varname, ConfigValueContainer* container)
    137137                { this->configValues_[varname] = container; }
    138138
    139             static std::map<std::string, Identifier*>& getIdentifierMap();
     139            static std::map<String, Identifier*>& getIdentifierMap();
    140140
    141141        private:
     
    166166            IdentifierList* children_;                                  //!< The Children of the class the Identifier belongs to
    167167
    168             std::string name_;                                          //!< The name of the class the Identifier belongs to
     168            String name_;                                          //!< The name of the class the Identifier belongs to
    169169
    170170            BaseFactory* factory_;                                      //!< The Factory, able to create new objects of the given class (if available)
     
    172172            static int hierarchyCreatingCounter_s;                      //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading)
    173173            unsigned int classID_;                                      //!< The network ID to identify a class through the network
    174             std::map<std::string, ConfigValueContainer*> configValues_; //!< A map to link the string of configurable variables with their ConfigValueContainer
     174            std::map<String, ConfigValueContainer*> configValues_; //!< A map to link the string of configurable variables with their ConfigValueContainer
    175175    };
    176176
     
    189189    {
    190190        public:
    191             static ClassIdentifier<T>* registerClass(const IdentifierList* parents, const std::string& name, bool bRootClass);
     191            static ClassIdentifier<T>* registerClass(const IdentifierList* parents, const String& name, bool bRootClass);
    192192            static void addObject(T* object);
    193193            static ClassIdentifier<T>* getIdentifier();
    194             void setName(const std::string& name);
     194            void setName(const String& name);
    195195
    196196        private:
     
    221221    */
    222222    template <class T>
    223     ClassIdentifier<T>* ClassIdentifier<T>::registerClass(const IdentifierList* parents, const std::string& name, bool bRootClass)
     223    ClassIdentifier<T>* ClassIdentifier<T>::registerClass(const IdentifierList* parents, const String& name, bool bRootClass)
    224224    {
    225225        COUT(4) << "*** Register Class in " << name << "-Singleton." << std::endl;
     
    265265    */
    266266    template <class T>
    267     void ClassIdentifier<T>::setName(const std::string& name)
     267    void ClassIdentifier<T>::setName(const String& name)
    268268    {
    269269        // Make sure we didn't already set the name, to avoid duplicate entries in the Identifier map
     
    271271        {
    272272            this->name_ = name;
    273             this->getIdentifierMap().insert(std::pair<std::string, Identifier*>(name, this));
     273            this->getIdentifierMap().insert(std::pair<String, Identifier*>(name, this));
    274274            this->bSetName_ = true;
    275275        }
  • code/branches/FICN/src/orxonox/core/IdentifierList.cc

    r670 r708  
    3131*/
    3232
     33#include "Identifier.h"
    3334#include "IdentifierList.h"
    34 #include "Identifier.h"
    3535
    3636namespace orxonox
     
    130130        @returns a string, containing a list of the names of all Identifiers in the list.
    131131    */
    132     std::string IdentifierList::toString() const
     132    String IdentifierList::toString() const
    133133    {
    134134        IdentifierListElement* temp = this->first_;
    135         std::string output = "";
     135        String output = "";
    136136
    137137        while (temp)
  • code/branches/FICN/src/orxonox/core/IdentifierList.h

    r682 r708  
    3737#define _IdentifierList_H__
    3838
    39 #include <string>
     39#include "CorePrereqs.h"
    4040
    41 #include "CorePrereqs.h"
     41#include "misc/String.h"
    4242
    4343namespace orxonox
     
    6262            void remove(const Identifier* identifier);
    6363            bool isInList(const Identifier* identifier) const;
    64             std::string toString() const;
     64            String toString() const;
    6565
    6666            IdentifierListElement* first_;      //!< The first element in the list
  • code/branches/FICN/src/orxonox/core/Language.cc

    r704 r708  
    2828#include <fstream>
    2929
     30#include "CoreIncludes.h"
    3031#include "Language.h"
    31 #include "CoreIncludes.h"
    3232
    3333namespace orxonox
     
    3636    // ###      LanguageEntry      ###
    3737    // ###############################
    38     LanguageEntry::LanguageEntry(const std::string& fallbackEntry)
     38    LanguageEntry::LanguageEntry(const String& fallbackEntry)
    3939    {
    4040        RegisterRootObject(LanguageEntry);
     
    4444    }
    4545
    46     void LanguageEntry::setTranslation(const std::string& translation)
     46    void LanguageEntry::setTranslation(const String& translation)
    4747    {
    4848        if (translation.compare("") != 0)
     
    5252    }
    5353
    54     void LanguageEntry::setDefault(const std::string& fallbackEntry)
     54    void LanguageEntry::setDefault(const String& fallbackEntry)
    5555    {
    5656        if (this->translatedEntry_.compare(this->fallbackEntry_) == 0)
     
    8585    }
    8686
    87     void Language::createEntry(const LanguageEntryName& name, const std::string& entry)
     87    void Language::createEntry(const LanguageEntryName& name, const String& entry)
    8888    {
    8989        if (!this->languageEntries_[name])
     
    9999    }
    100100
    101     void Language::addEntry(const LanguageEntryName& name, const std::string& entry)
    102     {
    103         std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(name);
     101    void Language::addEntry(const LanguageEntryName& name, const String& entry)
     102    {
     103        std::map<String, LanguageEntry*>::const_iterator it = this->languageEntries_.find(name);
    104104        if (!it->second)
    105105            this->createEntry(name, entry);
     
    112112    }
    113113
    114     const std::string& Language::getTranslation(const LanguageEntryName& name) const
    115     {
    116         std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(name);
     114    const String& Language::getTranslation(const LanguageEntryName& name) const
     115    {
     116        std::map<String, LanguageEntry*>::const_iterator it = this->languageEntries_.find(name);
    117117        if (it->second)
    118118            return it->second->getTranslation();
     
    124124    }
    125125
    126     const std::string Language::getFileName(const std::string& language)
    127     {
    128         return std::string("translation_" + language + ".lang");
     126    const String Language::getFileName(const String& language)
     127    {
     128        return String("translation_" + language + ".lang");
    129129    }
    130130
     
    154154        {
    155155            file.getline(line, 1024);
    156             std::string lineString = std::string(line);
     156            String lineString = String(line);
    157157            if (lineString.compare("") != 0)
    158158            {
     
    190190        {
    191191            file.getline(line, 1024);
    192             std::string lineString = std::string(line);
     192            String lineString = String(line);
    193193            if (lineString.compare("") != 0)
    194194            {
     
    196196                if (pos < lineString.size() && lineString.size() >= 3)
    197197                {
    198                     std::map<std::string, LanguageEntry*>::const_iterator it = this->languageEntries_.find(lineString.substr(0, pos));
     198                    std::map<String, LanguageEntry*>::const_iterator it = this->languageEntries_.find(lineString.substr(0, pos));
    199199                    if (it->second)
    200200                        it->second->setTranslation(lineString.substr(pos + 1));
  • code/branches/FICN/src/orxonox/core/Language.h

    r704 r708  
    2929#define _Language_H__
    3030
    31 #include <string>
    3231#include <map>
    3332
    3433#include "CorePrereqs.h"
    3534
     35#include "misc/String.h"
    3636#include "OrxonoxClass.h"
    3737
    3838namespace orxonox
    3939{
    40     typedef std::string LanguageEntryName;
     40    typedef String LanguageEntryName;
    4141
    4242    class _CoreExport LanguageEntry : public OrxonoxClass
    4343    {
    4444        public:
    45             explicit LanguageEntry(const std::string& fallbackEntry);
    46             void setTranslation(const std::string& translation);
    47             void setDefault(const std::string& fallbackEntry);
     45            explicit LanguageEntry(const String& fallbackEntry);
     46            void setTranslation(const String& translation);
     47            void setDefault(const String& fallbackEntry);
    4848
    49             inline const std::string& getTranslation()
     49            inline const String& getTranslation()
    5050                { return this->translatedEntry_; }
    5151
    52             inline const std::string& getDefault()
     52            inline const String& getDefault()
    5353                { return this->fallbackEntry_; }
    5454
    5555        private:
    56             std::string fallbackEntry_;
    57             std::string translatedEntry_;
     56            String fallbackEntry_;
     57            String translatedEntry_;
    5858    };
    5959
     
    6363            static Language& getLanguage();
    6464            void setConfigValues();
    65             void addEntry(const LanguageEntryName& name, const std::string& entry);
    66             const std::string& getTranslation(const LanguageEntryName& name) const;
     65            void addEntry(const LanguageEntryName& name, const String& entry);
     66            const String& getTranslation(const LanguageEntryName& name) const;
    6767
    6868        private:
     
    7474            void readTranslatedLanguageFile();
    7575            void writeDefaultLanguageFile() const;
    76             static const std::string getFileName(const std::string& language);
    77             void createEntry(const LanguageEntryName& name, const std::string& entry);
     76            static const String getFileName(const String& language);
     77            void createEntry(const LanguageEntryName& name, const String& entry);
    7878
    79             std::string language_;
    80             std::string defaultLanguage_;
    81             std::string defaultTranslation_;
    82             std::map<std::string, LanguageEntry*> languageEntries_;
     79            String language_;
     80            String defaultLanguage_;
     81            String defaultTranslation_;
     82            std::map<String, LanguageEntry*> languageEntries_;
    8383    };
    8484}
  • code/branches/FICN/src/orxonox/core/OrxonoxClass.h

    r695 r708  
    3737#define _OrxonoxClass_H__
    3838
    39 #include <string>
    40 
    4139#include "CorePrereqs.h"
    4240
     41#include "misc/String.h"
    4342#include "MetaObjectList.h"
    4443#include "Identifier.h"
     
    133132
    134133            /** @brief Sets the name of the object. @param name The name */
    135             inline virtual void setName(const std::string& name) { this->name_ = name; }
     134            inline virtual void setName(const String& name) { this->name_ = name; }
    136135
    137136            /** @returns the name of the object. */
    138             inline const std::string& getName() const { return this->name_; }
     137            inline const String& getName() const { return this->name_; }
    139138
    140139            /** @brief Sets the state of the objects activity. @param bActive True = active */
     
    155154            MetaObjectList metaList_;       //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in
    156155
    157             std::string name_;              //!< The name of the object
     156            String name_;              //!< The name of the object
    158157            bool bActive_;                  //!< True = the object is active
    159158            bool bVisible_;                 //!< True = the object is visible
  • code/branches/FICN/src/orxonox/core/OutputHandler.cc

    r699 r708  
    2626 */
    2727
     28#include "DebugLevel.h"
    2829#include "OutputHandler.h"
    29 #include "DebugLevel.h"
    3030
    3131namespace orxonox
     
    3535        @param logfilename The name of the logfile
    3636    */
    37     OutputHandler::OutputHandler(const std::string& logfilename)
     37    OutputHandler::OutputHandler(const String& logfilename)
    3838    {
    3939        this->logfilename_ = logfilename;
  • code/branches/FICN/src/orxonox/core/OutputHandler.h

    r704 r708  
    3737#define _OutputHandler_H__
    3838
    39 #include "CorePrereqs.h"
    40 
    4139#include <iostream>
    4240#include <fstream>
    43 #include <string>
     41
     42#include "misc/String.h"
     43#include "CorePrereqs.h"
    4444
    4545namespace orxonox
     
    108108
    109109        private:
    110             explicit OutputHandler(const std::string& logfilename);
     110            explicit OutputHandler(const String& logfilename);
    111111            OutputHandler(const OutputHandler& oh) {}; // don't copy
    112112            virtual ~OutputHandler();
    113113            std::ofstream logfile_;     //!< The logfile where the output is logged
    114             std::string logfilename_;   //!< The name of the logfile
     114            String logfilename_;   //!< The name of the logfile
    115115            int outputLevel_;           //!< The level of the incoming output
    116116    };
Note: See TracChangeset for help on using the changeset viewer.