ALib C++ Library
by
Library Version:
2511 R0
Documentation generated by
Loading...
Searching...
No Matches
A-Worx
ALib
src
alib
expressions
plugins
autocast.inl
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
/// \emoji :copyright: 2013-2025 A-Worx GmbH, Germany.
6
/// Published under \ref mainpage_license "Boost Software 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 \alib{expressions;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 \alib{expressions;Types::Float} and the other of type
18
/// \alib{expressions;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 \alib{expressions;Types::Float} and the other of type
22
/// \alib{expressions;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 \alib{expressions;Types::Integer} and the other of type
26
/// \alib{expressions;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 \alib{expressions;Types::Boolean}, the other is converted to
30
/// boolean using an internal callback function that simply invokes box-function
31
/// \alib{boxing;FIsTrue}.
32
/// The expression function returned for (optional) de-compilation is \b "Boolean()".
33
//==================================================================================================
34
struct
AutoCast
:
public
CompilerPlugin
35
{
36
/// Constructor.
37
/// @param compiler The compiler we will get attached to.
38
ALIB_DLL
AutoCast
(
Compiler
& compiler );
39
40
/// Virtual destructor.
41
virtual
~AutoCast
()
override
{}
42
43
/// Offers auto-cast functions for built-in types.
44
///
45
/// @param[out] ciAutoCast The compilation result.
46
/// @return \c true if an entry was found. \c false otherwise.
47
ALIB_DLL
48
virtual
bool
TryCompilation
(
CIAutoCast
& ciAutoCast )
override
;
49
};
50
51
}}}
// namespace [alib::expressions::detail]
alib::expressions::Compiler
Definition
compiler.inl:54
ALIB_DLL
#define ALIB_DLL
Definition
alib.inl:503
ALIB_EXPORT
#define ALIB_EXPORT
Definition
alib.inl:497
alib::expressions::plugins
Definition
arithmetics.inl:8
alib::expressions
Definition
compiler.cpp:32
alib
Definition
ALib.Boxing.StdFunctors.H:18
alib::expressions::CompilerPlugin::CIAutoCast
Definition
compilerplugin.inl:372
alib::expressions::CompilerPlugin::CompilerPlugin
CompilerPlugin(const NString &name, Compiler &compiler, CompilePriorities pPriority)
Definition
compilerplugin.inl:438
alib::expressions::plugins::AutoCast::~AutoCast
virtual ~AutoCast() override
Virtual destructor.
Definition
autocast.inl:41
alib::expressions::plugins::AutoCast::TryCompilation
virtual ALIB_DLL bool TryCompilation(CIAutoCast &ciAutoCast) override
alib::expressions::plugins::AutoCast::AutoCast
ALIB_DLL AutoCast(Compiler &compiler)