// GENERATED — DO NOT EDIT

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/struct.AttrList.html).
pub type AttrList

///|
pub(open) trait IAttrList {
  fn as_attr_list(Self) -> AttrList
  fn change(Self, Attribute) -> Unit = _
  fn equal(Self, AttrList) -> Bool = _
  fn get_attributes(Self) -> Array[Attribute] = _
  fn get_iterator(Self) -> AttrIterator = _
  fn insert(Self, Attribute) -> Unit = _
  fn insert_before(Self, Attribute) -> Unit = _
  fn ref_(Self) -> AttrList = _
  fn splice(Self, AttrList, Int, Int) -> Unit = _
  fn to_string(Self) -> String = _
  fn update(Self, Int, Int, Int) -> Unit = _
}

///|
pub impl IAttrList for AttrList with fn as_attr_list(self) {
  self
}

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/ctor.AttrList.new.html).
pub extern "c" fn AttrList::new() -> AttrList = "moonbit_pango_attr_list_new"

///|
#borrow(text)
extern "c" fn moonbit_pango_attr_list_from_string(
  text : Bytes,
) -> @glib.Nullable[AttrList] = "moonbit_pango_attr_list_from_string"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/type_func.AttrList.from_string.html).
pub fn AttrList::from_string(text : String) -> AttrList? {
  let raw_result = moonbit_pango_attr_list_from_string(
    @encoding/utf8.encode(text),
  )
  raw_result.to_option()
}

///|
#borrow(self_, attr)
extern "c" fn moonbit_pango_attr_list_change(
  self_ : AttrList,
  attr : Attribute,
) = "moonbit_pango_attr_list_change"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.AttrList.change.html).
pub fn AttrList::change(self : AttrList, attr : Attribute) -> Unit {
  moonbit_pango_attr_list_change(self, attr)
}

///|
#borrow(self_, other_list)
extern "c" fn moonbit_pango_attr_list_equal(
  self_ : AttrList,
  other_list : AttrList,
) -> Bool = "moonbit_pango_attr_list_equal"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.AttrList.equal.html).
pub fn AttrList::equal(self : AttrList, other_list : AttrList) -> Bool {
  moonbit_pango_attr_list_equal(self, other_list)
}

///|
#borrow(self_, result)
extern "c" fn moonbit_pango_attr_list_get_attributes(
  self_ : AttrList,
  result : Ref[FixedArray[Attribute]],
) = "moonbit_pango_attr_list_get_attributes"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.AttrList.get_attributes.html).
pub fn AttrList::get_attributes(self : AttrList) -> Array[Attribute] {
  let result_ref : Ref[FixedArray[Attribute]] = Ref([])
  moonbit_pango_attr_list_get_attributes(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.AttrList.get_iterator.html).
#borrow(self)
pub extern "c" fn AttrList::get_iterator(self : AttrList) -> AttrIterator = "moonbit_pango_attr_list_get_iterator"

///|
#borrow(self_, attr)
extern "c" fn moonbit_pango_attr_list_insert(
  self_ : AttrList,
  attr : Attribute,
) = "moonbit_pango_attr_list_insert"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.AttrList.insert.html).
pub fn AttrList::insert(self : AttrList, attr : Attribute) -> Unit {
  moonbit_pango_attr_list_insert(self, attr)
}

///|
#borrow(self_, attr)
extern "c" fn moonbit_pango_attr_list_insert_before(
  self_ : AttrList,
  attr : Attribute,
) = "moonbit_pango_attr_list_insert_before"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.AttrList.insert_before.html).
pub fn AttrList::insert_before(self : AttrList, attr : Attribute) -> Unit {
  moonbit_pango_attr_list_insert_before(self, attr)
}

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.AttrList.ref.html).
#borrow(self)
pub extern "c" fn AttrList::ref_(self : AttrList) -> AttrList = "moonbit_pango_attr_list_ref"

///|
#borrow(self_, other)
extern "c" fn moonbit_pango_attr_list_splice(
  self_ : AttrList,
  other : AttrList,
  pos : Int,
  len : Int,
) = "moonbit_pango_attr_list_splice"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.AttrList.splice.html).
pub fn AttrList::splice(
  self : AttrList,
  other : AttrList,
  pos : Int,
  len : Int,
) -> Unit {
  moonbit_pango_attr_list_splice(self, other, pos, len)
}

///|
#borrow(self_)
extern "c" fn moonbit_pango_attr_list_to_string(self_ : AttrList) -> Bytes = "moonbit_pango_attr_list_to_string"

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.AttrList.to_string.html).
pub fn AttrList::to_string(self : AttrList) -> String {
  @encoding/utf8.decode_lossy(moonbit_pango_attr_list_to_string(self))
}

///|
/// [Upstream documentation](https://gnome.pages.gitlab.gnome.org/pango/Pango/method.AttrList.update.html).
#borrow(self)
pub extern "c" fn AttrList::update(
  self : AttrList,
  pos : Int,
  remove : Int,
  add : Int,
) = "moonbit_pango_attr_list_update"

///|
impl IAttrList with fn change(self, attr) -> Unit {
  self.as_attr_list().change(attr)
}

///|
impl IAttrList with fn equal(self, other_list) -> Bool {
  self.as_attr_list().equal(other_list)
}

///|
impl IAttrList with fn get_attributes(self) -> Array[Attribute] {
  self.as_attr_list().get_attributes()
}

///|
impl IAttrList with fn get_iterator(self) -> AttrIterator {
  self.as_attr_list().get_iterator()
}

///|
impl IAttrList with fn insert(self, attr) -> Unit {
  self.as_attr_list().insert(attr)
}

///|
impl IAttrList with fn insert_before(self, attr) -> Unit {
  self.as_attr_list().insert_before(attr)
}

///|
impl IAttrList with fn ref_(self) -> AttrList {
  self.as_attr_list().ref_()
}

///|
impl IAttrList with fn splice(self, other, pos, len) -> Unit {
  self.as_attr_list().splice(other, pos, len)
}

///|
impl IAttrList with fn to_string(self) -> String {
  self.as_attr_list().to_string()
}

///|
impl IAttrList with fn update(self, pos, remove, add) -> Unit {
  self.as_attr_list().update(pos, remove, add)
}