class Unibilium
- Unibilium
- Reference
- Object
Defined in:
entry_methods.crextensions.cr
lib_unibilium.cr
output_methods.cr
unibilium.cr
value_methods.cr
Constant Summary
-
VERSION =
[VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION].join('.') -
VERSION_MAJOR =
2 -
VERSION_MINOR =
0 -
VERSION_REVISION =
2
Constructors
-
.dummy : Unibilium
Constructs a dummy terminfo database.
-
.from_bytes(bytes : Bytes) : Unibilium
Creates a terminfo database from the given bytes.
-
.from_env : Unibilium
Creates a terminfo database for the terminal name found in the environment.
-
.from_file(path) : Unibilium
Creates a terminfo database from the given file path.
-
.from_io(io) : Unibilium
Creates a terminfo database from the given io.
-
.from_terminal(name) : Unibilium
Creates a terminfo database for the given terminal name.
Class Method Summary
-
.with_dummy(&)
Constructs a dummy terminfo database and yield it to the block.
Instance Method Summary
-
#aliases
Gets the aliases.
- #aliases=(aliases : Array(String))
-
#destroy
Destroys the terminfo database.
-
#destroyed?
Returns
trueif the terminfo database has been destroyed. -
#dump
Returns the database as a compiled terminfo entry.
- #entry : EntryMethods
- #extensions : Unibilium::Extensions
-
#format(io : IO, fmt : Pointer(LibC::Char), *args)
Formats string and writes directly to IO.
- #get(id : Entry::Boolean)
- #get(id : Entry::Numeric)
- #get(id : Entry::String)
-
#get?(id : Entry::Boolean)
Gets the value of Boolean option id.
-
#get?(id : Entry::Numeric)
Gets the value of Numeric option id.
-
#get?(id : Entry::String)
Gets the value of String option id.
- #get?(name : String)
- #io : IO
- #io=(io : IO)
- #io? : IO | Nil
-
#name
Gets the terminal name.
- #name=(name : String)
-
#name_for(id : Entry::Boolean)
Gets the full name for the Boolean option id.
-
#name_for(id : Entry::Numeric)
Gets the full name for the Numeric option id.
-
#name_for(id : Entry::String)
Gets the full name for the String option id.
- #output : OutputMethods
- #output? : OutputMethods | Nil
-
#run(format, *args)
Formats string into
Bytesand returns it. -
#set(name : String, value)
Sets the extended capability named name to value, for symmetry with
#get?(name : String). -
#set(id, value)
Sets an option (Boolean, Numeric or String) identified by id to value.
-
#short_name_for(id : Entry::Boolean)
Gets the short name for the Boolean option id.
-
#short_name_for(id : Entry::Numeric)
Gets the short name for the Numeric option id.
-
#short_name_for(id : Entry::String)
Gets the short name for the String option id.
-
#to_unsafe : Pointer(Void)
Returns the underlying Unibilium database pointer.
- #value : ValueMethods
- #value? : ValueMethods | Nil
Constructor Detail
Creates a terminfo database from the given bytes.
Creates a terminfo database for the terminal name found in the environment.
Similar to Unibilium.from_terminal(ENV["TERM"]).
Creates a terminfo database from the given file path.
Creates a terminfo database for the given terminal name.
Class Method Detail
Constructs a dummy terminfo database and yield it to the block. It ensures that the database is destroyed after the block.
Instance Method Detail
Destroys the terminfo database.
Subsequent calls to methods will segfault.
You can check if it has been destroyed with #destroyed?.
Returns the database as a compiled terminfo entry.
It can be directly written to a file for later use.
Formats string and writes directly to IO.
Unlike #run, allocates no heap buffer per call; preferred for
allocation-sensitive hot loops.
Gets the full name for the Boolean option id.
unibi_name_bool returns NULL for an out-of-range id (e.g. the
enum's _begin/_end_ sentinels). The method's contract is a non-nil
String, so raise rather than dereference NULL.
Gets the full name for the Numeric option id.
unibi_name_num returns NULL for an out-of-range id (e.g. the
enum's _begin/_end_ sentinels). The method's contract is a non-nil
String, so raise rather than dereference NULL.
Gets the full name for the String option id.
unibi_name_str returns NULL for an out-of-range id (e.g. the
enum's _begin/_end_ sentinels). The method's contract is a non-nil
String, so raise rather than dereference NULL.
Formats string into Bytes and returns it.
Allocates a fresh Bytes buffer on every call (it has to, since it returns
the result). In allocation-sensitive hot loops (e.g. per-cell rendering),
prefer #format, which writes straight to an IO with no heap allocation.
Sets the extended capability named name to value, for symmetry with
#get?(name : String).
Gets the short name for the Boolean option id.
As with #name_for, unibi_short_name_bool returns NULL for an
out-of-range id; raise rather than dereference NULL.
Gets the short name for the Numeric option id.
As with #name_for, unibi_short_name_num returns NULL for an
out-of-range id; raise rather than dereference NULL.
Gets the short name for the String option id.
As with #name_for, unibi_short_name_str returns NULL for an
out-of-range id; raise rather than dereference NULL.