src/hbcore/style/hbstylevalue.h
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
--- 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 <QString>
+#include <QVariant>
+#include <hbicon.h>
 
 template<typename T>
 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<typename T>
+void HbStyleValue<T>::clear()
+{
+    mSet = false;
+}
+
+template<typename T>
+bool HbStyleValue<T>::operator!=(const T &value) const
+{
+    if (!mSet) {
+        return true;
+    }
+    return mVal!=value;
+}
+
+template<typename T>
+bool HbStyleValue<T>::operator==(const T &value) const
+{
+    return !(*this!=value);
+}
+
+template<typename T>
+bool operator!=(const T &value, const HbStyleValue<T> &other)
+{
+    return other!=value;
+}
+
+template<typename T>
+inline bool operator==(const T &value, const HbStyleValue<T> &other)
+{
+    return !(other!=value);
+}
+
+template<>
+inline void HbStyleValue<QString>::clear()
+{
+    mSet = false;
+    mVal.clear();
+}
+
+template<>
+inline void HbStyleValue<QVariant>::clear()
+{
+    mSet = false;
+    mVal.clear();
+}
+
+template<>
+inline void HbStyleValue<HbIcon>::clear()
+{
+    mSet = false;
+    mVal.clear();
+}
+
 #endif // HBSTYLEVALUE_H