ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
Calculus::AutoCastEntry Struct Reference

Description:

An entry of the field AutoCasts. Defines auto-casts for custom types.

Definition at line 748 of file calculus.hpp.

#include <calculus.hpp>

Collaboration diagram for Calculus::AutoCastEntry:
[legend]

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.
 

Field Details:

◆ Callback

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.

◆ DbgCallbackName

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.

◆ OperatorsAccepted

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.

◆ OperatorsDeclined

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.

◆ ResultType

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.

◆ ReverseCastFunctionName

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.

Note
This method is needed only if "normalized, optimized expression strings" are to be generated. For more information on this topic consult manual section 11.5.6 Normalized, Optimized Expression Strings.
If the aforementioned feature is used, then this function name has to be provided together with the implementation of the expression function itself, even if the internal default cast implementation (activated by setting field Callback to 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.

◆ Type

The type that is to be automatically cast.

Definition at line 751 of file calculus.hpp.


The documentation for this struct was generated from the following file: