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

# Xfc::Atk::RelationSet Class Reference

An AtkRelationSet C++ wrapper class. More...

`#include <xfc/atk/relation.hh>`

Inheritance diagram for Xfc::Atk::RelationSet:

List of all members.

## Public Member Functions

Constructors

- RelationSet ()
    Constructs an empty relation set with a reference count of 1 that the caller owns.
- virtual ~RelationSet ()
    Destructor.

Accessors

- AtkRelationSet * atk_relation_set () const
    Get a pointer to the AtkRelationSet structure.
- operator AtkRelationSet * () const
    Conversion operator; safely converts a RelationSet to an AtkRelationSet pointer.
- bool contains (RelationType relationship) const
    Determines whether the relation set contains a relation that matches the specified type.
- int get_n_relations () const
    Determines the number of relations in a relation set.
- Relation * get_relation (int index) const
    Determines the relation at the specified position in the relation set.
- Relation * get_relation (RelationType relationship) const
    Finds a relation that matches the specified type.

Methods

- void add (Relation &relation)
    Add a new relation to the current relation set if it is not already present.
- void remove (Relation &relation)
    Removes a relation from the relation set.
- void add_relation_by_type (RelationType relationship, Atk::Object &target)
    Add a new relation of the specified type with the specified target to the relation set if the relation set does not contain a relation of that type.

## Protected Member Functions

Constructors

- RelationSet (AtkRelationSet *set, bool owns_reference=true)
    Construct a new RelationSet from an existing AtkRelationSet.

## Detailed Description

An AtkRelationSet C++ wrapper class.

RelationSet is a set of Relations, normally the set of Relations which an Atk::Object has.

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::Atk::RelationSet::RelationSet | ( | AtkRelationSet * | set,
|  | bool | owns_reference = `true`
| ) | `[explicit, protected]`

Construct a new RelationSet from an existing AtkRelationSet.

Parameters:

  | set | A pointer to a AtkRelationSet.
  | owns_reference | Set false if the initial reference count is floating, set true if it's not.

The set can be a newly created AtkRelationSet or an existing AtkRelationSet. (see G::Object::Object).

## Member Function Documentation

void Xfc::Atk::RelationSet::add | ( | Relation & | relation | ) |

Add a new relation to the current relation set if it is not already present.

Parameters:

  | relation | A Relation.

void Xfc::Atk::RelationSet::add_relation_by_type | ( | RelationType | relationship,
|  | Atk::Object & | target
| ) |

Add a new relation of the specified type with the specified target to the relation set if the relation set does not contain a relation of that type.

Parameters:

  | relationship | An Atk::RelationType.
  | target | An Atk::Object.

If the relation set does contain a relation of that type a the target is added to the relation.

bool Xfc::Atk::RelationSet::contains | ( | RelationType | relationship | ) | const

Determines whether the relation set contains a relation that matches the specified type.

Parameters:

  | relationship | A RelationType.

Returns:
  true if relationship is the relationship type of a relation in the set, false otherwise.

int Xfc::Atk::RelationSet::get_n_relations | ( |  | ) | const

Determines the number of relations in a relation set.

Returns:
  An integer representing the number of relations in the set.

Relation* Xfc::Atk::RelationSet::get_relation | ( | RelationType | relationship | ) | const

Finds a relation that matches the specified type.

Parameters:

  | relationship | A RelationType.

Returns:
  A Relation, which is a relation matching the specified type.

Relation* Xfc::Atk::RelationSet::get_relation | ( | int | index | ) | const

Determines the relation at the specified position in the relation set.

Parameters:

  | index | An integer representing a position in the set, starting from 0.

Returns:
  A Relation, which is the relation at position i in the set.

void Xfc::Atk::RelationSet::remove | ( | Relation & | relation | ) |

Removes a relation from the relation set.

Parameters:

  | relation | A Relation.

This method unreferences the Relation so it will be deleted, unless there is another reference to it.

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

- relation.hh

Xfce Foundation Classes

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