class
Bindgen::Parser::Class
- Bindgen::Parser::Class
- Reference
- Object
Overview
Describes a C++ class, struct, or union.
Included Modules
- JSON::Serializable
Defined in:
bindgen/parser/class.crConstructors
- .new(pull : JSON::PullParser)
- .new(name : String, byte_size : Int32 = 0, pack_alignment : Int32 = 0, has_default_constructor : Bool = false, has_copy_constructor : Bool = false, has_user_declared_constructor : Bool = false, type_kind : Bindgen::Parser::TypeKind = TypeKind::Class, abstract __arg0 : Bool = false, final : Bool = false, polymorphic : Bool = false, trivially_copyable : Bool = true, standard_layout : Bool = true, anonymous : Bool = false, destructible : Bool = true, bases : Array(Bindgen::Parser::BaseClass) = [] of BaseClass, fields : Array(Bindgen::Parser::Field) = [] of Field, methods : Array(Bindgen::Parser::Method) = [] of Method, access : Bindgen::Parser::AccessSpecifier = AccessSpecifier::Public, doc : Nil | String = nil)
Instance Method Summary
-
#abstract? : Bool
Is this class abstract?
-
#access : Bindgen::Parser::AccessSpecifier
Visibility of the class.
-
#anonymous? : Bool
Is this class anonymous?
-
#as_type(pointer = 1, reference = false, const = false) : Type
Returns a
Typereferencing this class. -
#bases : Array(BaseClass)
Direct bases of the class.
-
#binding_name : String
The name of the class as part of binding methods.
-
#byte_size : Int32
Size of an instance of the class in memory.
-
#class?(*args, **options)
Is this a
class,struct, or Cunion? -
#class?(*args, **options, &)
Is this a
class,struct, or Cunion? -
#cpp_union?(*args, **options)
Is this a
class,struct, or Cunion? -
#cpp_union?(*args, **options, &)
Is this a
class,struct, or Cunion? -
#destructible? : Bool
Is this class publicly destructible?
-
#destructor_method : Method
Constructs a method destroying an instance of this class.
-
#destructor_name : String
The full binding function name of the destructor.
-
#doc : String | Nil
Documentation comment from the C++ source, without comment markers.
-
#each_wrappable_method(&)
Yields each wrappable method without any further processing.
-
#fields : Array(Field)
Data members defined in the class, both static and non-static.
-
#final? : Bool
Is this class
final, so it can't be derived from? -
#find_parent_method(method : Method) : Method | Nil
Assumes that method exists in a class inheriting from this class.
-
#has_copy_constructor? : Bool
Is the type copy-constructible?
-
#has_default_constructor? : Bool
Does the type have a default, argument-less constructor?
-
#has_user_declared_constructor? : Bool
Does the type declare any constructor itself? This includes defaulted (
= default) and deleted ones, which#methodscan't tell: A defaulted constructor isMethod#builtin?, and a deleted one isn't listed. -
#has_virtual_methods?
Does this class have any virtual methods?
-
#methods : Array(Method)
Methods defined in the class.
-
#name : String
Fully qualified name of the class.
-
#pack_alignment : Int32
The alignment limit in bytes of packing that moves a member: 1 for
__attribute__((packed)), or N for#pragma pack(N). -
#packed? : Bool
Are the members of this class packed without alignment?
-
#polymorphic? : Bool
Does the class declare or inherit a virtual method?
- #private?(*args, **options)
- #private?(*args, **options, &)
- #protected?(*args, **options)
- #protected?(*args, **options, &)
- #public?(*args, **options)
- #public?(*args, **options, &)
-
#standard_layout? : Bool
Is the class laid out like a C structure?
-
#struct?(*args, **options)
Is this a
class,struct, or Cunion? -
#struct?(*args, **options, &)
Is this a
class,struct, or Cunion? -
#trivially_copyable? : Bool
Can an instance be copied byte-wise, like a C structure?
-
#type_kind : TypeKind
The keyword used to declare this type (
class,struct, orunion). -
#wrap_methods : Array(Method)
List of all wrappable-methods.
-
#wrappable_methods
Non-yielding version of
#each_wrappable_method
Constructor Detail
Instance Method Detail
Visibility of the class. Default is public, but some generated Crystal classes may be private.
Returns a Type referencing this class.
Constructs a method destroying an instance of this class.
Yields each wrappable method without any further processing.
Note: This method hard-codes which methods to ignore. If you're wondering why a method doesn't even reach the graph in the first place, look in here.
Data members defined in the class, both static and non-static.
Assumes that method exists in a class inheriting from this class. Tries to find a method in this class which is overriden by method. The return type isn't compared, as an override may change it covariantly.
Does the type declare any constructor itself? This includes defaulted
(= default) and deleted ones, which #methods can't tell: A defaulted
constructor is Method#builtin?, and a deleted one isn't listed.
The alignment limit in bytes of packing that moves a member: 1 for
__attribute__((packed)), or N for #pragma pack(N). 0 if the class
isn't packed, or the packing doesn't change its layout.
The keyword used to declare this type (class, struct, or union).
List of all wrappable-methods. This includes all Method#variants.
Methods which use Method#move_semantics? on any type are explicitly
removed.
Note: This is a memoized getter. Thus it's cheap to call it multiple times.