Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Pango::Item Class Reference

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

`#include <inti/pango/item.h>`

Inheritance diagram for Inti::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>.

## Constructor & Destructor Documentation

Inti::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.

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

Copy constructor.

Parameters:

  src | The source Item.

## Member Function Documentation

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

Assignment operator.

Parameters:

  src | The source Item.

Pointer<Item> Inti::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.h

Main Page - Footer