class

Bindgen::Parser::Class

Inherits JSON::Serializable < Reference < Object

Describes a C++ class, struct, or union.

Constructors

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)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

abstract?

Is this class abstract?

Source
access

Visibility of the class. Default is public, but some generated Crystal classes may be private.

Source
anonymous?

Is this class anonymous?

Source
as_type(pointer = 1, reference = false, const = false) : Type

Returns a Type referencing this class.

Source
bases

Direct bases of the class.

Source
binding_name

The name of the class as part of binding methods.

Source
byte_size

Size of an instance of the class in memory.

Source
class?(*args, **options)

Is this a class, struct, or C union?

Source
class?(*args, **options, &)

Is this a class, struct, or C union?

Source
cpp_union?(*args, **options)

Is this a class, struct, or C union?

Source
cpp_union?(*args, **options, &)

Is this a class, struct, or C union?

Source
destructible?

Is this class publicly destructible?

Source
destructor_method

Constructs a method destroying an instance of this class.

Source
destructor_name

The full binding function name of the destructor.

Source
doc

Documentation comment from the C++ source, without comment markers.

Source
each_wrappable_method

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.

Source
fields

Data members defined in the class, both static and non-static.

Source
final?

Is this class final, so it can't be derived from?

Source
find_parent_method(method : Method) : Method | Nil

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.

Source
has_copy_constructor?

Is the type copy-constructible?

Source
has_default_constructor?

Does the type have a default, argument-less constructor?

Source
has_user_declared_constructor?

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.

Source
has_virtual_methods?

Does this class have any virtual methods?

Source
methods

Methods defined in the class.

Source
name

Fully qualified name of the class.

Source
pack_alignment

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.

Source
packed?

Are the members of this class packed without alignment?

Source
polymorphic?

Does the class declare or inherit a virtual method?

Source
private?(*args, **options)
Source
private?(*args, **options, &)
Source
protected?(*args, **options)
Source
protected?(*args, **options, &)
Source
public?(*args, **options)
Source
public?(*args, **options, &)
Source
standard_layout?

Is the class laid out like a C structure?

Source
struct?(*args, **options)

Is this a class, struct, or C union?

Source
struct?(*args, **options, &)

Is this a class, struct, or C union?

Source
trivially_copyable?

Can an instance be copied byte-wise, like a C structure?

Source
type_kind

The keyword used to declare this type (class, struct, or union).

Source
wrap_methods

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.

Source
wrappable_methods

Non-yielding version of #each_wrappable_method

Source

Nested types