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.
-
Untyped pointer to the underlying
PangoAttrIterator
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
attr_iterator_ptr
Default implementationTyped 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)
-
copy()
Extension methodCopy a
PangoAttrIterator
.Declaration
Swift
@inlinable func copy() -> Pango.AttrIteratorRef!
-
destroy()
Extension methodDestroy 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 methodGets a list of all attributes at the current position of the iterator.
Declaration
Swift
@inlinable func getAttrs() -> GLib.SListRef!
-
getFont(desc:
Extension methodlanguage: extraAttrs: ) 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 methodAdvance the iterator until the next change of style.
Declaration
Swift
@inlinable func next() -> Bool
-
range(start:
Extension methodend: ) 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 toG_MAXINT
.Declaration
Swift
@inlinable func range(start: UnsafeMutablePointer<gint>!, end: UnsafeMutablePointer<gint>!)
-
itemize(context:
Extension methodtext: startIndex: length: attrs: ) 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 overattrs
currently positioned at a range before or containingstart_index
;cached_iter
will be advanced to the range covering the position just afterstart_index
+length
. (i.e. if itemizing in a loop, just keep passing in the samecached_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
-
itemizeWithBaseDir(context:
Extension methodbaseDir: text: startIndex: length: attrs: ) Like
pango_itemize()
, but with an explicitly specified base direction.The base direction is used when computing bidirectional levels. [func
itemize
] gets the base direction from thePangoContext
(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 methodGets a list of all attributes at the current position of the iterator.
Declaration
Swift
@inlinable var attrs: GLib.SListRef! { get }