ALib C++ Framework
by
Library Version:
2605 R0
Documentation generated by
Loading...
Searching...
No Matches
ALib
src
alib
expressions
plugins
autocast.hpp
Go to the documentation of this file.
1
//==================================================================================================
2
/// \file
3
/// This header-file is part of module \alib_expressions of the \aliblong.
4
///
5
/// Copyright 2013-2026 A-Worx GmbH, Germany.
6
/// Published under #"mainpage_license".
7
//==================================================================================================
8
ALIB_EXPORT
namespace
alib
{
namespace
expressions
{
namespace
plugins
{
9
10
//==================================================================================================
11
/// This built-in compiler plug-in of \alib_expressions_nl, performs auto-casts only if two
12
/// different types are given. In this case, the following casts are performed:
13
///
14
/// 1. If one argument is of type #"Types::String;*", the other is converted to
15
/// string. The expression function returned for (optional) de-compilation is \b "String()".
16
///
17
/// 2. If one argument is of type #"Types::Float;*" and the other of type
18
/// #"Types::Integer;*", the integral value is cast to floating point.
19
/// The expression function returned for (optional) de-compilation is \b "Float()".
20
///
21
/// 3. If one argument is of type #"Types::Float;*" and the other of type
22
/// #"Types::Boolean;*", the boolean value is cast to floating point.
23
/// The expression function returned for (optional) de-compilation is \b "Float()".
24
///
25
/// 4. If one argument is of type #"Types::Integer;*" and the other of type
26
/// #"Types::Boolean;*", the boolean value is cast to integer.
27
/// The expression function returned for (optional) de-compilation is \b "Integer()".
28
///
29
/// 5. If one argument is of type #"Types::Boolean;*", the other is converted to
30
/// boolean using an internal callback function that simply invokes box-function
31
/// #"FIsTrue".
32
/// The expression function returned for (optional) de-compilation is \b "Boolean()".
33
//==================================================================================================
34
struct
AutoCast
:
public
CompilerPlugin
{
35
/// Constructor.
36
/// @param compiler The compiler we will get attached to.
37
ALIB_DLL
AutoCast
(
Compiler
& compiler );
38
39
/// Virtual destructor.
40
virtual
~AutoCast
()
override
{}
41
42
/// Offers auto-cast functions for built-in types.
43
///
44
/// @param[out] ciAutoCast The compilation result.
45
/// @return \c true if an entry was found. \c false otherwise.
46
ALIB_DLL
47
virtual
bool
TryCompilation
(
CIAutoCast
& ciAutoCast )
override
;
48
};
49
50
}}}
// namespace [alib::expressions::detail]
ALIB_DLL
#define ALIB_DLL
Definition
alib.prepro.hpp:549
ALIB_EXPORT
#define ALIB_EXPORT
Definition
alib.prepro.hpp:538
alib::expressions::Compiler
Definition
compiler.hpp:52
alib::expressions::plugins
Definition
arithmetics.hpp:8
alib::expressions
Definition
compiler.cpp:1
alib
Definition
alox.cpp:14
alib::expressions::CompilerPlugin::CIAutoCast
Definition
compilerplugin.hpp:367
alib::expressions::CompilerPlugin::CompilerPlugin
CompilerPlugin(const NString &name, Compiler &compiler, CompilePriorities pPriority)
Definition
compilerplugin.hpp:434
alib::expressions::plugins::AutoCast::~AutoCast
virtual ~AutoCast() override
Virtual destructor.
Definition
autocast.hpp:40
alib::expressions::plugins::AutoCast::TryCompilation
virtual bool TryCompilation(CIAutoCast &ciAutoCast) override
alib::expressions::plugins::AutoCast::AutoCast
AutoCast(Compiler &compiler)