pangomm 2.54.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Related Symbols | List of all members
Pango::AttrIter Class Reference

A Pango::AttrIter is used to represent an iterator through a Pango::AttrList. More...

#include <pangomm/attriter.h>

Public Types

typedef std::forward_iterator_tag iterator_category
 
typedef int difference_type
 

Public Member Functions

 AttrIter (PangoAttrIterator * castitem, bool take_copy=true)
 
 AttrIter (const AttrIter & src)
 
 ~AttrIter ()
 
AttrIteroperator= (const AttrIter & src)
 
AttrIteroperator++ ()
 Advance the iterator until the next change of style.
 
const AttrIter operator++ (int)
 
 operator bool () const
 Check whether the iterator is valid.
 
bool next ()
 The same as operator++().
 
void get_range (int &start, int &end) const
 Get the range of the current segment.
 
Attribute get_attribute (AttrType type) const
 Find the current attribute of a particular type at the iterator location.
 
FontDescription get_font_desc () const
 Get the font description used at the current iterator position.
 
Language get_language () const
 Gets the language tag used at current iterator position.
 
std::vector< Attributeget_extra_attrs () const
 Gets a list of non-font attributes at the the current iterator position.
 
std::vector< Attributeget_attrs () const
 Gets a list all attributes a the current position of the iterator.
 
PangoAttrIterator * gobj ()
 
const PangoAttrIterator * gobj () const
 

Protected Member Functions

 AttrIter ()
 

Protected Attributes

PangoAttrIterator * gobject_
 

Related Symbols

(Note that these are not member symbols.)

Pango::AttrIter wrap (PangoAttrIterator * object, bool take_copy=false)
 

Detailed Description

A Pango::AttrIter is used to represent an iterator through a Pango::AttrList.

A new iterator is created with Pango::AttrList::get_iter(). Once the iterator is created, it can be advanced through the style changes in the text using Pango::AttrIter::next(). At each style change, the range of the current style segment and the attributes currently in effect can be queried.

Member Typedef Documentation

◆ difference_type

◆ iterator_category

Constructor & Destructor Documentation

◆ AttrIter() [1/3]

Pango::AttrIter::AttrIter ( )
protected

◆ AttrIter() [2/3]

Pango::AttrIter::AttrIter ( PangoAttrIterator *  castitem,
bool  take_copy = true 
)
explicit

◆ AttrIter() [3/3]

Pango::AttrIter::AttrIter ( const AttrIter src)

◆ ~AttrIter()

Pango::AttrIter::~AttrIter ( )

Member Function Documentation

◆ get_attribute()

Attribute Pango::AttrIter::get_attribute ( AttrType  type) const

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.

Parameters
typeThe type of attribute to find.
Returns
The current attribute of the given type, or nullptr if no attribute of that type applies to the current location.

◆ get_attrs()

std::vector< Attribute > Pango::AttrIter::get_attrs ( ) const

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

Returns
A list of all attributes for the current range.

◆ get_extra_attrs()

std::vector< Attribute > Pango::AttrIter::get_extra_attrs ( ) const

Gets a list of non-font attributes at the the current iterator position.

Only the highest priority value of each attribute will be added to this list.

Returns
The list of non-font attributes at the current iterator position.

◆ get_font_desc()

FontDescription Pango::AttrIter::get_font_desc ( ) const

Get the font description used at the current iterator position.

Returns
The font description used at the current iterator position.

◆ get_language()

Language Pango::AttrIter::get_language ( ) const

Gets the language tag used at current iterator position.

Returns
The language tag or an empty Pango::Language object if non is found.

◆ get_range()

void Pango::AttrIter::get_range ( int &  start,
int &  end 
) const

Get the range of the current segment.

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

Parameters
startLocation to store the start of the range.
endLocation to store the end of the range.

◆ gobj() [1/2]

PangoAttrIterator * Pango::AttrIter::gobj ( )
inline

◆ gobj() [2/2]

const PangoAttrIterator * Pango::AttrIter::gobj ( ) const
inline

◆ next()

bool Pango::AttrIter::next ( )

The same as operator++().

Returns
false if the end of the list is reached.

◆ operator bool()

Pango::AttrIter::operator bool ( ) const
explicit

Check whether the iterator is valid.

Returns
true if the iterator is valid.

◆ operator++() [1/2]

AttrIter & Pango::AttrIter::operator++ ( )

Advance the iterator until the next change of style.

The iterator becomes invalid if the end of the list is reached.

Returns
The iterator itself.

◆ operator++() [2/2]

const AttrIter Pango::AttrIter::operator++ ( int  )

◆ operator=()

AttrIter & Pango::AttrIter::operator= ( const AttrIter src)

Friends And Related Symbol Documentation

◆ wrap()

Pango::AttrIter wrap ( PangoAttrIterator *  object,
bool  take_copy = false 
)
related

Member Data Documentation

◆ gobject_

PangoAttrIterator* Pango::AttrIter::gobject_
protected