class Bindgen::Graph::Class

Overview

A class in Crystal, or a C++ struct. We use a struct in C++ due to it defaulting to public visibility.

Defined in:

bindgen/graph/class.cr

Constant Summary

FORCE_UNWRAP_VARIABLE_TAG = "FORCE_UNWRAP_VARIABLE_TAG"

When this tag is set, Processor::CrystalWrapper will emit the @unwrap instance variable and the #to_unsafe method. This overrides its default behaviour of deducing if these are required.

Constructors

Instance Method Summary

Instance methods inherited from class Bindgen::Graph::Container

by_name(name) : Node by_name, by_name?(name) : Node | Nil by_name?, nodes : Array(Bindgen::Graph::Node) nodes, platform_specific(platform : Platform | Platforms) platform_specific, platform_specific?(platform : Platform | Platforms) platform_specific?

Instance methods inherited from class Bindgen::Graph::Node

constant? : Bool constant?, crystal_prefix : String crystal_prefix, diagnostics_path : String diagnostics_path, find_root : Node find_root, full_path : Array(Node) full_path, kind_name : String kind_name, name : String name, parent : Container | Nil parent, parent=(parent : Container | Nil) parent=, path_name : String path_name, set_tag(name : String, value : String = "") set_tag, tag(name : String) tag, tag?(name : String) tag?, tags : Hash(String, String) tags, unspecific_parent : Container | Nil unspecific_parent

Constructor methods inherited from class Bindgen::Graph::Node

new(name : String, parent : Container | Nil = nil) new

Constructor Detail

def self.new(origin : Bindgen::Parser::Class, name, parent = nil) #

[View source]

Instance Method Detail

def abstract=(abstract __arg0 : Bool) #

Is this class abstract?


[View source]
def abstract? : Bool #

Is this class abstract?


[View source]
def base_class : String | Nil #

Name of the base-class, if any. Used by both Crystal and C++, and may point at types outside the graph.


[View source]
def base_class=(base_class : String | Nil) #

Name of the base-class, if any. Used by both Crystal and C++, and may point at types outside the graph.


[View source]
def cpp_sub_class : String | Nil #

If this class is to be shadow sub-classed in C++, the full name of the structure. Processors make the assumption that if this is set, the class will be sub-classed, and may generate code different to what they would've done without. This affects Crystal #initialize methods, and the CONSTRUCT C++ wrappers.


[View source]
def cpp_sub_class=(cpp_sub_class : String | Nil) #

If this class is to be shadow sub-classed in C++, the full name of the structure. Processors make the assumption that if this is set, the class will be sub-classed, and may generate code different to what they would've done without. This affects Crystal #initialize methods, and the CONSTRUCT C++ wrappers.


[View source]
def included_modules : Set(String) #

List of included Crystal modules. Used by wrapper classes only, and may point at modules outside the graph. Ignored by C++ structs.


[View source]
def instance_variables : Hash(String, Bindgen::Call::Result) #

Crystal instance vars in this class. Will be ignored by the C++ code paths.


[View source]
def mangled_name #

The mangled name of this class, used to build structures with a class name component.


[View source]
def origin : Parser::Class #

The origin class


[View source]
def structure : Struct | CppUnion | Nil #

If the structure of this class is copied, the Struct or CppUnion node.


[View source]
def structure=(structure : Struct | CppUnion | Nil) #

If the structure of this class is copied, the Struct or CppUnion node.


[View source]
def wrap_class : Class | Nil #

If this is set, the class is assumed to be abstract. This property then contains the implementation class node.


[View source]
def wrap_class=(wrap_class : Class | Nil) #

If this is set, the class is assumed to be abstract. This property then contains the implementation class node.


[View source]
def wrapped_class : Class | Nil #

Opposite direction of #wrap_class: From the Impl class back to its abstract parent.


[View source]
def wrapped_class=(wrapped_class : Class | Nil) #

Opposite direction of #wrap_class: From the Impl class back to its abstract parent.


[View source]