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

# Xfc::Pango::Item Class Reference

A PangoItem C++ wrapper class. More...

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

Inheritance diagram for Xfc::Pango::Item:

List of all members.

## Public Member Functions

Constructors

- Item ()
    Construct a new item initialized to default values.
- Item (PangoItem *item, bool copy)
    Construct a new item from an existing PangoItem.
- Item (const Item &src)
    Copy constructor.
- ~Item ()
    Destructor.
- Item & operator= (const Item &src)
    Assignment operator.

Accessors

- PangoItem * pango_item () const
    Get a pointer to the PangoItem structure.
- operator PangoItem * () const
    Conversion operator; safely converts an Item to a PangoItem pointer.
- int offset () const
    Returns the offset of the segment from the beginning of the string in bytes.
- int length () const
    Returns the length of the segment in bytes.
- int num_chars () const
    Returns the length of the segment in characters.
- const Analysis & analysis () const
    Returns a reference to the analysis object that stores the properties of the segment.

Methods

- Pointer< Item > split (int split_index, int split_offset)
    Modifies the item to cover only the text after split_index, and returns a new item that covers the text before split_index that used to be in the item.

## Detailed Description

A PangoItem C++ wrapper class.

Item is an object that stores information about a segment of text. You can obtain an Item by calling Pango::Context::itemize() which returns a vector of Pointer<Item>.

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.

## Constructor & Destructor Documentation

Xfc::Pango::Item::Item | ( |  | ) |

| Construct a new item initialized to default values. The Item is created with a reference count of 1 that the caller owns.

Xfc::Pango::Item::Item | ( | PangoItem * | item,
|  | bool | copy
| ) | `[explicit]`

Construct a new item from an existing PangoItem.

Parameters:

  | item | A pointer to a PangoItem.
  | copy | Whether the Item object should make a copy of PangoItem or not.

The item can be a newly created PangoItem or an existing PangoItem. If copy is true Item will make a copy of PangoItem. If copy is false Item wont make a copy but instead takes over the ownership of PangoItem. Either way, the destructor will free the PangoItem when the Item object is destroyed.

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

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

Copy constructor.

Parameters:

  | src | The source Item.

## Member Function Documentation

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

Assignment operator.

Parameters:

  | src | The source Item.

Pointer<Item> Xfc::Pango::Item::split | ( | int | split_index,
|  | int | split_offset
| ) |

Modifies the item to cover only the text after split_index, and returns a new item that covers the text before split_index that used to be in the item.

Parameters:

  | split_index | The byte index at the position to split the item, relative to the start of the item.
  | split_offset | The number of characters between the start of the item and split_index.

Returns:
  A smart pointer to a new item representing the text before split_index.

You can think of split_index as the length of the returned item. split_index may not be 0, and it may not be greater than or equal to the length this item before the split (that is, there must be at least one byte assigned to each item, you can't create a zero-length item). split_offset is the length chars of the first (returned) item, and must be provided because the text used to generate the item isn't available, so split() can't count the character length of the split items itself.

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

- pango/item.hh

Xfce Foundation Classes

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