// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.Language.html).
pub type Language
///|
pub(open) trait ILanguage {
fn as_language(Self) -> Language
fn get_sample_string(Self) -> String = _
fn get_scripts(Self) -> Array[Int]? = _
fn includes_script(Self, Script) -> Bool = _
fn matches(Self, String) -> Bool = _
fn to_string(Self) -> String = _
}
///|
pub impl ILanguage for Language with fn as_language(self) {
self
}
///|
#borrow(language)
extern "c" fn moonbit_pango_language_from_string(
language : @glib.Nullable[Bytes],
) -> @glib.Nullable[Language] = "moonbit_pango_language_from_string"
///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/type_func.Language.from_string.html).
pub fn Language::from_string(language : String?) -> Language? {
let raw_result = moonbit_pango_language_from_string(
match language {
Some(s) => @glib.Nullable::some(@encoding/utf8.encode(s))
None => @glib.Nullable::null()
},
)
raw_result.to_option()
}
///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/type_func.Language.get_default.html).
pub extern "c" fn Language::get_default() -> Language = "moonbit_pango_language_get_default"
///|
#borrow(result)
extern "c" fn moonbit_pango_language_get_preferred(
result : Ref[@glib.Nullable[FixedArray[Language]]],
) = "moonbit_pango_language_get_preferred"
///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/type_func.Language.get_preferred.html).
pub fn Language::get_preferred() -> Array[Language]? {
let result_ref : Ref[@glib.Nullable[FixedArray[Language]]] = Ref(
@glib.Nullable::null(),
)
moonbit_pango_language_get_preferred(result_ref)
match result_ref.val.to_option() {
Some(array) => Some(Array::from_fixed_array(array))
None => None
}
}
///|
#borrow(self_)
extern "c" fn moonbit_pango_language_get_sample_string(
self_ : Language,
) -> Bytes = "moonbit_pango_language_get_sample_string"
///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.Language.get_sample_string.html).
pub fn Language::get_sample_string(self : Language) -> String {
@encoding/utf8.decode_lossy(moonbit_pango_language_get_sample_string(self))
}
///|
#borrow(self_, result)
extern "c" fn moonbit_pango_language_get_scripts(
self_ : Language,
result : Ref[@glib.Nullable[FixedArray[Int]]],
) = "moonbit_pango_language_get_scripts"
///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.Language.get_scripts.html).
pub fn Language::get_scripts(self : Language) -> Array[Int]? {
let result_ref : Ref[@glib.Nullable[FixedArray[Int]]] = Ref(
@glib.Nullable::null(),
)
moonbit_pango_language_get_scripts(self, result_ref)
match result_ref.val.to_option() {
Some(array) => Some(Array::from_fixed_array(array))
None => None
}
}
///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.Language.includes_script.html).
#borrow(self)
pub extern "c" fn Language::includes_script(
self : Language,
script : Script,
) -> Bool = "moonbit_pango_language_includes_script"
///|
#borrow(self_, range_list)
extern "c" fn moonbit_pango_language_matches(
self_ : Language,
range_list : Bytes,
) -> Bool = "moonbit_pango_language_matches"
///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.Language.matches.html).
pub fn Language::matches(self : Language, range_list : String) -> Bool {
moonbit_pango_language_matches(self, @encoding/utf8.encode(range_list))
}
///|
#borrow(self_)
extern "c" fn moonbit_pango_language_to_string(self_ : Language) -> Bytes = "moonbit_pango_language_to_string"
///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.Language.to_string.html).
pub fn Language::to_string(self : Language) -> String {
@encoding/utf8.decode_lossy(moonbit_pango_language_to_string(self))
}
///|
impl ILanguage with fn get_sample_string(self) -> String {
self.as_language().get_sample_string()
}
///|
impl ILanguage with fn get_scripts(self) -> Array[Int]? {
self.as_language().get_scripts()
}
///|
impl ILanguage with fn includes_script(self, script) -> Bool {
self.as_language().includes_script(script)
}
///|
impl ILanguage with fn matches(self, range_list) -> Bool {
self.as_language().matches(range_list)
}
///|
impl ILanguage with fn to_string(self) -> String {
self.as_language().to_string()
}