#include "WfCpp.h"
namespace
{
namespace
{
namespace
{
using
namespace
collections
;
using
namespace
reflection
;
using
namespace
reflection
::
description
;
using
namespace
analyzer
;
bool
(
*
,
*
)
{
=
->
->
.
().
(
);
if
(
index
!= -
1
)
{
auto
=
dynamic_cast
<
*>(
->
->
.
()
index
].
());
if
(
methodInfo
->
())
{
return
false
;
}
auto
=
methodInfo
->
();
return
td
->
() ==
::
;
}
return
false
;
}
class
WfGenerateClassMemberDeclVisitor
:
public
,
public
::
{
public
:
*
;
stream
::
&
;
;
;
bool
;
WfGenerateClassMemberDeclVisitor
(
*
,
stream
::
&
,
const
&
,
const
&
,
bool
)
:config(
)
, writer(
)
, className(
)
, prefix(
)
, forClassExpr(
)
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
bool
=
(
,
);
.
(
);
if
(
isVirtual
)
{
.
(
L"virtual "
);
}
else
if
(
->
==
::
)
{
.
(
L"static "
);
}
->
(
,
,
->
(
->
.
),
true
);
if
(
isVirtual
)
{
.
(
L" = 0"
);
}
else
if
(
->
==
::
)
{
.
(
L" override"
);
}
.
(
L";"
);
}
void
(
*
)
override
{
auto
=
->
->
].
();
auto
=
scope
->
->
.
]
0
];
auto
=
symbol
;
.
(
+
->
(
typeInfo
.
()) +
L" "
+
->
(
->
.
));
if
(
)
{
auto
=
->
(
typeInfo
.
());
if
(
defaultValue
!=
L""
)
{
.
(
L" = "
);
.
(
defaultValue
);
}
}
.
(
L";"
);
}
void
(
*
)
override
{
auto
=
dynamic_cast
<
*>(
->
->
].
());
auto
=
eventInfo
->
();
.
(
);
.
(
L"::vl::Event<void("
);
=
typeInfo
->
();
for
(
=
1
;
i
<
count
;
i
++)
{
if
(
i
>
1
)
.
(
L", "
);
.
(
->
(
typeInfo
->
(
i
)));
}
.
(
L")> "
+
->
(
->
.
) +
L";"
);
}
void
(
*
)
override
{
}
void
(
*
)
override
{
auto
=
dynamic_cast
<
*>(
->
->
].
());
.
(
);
->
(
,
methodInfo
,
,
false
);
.
(
L";"
);
}
void
(
*
)
override
{
.
(
+
L"~"
+
+
L"();"
);
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
FOREACH(Ptr<WfDeclaration>, decl, node->expandedDeclarations)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
decl
);)
{
decl
(
this
);
}
}
void
(
*
)
override
{
FOREACH(Ptr<WfDeclaration>, decl, node->expandedDeclarations)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
decl
);)
{
decl
(
this
);
}
}
};
class
WfGenerateClassMemberInitVisitor
:
public
empty_visitor
::
{
public
:
*
;
stream
::
&
;
;
&
;
WfGenerateClassMemberInitVisitor
(
*
,
stream
::
&
,
const
&
,
&
)
:config(
)
, writer(
)
, prefix(
)
, callIndex(
)
{
}
void
(
* )
{
.
(
);
if
(
++ ==
0
)
{
.
(
L"\t: "
);
}
else
{
.
(
L"\t, "
);
}
.
(
->
(
->
.
));
}
void
(
*
)
override
{
auto
=
->
->
].
();
auto
=
scope
->
->
.
]
0
];
auto
=
symbol
;
if
(
->
)
{
(
);
.
(
L"("
);
(
,
,
->
,
typeInfo
.
());
.
(
L")"
);
}
else
{
auto
=
->
(
typeInfo
.
());
if
(
defaultValue
!=
L""
)
{
(
);
.
(
L"("
);
.
(
defaultValue
);
.
(
L")"
);
}
}
}
void
(
*
)
override
{
FOREACH(Ptr<WfDeclaration>, decl, node->expandedDeclarations)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
decl
);)
{
decl
(
this
);
}
}
void
(
*
)
override
{
FOREACH(Ptr<WfDeclaration>, decl, node->expandedDeclarations)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
decl
);)
{
decl
(
this
);
}
}
};
void
(
*
,
stream
::
&
,
const
&
,
<
>
,
const
&
,
bool
)
{
WfGenerateClassMemberDeclVisitor
(
,
,
,
,
);
(&
visitor
);
}
class
WfGenerateClassMemberImplVisitor
:
public
,
public
::
{
public
:
*
;
stream
::
&
;
*
;
;
;
;
;
bool
=
false
;
WfGenerateClassMemberImplVisitor
(
*
,
stream
::
&
,
*
,
const
&
,
const
&
,
const
&
,
const
&
)
:config(
)
, writer(
)
, classDef(
)
, classBaseName(
)
, className(
)
, classFullName(
)
, prefix(
)
{
}
void
(
const
&
)
{
.
(
);
.
(
L"{/* USER_CONTENT_BEGIN("
+
+
L") */"
);
.
(
);
.
(
L"\tthrow ::vl::Exception(L\"You should implement this function.\");"
);
.
(
);
.
(
L"}/* USER_CONTENT_END() */"
);
}
void
(
*
)
override
{
}
void
(
*
)
override
{
if
(!
(
,
))
{
=
true
;
.
(
);
auto
=
->
(
,
,
+
L"::"
+
->
(
->
.
),
true
);
.
(
L""
);
bool
=
->
(
->
,
L"cpp"
,
L"UserImpl"
);
if
(
userImpl
)
{
(
);
}
else
{
->
(
,
->
,
,
returnType
);
}
}
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
auto
=
->
->
].
();
=
true
;
auto
=
dynamic_cast
<
*>(
->
->
].
());
<
>
;
FOREACH(Ptr<WfFunctionArgument>, argument, node->arguments)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
argument
);)
{
arguments
.
(
->
(
argument
.
));
}
.
(
);
->
(
,
methodInfo
,
arguments
,
+
L"::"
+
,
false
);
.
(
L""
);
=
0
;
FOREACH(Ptr<WfBaseConstructorCall>, call, node->baseConstructorCalls)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
call
);)
{
auto
=
(
scope
,
call
,
false
);
auto
=
->
->
baseConstructorCallResolvings
{
,
callType
()}].
;
.
(
);
if
(
callIndex
++ ==
0
)
{
.
(
L"\t: "
);
}
else
{
.
(
L"\t, "
);
}
.
(
->
(
callType
()));
.
(
L"("
);
FOREACH_INDEXER(Ptr<WfExpression>, argument, argumentIndex, call->arguments)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
call
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
if
(
bool
=
true
)
for
(
=
0
;
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
argument
);
argumentIndex
++)
{
if
(
argumentIndex
)
.
(
L", "
);
(
,
,
argument
,
callCtor
->
(
argumentIndex
)->
());
}
.
(
L")"
);
}
if
(
)
{
WfGenerateClassMemberInitVisitor
(
,
,
,
callIndex
);
FOREACH(Ptr<WfDeclaration>, member, classDef->declarations)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
member
);)
{
member
(&
visitor
);
}
}
bool
=
->
(
->
,
L"cpp"
,
L"UserImpl"
);
if
(
userImpl
)
{
(
);
}
else
{
->
(
,
->
,
,
nullptr
);
}
}
void
(
*
)
override
{
=
true
;
.
(
+
+
L"::~"
+
+
L"()"
);
bool
=
->
(
->
,
L"cpp"
,
L"UserImpl"
);
if
(
userImpl
)
{
(
);
}
else
{
->
(
,
->
,
,
nullptr
);
}
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
}
void
(
*
)
override
{
FOREACH(Ptr<WfDeclaration>, decl, node->expandedDeclarations)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
decl
);)
{
decl
(
this
);
}
}
void
(
*
)
override
{
FOREACH(Ptr<WfDeclaration>, decl, node->expandedDeclarations)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
decl
);)
{
decl
(
this
);
}
}
};
bool
(
*
,
stream
::
&
,
*
,
const
&
,
const
&
,
const
&
,
<
>
,
const
&
)
{
WfGenerateClassMemberImplVisitor
(
,
,
,
,
,
,
);
(&
visitor
);
return
visitor
.
;
}
}
}
}