Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 28, 2007, 10:30:29 PM (16 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..
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.