Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 14, 2008, 11:31:28 PM (16 years ago)
Author:
rgrieder
Message:

gcc didn't like me..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core3/src/util/Math.cc

    r1778 r1779  
    130130
    131131// std::string to Vector2
    132 bool fallbackConversion(orxonox::Vector2* output, const std::string& input)
    133 {
    134     unsigned int opening_parenthesis, closing_parenthesis = input.find(')');
    135     if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
    136 
    137     SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
     132bool ConverterFallback<orxonox::Vector2, std::string>::convert(orxonox::Vector2* output, const std::string& input)
     133{
     134    unsigned int opening_parenthesis, closing_parenthesis = input.find(')');
     135    if ((opening_parenthesis = input.find('(')) == std::string::npos)
     136        opening_parenthesis = 0;
     137    else
     138        opening_parenthesis++;
     139
     140    SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
     141                     ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
    138142    if (tokens.size() >= 2)
    139143    {
     
    149153
    150154// std::string to Vector3
    151 bool fallbackConversion(orxonox::Vector3* output, const std::string& input)
    152 {
    153     unsigned int opening_parenthesis, closing_parenthesis = input.find(')');
    154     if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
    155 
    156     SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
     155bool ConverterFallback<orxonox::Vector3, std::string>::convert(orxonox::Vector3* output, const std::string& input)
     156{
     157    unsigned int opening_parenthesis, closing_parenthesis = input.find(')');
     158    if ((opening_parenthesis = input.find('(')) == std::string::npos)
     159        opening_parenthesis = 0;
     160    else
     161        opening_parenthesis++;
     162
     163    SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
     164                     ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
    157165    if (tokens.size() >= 3)
    158166    {
     
    170178
    171179// std::string to Vector4
    172 bool fallbackConversion(orxonox::Vector4* output, const std::string& input)
     180bool ConverterFallback<orxonox::Vector4, std::string>::convert(orxonox::Vector4* output, const std::string& input)
     181{
     182    unsigned int opening_parenthesis, closing_parenthesis = input.find(')');
     183    if ((opening_parenthesis = input.find('(')) == std::string::npos)
     184        opening_parenthesis = 0;
     185    else
     186        opening_parenthesis++;
     187
     188    SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis),
     189                     ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
     190    if (tokens.size() >= 4)
     191    {
     192        if (!ConvertValue(&(output->x), tokens[0]))
     193            return false;
     194        if (!ConvertValue(&(output->y), tokens[1]))
     195            return false;
     196        if (!ConvertValue(&(output->z), tokens[2]))
     197            return false;
     198        if (!ConvertValue(&(output->w), tokens[3]))
     199            return false;
     200
     201        return true;
     202    }
     203    return false;
     204}
     205
     206// std::string to Quaternion
     207bool ConverterFallback<orxonox::Quaternion, std::string>::convert(orxonox::Quaternion* output, const std::string& input)
    173208{
    174209    unsigned int opening_parenthesis, closing_parenthesis = input.find(')');
     
    178213    if (tokens.size() >= 4)
    179214    {
    180         if (!ConvertValue(&(output->x), tokens[0]))
    181             return false;
    182         if (!ConvertValue(&(output->y), tokens[1]))
    183             return false;
    184         if (!ConvertValue(&(output->z), tokens[2]))
    185             return false;
    186         if (!ConvertValue(&(output->w), tokens[3]))
    187             return false;
    188 
    189         return true;
    190     }
    191     return false;
    192 }
    193 
    194 // std::string to Quaternion
    195 bool fallbackConversion(orxonox::Quaternion* output, const std::string& input)
     215        if (!ConvertValue(&(output->w), tokens[0]))
     216            return false;
     217        if (!ConvertValue(&(output->x), tokens[1]))
     218            return false;
     219        if (!ConvertValue(&(output->y), tokens[2]))
     220            return false;
     221        if (!ConvertValue(&(output->z), tokens[3]))
     222            return false;
     223
     224        return true;
     225    }
     226    return false;
     227}
     228
     229// std::string to ColourValue
     230bool ConverterFallback<orxonox::ColourValue, std::string>::convert(orxonox::ColourValue* output, const std::string& input)
    196231{
    197232    unsigned int opening_parenthesis, closing_parenthesis = input.find(')');
     
    201236    if (tokens.size() >= 4)
    202237    {
    203         if (!ConvertValue(&(output->w), tokens[0]))
    204             return false;
    205         if (!ConvertValue(&(output->x), tokens[1]))
    206             return false;
    207         if (!ConvertValue(&(output->y), tokens[2]))
    208             return false;
    209         if (!ConvertValue(&(output->z), tokens[3]))
    210             return false;
    211 
    212         return true;
    213     }
    214     return false;
    215 }
    216 
    217 // std::string to ColourValue
    218 bool fallbackConversion(orxonox::ColourValue* output, const std::string& input)
    219 {
    220     unsigned int opening_parenthesis, closing_parenthesis = input.find(')');
    221     if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
    222 
    223     SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', true, '"', true, '\0', '\0', true, '\0');
    224     if (tokens.size() >= 4)
    225     {
    226238        if (!ConvertValue(&(output->r), tokens[0]))
    227239            return false;
Note: See TracChangeset for help on using the changeset viewer.