Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Pango::AttrIterator Class Reference

A PangoAttrIterator C++ wrapper class. More...

`#include <xfc/pango/attributes.hh>`

Inheritance diagram for Xfc::Pango::AttrIterator:

List of all members.

## Public Member Functions

Constructors

- AttrIterator (PangoAttrIterator *iterator)
    Constructs a new attribute iterator from an existing PangoAttrIterator.
- AttrIterator (const AttrIterator &src)
    Copy constructor.
- ~AttrIterator ()
    Destructor.
- AttrIterator & operator= (const AttrIterator &src)
    Assignment operator.

Accessors

- PangoAttrIterator * pango_attr_iterator () const
    Get a pointer to the PangoAttrIterator structure.
- operator PangoAttrIterator * () const
    Conversion operator; safely converts an AttrIterator to a PangoAttrIterator pointer.
- int start_index () const
    Returns the start index of the current range.
- int end_index () const
    Returns the end index of the current range.
- void range (int *start, int *end) const
    Get the range of the current segment.
- Pointer< Attribute > get (AttrType type)
    Find the current attribute of a particular type at the iterator location.
- void get_font (FontDescription &desc, PangoLanguage **language, std::vector< Pointer< Attribute > > *extra_attrs) const
    Get the font and other attributes at the current iterator position.
- bool get_attrs (std::vector< Pointer< Attribute > > &attrs) const
    Gets a list all attributes at the current position of the iterator.

Methods

- bool next ()
    Advance the iterator until the next change of style.

## Detailed Description

A PangoAttrIterator C++ wrapper class.

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

## Constructor & Destructor Documentation

Xfc::Pango::AttrIterator::AttrIterator | ( | PangoAttrIterator * | iterator | ) | `[explicit]`

Constructs a new attribute iterator from an existing PangoAttrIterator.

Parameters:

  | iterator | A PangoAttrIterator.

AttrIterator takes over the ownership of the PangoAttrIterator and calls pango_attr_iterator_destroy() when it's no longer required.

Xfc::Pango::AttrIterator::AttrIterator | ( | const AttrIterator & | src | ) |

Copy constructor.

Parameters:

  | src | The source iterator.

## Member Function Documentation

Pointer<Attribute> Xfc::Pango::AttrIterator::get | ( | AttrType | type | ) |

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

Parameters:

  | type | The type of attribute to find.

Returns:
  The current attribute of the given type, or null if no attribute of that type applies to the current location.

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

bool Xfc::Pango::AttrIterator::get_attrs | ( | std::vector< Pointer< Attribute > > & | attrs | ) | const

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

Parameters:

  | attrs | A reference to a vector of Pointer<Attribute> to hold the list of attributes.

Returns:
  true if the vector is not empty.

void Xfc::Pango::AttrIterator::get_font | ( | FontDescription & | desc,
|  | PangoLanguage ** | language,
|  | std::vector< Pointer< Attribute > > * | extra_attrs
| ) | const

Get the font and other attributes at the current iterator position.

Parameters:

  | desc | A FontDescription to fill in with the current values.
  | language | If non-null, location to store the language tag for item, or null if none is found.
  | extra_attrs | If non-null, a vector in which to store a list of non-font attributes at the current position; only the highest priority value of each attribute will be added to this list.

The family name in desc will be set by Pango using pango_font_description_set_family_static() using values from an attribute in the AttrList associated with the iterator, so if you plan to keep it around, you must call: desc.set_family(desc.get_family()).

bool Xfc::Pango::AttrIterator::next | ( |  | ) |

Advance the iterator until the next change of style.

Returns:
  false if the iterator is at the end of the list, otherwise true.

AttrIterator& Xfc::Pango::AttrIterator::operator= | ( | const AttrIterator & | src | ) |

Assignment operator.

Parameters:

  | src | The source iterator.

void Xfc::Pango::AttrIterator::range | ( | int * | start,
|  | int * | end
| ) | const

Get the range of the current segment.

Parameters:

  | start | The location to store the start of the range.
  | end | The location to store the end of the range.

The documentation for this class was generated from the following file:

- attributes.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3