// GENERATED — DO NOT EDIT
///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.AttrIterator.html).
pub type AttrIterator
///|
pub(open) trait IAttrIterator {
fn as_attr_iterator(Self) -> AttrIterator
fn get(Self, AttrType) -> Attribute? = _
fn get_attrs(Self) -> Array[Attribute] = _
fn next(Self) -> Bool = _
fn range(Self) -> (Int, Int) = _
}
///|
pub impl IAttrIterator for AttrIterator with fn as_attr_iterator(self) {
self
}
///|
#borrow(self_)
extern "c" fn moonbit_pango_attr_iterator_get(
self_ : AttrIterator,
type_ : AttrType,
) -> @glib.Nullable[Attribute] = "moonbit_pango_attr_iterator_get"
///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.AttrIterator.get.html).
pub fn AttrIterator::get(self : AttrIterator, type_ : AttrType) -> Attribute? {
let raw_result = moonbit_pango_attr_iterator_get(self, type_)
raw_result.to_option()
}
///|
#borrow(self_, result)
extern "c" fn moonbit_pango_attr_iterator_get_attrs(
self_ : AttrIterator,
result : Ref[FixedArray[Attribute]],
) = "moonbit_pango_attr_iterator_get_attrs"
///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.AttrIterator.get_attrs.html).
pub fn AttrIterator::get_attrs(self : AttrIterator) -> Array[Attribute] {
let result_ref : Ref[FixedArray[Attribute]] = Ref([])
moonbit_pango_attr_iterator_get_attrs(self, result_ref)
let values : Array[Attribute] = Array::new(capacity=result_ref.val.length())
for value in result_ref.val {
values.push(value)
}
values
}
///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.AttrIterator.next.html).
#borrow(self)
pub extern "c" fn AttrIterator::next(self : AttrIterator) -> Bool = "moonbit_pango_attr_iterator_next"
///|
#borrow(self_, start, end)
extern "c" fn moonbit_pango_attr_iterator_range(
self_ : AttrIterator,
start : Ref[Int],
end : Ref[Int],
) = "moonbit_pango_attr_iterator_range"
///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.AttrIterator.range.html).
pub fn AttrIterator::range(self : AttrIterator) -> (Int, Int) {
let start = Ref(0)
let end = Ref(0)
moonbit_pango_attr_iterator_range(self, start, end)
(start.val, end.val)
}
///|
impl IAttrIterator with fn get(self, type_) -> Attribute? {
self.as_attr_iterator().get(type_)
}
///|
impl IAttrIterator with fn get_attrs(self) -> Array[Attribute] {
self.as_attr_iterator().get_attrs()
}
///|
impl IAttrIterator with fn next(self) -> Bool {
self.as_attr_iterator().next()
}
///|
impl IAttrIterator with fn range(self) -> (Int, Int) {
self.as_attr_iterator().range()
}