class
Bindgen::Parser::Argument
- Bindgen::Parser::Argument
- Bindgen::Parser::Type
- Reference
- Object
Overview
Describes a method argument.
Included Modules
- JSON::Serializable
Defined in:
bindgen/parser/argument.crConstant Summary
-
STD_FUNCTION =
"std::function" -
The name of a
std::functionclass template.
Constructors
- .new(name : String, base_name, full_name, const, reference, move, builtin, void, pointer, template, kind = Type::Kind::Class, has_default : Bool = false, value : Bool | Float64 | Int64 | String | UInt64 | Nil = nil, nilable = false, variadic : Bool = false, extents = Array(UInt64).new, array_pointer = 0, desugared = nil, never_nil = false, typedefs = nil)
- .new(name : String, type : Type, has_default : Bool = false, value : Bool | Float64 | Int64 | String | UInt64 | Nil = nil)
-
.new(pull : JSON::PullParser)
Describes a method argument.
Instance Method Summary
-
#==(other : self)
Returns
trueif this reference is the same as other. -
#after_initialize
A
std::function<R (Args...)>argument becomes aKind::Functiontype likeType.procbuilds: aProcor block in Crystal, aCrystalProcin the binding, which the C++ glue wraps into thestd::function. -
#defaults_to_nil? : Bool
If this is a pointer-type, does it default to
nullptrin C++? -
#has_default? : Bool
Does this argument have a default value?
-
#has_exposed_default?
Does this argument have an exposed default value?
-
#hash(hasher)
See
Object#hash(hasher) -
#merge(other : Argument)
Merges this argument with other.
-
#name : String
Name of this argument.
-
#named(name : String) : Argument
Returns a copy of this argument named name.
-
#nilable? : Bool
Assume that if the argument defaults to
nullptr, that it is nilable. -
#substitute_type(name : String, with type : Type) : Argument
Substitutes all uses of name on the type part of this argument with the given type.
-
#substitute_type(replacements : Hash(String, Type)) : Argument
Performs type substitution on the type part of this argument using the given replacements.
-
#type_equals?(other : Type)
Checks if the type-part of this equals the type-part of other.
-
#value : DefaultValueTypes | Nil
Default value for this argument, if an initializer literal is found.
-
#variadic? : Bool
Is this the vararg (
...) argument? -
#without_default : Argument
Returns a copy of this argument without a default value.
Instance methods inherited from class Bindgen::Parser::Type
==(other : self)
==,
array_element : Type
array_element,
array_pointer : Int32
array_pointer,
base_name : String
base_name,
builtin? : Bool
builtin?,
builtin_array_pointer? : Bool
builtin_array_pointer?,
c_array?
c_array?,
c_complete_array?
c_complete_array?,
const? : Bool
const?,
decayed : Type | Nil
decayed,
dereferenced : Type
dereferenced,
desugared : String | Nil
desugared,
equals_except_nil?(other : Type)
equals_except_nil?,
extents : Array(UInt64)
extents,
full_name : String
full_name,
function? : Bool
function?,
hash(hasher)
hash,
kind : Bindgen::Parser::Type::Kind
kind,
make_pointer_nilable : Type | Nil
make_pointer_nilable,
mangled_name
mangled_name,
move? : Bool
move?,
never_nil : Type
never_nil,
never_nil=(never_nil : Bool)
never_nil=,
never_nil? : Bool
never_nil?,
nilable? : Bool
nilable?,
pointee_array : Type
pointee_array,
pointer : Int32
pointer,
pointer_to_c_array? : Bool
pointer_to_c_array?,
pure_void?
pure_void?,
reference? : Bool
reference?,
reference_to_c_array? : Bool
reference_to_c_array?,
remove_all_extents : Type
remove_all_extents,
std_function? : Bool
std_function?,
substitute(name : String, with type : Type) : Typesubstitute(replacements : Hash(String, Type)) : Type
substitute(replacements : Tuple(String, Type)) : Type substitute, template : Template | Nil template, template_arguments : Array(Type) template_arguments, typedefs : Array(String) | Nil typedefs, uses_typename?(name : String) uses_typename?, void? : Bool void?, with_nilable(nilable : Bool) : self with_nilable
Constructor methods inherited from class Bindgen::Parser::Type
new(base_name : String, full_name : String, const : Bool, reference : Bool, pointer : Int32, move : Bool = false, builtin : Bool = false, void : Bool = false, kind : Bindgen::Parser::Type::Kind = Kind::Class, template : Nil | Bindgen::Parser::Template = nil, nilable : Bool = false, extents : Array(UInt64) = Array(UInt64).new, array_pointer : Int32 = 0, desugared : Nil | String = nil, typedefs : Nil | Array(String) = nil, never_nil : Bool = false)new(pull : JSON::PullParser) new
Class methods inherited from class Bindgen::Parser::Type
builtin_type(cpp_name : String, pointer = 0, reference = false)
builtin_type,
parse(type_name : String, pointer_depth = 0)
parse,
proc(return_type : Type, arguments : Enumerable(Type))
proc
Constructor Detail
Instance Method Detail
Returns true if this reference is the same as other. Invokes same?.
A std::function<R (Args...)> argument becomes a Kind::Function type
like Type.proc builds: a Proc or block in Crystal, a CrystalProc
in the binding, which the C++ glue wraps into the std::function.
See Type#std_function? and SPEC.md ยง2.2.6.
Merges this argument with other. Only merges the name, defaultness, its value and nil-ability. For the value, this argument takes precedence over other. The name is taken from other, as Crystal expects the arguments of an overriding method to be named like those of the overridden one. Unnamed arguments are named by their position.
Substitutes all uses of name on the type part of this argument with the given type.
Performs type substitution on the type part of this argument using the given replacements.
Checks if the type-part of this equals the type-part of other.
Default value for this argument, if an initializer literal is found.
Returns a copy of this argument without a default value.