class Bindgen::Parser::Type
- Bindgen::Parser::Type
- Reference
- Object
Overview
Stores information about a specific C++ type.
Direct Known Subclasses
Defined in:
bindgen/parser/type.crConstant Summary
-
CRYSTAL_PROC =
"CrystalProc" -
Name of the
CrystalProcC++ and Crystal type. This type is a template type in C++, and astructin Crystal. -
EMPTY =
new(isConst: false, isMove: false, isReference: false, isBuiltin: true, isVoid: false, pointer: 0, baseName: "", fullName: "", template: nil, nilable: false) -
Empty type, as is returned by the parser for constructors. Only valid as a return type of a constructor method.
-
VOID =
new(isConst: false, isMove: false, isReference: false, isBuiltin: true, isVoid: true, pointer: 0, baseName: "void", fullName: "void", template: nil, nilable: false) -
Voidtype
Constructors
- .new(baseName : String, fullName : String, isConst : Bool, isReference : Bool, pointer : Int32, isMove : Bool = false, isBuiltin : Bool = false, isVoid : Bool = false, kind : Bindgen::Parser::Type::Kind = Kind::Class, template : Template | Nil = nil, nilable : Bool = false)
- .new(__temp_44 : JSON::PullParser)
Class Method Summary
-
.builtin_type(cpp_name : String, pointer = 0, reference = false)
Returns a
Typeof a C++ built-in type cpp_name. -
.parse(type_name : String, pointer_depth = 0)
Parser for qualified C++ type-names.
-
.proc(return_type : Type, arguments : Enumerable(Type))
Creates a
Typedescribing a CrystalProctype, which returns a return_type using arguments.
Instance Method Summary
-
#==(other : self)
Returns
trueif this reference is the same as other. -
#base_name : String
Unqualified base name for easier mapping to Crystal.
- #baseName : String
- #baseName=(_baseName : String)
-
#builtin? : Bool
Is this type a C++ built-in type?
-
#const? : Bool
Is this type constant?
-
#decayed : Type | Nil
Decays the type.
-
#equals_except_nil?(other : Type)
Checks if this type equals the other type, except for nil-ability.
-
#full_name : String
Fully qualified, full name, for the C++ bindings.
- #fullName : String
- #fullName=(_fullName : String)
-
#hash(hasher)
See
Object#hash(hasher) - #isBuiltin : Bool
- #isBuiltin=(_isBuiltin : Bool)
- #isConst : Bool
- #isConst=(_isConst : Bool)
- #isMove : Bool
- #isMove=(_isMove : Bool)
- #isReference : Bool
- #isReference=(_isReference : Bool)
- #isVoid : Bool
- #isVoid=(_isVoid : Bool)
- #kind : Kind
- #kind=(_kind : Kind)
-
#mangled_name
The mangled type name for C++ bindings.
-
#move? : Bool
Does the type use move-semantics?
- #nilable : Bool
- #nilable=(_nilable : Bool)
-
#nilable? : Bool
Is this type nilable? For compatibility with
Argument. - #pointer : Int32
- #pointer=(_pointer : Int32)
-
#pure_void?
Returns
trueif this type isvoid, and nothing else. -
#reference? : Bool
Is this a C++ reference type?
- #template : Template | Nil
- #template=(_template : Template | Nil)
- #to_json(json : JSON::Builder)
-
#void? : Bool
Is it C++
void? Note thatvoid *is also void.
Constructor Detail
Class Method Detail
Returns a Type of a C++ built-in type cpp_name.
Parser for qualified C++ type-names. It's really stupid though.
Creates a Type describing a Crystal Proc type, which returns a
return_type using arguments.
The generated type will use CrystalProc as base type.
Instance Method Detail
Returns true if this reference is the same as other. Invokes same?.
Unqualified base name for easier mapping to Crystal.
E.g., the base name of const QWidget *& is QWidget.
Decays the type. This means that a single "layer" of information is removed from this type. Each rule is tried in the following order. The first winning rule returns a new type.
- If
#const?, remove const (const int &->int &) - If
#reference?, pointer-ize (int &->int *) - If
#pointer > 0, remove one (int *->int) - Else, it's the base-type already. Return
nil.
Checks if this type equals the other type, except for nil-ability.