macro-ify

This commit is contained in:
Mathieu Lacage
2008-02-15 05:38:29 +01:00
parent e94efb4a11
commit 25bb76ce20
11 changed files with 64 additions and 202 deletions

38
src/core/value-helper.h Normal file
View File

@@ -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 */

View File

@@ -114,5 +114,6 @@ def build(bld):
'enum-value.h',
'object-factory.h',
'class-value-helper.h',
'value-helper.h',
]