Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 5, 2008, 1:29:47 AM (16 years ago)
Author:
landauf
Message:

several changes:

  • XMLPort is now theoretically able to load something (but still buggy)
  • Expanded Convert with several partial template specializations
  • Expanded all MultiTypes with new functions, mostly to convert values
  • Expanded SubString with a new functionality: chars inside parentheses aren't split

It's not yet working as it should (at least not in all cases - loading the objects name works)

File:
1 edited

Legend:

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

    r797 r848  
    2828
    2929#include "MultiTypeString.h"
     30#include "Convert.h"
    3031
    3132MultiTypeString::MultiTypeString(MultiType type) : MultiTypePrimitive(type)
     
    7677}
    7778
     79MultiTypeString::operator std::string() const
     80{
     81    return (this->type_ == MT_string) ? this->string_ : ConvertValueAndReturn<MultiTypePrimitive, std::string>(*this);
     82}
     83
     84MultiTypeString::operator const char*() const
     85{
     86    return (this->type_ == MT_constchar) ? this->string_.c_str() : ConvertValueAndReturn<MultiTypePrimitive, const char*>(*this);
     87}
     88
    7889void MultiTypeString::setValue(const MultiTypeString& mts)
    7990{
    8091    this->type_ = mts.type_;
    8192    this->value_ = mts.value_;
     93}
     94
     95std::string MultiTypeString::toString() const
     96{
     97    if (this->type_ == MT_constchar)
     98        return this->string_;
     99    else if (this->type_ == MT_string)
     100        return this->string_;
     101    else
     102        return MultiTypePrimitive::toString();
     103}
     104
     105bool MultiTypeString::fromString(const std::string value)
     106{
     107    if (this->type_ == MT_constchar)
     108        this->string_ = value;
     109    else if (this->type_ == MT_string)
     110        this->string_ = value;
     111    else
     112        return MultiTypePrimitive::fromString(value);
     113
     114    return true;
    82115}
    83116
Note: See TracChangeset for help on using the changeset viewer.