abstract class Bindgen::Generator::Base

Overview

Base class for a Generator. It's used in conjunction of one or several processors to write generated data out to disk.

Direct Known Subclasses

Defined in:

bindgen/generator/base.cr

Constant Summary

INDENTION = " "

Single indention-depth prefix

SINGLE_FILE_SECTION = ""

Name of the section in a single-file setup.

Constructors

Instance Method Summary

Constructor Detail

def self.new(user_config : Configuration, config : Configuration::Generator, db : TypeDatabase) #

[View source]

Instance Method Detail

Configuration of this generator.


[View source]
def indented(&) #

Increments the indention depth by one, yields, and decrements the depth afterwards again.


[View source]
def puts(text : String) #

Prints text into the current output, adhering to the current indention depth. Multi-line text is supported, too.


[View source]
def user_config : Configuration #

Complete configuration document


[View source]
abstract def write(node : Graph::Container) #

Writes the node to the output file(s). Make sure to call #begin_section before writing any data.


[View source]
def write_all(node : Graph::Container, io : IO | Nil = nil, depth : Int32 = 0) #

Publicly accessed method. Writes node, while taking into account that the output may be split among multiple files. If io is not nil, it'll be used as output. This is useful for recursive generator invocations.

depth is only respected if io is not nil, in which case it'll override @depth.


[View source]