Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 11, 2008, 3:29:16 AM (17 years ago)
Author:
landauf
Message:

config-values are working again, now with a totally reworked ConfigValueContainer using MultiTypes (this commit is just a bugfix, the major work was done before, see r792)

added << operator to std::ostream for all MultiTypes

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

Legend:

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

    r794 r797  
    105105    this->value_ = mtm.value_;
    106106}
     107
     108std::ostream& operator<<(std::ostream& out, MultiTypeMath& mtm)
     109{
     110    if (mtm.isA(MT_vector2))
     111        out << mtm.getVector2();
     112    else if (mtm.isA(MT_vector3))
     113        out << mtm.getVector3();
     114    else if (mtm.isA(MT_colourvalue))
     115        out << mtm.getColourValue();
     116    else if (mtm.isA(MT_quaternion))
     117        out << mtm.getQuaternion();
     118    else if (mtm.isA(MT_radian))
     119        out << mtm.getRadian();
     120    else if (mtm.isA(MT_degree))
     121        out << mtm.getDegree();
     122    else
     123        out << ((MultiTypeString)mtm);
     124
     125    return out;
     126}
  • code/branches/core/src/util/MultiTypeMath.h

    r794 r797  
    121121};
    122122
     123std::ostream& operator<<(std::ostream& out, MultiTypeMath& mtm);
     124
    123125#endif /* _MultiTypeMath_H__ */
  • code/branches/core/src/util/MultiTypePrimitive.cc

    r792 r797  
    145145    this->value_ = mtp.value_;
    146146}
     147
     148std::ostream& operator<<(std::ostream& out, const MultiTypePrimitive& mtp)
     149{
     150    if (mtp.isA(MT_int))
     151        out << mtp.getInt();
     152    else if (mtp.isA(MT_uint))
     153        out << mtp.getUnsignedInt();
     154    else if (mtp.isA(MT_char))
     155        out << mtp.getChar();
     156    else if (mtp.isA(MT_uchar))
     157        out << mtp.getUnsignedChar();
     158    else if (mtp.isA(MT_short))
     159        out << mtp.getShort();
     160    else if (mtp.isA(MT_ushort))
     161        out << mtp.getUnsignedShort();
     162    else if (mtp.isA(MT_long))
     163        out << mtp.getLong();
     164    else if (mtp.isA(MT_ulong))
     165        out << mtp.getUnsignedLong();
     166    else if (mtp.isA(MT_float))
     167        out << mtp.getFloat();
     168    else if (mtp.isA(MT_double))
     169        out << mtp.getDouble();
     170    else if (mtp.isA(MT_longdouble))
     171        out << mtp.getLongDouble();
     172    else if (mtp.isA(MT_bool))
     173        out << mtp.getBool();
     174
     175    return out;
     176}
  • code/branches/core/src/util/MultiTypePrimitive.h

    r794 r797  
    2929#ifndef _MultiTypePrimitive_H__
    3030#define _MultiTypePrimitive_H__
     31
     32#include <ostream>
    3133
    3234#include "UtilPrereqs.h"
     
    142144};
    143145
     146std::ostream& operator<<(std::ostream& out, const MultiTypePrimitive& mtp);
     147
    144148#endif /* _MultiTypePrimitive_H__ */
  • code/branches/core/src/util/MultiTypeString.cc

    r794 r797  
    8181    this->value_ = mts.value_;
    8282}
     83
     84std::ostream& operator<<(std::ostream& out, MultiTypeString& mts)
     85{
     86    if (mts.isA(MT_constchar))
     87        out << mts.getConstChar();
     88    else if (mts.isA(MT_string))
     89        out << mts.getString();
     90    else
     91        out << ((MultiTypePrimitive)mts);
     92
     93    return out;
     94}
  • code/branches/core/src/util/MultiTypeString.h

    r794 r797  
    7676        void setValue(const MultiTypeString& mtp);
    7777
    78         inline std::string& getString() { return this->string_; }
     78        inline std::string& getString()    { return this->string_; }
     79        inline const char*  getConstChar() { return this->string_.c_str(); }
    7980
    8081        using MultiTypePrimitive::getValue;
    81         inline void getValue(std::string* variable) const { (*variable) = std::string(this->string_); }
     82        inline void getValue(std::string* variable) const { (*variable) = this->string_; }
     83        inline void getValue(const char** variable) const { (*variable) = this->string_.c_str(); }
    8284
    8385    protected:
     
    8587};
    8688
     89std::ostream& operator<<(std::ostream& out, MultiTypeString& mts);
     90
    8791#endif /* _MultiTypeString_H__ */
Note: See TracChangeset for help on using the changeset viewer.