module
Bindgen::TypeHelper
Overview
Helper functionality for working with types. Useful for all platforms.
TODO Turn into a struct?
Direct including types
- Bindgen::CallBuilder::CppCall
- Bindgen::CallBuilder::CppWrapper
- Bindgen::Cpp::MethodName
- Bindgen::Cpp::Pass
- Bindgen::Crystal::Pass
- Bindgen::Processor::CopyStructs
- Bindgen::Processor::CppWrapper
- Bindgen::Processor::CrystalWrapper
- Bindgen::Processor::InstanceProperties
- Bindgen::Processor::VirtualOverride
Defined in:
bindgen/type_helper.crInstance Method Summary
-
#cpp_class_name(class_name : String) : String
Returns the name of the class class_name in C++ code.
-
#passthrough(type : Parser::Type)
Builds a result passing-through type without modifications.
-
#proc_by_pointer?(type : Parser::Type) : Bool
Is type a structure passed by value? A
CrystalProcpasses it by pointer instead, as a CrystalProcdoesn't follow the C ABI: the C ABI passes a structure larger than 16 bytes indirectly, which aProctaking it by value reads as garbage. -
#reconfigure_pass_type(pass_by, is_ref, ptr)
Helper for
#to_X, configuring the type according to user-specified rules. -
#structure_hosted?(rules : TypeDatabase::TypeConfig) : Bool
Does the Crystal wrapper class of the type described by rules host a copy of the structure, instead of a pointer to it? Its
#to_unsafereturns a pointer to the hosted structure then. -
#type_copied?(type) : Bool
Is type available in Crystal? It will be if any of: 1.
-
#type_pointer_depth(type : Parser::Type) : Int32
Returns the pointer-depth without a reference of type.
-
#variadic_argument : Call::VariadicArgument
Builds a
Call::VariadicArgument.
Instance Method Detail
Returns the name of the class class_name in C++ code. An anonymous
class can only be named through the typedef added by
Processor::InstanceProperties.
Is type a structure passed by value? A CrystalProc passes it by
pointer instead, as a Crystal Proc doesn't follow the C ABI: the C ABI
passes a structure larger than 16 bytes indirectly, which a Proc
taking it by value reads as garbage. This covers copied structures and
built-in kind: Struct types, like the CrystalVariant behind
QVariant.
Helper for #to_X, configuring the type according to user-specified
rules.
Does the Crystal wrapper class of the type described by rules host a
copy of the structure, instead of a pointer to it? Its #to_unsafe
returns a pointer to the hosted structure then.
This is not the case for a kind: Struct type, whose wrapper is a
Crystal struct returning the structure itself.
Is type available in Crystal? It will be if any of:
- The structure will be copied
- It's a built-in type
- It's an enumeration type
Otherwise, false is returned. If the type is not configured in the
type database, it defaults to false.
Returns the pointer-depth without a reference of type.
Builds a Call::VariadicArgument. This is only applicable to directly
bound functions.