AttrIteratorProtocol

public protocol AttrIteratorProtocol

A PangoAttrIterator is used to iterate through a PangoAttrList.

A new iterator is created with [methodPango.AttrList.get_iterator]. Once the iterator is created, it can be advanced through the style changes in the text using [methodPango.AttrIterator.next]. At each style change, the range of the current style segment and the attributes currently in effect can be queried.

The AttrIteratorProtocol protocol exposes the methods and properties of an underlying PangoAttrIterator instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see AttrIterator. Alternatively, use AttrIteratorRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying PangoAttrIterator instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • attr_iterator_ptr Default implementation

    Typed pointer to the underlying PangoAttrIterator instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the PangoAttrIterator instance.

    Declaration

    Swift

    var attr_iterator_ptr: UnsafeMutablePointer<PangoAttrIterator>! { get }
  • Required Initialiser for types conforming to AttrIteratorProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

AttrIterator Record: AttrIteratorProtocol extension (methods and fields)

  • copy() Extension method

    Copy a PangoAttrIterator.

    Declaration

    Swift

    @inlinable
    func copy() -> Pango.AttrIteratorRef!
  • destroy() Extension method

    Destroy a PangoAttrIterator and free all associated memory.

    Declaration

    Swift

    @inlinable
    func destroy()
  • get(type:) Extension method

    Find the current attribute of a particular type at the iterator location.

    When multiple attributes of the same type overlap, the attribute whose range starts closest to the current location is used.

    Declaration

    Swift

    @inlinable
    func get(type: PangoAttrType) -> Pango.AttributeRef!
  • getAttrs() Extension method

    Gets a list of all attributes at the current position of the iterator.

    Declaration

    Swift

    @inlinable
    func getAttrs() -> GLib.SListRef!
  • Get the font and other attributes at the current iterator position.

    Declaration

    Swift

    @inlinable
    func getFont<FontDescriptionT>(desc: FontDescriptionT, language: UnsafeMutablePointer<UnsafeMutablePointer<PangoLanguage>?>! = nil, extraAttrs: UnsafeMutablePointer<UnsafeMutablePointer<GSList>?>! = nil) where FontDescriptionT : FontDescriptionProtocol
  • next() Extension method

    Advance the iterator until the next change of style.

    Declaration

    Swift

    @inlinable
    func next() -> Bool
  • range(start:end:) Extension method

    Get the range of the current segment.

    Note that the stored return values are signed, not unsigned like the values in PangoAttribute. To deal with this API oversight, stored return values that wouldn’t fit into a signed integer are clamped to G_MAXINT.

    Declaration

    Swift

    @inlinable
    func range(start: UnsafeMutablePointer<gint>!, end: UnsafeMutablePointer<gint>!)
  • Breaks a piece of text into segments with consistent directional level and font.

    Each byte of text will be contained in exactly one of the items in the returned list; the generated list of items will be in logical order (the start offsets of the items are ascending).

    cached_iter should be an iterator over attrs currently positioned at a range before or containing start_index; cached_iter will be advanced to the range covering the position just after start_index + length. (i.e. if itemizing in a loop, just keep passing in the same cached_iter).

    Declaration

    Swift

    @inlinable
    func itemize<AttrListT, ContextT>(context: ContextT, text: UnsafePointer<CChar>!, startIndex: Int, length: Int, attrs: AttrListT) -> GLib.ListRef! where AttrListT : AttrListProtocol, ContextT : ContextProtocol
  • Like pango_itemize(), but with an explicitly specified base direction.

    The base direction is used when computing bidirectional levels. [funcitemize] gets the base direction from the PangoContext (see [methodPango.Context.set_base_dir]).

    Declaration

    Swift

    @inlinable
    func itemizeWithBaseDir<AttrListT, ContextT>(context: ContextT, baseDir: PangoDirection, text: UnsafePointer<CChar>!, startIndex: Int, length: Int, attrs: AttrListT) -> GLib.ListRef! where AttrListT : AttrListProtocol, ContextT : ContextProtocol
  • attrs Extension method

    Gets a list of all attributes at the current position of the iterator.

    Declaration

    Swift

    @inlinable
    var attrs: GLib.SListRef! { get }