#ifndef VCZH_REFLECTION_GUITYPEDESCRIPTORBUILDER_FUNCTION
#define VCZH_REFLECTION_GUITYPEDESCRIPTORBUILDER_FUNCTION
#include "GuiTypeDescriptorBuilder.h"
namespace
{
namespace
{
namespace
{
template
<
typename
...
>
struct
{
using
=
const
<
void
(
...)>&;
class
:
public
,
public
reflection
::
description
::
{
public
:
<
>
;
(
<
>
)
:handler(
)
{
}
bool
()
override
{
return
();
}
};
static
<
reflection
::
description
::
>
(
<
void
(
...)>&
,
)
{
return
<
>(
.
(
));
}
static
bool
(
<
void
(
...)>&
,
<
reflection
::
description
::
>
)
{
auto
=
.
<
>();
if
(!
impl
)
return
false
;
return
.
(
impl
);
}
static
<
void
(
...)>&
(
<
void
(
...)>&
)
{
return
;
}
};
#ifndef VCZH_DEBUG_NO_REFLECTION
namespace
{
template
<
typename
>
struct
{
static
void
(
<
>
)
{
}
};
template
<
typename
,
typename
...
>
struct
<
<
,
...>>
{
static
void
(
<
>
)
{
(
<
>::
());
<
<
...>>::
(
);
}
};
}
#endif
template
<
typename
,
typename
...
>
struct
<
<
(
...)>,
::
>
{
typedef
<
const
<
(
...)>,
::
>
;
static
const
::
=
::
;
typedef
;
typedef
typename
::
;
typedef
typename
::
;
typedef
typename
::
;
#ifndef VCZH_DEBUG_NO_REFLECTION
static
<
>
(
)
{
auto
=
<
>(
<
>(),
);
auto
=
<
>(
functionType
);
genericType
(
<
>::
());
internal_helper
::
<
<
...>>::
(
genericType
);
auto
=
<
>(
genericType
);
return
type
;
}
#endif
};
template
<
typename
,
typename
...
>
struct
<
const
<
(
...)>,
::
>
:
<
<
(
...)>,
::
>
{
};
template
<
typename
>
class
ValueFunctionProxyWrapper
{
};
namespace
{
extern
void
(
<
>
,
);
template
<
typename
,
typename
...
>
void
(
<
>
,
,
&
,
& ...
)
{
<
typename
<
>::
>(
(
),
,
0
,
(
+
1
) +
L"-th argument"
);
(
,
+
1
,
...);
}
template
<
typename
,
typename
...
>
struct
{
static
(
const
<
(
...)>&
,
<
>
,
typename
<
>::Type&& ...
)
{
(
,
0
,
...);
=
...);
return
<
>(
result
);
}
};
template
<
typename
...
>
struct
<
void
,
...>
{
static
(
const
<
void
(
...)>&
,
<
>
,
typename
<
>::Type&& ...
)
{
(
,
0
,
...);
...);
return
();
}
};
}
template
<
typename
,
typename
...
>
class
ValueFunctionProxyWrapper
<
(
...)> :
public
,
public
virtual
{
typedef
<
(
...)>
;
protected
:
;
public
:
ValueFunctionProxyWrapper
(
const
&
)
:function(
)
{
}
()
{
return
;
}
(
<
>
)
override
{
if
(!
||
() !=
sizeof
...(
))
{
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
throw
ArgumentCountMismtatchException
();
#else
CHECK_FAIL(L"Argument count mismatch.");
#endif
}
return
internal_helper
::
<
,
...>::
(
,
,
typename
<
>::Type()...);
}
};
namespace
{
extern
void
(
<
>
);
template
<
typename
,
typename
...
>
void
(
<
>
,
&&
,
&& ...
)
{
(
description
::
<
>(
));
(
,
...);
}
}
template
<
typename
,
typename
...
>
struct
<
<
(
...)>,
::
>
{
static
(
const
<
(
...)>&
,
*
)
{
typedef
(
)(
...);
<
>
=
new
ValueFunctionProxyWrapper
<
>(
);
*
=
nullptr
;
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
td
=
<
>::
GetAssociatedTypeDescriptor
();
#endif
return
<
<
>>(
result
,
td
);
}
static
void
(
const
&
,
<
(
...)>&
,
*
,
const
&
)
{
typedef
(
)(
...);
typedef
ValueFunctionProxyWrapper
<
>
;
<
>
=
<
<
>>(
,
,
);
if
(
functionProxy
)
{
if
(
<
>
=
functionProxy
.
<
>())
{
proxy
();
}
else
{
=[functionProxy](
...
)
{
<
>
=
::
();
internal_helper
::
(
arguments
,
<
>(
args
)...);
typedef
typename
<
>::
;
;
description
::
<
>(
functionProxy
(
arguments
),
proxyResult
);
return
proxyResult
;
};
}
}
}
};
template
<
typename
,
typename
...
>
struct
<
const
<
(
...)>,
::
> :
<
<
(
...)>,
::
>
{
};
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
template
<
typename
>
class
CustomConstructorInfoImpl
{};
template
<
typename
,
typename
>
class
{};
template
<
typename
,
typename
>
class
CustomExternalMethodInfoImpl
{};
template
<
typename
>
class
CustomStaticMethodInfoImpl
{};
template
<
typename
,
typename
>
class
{};
namespace
{
extern
void
(
*
,
collections
::
<
>&
,
);
template
<
typename
,
typename
...
>
void
(
*
,
collections
::
<
>&
,
,
&
,
& ...
)
{
<
typename
<
>::
>(
],
,
->
(
)->
()->
(),
(
) +
L"-th argument"
);
(
,
,
+
1
,
...);
}
template
<
typename
,
typename
...
>
struct
{
static
(
*
,
collections
::
<
>&
,
typename
<
>::Type&& ...
)
{
(
,
,
0
,
...);
=
new
typename
<
>::
(
...);
return
<
>(
result
);
}
};
template
<
typename
>
struct
{
static
void
(
*
,
const
wchar_t
*
[],
)
{
}
};
template
<
typename
,
typename
...
>
struct
<
<
,
...>>
{
static
void
(
*
,
const
wchar_t
*
[],
)
{
->
(
new
(
,
[
],
<
>::
()));
<
<
...>>::
(
,
,
+
1
);
}
};
}
template
<
typename
,
typename
...
>
class
CustomConstructorInfoImpl
<
(
...)> :
public
{
protected
:
(
const
&
,
collections
::
<
>&
)
override
{
return
internal_helper
::
<
,
...>::
(
this
,
,
typename
<
>::Type()...);
}
CreateFunctionProxyInternal
(
const
&
)
override
{
<
(
...)>
(
LAMBDA([](TArgs ...args)->R
vl
::
function_lambda
::
([](
...
)->
{
=
new
typename
<
>::
(
args
...);
return
result
;
})
);
return
<
<
(
...)>>(
proxy
);
}
public
:
CustomConstructorInfoImpl
(
const
wchar_t
*
[])
:
(
0
,
<
>::
(),
true
)
{
internal_helper
::
<
<
...>>::
(
this
,
,
0
);
}
::
*
()
override
{
return
nullptr
;
}
};
namespace
{
template
<
typename
,
typename
,
typename
...
>
struct
{
static
(
*
,
(
__thiscall
::*
)(
...),
*
,
collections
::
<
>&
,
typename
<
>::Type&& ...
)
{
(
,
,
0
,
...);
= (
->*
)(
...);
return
<
>(
result
,
->
()->
());
}
};
template
<
typename
,
typename
...
>
struct
<
,
void
,
...>
{
static
(
*
,
void
(
__thiscall
::*
)(
...),
*
,
collections
::
<
>&
,
typename
<
>::Type&& ...
)
{
(
,
,
0
,
...);
(
->*
)(
...);
return
();
}
};
template
<
typename
,
typename
,
typename
...
>
struct
BoxedExternalMethodInvoker
{
static
(
*
,
(*
)(
*,
...),
*
,
collections
::
<
>&
,
typename
<
>::Type&& ...
)
{
(
,
,
0
,
...);
=
(
,
...);
return
<
>(
result
,
->
()->
());
}
};
template
<
typename
,
typename
...
>
struct
BoxedExternalMethodInvoker
<
,
void
,
...>
{
static
(
*
,
void
(*
)(
*,
...),
*
,
collections
::
<
>&
,
typename
<
>::Type&& ...
)
{
(
,
,
0
,
...);
(
,
...);
return
();
}
};
}
class
:
public
,
private
::
{
private
:
;
;
const
&
()
override
{
return
;
}
const
&
()
override
{
return
;
}
public
:
(
*
,
<
>
,
bool
,
const
wchar_t
*
,
const
wchar_t
*
)
:
(
,
,
)
{
CHECK_ERROR((_invokeTemplate == nullptr) == (_closureTemplate == nullptr), L"MethodInfoImpl_StaticCpp::MethodInfoImpl_StaticCpp()#Templates should all be set or default at the same time.");
do
{
if
(!((
==
nullptr
) == (
==
nullptr
)))
throw
(
L"MethodInfoImpl_StaticCpp::MethodInfoImpl_StaticCpp()#Templates should all be set or default at the same time."
);}
while
(
0
);
if
(
)
{
(
,
false
);
}
if
(
)
{
(
,
false
);
}
}
::
*
()
override
{
return
.
() ==
0
||
.
() ==
0
?
nullptr
:
this
;
}
};
template
<
typename
,
typename
,
typename
...
>
class
<
,
(
...)> :
public
{
protected
:
(
__thiscall
::*
)(
...);
(
const
&
,
collections
::
<
>&
)
override
{
*
=
<
*>(
,
(),
L"thisObject"
);
return
internal_helper
::
<
,
,
...>::
(
object
,
,
this
,
,
typename
<
>::Type()...);
}
CreateFunctionProxyInternal
(
const
&
)
override
{
*
=
<
*>(
,
(),
L"thisObject"
);
<
(
...)>
(
object
,
);
return
<
<
(
...)>>(
proxy
);
}
public
:
(
const
wchar_t
*
[],
(
__thiscall
::*
)(
...),
const
wchar_t
*
,
const
wchar_t
*
)
:
(
0
,
<
>::
(),
false
,
,
)
,method(
)
{
internal_helper
::
<
<
...>>::
(
this
,
,
0
);
}
};
template
<
typename
,
typename
,
typename
...
>
class
CustomExternalMethodInfoImpl
<
,
(
...)> :
public
{
protected
:
(*
)(
*,
...);
(
const
&
,
collections
::
<
>&
)
override
{
*
=
<
*>(
,
(),
L"thisObject"
);
return
internal_helper
::
BoxedExternalMethodInvoker
<
,
,
...>::
(
object
,
,
this
,
,
typename
<
>::Type()...);
}
CreateFunctionProxyInternal
(
const
&
)
override
{
*
=
<
*>(
,
(),
L"thisObject"
);
<
(
...)>
=
(
<
(
*,
...)>(
))
object
);
return
<
<
(
...)>>(
proxy
);
}
public
:
CustomExternalMethodInfoImpl
(
const
wchar_t
*
[],
(*
)(
*,
...),
const
wchar_t
*
,
const
wchar_t
*
)
:
(
0
,
<
>::
(),
false
,
,
)
,method(
)
{
internal_helper
::
<
<
...>>::
(
this
,
,
0
);
}
};
namespace
{
template
<
typename
,
typename
...
>
struct
{
static
(
(*
)(
...),
*
,
collections
::
<
>&
,
typename
<
>::Type&& ...
)
{
(
,
,
0
,
...);
=
(
...);
return
<
>(
result
,
->
()->
());
}
};
template
<
typename
...
>
struct
<
void
,
...>
{
static
(
void
(*
)(
...),
*
,
collections
::
<
>&
,
typename
<
>::Type&& ...
)
{
(
,
,
0
,
...);
(
...);
return
();
}
};
}
template
<
typename
,
typename
...
>
class
CustomStaticMethodInfoImpl
<
(
...)> :
public
{
protected
:
(*
)(
...);
(
const
&
,
collections
::
<
>&
)
override
{
return
internal_helper
::
<
,
...>::
(
,
this
,
,
typename
<
>::Type()...);
}
CreateFunctionProxyInternal
(
const
&
)
override
{
<
(
...)>
(
);
return
<
<
(
...)>>(
proxy
);
}
public
:
CustomStaticMethodInfoImpl
(
const
wchar_t
*
[],
(*
)(
...),
const
wchar_t
*
,
const
wchar_t
*
)
:
(
0
,
<
>::
(),
true
,
,
)
,method(
)
{
internal_helper
::
<
<
...>>::
(
this
,
,
0
);
}
};
namespace
{
template
<
typename
...
>
struct
{
static
void
(
<
void
(
...)>&
,
<
>
,
typename
<
>::Type&& ...
)
{
(
,
0
,
...);
...);
}
};
}
template
<
typename
,
typename
...
>
class
<
,
void
(
...)> :
public
{
protected
:
<
void
(
...)>
::*
;
<
>
(
*
,
<
>
)
override
{
*
=
<
*>(
::
(
),
(),
L"thisObject"
);
<
void
(
...)>&
=
object
->*
;
auto
=
<
void
(
...)>([=](
...
)
{
auto
=
::
();
internal_helper
::
(
arguments
,
<
>(
args
)...);
(
arguments
);
});
return
<
...>::
(
eventObject
,
func
);
}
bool
(
*
,
<
>
)
override
{
*
=
<
*>(
::
(
),
(),
L"thisObject"
);
<
void
(
...)>&
=
object
->*
;
return
<
...>::
(
eventObject
,
);
}
void
(
*
,
<
>
)
override
{
*
=
<
*>(
::
(
),
(),
L"thisObject"
);
<
void
(
...)>&
=
object
->*
;
internal_helper
::
<
...>::
(
eventObject
,
,
typename
<
>::Type()...);
}
<
>
()
override
{
return
<
<
void
(
...)>>::
();
}
public
:
(
*
,
const
&
,
<
void
(
...)>
::*
)
:
(
,
)
, eventRef(
)
{
}
()
{
}
::
*
()
override
{
return
nullptr
;
}
};
template
<
typename
>
struct
CustomEventFunctionTypeRetriver
{
typedef
;
};
template
<
typename
,
typename
>
struct
CustomEventFunctionTypeRetriver
<
<
>
::*>
{
typedef
;
};
#endif
}
}
}
#endif