#include "GuiInstanceLoader.h"
#include "WorkflowCodegen/GuiInstanceLoader_WorkflowCodegen.h"
#include "../Controls/GuiApplication.h"
#include "../Resources/GuiParserManager.h"
namespace
{
namespace
{
using
namespace
collections
;
using
namespace
reflection
::
description
;
using
namespace
parsing
;
using
namespace
workflow
;
using
namespace
workflow
::
analyzer
;
using
namespace
workflow
::
runtime
;
using
namespace
controls
;
using
namespace
stream
;
class
GuiResourceInstanceBinder
:
public
,
public
{
public
:
()
override
{
return
::
;
}
bool
ApplicableToConstructorArgument
()
override
{
return
true
;
}
bool
()
override
{
return
false
;
}
<
workflow
::
>
GenerateConstructorArgument
(
GuiResourcePrecompileContext
&
,
types
::
&
,
*
,
const
::
&
,
<
>
,
const
&
,
,
::
&
)
override
{
,
;
if
(!
(
,
protocol
,
path
))
{
.
(
({
.
},
,
L"Precompile: \""
+
+
L"\" is not a valid resource uri."
));
return
nullptr
;
}
else
if
(!
.
(
protocol
,
path
))
{
.
(
({
.
},
,
L"Precompile: Resource \""
+
+
L"\" does not exist."
));
return
nullptr
;
}
else
{
return
(
,
,
,
,
,
protocol
,
path
,
,
);
}
}
<
workflow
::
>
(
GuiResourcePrecompileContext
&
,
types
::
&
,
,
description
::
*
,
*
,
const
::
&
,
<
>
,
const
&
,
,
::
&
)
override
{
,
;
if
(!
(
,
protocol
,
path
))
{
.
(
({
.
},
,
L"Precompile: \""
+
+
L"\" is not a valid resource uri."
));
return
nullptr
;
}
else
if
(!
.
(
protocol
,
path
))
{
.
(
({
.
},
,
L"Precompile: Resource \""
+
+
L"\" does not exist."
));
return
nullptr
;
}
else
{
return
Workflow_InstallUriProperty
(
,
,
,
,
,
,
protocol
,
path
,
,
);
}
}
};
class
GuiReferenceInstanceBinder
:
public
,
public
{
public
:
()
override
{
return
::
;
}
bool
ApplicableToConstructorArgument
()
override
{
return
false
;
}
bool
()
override
{
return
false
;
}
<
workflow
::
>
GenerateConstructorArgument
(
GuiResourcePrecompileContext
&
,
types
::
&
,
*
,
const
::
&
,
<
>
,
const
&
,
,
::
&
)
override
{
CHECK_FAIL(L"GuiReferenceInstanceBinder::GenerateConstructorArgument()#This binder does not support binding to constructor arguments. Please call ApplicableToConstructorArgument() to determine before calling this function.");
do
{
throw
(
L"GuiReferenceInstanceBinder::GenerateConstructorArgument()#This binder does not support binding to constructor arguments. Please call ApplicableToConstructorArgument() to determine before calling this function."
);}
while
(
0
);
}
<
workflow
::
>
(
GuiResourcePrecompileContext
&
,
types
::
&
,
,
description
::
*
,
*
,
const
::
&
,
<
>
,
const
&
,
,
::
&
)
override
{
auto
=
<
>();
expression
.
;
return
Workflow_InstallEvalProperty
(
,
,
,
,
,
,
expression
,
,
);
}
};
class
:
public
,
public
{
public
:
()
override
{
return
::
;
}
bool
ApplicableToConstructorArgument
()
override
{
return
true
;
}
bool
()
override
{
return
false
;
}
<
workflow
::
>
GenerateConstructorArgument
(
GuiResourcePrecompileContext
&
,
types
::
&
,
*
,
const
::
&
,
<
>
,
const
&
,
,
::
&
)
override
{
return
(
, {
.
},
,
,
);
}
<
workflow
::
>
(
GuiResourcePrecompileContext
&
,
types
::
&
,
,
description
::
*
,
*
,
const
::
&
,
<
>
,
const
&
,
,
::
&
)
override
{
if
(
auto
=
(
, {
.
},
,
,
))
{
return
Workflow_InstallEvalProperty
(
,
,
,
,
,
,
expression
,
,
);
}
return
nullptr
;
}
};
class
:
public
,
public
{
public
:
()
override
{
return
::
;
}
bool
ApplicableToConstructorArgument
()
override
{
return
false
;
}
bool
()
override
{
return
true
;
}
<
workflow
::
>
GenerateConstructorArgument
(
GuiResourcePrecompileContext
&
,
types
::
&
,
*
,
const
::
&
,
<
>
,
const
&
,
,
::
&
)
override
{
CHECK_FAIL(L"GuiBindInstanceBinder::GenerateConstructorArgument()#This binder does not support binding to constructor arguments. Please call ApplicableToConstructorArgument() to determine before calling this function.");
do
{
throw
(
L"GuiBindInstanceBinder::GenerateConstructorArgument()#This binder does not support binding to constructor arguments. Please call ApplicableToConstructorArgument() to determine before calling this function."
);}
while
(
0
);
}
<
workflow
::
>
(
GuiResourcePrecompileContext
&
,
types
::
&
,
,
description
::
*
,
*
,
const
::
&
,
<
>
,
const
&
,
,
::
&
)
override
{
if
(
auto
=
(
, {
.
},
,
,
))
{
auto
=
<
>();
inferExpr
expression
;
inferExpr
(
->
());
auto
=
<
>();
bindExpr
inferExpr
;
return
Workflow_InstallBindProperty
(
,
,
,
,
bindExpr
);
}
return
nullptr
;
}
};
class
:
public
,
public
{
public
:
()
override
{
return
::
;
}
bool
()
override
{
return
false
;
}
bool
()
override
{
return
true
;
}
<
workflow
::
>
GenerateConstructorArgument
(
GuiResourcePrecompileContext
&
,
types
::
&
,
*
,
const
::
&
,
<
>
,
const
&
,
,
::
&
)
override
{
CHECK_FAIL(L"GuiFormatInstanceBinder::GenerateConstructorArgument()#This binder does not support binding to constructor arguments. Please call ApplicableToConstructorArgument() to determine before calling this function.");
do
{
throw
(
L"GuiFormatInstanceBinder::GenerateConstructorArgument()#This binder does not support binding to constructor arguments. Please call ApplicableToConstructorArgument() to determine before calling this function."
);}
while
(
0
);
}
<
workflow
::
>
(
GuiResourcePrecompileContext
&
,
types
::
&
,
,
description
::
*
,
*
,
const
::
&
,
<
>
,
const
&
,
,
::
&
)
override
{
if
(
auto
=
(
, {
.
},
L"bind($\""
+
+
L"\")"
,
,
, {
0
,
7
}))
{
return
Workflow_InstallBindProperty
(
,
,
,
,
expression
);
}
return
nullptr
;
}
};
class
GuiLocalizedStringInstanceBinder
:
public
,
public
{
public
:
()
override
{
return
::
;
}
bool
ApplicableToConstructorArgument
()
override
{
return
false
;
}
bool
()
override
{
return
true
;
}
<
workflow
::
>
GenerateConstructorArgument
(
GuiResourcePrecompileContext
&
,
types
::
&
,
*
,
const
::
&
,
<
>
,
const
&
,
,
::
&
)
override
{
CHECK_FAIL(L"GuiLocalizedStringInstanceBinder::GenerateConstructorArgument()#This binder does not support binding to constructor arguments. Please call ApplicableToConstructorArgument() to determine before calling this function.");
do
{
throw
(
L"GuiLocalizedStringInstanceBinder::GenerateConstructorArgument()#This binder does not support binding to constructor arguments. Please call ApplicableToConstructorArgument() to determine before calling this function."
);}
while
(
0
);
}
<
workflow
::
>
(
GuiResourcePrecompileContext
&
,
types
::
&
,
,
description
::
*
,
*
,
const
::
&
,
<
>
,
const
&
,
,
::
&
)
override
{
if
(
auto
=
(
, {
.
},
,
,
, {
0
,
0
}))
{
=
.
();
if
(
auto
=
expression
.
<
>())
{
if
(
auto
=
callExpr
.
<
>())
{
auto
=
(
.
)
.Where([](
<
>
)
{
return
ls
;
})
.First(
nullptr
);
if
(
defaultLs
)
{
auto
=
<
>();
thisExpr
.
=
L"<this>"
;
thisExpr
refExpr
;
auto
=
<
>();
thisMember
thisExpr
;
thisMember
.
=
defaultLs
->name.ToString();
thisMember
refExpr
;
auto
=
<
>();
refMember
thisMember
;
refMember
.
refExpr
.
;
refMember
refExpr
;
callExpr
refMember
;
goto
PASSED;
}
else
{
.
({
,
L"Precompiled: Omitting the name of the localized strings requires specifying a default one in <ref.LocalizedStrings> by adding a Default=\"true\" attribute."
});
}
}
else
if
(
auto
=
callExpr
.
<
>())
{
if
(
auto
=
memberExpr
.
<
>())
{
auto
=
<
>();
thisExpr
.
=
L"<this>"
;
thisExpr
refStrings
;
auto
=
<
>();
thisMember
thisExpr
;
thisMember
.
refStrings
.
;
thisMember
refStrings
;
memberExpr
thisMember
;
goto
PASSED;
}
}
.
({
,
L"Precompiled: The function expression in binding \"-str\" should be a \"<string-name>\" or \"<localized-strings-name>.<string-name>\"."
});
PASSED:;
}
else
{
.
({
,
L"Precompiled: Expression in binding \"-str\" should be a function call expression."
});
}
if
(
errorCount
==
.
())
{
auto
=
<
>();
bindExpr
expression
;
bindExpr
expression
;
return
Workflow_InstallBindProperty
(
,
,
,
,
bindExpr
);
}
}
return
nullptr
;
}
};
class
GuiEvalInstanceEventBinder
:
public
,
public
{
public
:
()
override
{
return
::
;
}
<
workflow
::
>
(
GuiResourcePrecompileContext
&
,
types
::
&
,
,
description
::
*
,
const
&
,
,
::
&
)
override
{
bool
=
false
;
{
auto
=
.
();
while
(
true
)
{
switch
(*
reading
)
{
case
' '
:
case
'\t'
:
case
'\r'
:
case
'\n'
:
reading
++;
break
;
default
:
goto
BEGIN_TESTING;
}
}
BEGIN_TESTING:
coroutine
= *
reading
==
'$'
;
}
auto
=
coroutine
? &
Workflow_ParseCoProviderStatement
: &
;
if
(
auto
=
parseFunction
(
, {
.
},
,
,
, {
0
,
0
}))
{
return
Workflow_InstallEvalEvent
(
,
,
,
,
statement
);
}
return
nullptr
;
}
};
class
GuiPredefinedInstanceBindersPlugin
:
public
,
public
{
public
:
GUI_PLUGIN_NAME(GacUI_Compiler_ParsersAndBinders)
vl
::
()
override
{
return
L"GacUI_Compiler_ParsersAndBinders"
; }
void
(
vl
::
collections
::
<
>&
)
override
{
GUI_PLUGIN_DEPEND(GacUI_Parser);
GUI_PLUGIN_DEPEND(GacUI_Res_ResourceResolver);
.
(
L"GacUI_Res_ResourceResolver"
);
GUI_PLUGIN_DEPEND(GacUI_Instance);
GUI_PLUGIN_DEPEND(GacUI_Instance_Reflection);
.
(
L"GacUI_Instance_Reflection"
);
}
void
()
override
{
();
();
{
*
=
();
manager
->
(
L"WORKFLOW"
, &
);
manager
->
(
L"WORKFLOW"
,
L"WORKFLOW-TYPE"
, &
);
manager
->
(
L"WORKFLOW"
,
L"WORKFLOW-EXPRESSION"
, &
);
manager
->
(
L"WORKFLOW"
,
L"WORKFLOW-STATEMENT"
, &
);
manager
->
(
L"WORKFLOW"
,
L"WORKFLOW-COPROVIDER-STATEMENT"
, &
WfParseCoProviderStatement
);
manager
->
(
L"WORKFLOW"
,
L"WORKFLOW-DECLARATION"
, &
);
manager
->
(
L"WORKFLOW"
,
L"WORKFLOW-MODULE"
, &
);
manager
->
(
L"INSTANCE-QUERY"
, &
);
manager
->
(
L"INSTANCE-QUERY"
,
L"INSTANCE-QUERY"
, &
);
}
{
IGuiInstanceLoaderManager
*
=
();
manager
->
(
new
GuiResourceInstanceBinder
);
manager
->
(
new
GuiReferenceInstanceBinder
);
manager
->
(
new
);
manager
->
(
new
);
manager
->
(
new
);
manager
->
(
new
GuiLocalizedStringInstanceBinder
);
manager
->
(
new
GuiEvalInstanceEventBinder
);
}
}
void
()
override
{
}
};
GUI_REGISTER_PLUGIN(GuiPredefinedInstanceBindersPlugin)
class
GuiRegisterPluginClass_GuiPredefinedInstanceBindersPlugin
{
public
:
GuiRegisterPluginClass_GuiPredefinedInstanceBindersPlugin
() {
vl
::
presentation
::
controls
::
()->
(
new
GuiPredefinedInstanceBindersPlugin
); } }
instance_GuiRegisterPluginClass_GuiPredefinedInstanceBindersPlugin
;
}
}