#include "WfCpp.h"
namespace
{
namespace
{
namespace
{
using
namespace
collections
;
void
::
(
stream
::
&
)
{
.
(
L"#if defined( _MSC_VER)"
);
.
(
L"#pragma warning(push)"
);
.
(
L"#pragma warning(disable:4250)"
);
.
(
L"#elif defined(__GNUC__)"
);
.
(
L"#pragma GCC diagnostic push"
);
.
(
L"#elif defined(__clang__)"
);
.
(
L"#pragma clang diagnostic push"
);
.
(
L"#pragma clang diagnostic ignored \"-Wparentheses-equality\""
);
.
(
L"#endif"
);
}
void
::
(
stream
::
&
)
{
.
(
L"#if defined( _MSC_VER)"
);
.
(
L"#pragma warning(pop)"
);
.
(
L"#elif defined(__GNUC__)"
);
.
(
L"#pragma GCC diagnostic pop"
);
.
(
L"#elif defined(__clang__)"
);
.
(
L"#pragma clang diagnostic pop"
);
.
(
L"#endif"
);
}
void
::
(
stream
::
&
)
{
.
(
L"#define GLOBAL_SYMBOL "
);
.
(
L"::"
);
.
(
);
.
(
L"::"
);
.
(
);
.
(
L"::"
);
.
(
L"#define GLOBAL_NAME "
);
.
(
L"::"
);
.
(
);
.
(
L"::"
);
.
(
);
.
(
L"::Instance()."
);
.
(
L"#define GLOBAL_OBJ "
);
.
(
L"&::"
);
.
(
);
.
(
L"::"
);
.
(
);
.
(
L"::Instance()"
);
}
void
::
(
stream
::
&
)
{
.
(
L"#undef GLOBAL_SYMBOL"
);
.
(
L"#undef GLOBAL_NAME"
);
.
(
L"#undef GLOBAL_OBJ"
);
}
void
::(
stream
::
& ,
bool
)
{
(
);
.
(
L""
);
{
<
,
<
>> ;
<
,
<
>> ;
(
reversedLambdaExprs
,
reversedClassExprs
);
if
(
reversedLambdaExprs
.
() +
reversedClassExprs
.
() >
0
)
{
.
(
L"namespace "
);
.
(
);
.
(
L"{"
);
FOREACH(Ptr<WfExpression>, expr, reversedLambdaExprs.Values())
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>& = ::
vl
::
collections
::
(
reversedLambdaExprs
.
());
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
> ;
__foreach_iterator__
.
(
expr
);)
{
WriteHeader_ClosurePreDecl
(
,
expr
);
}
FOREACH(Ptr<WfNewInterfaceExpression>, expr, reversedClassExprs.Values())
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>& = ::
vl
::
collections
::
(
reversedClassExprs
.
());
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
> ;
__foreach_iterator__
.
(
expr
);)
{
WriteHeader_ClosurePreDecl
(
,
expr
);
}
.
(
L"}"
);
.
(
L""
);
}
}
<
> ;
if
(
.
() >
0
)
{
WriteHeader_MainHeaderEnums
(
,
nss
);
if
(
.
().
(
nullptr
))
{
FOREACH(Ptr<WfEnumDeclaration>, decl, enumDecls[nullptr])
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>& = ::
vl
::
collections
::
(
nullptr
]);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
> ;
__foreach_iterator__
.
(
decl
);)
{
(
,
decl
,
nss
,
false
);
}
.
(
L""
);
}
}
if
(
.
() >
0
)
{
WriteHeader_MainHeaderStructs
(
,
nss
);
if
(
.
().
(
nullptr
))
{
FOREACH(Ptr<WfStructDeclaration>, decl, structDecls[nullptr])
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>& = ::
vl
::
collections
::
(
nullptr
]);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
> ;
__foreach_iterator__
.
(
decl
);)
{
(
,
decl
,
nss
,
false
);
}
.
(
L""
);
}
}
if
(
.
().
(
nullptr
))
{
FOREACH(Ptr<WfClassDeclaration>, decl, classDecls[nullptr])
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>& = ::
vl
::
collections
::
(
nullptr
]);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
> ;
__foreach_iterator__
.
(
decl
);)
{
(
,
decl
,
nss
);
}
.
(
L""
);
if
(
)
{
=
.
().
(
0
);
if
(
index
!= -
1
)
{
FOREACH(Ptr<WfClassDeclaration>, decl, headerFilesClasses.GetByIndex(index))
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>& = ::
vl
::
collections
::
(
.
(
index
));
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
> ;
__foreach_iterator__
.
(
decl
);)
{
(
,
decl
,
nss
);
.
(
L""
);
}
}
}
else
{
FOREACH(Ptr<WfClassDeclaration>, decl, classDecls[nullptr])
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>& = ::
vl
::
collections
::
(
nullptr
]);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
> ;
__foreach_iterator__
.
(
decl
);)
{
(
,
decl
,
nss
);
.
(
L""
);
}
}
}
(
,
nss
);
(
);
.
(
L""
);
(
);
}
void
::(
stream
::
& ,
)
{
(
);
.
(
L""
);
<
> ;
if
(
.
().
(
nullptr
))
{
=
.
().
(
);
if
(
index
!= -
1
)
{
FOREACH(Ptr<WfClassDeclaration>, decl, headerFilesClasses.GetByIndex(index))
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>& = ::
vl
::
collections
::
(
.
(
index
));
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
> ;
__foreach_iterator__
.
(
decl
);)
{
(
,
decl
,
nss
);
.
(
L""
);
}
}
}
(
,
nss
);
.
(
L""
);
(
);
}
void
::
(
stream
::
&
,
bool
)
{
(
);
.
(
L""
);
(
);
.
(
L""
);
(
);
.
(
L""
);
if
(
.
().
(
nullptr
))
{
<
>
;
if
(
)
{
=
.
().
(
L""
);
if
(
index
!= -
1
)
{
FOREACH(Ptr<WfClassDeclaration>, decl, customFilesClasses.GetByIndex(index))
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
.
(
index
));
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
decl
);)
{
(
,
decl
,
nss
);
}
}
}
else
{
FOREACH(Ptr<WfClassDeclaration>, decl, classDecls[nullptr])
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
nullptr
]);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
decl
);)
{
(
,
decl
,
nss
);
}
}
(
,
nss
);
}
(
);
.
(
L""
);
(
);
}
void
::(
stream
::
& ,
const
& )
{
(
);
.
(
L""
);
<
> ;
FOREACH(Ptr<WfClassDeclaration>, decl, customFilesClasses.Get(fileName))
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>& = ::
vl
::
collections
::
(
.
(
));
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
> ;
__foreach_iterator__
.
(
decl
);)
{
(
,
decl
,
nss
);
.
(
L""
);
}
(
,
nss
);
(
);
}
void
::
(
stream
::
&
,
const
&
)
{
(
);
.
(
L""
);
(
);
.
(
L""
);
if
(
(
.
(
))
.
([=](
<
>
)
{
return
IsClassHasUserImplMethods
(
decl
,
true
);
}))
{
.
(
L"/* USER_CONTENT_BEGIN(custom global declarations) */"
);
.
(
L"/* USER_CONTENT_END() */"
);
.
(
L""
);
}
<
>
;
FOREACH(Ptr<WfClassDeclaration>, decl, customFilesClasses.Get(fileName))
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
.
(
));
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
decl
);)
{
(
,
decl
,
nss
);
}
(
,
nss
);
(
);
.
(
L""
);
(
);
}
void
::(
stream
::
& ,
bool
)
{
(
);
if
(
->
.
() >
0
)
{
.
(
L""
);
(
);
.
(
L""
);
}
(
);
}
void
::
(
stream
::
&
,
bool
)
{
(
);
if
(
->
.
() >
0
)
{
.
(
L""
);
(
);
.
(
L""
);
}
(
);
}
}
}
}