File Index Symbol Index

/*********************************************************************** Author: Zihan Chen (vczh) Licensed under https://github.com/vczh-libraries/License ***********************************************************************/
#ifndef VCZH_REFLECTION_GUITYPEDESCRIPTORREFLECTION
#define VCZH_REFLECTION_GUITYPEDESCRIPTORREFLECTION
#include "GuiTypeDescriptorMacros.h"
namespace
vl
{
namespace
reflection
{
namespace
description
{
/*********************************************************************** Predefined Types ***********************************************************************/
#define REFLECTION_PREDEFINED_PRIMITIVE_TYPES(F)\
F(vuint8_t) \
F(vuint16_t) \
F(vuint32_t) \
F(vuint64_t) \
F(vint8_t) \
F(vint16_t) \
F(vint32_t) \
F(vint64_t) \
F(float) \
F(double) \
F(bool) \
F(wchar_t) \
F(WString) \
F(Locale) \
#define REFLECTION_PREDEFINED_SERIALIZABLE_TYPES(F)\
REFLECTION_PREDEFINED_PRIMITIVE_TYPES(F) \
F(DateTime) \
#ifndef VCZH_DEBUG_NO_REFLECTION
#define REFLECTION_PREDEFINED_COMPLEX_TYPES(F, VOID_TYPE)\
F(VOID_TYPE) \
F(VoidValue) \
F(IDescriptable) \
F(DescriptableObject) \
F(DateTime) \
F(IValueEnumerator) \
F(IValueEnumerable) \
F(IValueReadonlyList) \
F(IValueList) \
F(IValueObservableList) \
F(IValueReadonlyDictionary) \
F(IValueDictionary) \
F(IValueInterfaceProxy) \
F(IValueFunctionProxy) \
F(IValueSubscription) \
F(IValueCallStack) \
F(IValueException) \
F(IBoxedValue) \
F(IBoxedValue::CompareResult) \
F(IValueType) \
F(IEnumType) \
F(ISerializableType) \
F(ITypeInfo) \
F(ITypeInfo::Decorator) \
F(IMemberInfo) \
F(IEventHandler) \
F(IEventInfo) \
F(IPropertyInfo) \
F(IParameterInfo) \
F(IMethodInfo) \
F(IMethodGroupInfo) \
F(TypeDescriptorFlags) \
F(ITypeDescriptor) \
#endif
#define DEFINE_TYPED_VALUE_SERIALIZER_PROVIDER(TYPENAME)\
template<>\
struct TypedValueSerializerProvider<TYPENAME>\
{\
static TYPENAME GetDefaultValue();\
static bool Serialize(const TYPENAME& input, WString& output);\
static bool Deserialize(const WString& input, TYPENAME& output);\
static IBoxedValue::CompareResult Compare(const TYPENAME& a, const TYPENAME& b);\
};\
#undef DEFINE_TYPED_VALUE_SERIALIZER_PROVIDER
/*********************************************************************** Interface Implementation Proxy (Implement) ***********************************************************************/
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
#pragma warning(push) #pragma warning(disable:
4250
)
Value
GetCurrent
()
override
{ }
vint
GetIndex
()
override
{ }
bool
Next
()
override
{ }
Ptr
<
IValueEnumerator
>
CreateEnumerator
()
override
{ }
vint
GetCount
()
override
{ }
Value
Get
(
vint
index
)
override
{ }
bool
Contains
(
const
Value
&
value
)
override
{ }
vint
IndexOf
(
const
Value
&
value
)
override
{ }
void
Set
(
vint
index
,
const
Value
&
value
)
override
{ }
vint
Add
(
const
Value
&
value
)
override
{ }
vint
Insert
(
vint
index
,
const
Value
&
value
)
override
{ }
bool
Remove
(
const
Value
&
value
)
override
{ }
bool
RemoveAt
(
vint
index
)
override
{ }
void
Clear
()
override
{ }
Ptr
<
IValueReadonlyList
>
GetKeys
()
override
{ }
Ptr
<
IValueReadonlyList
>
GetValues
()
override
{ }
vint
GetCount
()
override
{ }
Value
Get
(
const
Value
&
key
)
override
{ }
void
Set
(
const
Value
&
key
,
const
Value
&
value
)
override
{ }
bool
Remove
(
const
Value
&
key
)
override
{ }
void
Clear
()
override
{ }
bool
Open
()
override
{ }
bool
Update
()
override
{ }
bool
Close
()
override
{ } #pragma warning(pop)
#endif
/*********************************************************************** Helper Functions ***********************************************************************/
extern
vint
ITypeDescriptor_GetTypeDescriptorCount
();
extern
ITypeDescriptor
*
ITypeDescriptor_GetTypeDescriptor
(
vint
index
);
extern
ITypeDescriptor
*
ITypeDescriptor_GetTypeDescriptor
(
const
WString
&
name
);
extern
ITypeDescriptor
*
ITypeDescriptor_GetTypeDescriptor
(
const
Value
&
value
);
/*********************************************************************** LoadPredefinedTypes ***********************************************************************/
/// <summary>Register all reflectable types in <b>VlppReflection</b>.</summary>
/// <returns>Returns true if this operation succeeded.</returns>
extern
bool
LoadPredefinedTypes
(); } } }
#endif