diff -r e6ad4ef83b23 -r b7da29130b0e src/hbcore/style/hbstylevalue.h --- a/src/hbcore/style/hbstylevalue.h Thu Sep 02 20:44:51 2010 +0300 +++ b/src/hbcore/style/hbstylevalue.h Fri Sep 17 08:32:10 2010 +0300 @@ -26,6 +26,9 @@ #ifndef HBSTYLEVALUE_H #define HBSTYLEVALUE_H +#include +#include +#include template class HbStyleValue @@ -38,6 +41,9 @@ T value() const; operator T() const; void operator=(const T &value); + bool operator!=(const T &value) const; + bool operator==(const T &value) const; + void clear(); private: bool mSet; @@ -81,4 +87,58 @@ mSet = true; } +template +void HbStyleValue::clear() +{ + mSet = false; +} + +template +bool HbStyleValue::operator!=(const T &value) const +{ + if (!mSet) { + return true; + } + return mVal!=value; +} + +template +bool HbStyleValue::operator==(const T &value) const +{ + return !(*this!=value); +} + +template +bool operator!=(const T &value, const HbStyleValue &other) +{ + return other!=value; +} + +template +inline bool operator==(const T &value, const HbStyleValue &other) +{ + return !(other!=value); +} + +template<> +inline void HbStyleValue::clear() +{ + mSet = false; + mVal.clear(); +} + +template<> +inline void HbStyleValue::clear() +{ + mSet = false; + mVal.clear(); +} + +template<> +inline void HbStyleValue::clear() +{ + mSet = false; + mVal.clear(); +} + #endif // HBSTYLEVALUE_H