ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
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 #"mainpage_license".
7//==================================================================================================
8ALIB_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//==================================================================================================
34struct AutoCast : public CompilerPlugin
35{
36 /// Constructor.
37 /// @param compiler The compiler we will get attached to.
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.
48 virtual bool TryCompilation( CIAutoCast& ciAutoCast ) override;
49};
50
51}}} // namespace [alib::expressions::detail]
#define ALIB_DLL
Definition alib.inl:573
#define ALIB_EXPORT
Definition alib.inl:562
CompilerPlugin(const NString &name, Compiler &compiler, CompilePriorities pPriority)
virtual ~AutoCast() override
Virtual destructor.
Definition autocast.inl:41
virtual bool TryCompilation(CIAutoCast &ciAutoCast) override