src/core/value-helper.h
changeset 2422 6cbcb8fe4551
child 2424 217a447122a6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/core/value-helper.h	Fri Feb 15 05:38:29 2008 +0100
@@ -0,0 +1,38 @@
+#ifndef VALUE_HELPER_H
+#define VALUE_HELPER_H
+
+#include "class-value-helper.h"
+
+#define VALUE_HELPER_HEADER_1(type) \
+  type (PValue value); \
+  operator PValue () const;
+
+#define VALUE_HELPER_HEADER_2(type)				\
+  class type##Value : public Value {};				\
+  class type##ParamSpec : public ParamSpec {};			\
+  template <typename T1>					\
+  Ptr<ParamSpec> Make##type##ParamSpec (T1 a1,			\
+					type initialValue)	\
+  {								\
+    return MakeClassValueHelperParamSpec< type ,		\
+      type##Value, type##ParamSpec> (a1, initialValue);		\
+  }								\
+  template <typename T1, typename T2>				\
+    Ptr<ParamSpec> Make##type##ParamSpec (T1 a1, T2 a2,		\
+					  type initialValue)	\
+  {								\
+    return MakeClassValueHelperParamSpec<type,			\
+      type##Value,type##ParamSpec> (a1, a2, initialValue);	\
+  }
+
+#define VALUE_HELPER_CPP(type)						\
+  type::type (PValue value)						\
+  {									\
+    *this = ClassValueHelperExtractFrom<type,type##Value> (value);	\
+  }									\
+  type::operator PValue () const					\
+  {									\
+    return ClassValueHelperConvertTo<type,type##Value> (this);		\
+  }
+
+#endif /* VALUE_HELPER_H */