struct Bindgen::Crystal::Pass

Overview

Methods for passing data from Crystal and Crystal bindings to C++.

This is a helper struct: Cheap to create and to pass around.

Included Modules

Defined in:

bindgen/crystal/pass.cr

Constant Summary

Log = ::Log.for(self)

Constructors

Instance Method Summary

Instance methods inherited from module Bindgen::TypeHelper

cpp_class_name(class_name : String) : String cpp_class_name, passthrough(type : Parser::Type) passthrough, proc_by_pointer?(type : Parser::Type) : Bool proc_by_pointer?, reconfigure_pass_type(pass_by, is_ref, ptr) reconfigure_pass_type, structure_hosted?(rules : TypeDatabase::TypeConfig) : Bool structure_hosted?, type_copied?(type) : Bool type_copied?, type_pointer_depth(type : Parser::Type) : Int32 type_pointer_depth, variadic_argument : Call::VariadicArgument variadic_argument

Constructor Detail

def self.new(db : TypeDatabase) #

[View source]

Instance Method Detail

def arguments_to_binding(list : Enumerable(Parser::Argument), outs = [] of Int32) #

Turns the list of arguments into a list of Call::Arguments. The arguments at the indices outs, see Parser::Method#out_arguments, become Call::OutArguments, see #out_argument_to_binding.


[View source]
def arguments_to_wrapper(list : Enumerable(Parser::Argument), outs = [] of Int32, block = true) #

Turns the list of arguments into a list of Call::Arguments. Of the out arguments at the indices outs, see Parser::Method#out_arguments, the wrapper takes the in/out ones, the references, by value, and drops the out-only ones, the pointers: their values are part of the result, see #wrapper_result. A Proc argument is taken as a block if it is the last one, unless block is false: a setter can't have a block.


[View source]
def from(type : Parser::Type, is_constructor = false, no_slice = false, &) : Call::Result #

[View source]
def from_binding(type : Parser::Type, qualified = false, is_constructor = false, no_slice = false) : Call::Result #

Computes a result for passing type from C++ to Crystal.

If qualified is true, the type is assumed to be used outside the lib Binding, and will be qualified if required.


[View source]
def from_wrapper(type : Parser::Type, is_constructor = false, no_slice = false, callback_argument = false, discover = true) : Call::Result #

Computes a result for passing type from the wrapper to the user.

A pointer or reference to a class with Graph::Class#type_discovery? is wrapped by its DISCOVER_METHOD, in the wrapper class of the object's dynamic type, unless discover is false.


[View source]
def to(type : Parser::Type, &) : Call::Result #

[View source]
def to_binding(type : Parser::Type, to_unsafe = false, qualified = false) : Call::Result #

Computes a result for passing type from Crystal to C++. If to_unsafe is true, and the type is not built-in, the result will be wrapped in a call to to_unsafe - Except if a user-defined conversion is set.


[View source]
def to_wrapper(type : Parser::Type) : Call::Result #

Computes a result for passing type to the wrapper.


[View source]
def wrapper_result(method : Parser::Method) : Call::Result #

The result of the wrapper of method: that of its return type, see #from_wrapper, followed by the values of its out arguments, see Parser::Method#out_arguments, as a Call::TupleResult. Each value is read from the local of #out_argument_to_binding by the conversion of #from_binding.


[View source]