ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Fields | List of all members
Calculus::AutoCastEntry Struct Reference

#include <calculus.hpp>

Collaboration diagram for Calculus::AutoCastEntry:
[legend]

Class Description

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

Definition at line 782 of file calculus.hpp.

Public Fields

CallbackDecl Callback
 
const char * DbgCallbackName
 
std::vector< String > * OperatorsAccepted
 
std::vector< String > * OperatorsDeclined
 
Box ResultType
 
String ReverseCastFunctionName
 
Box Type
 

Member Data Documentation

◆ 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 811 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 aforementioned macro CALCULUS_CALLBACK use macro CALCULUS_DEFAULT_AUTOCAST instead.

Definition at line 825 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 791 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 this 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 800 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 835 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 functions 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.
Note that, 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 can not automatically convert integral types back to a custom type. This is even true for simple enumeration types.

Definition at line 855 of file calculus.hpp.

◆ Type

The type that is to be automatically casted.

Definition at line 785 of file calculus.hpp.


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