macro-ify
This commit is contained in:
38
src/core/value-helper.h
Normal file
38
src/core/value-helper.h
Normal 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 */
|
||||
@@ -114,5 +114,6 @@ def build(bld):
|
||||
'enum-value.h',
|
||||
'object-factory.h',
|
||||
'class-value-helper.h',
|
||||
'value-helper.h',
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user