#include "WfCpp.h"
namespace
{
namespace
{
namespace
{
using
namespace
collections
;
using
namespace
regex
;
using
namespace
reflection
;
using
namespace
reflection
::
description
;
using
namespace
stream
;
using
namespace
emitter
;
::
(
analyzer
::
*
,
const
&
,
const
&
)
:manager(
)
, regexSplitName(
L"::"
)
, regexSpecialName(
L"/<(<category>/w+)(-(<category>/w+))*/>(<name>/w*)"
)
, regexTemplate(
L", /$Arguments|/$Arguments, |/$/l+"
)
, assemblyName(
)
, assemblyNamespace(
)
{
<
>(
);
();
for
(
=
0
;
i
<
.
();
i
++)
{
const
auto
&
=
.
(
i
);
(
const_cast
<
<
<
>>&>(
values
));
}
for
(
=
0
;
i
<
.
();
i
++)
{
const
auto
&
=
.
(
i
);
(
const_cast
<
<
<
>>&>(
values
));
}
for
(
=
0
;
i
<
.
();
i
++)
{
const
auto
&
=
.
(
i
);
(
const_cast
<
<
<
>>&>(
values
));
}
();
}
::
()
{
}
void
::
(
stream
::
&
,
<
>
,
const
&
,
*
)
{
.
(
);
.
(
L"return "
);
(
this
,
,
,
);
.
(
L";"
);
}
void
::
(
stream
::
&
,
<
>
,
const
&
,
*
)
{
(
this
,
<
>(),
,
,
,
(
L"\t"
,
false
),
);
}
::(
const
& ,
const
& )
{
return
L"__vwsn_"
+
+
L"s::"
+
(
,
L"_"
);
}
::
(
const
&
,
const
&
,
bool
)
{
if
(
.
() >
0
&&
0
] ==
L'$'
)
{
return
L"__vwsno_"
+
.
(
1
,
.
() -
1
);
}
auto
=
.
(
);
if
(
match
)
{
return
+
(
match
()[
L"category"
])
.Select([](
const
&
)
{
return
rs
.
();
})
.Aggregate([](
const
&
,
const
&
)
{
return
a
+
L"_"
+
b
;
})
+
L"_"
+
match
()[
L"name"
][
0
].
();
}
else
if
(
)
{
return
;
}
{
return
;
}
}
::
(
const
&
)
{
return
(
,
(
L"__vwsn_"
,
false
),
false
);
}
::
(
const
&
,
const
&
)
{
return
(
,
,
true
);
}
::
(
const
&
,
)
{
<
<
>>
;
.
(
,
false
,
matches
);
return
(
0
] ==
L':'
?
:
::
) +
(
matches
)
.Select([
this
](
<
>
)
{
return
(
match
().
());
})
.Aggregate([&](
const
&
,
const
&
)
{
return
a
+
b
;
});
}
::
(
*
,
)
{
=
(
->
()) +
+
L"("
;
=
->
();
for
(
=
0
;
i
<
count
;
i
++)
{
if
(
i
>
0
)
{
type
+=
L", "
;
}
type
(
->
(
i
)->
());
}
type
+=
L")"
;
return
type
;
}
::
(
*
)
{
if
(
->
() ==
::
)
{
return
(
->
());
}
CHECK_ERROR(typeInfo->GetDecorator() == ITypeInfo::Generic, L"WfCppConfig::ConvertFunctionType(ITypeInfo*)#Internal error: Wrong function type.");
do
{
if
(!(
->
() ==
::
))
throw
(
L"WfCppConfig::ConvertFunctionType(ITypeInfo*)#Internal error: Wrong function type."
);}
while
(
0
);
CHECK_ERROR(typeInfo->GetTypeDescriptor() == description::GetTypeDescriptor<IValueFunctionProxy>(), L"WfCppConfig::ConvertFunctionType(ITypeInfo*)#Internal error: Wrong function type.");
do
{
if
(!(
->
() ==
description
::
<
>()))
throw
(
L"WfCppConfig::ConvertFunctionType(ITypeInfo*)#Internal error: Wrong function type."
);}
while
(
0
);
=
(
->
(
0
)) +
L"("
;
=
->
();
for
(
=
1
;
i
<
count
;
i
++)
{
if
(
i
>
1
)
type
+=
L", "
;
type
(
->
(
i
));
}
type
+=
L")"
;
return
type
;
}
bool
::
(
*
)
{
switch
(
->
())
{
case
::
:
if
(
->
() ==
description
::
<
>())
{
return
true
;
}
else
if
(
->
() ==
description
::
<
>())
{
return
true
;
}
else
{
return
false
;
}
default
:
return
false
;
}
}
::
(
*
,
)
{
return
(
(
),
);
}
::
(
*
,
bool
)
{
switch
(
->
())
{
case
::
:
return
(
->
(),
) +
L"*"
;
case
::
:
if
(
->
()->
() ==
::
)
{
if
(
->
() ==
description
::
<
>())
{
return
(
->
(),
);
}
else
if
(
->
() ==
description
::
<
>())
{
return
(
->
(),
);
}
}
return
L"::vl::Ptr<"
+
(
->
(),
) +
L">"
;
case
::
:
return
L"::vl::Nullable<"
+
(
->
(),
) +
L">"
;
case
::
:
if
(
->
() ==
description
::
<
>())
{
return
L"::vl::Func<"
+
(
) +
L">"
;
}
else
if
(
->
() ==
description
::
<
>())
{
return
L"::vl::collections::LazyList<"
+
(
->
(
0
),
) +
L">"
;
}
else
{
return
(
->
(),
);
}
default
:;
}
if
(
)
{
switch
(
->
()->
())
{
case
::
:
if
(
.
().
(
->
()))
{
return
L"::"
+
CppNameToHeaderEnumStructName
(
(
->
()),
L"enum"
);
}
break
;
case
::
:
if
(
.
().
(
->
()))
{
return
L"::"
+
CppNameToHeaderEnumStructName
(
(
->
()),
L"struct"
);
}
break
;
default
:;
}
return
(
->
());
}
else
{
return
(
->
());
}
}
::
(
*
)
{
auto
=
->
();
bool
=
td
==
description
::
<
>() ||
td
==
description
::
<
>() ||
(
->
() ==
::
&&
->
()->
() ==
::
&&
(
td
==
description
::
<
>() ||
td
==
description
::
<
>()
)
);
if
(
constRef
)
{
return
L"const "
+
(
) +
L"&"
;
}
else
{
return
(
);
}
}
::
(
*
)
{
switch
(
->
())
{
case
::
:
return
L"nullptr"
;
case
::
:
return
L""
;
case
::
:
return
L""
;
case
::
:
return
L""
;
default
:;
}
auto
=
->
();
if
((
td
->
()
::
) !=
::
)
{
return
L"static_cast<"
+
(
) +
L">(0)"
;
}
if
(
td
==
description
::
<
>())
return
L"0"
;
if
(
td
==
description
::
<
>())
return
L"0"
;
if
(
td
==
description
::
<
>())
return
L"0"
;
if
(
td
==
description
::
<
>())
return
L"0"
;
if
(
td
==
description
::
<
>())
return
L"0"
;
if
(
td
==
description
::
<
>())
return
L"0"
;
if
(
td
==
description
::
<
>())
return
L"0"
;
if
(
td
==
description
::
<
>())
return
L"0"
;
if
(
td
==
description
::
<
bool
>())
return
L"false"
;
if
(
td
==
description
::
<
float
>())
return
L"0.0f"
;
if
(
td
==
description
::
<
double
>())
return
L"0.0"
;
return
L""
;
}
bool
::
IsClassHasUserImplMethods
(
<
>
,
bool
)
{
<
<
>>
;
(
unprocessed
,
);
for
(
=
0
;
i
<
unprocessed
.
();
i
++)
{
auto
=
unprocessed
i
];
if
(
auto
=
memberDecl
.
<
>())
{
(
unprocessed
,
cfe
,
true
);
}
else
if
(
auto
=
memberDecl
.
<
>())
{
(
unprocessed
,
cse
,
true
);
}
else
if
(
auto
=
memberDecl
.
<
>())
{
if
(
)
{
(
unprocessed
,
classDecl
,
true
);
}
}
else
if
(
(
memberDecl
,
L"cpp"
,
L"UserImpl"
))
{
return
true
;
}
}
return
false
;
}
::
(
<
>
)
{
=
0
;
auto
=
->
.
()].
();
while
(
scope
)
{
if
(
scope
->
.
<
>())
{
result
++;
}
scope
=
scope
->
.
();
}
return
result
;
}
void
::
(
<
>
,
collections
::
<
>&
)
{
auto
=
->
.
()].
();
auto
=
(
td
);
=
(
);
<
<
>>
;
.
(
name
,
false
,
matches
);
(
,
(
matches
)
.Take(
count
)
.Select([
this
](
<
>
)
{
return
(
match
().
());
})
);
}
::
(
<
>
)
{
auto
=
->
.
()].
();
auto
=
(
td
);
=
(
);
<
<
>>
;
.
(
name
,
false
,
matches
);
return
(
matches
)
.Skip(
count
)
.Select([
this
](
<
>
)
{
return
(
match
().
());
})
.Aggregate([](
const
&
,
const
&
)
{
return
a
+
L"::"
+
b
;
});
}
::
(
stream
::
&
,
collections
::
<
>&
,
collections
::
<
>&
)
{
=
0
;
for
(
=
0
;
i
<
.
() &&
i
<
.
();
i
++)
{
if
(
i
] ==
i
])
{
commonPrefix
++;
}
else
{
break
;
}
}
while
(
.
() >
commonPrefix
)
{
for
(
=
1
;
i
<
.
();
i
++)
{
.
(
L'\t'
);
}
.
(
L"}"
);
.
(
.
() -
1
);
}
;
for
(
=
0
;
i
<
.
();
i
++)
{
prefix
L'\t'
;
}
for
(
=
commonPrefix
;
i
<
.
();
i
++)
{
.
(
prefix
);
.
(
L"namespace "
);
.
(
i
]);
.
(
prefix
);
.
(
L"{"
);
.
(
i
]);
prefix
L'\t'
;
}
return
prefix
;
}
::
(
stream
::
&
,
const
&
,
collections
::
<
>&
,
&
)
{
<
<
>>
;
.
(
,
false
,
matches
);
<
>
;
(
nss2
,
(
matches
)
.Select([
this
](
<
>
)
{
return
(
match
().
());
})
);
nss2
nss2
.
() -
1
];
nss2
.
(
nss2
.
() -
1
);
return
(
,
,
nss2
);
}
void
::
(
stream
::
&
,
collections
::
<
>&
)
{
while
(
.
() >
0
)
{
for
(
=
1
;
i
<
.
();
i
++)
{
.
(
L'\t'
);
}
.
(
L"}"
);
.
(
0
);
}
}
}
}
}