Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 854 for code


Ignore:
Timestamp:
Mar 5, 2008, 7:38:28 PM (17 years ago)
Author:
landauf
Message:

hopefully fixed the bug in XMLPort and Converter

Location:
code/branches/core/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core/src/orxonox/core/XMLPort.h

    r853 r854  
    108108                if (loading)
    109109                {
    110 std::cout << "3_1: load param " << this->paramname_ << std::endl;
    111110                    std::string attribute = xmlelement.GetAttribute(this->paramname_);
    112 std::cout << "3_2: attribute " << attribute << std::endl;
    113111                    if (attribute.size() > 0)
    114112                    {
    115113                        SubString tokens(attribute, ",", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
    116 std::cout << "3_3: tokens: " << tokens.size() << " params: " << this->loadfunction_->getParamCount() << std::endl;
    117114                        if ((unsigned int)tokens.size() >= (unsigned int)this->loadfunction_->getParamCount())
    118115                        {
    119116                            if (this->loadfunction_->getParamCount() == 1)
    120117                            {
    121 std::cout << "3_4 start: load with whole attribute as input" << std::endl;
    122118                                (*this->loadfunction_)(object, MultiTypeMath(attribute));
    123 std::cout << "3_5 end" << std::endl;
    124119                            }
    125120                            else
    126121                            {
    127 std::cout << "3_4: load with tokens as input" << std::endl;
    128122                                MultiTypeMath param1, param2, param3, param4, param5;
    129123                                if (tokens.size() >= 1) param1 = tokens[0];
  • code/branches/core/src/util/Convert.h

    r853 r854  
    226226        return ConvertValue(output, input.getString());
    227227      else
    228         return false;
     228        return ConvertValue(output, (MultiTypePrimitive)input);
    229229    }
    230230};
     
    240240        return ConvertValue(output, input.getString());
    241241      else
    242         return false;
     242        return ConvertValue(output, (MultiTypePrimitive)input);
    243243    }
    244244};
     
    264264        return ConvertValue(output, input.getDegree());
    265265      else
    266         return false;
     266        return ConvertValue(output, (MultiTypeString)input);
    267267    }
    268268};
     
    286286        return ConvertValue(output, input.getDegree());
    287287      else
    288         return false;
     288        return ConvertValue(output, (MultiTypeString)input);
    289289    }
    290290};
     
    397397    bool operator()(orxonox::Vector2* output, const std::string& input) const
    398398    {
    399       SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
     399      unsigned int opening_parenthesis, closing_parenthesis = input.find(')');
     400      if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
     401
     402      SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
    400403
    401404      if (tokens.size() >= 2)
     
    420423    bool operator()(orxonox::Vector3* output, const std::string& input) const
    421424    {
    422       SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
     425      unsigned int opening_parenthesis, closing_parenthesis = input.find(')');
     426      if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
     427
     428      SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
    423429
    424430      if (tokens.size() >= 3)
     
    445451    bool operator()(orxonox::Vector4* output, const std::string& input) const
    446452    {
    447       SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
     453      unsigned int opening_parenthesis, closing_parenthesis = input.find(')');
     454      if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
     455
     456      SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
    448457
    449458      if (tokens.size() >= 4)
     
    472481    bool operator()(orxonox::Quaternion* output, const std::string& input) const
    473482    {
    474       SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
     483      unsigned int opening_parenthesis, closing_parenthesis = input.find(')');
     484      if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
     485
     486      SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
    475487
    476488      if (tokens.size() >= 4)
     
    499511    bool operator()(orxonox::ColourValue* output, const std::string& input) const
    500512    {
    501       SubString tokens(input, ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
     513      unsigned int opening_parenthesis, closing_parenthesis = input.find(')');
     514      if ((opening_parenthesis = input.find('(')) == std::string::npos) { opening_parenthesis = 0; } else { opening_parenthesis++; }
     515
     516      SubString tokens(input.substr(opening_parenthesis, closing_parenthesis - opening_parenthesis), ",", SubString::WhiteSpaces, false, '\\', '"', '\0', '\0', '\0');
    502517
    503518      if (tokens.size() >= 4)
  • code/branches/core/src/util/MultiTypeMath.cc

    r853 r854  
    9595MultiTypeMath::operator orxonox::Vector3() const
    9696{
    97 std::cout << "4_2: Convert MultiTypeMath to Vector3:" << std::endl;
    98 std::cout << "     MultiTypeMath has type " << this->getType() << std::endl;
    99 std::cout << MT_vector3 << std::endl;
    100 std::cout << MT_string << std::endl;
    101 std::cout << MT_vector2 << std::endl;
    102 std::cout << MT_int << std::endl;
    103 std::cout << MT_uint << std::endl;
    104 std::cout << MT_null << std::endl;
    105 if (this->type_ == MT_vector3)
    106 {
    107     std::cout << "     MultiTypeMath contains already a Vector3" << std::endl;
    108     std::cout << "     Returnvalue is " << this->vector3_ << std::endl;
    109 }
    110 else
    111 {
    112     std::cout << "     MultiTypeMath doesn't contain a Vector3" << std::endl;
    113     std::cout << "     Returnvalue is " << ConvertValueAndReturn<MultiTypeMath, orxonox::Vector3>(*this) << std::endl;
    114     std::cout << "     Returnvalue was " << ConvertValueAndReturn<MultiTypePrimitive, orxonox::Vector3>(*this) << std::endl;
    115 }
    11697    return (this->type_ == MT_vector3) ? this->vector3_ : ConvertValueAndReturn<MultiTypeMath, orxonox::Vector3>(*this);
    11798}
  • code/branches/core/src/util/MultiTypeMath.h

    r853 r854  
    9797        using MultiTypeString::setValue;
    9898        inline void setValue(const orxonox::Vector2&     value) { this->type_ = MT_vector2;     this->vector2_     = value; }
    99         inline void setValue(const orxonox::Vector3&     value) { std::cout << "4_4: setValue Vector3: " << value << std::endl; this->type_ = MT_vector3;     this->vector3_     = value; }
     99        inline void setValue(const orxonox::Vector3&     value) { this->type_ = MT_vector3;     this->vector3_     = value; }
    100100        inline void setValue(const orxonox::ColourValue& value) { this->type_ = MT_colourvalue; this->colourvalue_ = value; }
    101101        inline void setValue(const orxonox::Quaternion&  value) { this->type_ = MT_quaternion;  this->quaternion_  = value; }
  • code/branches/core/src/util/MultiTypePrimitive.cc

    r853 r854  
    3232MultiTypePrimitive::MultiTypePrimitive(MultiType type)
    3333{
    34 std::cout << "4_5: Created MultiTypePrimitive with type " << type << std::endl;
    3534    this->type_ = type;
    3635
     
    191190void MultiTypePrimitive::setValue(const MultiTypePrimitive& mtp)
    192191{
    193     std::cout << "4_3: setValue in MultiTypePrimitive with other Multitype as parameter: " << mtp << std::endl;
    194192    this->type_ = mtp.type_;
    195193    this->value_ = mtp.value_;
  • code/branches/core/src/util/MultiTypeString.h

    r853 r854  
    5353        inline MultiTypeString(bool           value) : MultiTypePrimitive(value) {}
    5454        inline MultiTypeString(const char*        value)   { this->setValue(value); }
    55         inline MultiTypeString(const std::string& value)   { this->setValue(value); std::cout << "4_1: Created MultiTypeString with value " << value << " and type " << this->getType() << std::endl; }
     55        inline MultiTypeString(const std::string& value)   { this->setValue(value); }
    5656        inline MultiTypeString(const MultiTypeString& mts) { this->setValue(mts);   }
    5757
Note: See TracChangeset for help on using the changeset viewer.