Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 26, 2008, 1:36:35 AM (16 years ago)
Author:
landauf
Message:
  • the MultiTypes can now handle pointers and xml-elements
  • added a const keyword in the ticpp.h file (TinyXML++)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core2/src/util/MultiTypeString.cc

    r871 r925  
    4646        else if (this->type_ == MT_string)
    4747            return (this->string_ == mts.string_);
     48        else if (this->type_ == MT_xmlelement)
     49            return (&this->xmlelement_ == &mts.xmlelement_);
    4850    }
    4951
     
    5961        else if (this->type_ == MT_string)
    6062            return (this->string_ != mts.string_);
     63        else if (this->type_ == MT_xmlelement)
     64            return (&this->xmlelement_ != &mts.xmlelement_);
    6165    }
    6266
     
    6468}
    6569
     70MultiTypeString::operator orxonox::BaseObject*() const
     71{ return (this->type_ == MT_void) ? (orxonox::BaseObject*)this->value_.void_ : (orxonox::BaseObject*)ConvertValueAndReturn<MultiTypeString, void*>(*this); }
     72MultiTypeString::operator void*() const
     73{ return (this->type_ == MT_void) ? this->value_.void_ : ConvertValueAndReturn<MultiTypeString, void*>(*this); }
    6674MultiTypeString::operator int() const
    6775{ return (this->type_ == MT_int) ? this->value_.int_ : ConvertValueAndReturn<MultiTypeString, int>(*this); }
     
    92100MultiTypeString::operator const char*() const
    93101{ return ((this->type_ == MT_constchar) ? this->string_ : ConvertValueAndReturn<MultiTypeString, std::string>(*this)).c_str(); }
     102MultiTypeString::operator orxonox::Element() const
     103{ return (this->type_ == MT_xmlelement) ? this->xmlelement_ : ConvertValueAndReturn<MultiTypeString, orxonox::Element>(*this); }
    94104
    95105void MultiTypeString::setValue(const MultiTypeString& mts)
     
    101111std::string MultiTypeString::toString() const
    102112{
     113    std::string output;
     114
    103115    if (this->type_ == MT_constchar)
    104116        return this->string_;
    105117    else if (this->type_ == MT_string)
    106118        return this->string_;
     119    else if (this->type_ == MT_xmlelement)
     120        ConvertValue(&output, this->xmlelement_);
    107121    else
    108122        return MultiTypePrimitive::toString();
     123
     124    return output;
    109125}
    110126
     
    115131    else if (this->type_ == MT_string)
    116132        this->string_ = value;
     133    else if (this->type_ == MT_xmlelement)
     134        return ConvertValue(&this->xmlelement_, value, orxonox::Element());
    117135    else
    118136        return MultiTypePrimitive::fromString(value);
Note: See TracChangeset for help on using the changeset viewer.