Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Pango::AttrList Class Reference

A PangoAttrList C++ wrapper class. More...

#include <xfc/pango/attributes.hh>

Inheritance diagram for Xfc::Pango::AttrList:

Xfc::G::Boxed Xfc::Object Xfc::Trackable List of all members.

Constructors

Public Types

Public Member Functions

Accessors
Methods

Detailed Description

A PangoAttrList C++ wrapper class.

AttrList represents a list of attributes that apply to a section of text. The attributes are, in general, allowed to overlap in an arbitrary fashion, however, if the attributes are manipulated only through change(), the overlap between properties will meet stricter criteria.

Since the wrapped PangoAttrList structure is stored as a linear list, it is not suitable for storing attributes for large amounts of text. In general, you should not use a single AttrList for more than one paragraph of text.

Note: dynamically allocated objects must either be unreferenced or assigned to a smart pointer. Stack objects are automatically unreferenced when they go out of scope.


Member Typedef Documentation

typedef sigc::slot<bool, const Attribute&> Xfc::Pango::AttrList::AttrFilterSlot

Signature of the callback slot used by filter() to filter out a subset of attributes for a list.

Example: Method signature for AttrFilterSlot.

< bool method(const Attibute& attr);
<
< // attr: A Pango::Attribute.
< // return: true if the attribute should be filtered out.
<


Constructor & Destructor Documentation

Xfc::Pango::AttrList::AttrList ( PangoAttrList *  list  )  [explicit]

Constructs a new attribute list from an existing PangoAttrList.

Parameters:
list A pointer to a PangoAttrList.
The list can be a newly created PangoAttrList or an existing PangoAttrList. The AttrList object created is a temporary object. It doesn't take over the ownership of PangoAttrList and PangoAttrList is not freed by the destructor. The AttrList is created with a reference count of 1 that the caller owns.

Xfc::Pango::AttrList::AttrList ( PangoAttrList *  list,
bool  copy 
)

Constructs a new attribute list from an existing PangoAttrList.

Parameters:
list A pointer to a PangoAttrList.
copy Whether the AttrList object should make a copy of PangoAttrList or not.
The list can be a newly created PangoAttrList or an existing PangoAttrList. If copy is true AttrList will make a copy of PangoAttrList. If copy is false AttrList wont make a copy but instead takes over the ownership of PangoAttrList. Either way, the destructor will free PangoAttrList when the AttrList object is destroyed. This constructor is used by G::Boxed::wrap() to wrap PangoAttrList objects in a C++ wrapper.

The AttrList is created with a reference count of 1 that the caller owns.

Xfc::Pango::AttrList::AttrList ( const AttrList src  ) 

Copy constructor.

Parameters:
src The source attribute list.


Member Function Documentation

AttrList& Xfc::Pango::AttrList::operator= ( const AttrList src  ) 

Assignment operator.

Parameters:
src The source attribute list.

Pointer<AttrIterator> Xfc::Pango::AttrList::get_iterator (  )  const

Creates an iterator initialized to the beginning of the list.

Returns:
A smart pointer to a new attribute iterator.
The list must not be modified until the smart pointer has gone out of scope (i.e. the iterator has been destroyed).

void Xfc::Pango::AttrList::insert ( Attribute attr,
bool  before = false 
)

Insert the given attribute into the list.

Parameters:
attr The attribute to insert. Ownership of this value is assumed by the list.
before Set true if attr should be inserted before other attributes.
If before is false attr will be inserted after all other attributes with a matching start_index. If before is true attr will be inserted before all other attributes with a matching start_index.

void Xfc::Pango::AttrList::change ( Attribute attr  ) 

Insert the given attribute into the list.

Parameters:
attr The attribute to insert. Ownership of this value is assumed by the list.
It will replace any attributes of the same type on that segment and be merged with any adjoining attributes that are identical. This function is slower than insert() for creating an attribute list in order (potentially much slower for large lists). However, insert() is not suitable for continually changing a set of attributes since it never removes or combines existing attributes.

void Xfc::Pango::AttrList::splice ( AttrList other,
int  pos,
int  length 
)

This method splices the other attribute list into this list.

Parameters:
other Another attribute list.
pos The position in list at which to insert other.
length The length of the spliced segment.
This operation is equivalent to stretching every attribute that applies at position pos in list by an amount len, and then calling change() with a copy of each attribute in other in sequence (offset in position by pos).

This operation proves useful for, for instance, inserting a preedit string in the middle of an edit buffer.

Note: length must be specified since the attributes in other may only be present at some subsection of this range.

Pointer<AttrList> Xfc::Pango::AttrList::filter ( const AttrFilterSlot slot  ) 

Given an AttrList and callback slot, this method removes any elements of list for which slot returns true and inserts them into a new list.

Parameters:
slot A callback slot; returns true if an atttribute should be filtered out.
Returns:
A smart pointer to a newly allocated AttrList, or null if no attributes of the given types were found.


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3