Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 21, 2008, 10:05:05 PM (16 years ago)
Author:
landauf
Message:

added convert-operators

File:
1 edited

Legend:

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

    r797 r834  
    6363        using MultiTypePrimitive::operator==;
    6464        inline bool operator==(const char*        value) const { return (this->string_ == std::string(value)); }
    65         inline bool operator==(const std::string& value) const { return (this->string_ == value); }
     65        inline bool operator==(const std::string& value) const { return (this->string_ == value);              }
    6666        bool operator==(const MultiTypeString& mtp) const;
    6767
    6868        using MultiTypePrimitive::operator!=;
    6969        inline bool operator!=(const char*        value) const { return (this->string_ != std::string(value)); }
    70         inline bool operator!=(const std::string& value) const { return (this->string_ != value); }
     70        inline bool operator!=(const std::string& value) const { return (this->string_ != value);              }
    7171        bool operator!=(const MultiTypeString& mtp) const;
     72
     73        inline operator std::string() const { return this->string_;         }
     74        inline operator const char*() const { return this->string_.c_str(); }
    7275
    7376        using MultiTypePrimitive::setValue;
    7477        inline void setValue(const char*        value) { this->type_ = MT_string; this->string_ = std::string(value); }
    75         inline void setValue(const std::string& value) { this->type_ = MT_string; this->string_ = value; }
     78        inline void setValue(const std::string& value) { this->type_ = MT_string; this->string_ = value;              }
    7679        void setValue(const MultiTypeString& mtp);
    7780
    78         inline std::string& getString()    { return this->string_; }
     81        inline std::string& getString()    { return this->string_;         }
    7982        inline const char*  getConstChar() { return this->string_.c_str(); }
    8083
    8184        using MultiTypePrimitive::getValue;
    82         inline void getValue(std::string* variable) const { (*variable) = this->string_; }
     85        inline void getValue(std::string* variable) const { (*variable) = this->string_;         }
    8386        inline void getValue(const char** variable) const { (*variable) = this->string_.c_str(); }
    8487
Note: See TracChangeset for help on using the changeset viewer.