An entry of the field AutoCasts. Defines auto-casts for custom types.
Definition at line 748 of file calculus.hpp.
#include <calculus.hpp>
Public Field Index: | |
CallbackDecl | Callback |
const char * | DbgCallbackName |
std::vector< String > * | OperatorsAccepted |
std::vector< String > * | OperatorsDeclined |
Box | ResultType |
String | ReverseCastFunctionName |
Box | Type |
The type that is to be automatically cast. | |
CallbackDecl Callback |
Callback function to add to the program that performs the auto-cast.
If nullptr
is given, then an internal, predefined callback is used, which returns a value of type Types::Integer which is generated by taking the raw value of the argument box. This is especially useful for any boxed enum type that is to be made compatible with bitwise boolean operators (and other integral calculations and functions).
Definition at line 771 of file calculus.hpp.
const char* DbgCallbackName |
The C++ name of the callback function (only available with debug-builds of the library. Use preprocessor macro CALCULUS_CALLBACK to provide this field together with field Callback. The macro selects to prune the name string in release compilations.
If Callback is set to nullptr, the name of the internal function ("any2int") is inserted automatically. Instead of the aforementioned macro CALCULUS_CALLBACK use macro CALCULUS_DEFAULT_AUTOCAST instead.
Definition at line 783 of file calculus.hpp.
std::vector<String>* OperatorsAccepted |
List of operators that the auto-cast accepts. If nulled, then just any operator that is not in OperatorsDeclined is accepted.
Definition at line 755 of file calculus.hpp.
std::vector<String>* OperatorsDeclined |
List of operators that the auto-cast does not accept. An operator should not appear in both lists, this one and list OperatorsAccepted. However, it is does, then the operator is not accepted.
A value of nullptr
is allowed to indicate no declined operators.
Definition at line 762 of file calculus.hpp.
Box ResultType |
The result type given a sample box.
If field Callback is nullptr
to specify the use of the internal, default cast function, this field will be ignored and Types::Integer, will be set instead. Hence, in this case, this field can be specified as nullptr
.
Definition at line 791 of file calculus.hpp.
String ReverseCastFunctionName |
This is the name of the function that reverses the cast. The function is used when an expression with an auto-cast function is decompiled to generate compilable, optimized expression strings.
nullptr
) is used. The rationale is, that this library cannot automatically convert integral types back to a custom type. This is even true for simple enumeration types. Definition at line 809 of file calculus.hpp.
The type that is to be automatically cast.
Definition at line 751 of file calculus.hpp.