class Bindgen::TypeDatabase
- Bindgen::TypeDatabase
- Reference
- Object
Overview
Database of type mapping data for wrapper-code generation. Configuration for common (and built-in) C/C++ types is automatically loaded and added.
Defined in:
bindgen/type_database.crConstant Summary
-
BUILTIN_CONFIG_PATH =
"/srv/crystaldoc.info/github-kalinon-bindgen-last-working/src/bindgen/../../builtin_types.yml"
-
Path to the built-in type configuration. This file defines mappings for most-ish built-in (and other common) types in C++.
Constructors
Class Method Summary
-
.load_builtins : Configuration
Helper method to read the built-in type configuration.
Instance Method Summary
-
#[](type : String | Parser::Type)
Look up type in the database.
-
#[]?(type : String, recursion_check = nil)
Look up type in the database.
-
#[]?(type : Parser::Type, recursion_check = nil)
Look up type in the database.
-
#add(name : String, rules : TypeConfig)
Adds a type rules as name.
-
#add(name : String, **rules)
Quickly adds the rules to name.
-
#add_sparse_type(cpp_name : String, crystal_name : String | Nil, kind)
Adds a type configuration to the type database.
- #cookbook : Cpp::Cookbook
- #each(*args, **options)
- #each(*args, **options, &)
-
#get_or_add(type : Parser::Type | String) : TypeConfig
Returns the rules for type.
-
#try_or(type : Parser::Type | String, default, &)
Helper, equivalent to calling
#[type]?.try(&.x) || default
Constructor Detail
Class Method Detail
Instance Method Detail
Look up type in the database. If type is a Parser::Type
, the best
match will be found by gradually decaying the type (See
Parser::Type#decayed
).
Prefer passing a Parser::Type
over passing a String
.
Also see #[]?
.
Look up type in the database. type is expected to be the base name of
a C++ type. If you actually have a full type-name instead, use
Parser::Type.parse
first, and pass that instead.
Prefer passing a Parser::Type
over passing a String
.
Look up type in the database. The best match will be found by gradually
decaying the type (See Parser::Type#decayed
). This enables the user
to write rules for int *
and int
without clashes.
Adds a type rules as name.
Also see #get_or_add
to add rules from processors.
Quickly adds the rules to name. Used for testing purposes.
Also see #get_or_add
to add rules from processors.
Adds a type configuration to the type database. If a configuration for this type was set by the user, it's updated - not replaced!
Returns the rules for type. If none are found, a new TypeConfig
is
inserted, and returned.
This is the method you want to use to add or change rules from within processors.
Important: If type is a Parser::Type
, then its #base_name
is
used - not the #full_name
. If you want to provide configuration for
a specific type, pass the #full_name
as string.
Helper, equivalent to calling #[type]?.try(&.x) || default