KDE 4.7 PyKDE API Reference

- KDE's Python API

# DBusExportIterator Class Reference

`from PyKDE4.soprano import *`

Inherits: QObject,Soprano.Error.ErrorCache
Namespace: Soprano.Server

## Detailed Description

\class DBusExportIterator dbusexportiterator.h Soprano/Server/DBusExportIterator

Exports a %Soprano Iterator via D-Bus.

The DBusExportIterator can be used to export a single iterator via D-Bus. This may be useful in case one does not want to expose the complete Model API but restrict access via custom methods that return %Soprano Iterators.

The most common usage is probably as a fire-and-forget class:

     void myDbusMethod( const QDBusMessage& m ) {
        Soprano.StatementIterator it = model->listStatements();
        Soprano.Server.DBusExportIterator* dbusIt = new Soprano.Server.DBusExportIterator( it, this );
        dbusIt->setDeleteOnClose( true );
        dbusIt->registerIterator( myFancyDBusObjectPath, m.service() );
        return myFancyDBusObjectPath;
     }

This is a class for advanced usage. In most situations using DBusExportModel or even ServerCore.registerAsDBusObject is probably enough.

Author:
  Sebastian Trueg <trueg@kde.org>

\sa soprano_server_dbus

Since:
  2.1

## Methods
| __init__ (self, Soprano.StatementIterator it, QObject parent=0)
| __init__ (self, Soprano.NodeIterator it, QObject parent=0)
| __init__ (self, Soprano.QueryResultIterator it, QObject parent=0)
QString | dbusObjectPath (self)
bool | deleteOnClose (self)
Soprano.NodeIterator | nodeIterator (self)
Soprano.QueryResultIterator | queryResultIterator (self)
bool | registerIterator (self, QString dbusObjectPath, QString dbusClient=QString())
| setDeleteOnClose (self, bool deleteOnClose)
Soprano.StatementIterator | statementIterator (self)
| unregisterIterator (self)

## Method Documentation

__init__ | ( | self, |
|  | Soprano.StatementIterator | it,
|  | QObject | parent=0
| ) |  |  |

Create a new instance to export a QueryResultIterator

__init__ | ( | self, |
|  | Soprano.NodeIterator | it,
|  | QObject | parent=0
| ) |  |  |

Create a new instance to export a QueryResultIterator

__init__ | ( | self, |
|  | Soprano.QueryResultIterator | it,
|  | QObject | parent=0
| ) |  |  |

Create a new instance to export a QueryResultIterator

QString dbusObjectPath | ( |  | self ) |

The path this iterator is exported on. This is an empty string if the iterator is not exported.

bool deleteOnClose | ( |  | self ) |

The DBusExportIterator instance can delete itself once the iterator is closed. The default value is false, i.e. the creator has to delete the instance.

\sa setDeleteOnClose, Iterator.close

Soprano.NodeIterator nodeIterator | ( |  | self ) |

Returns:
  The used NodeIterator or an invalid one if this DBusExportIterator does not export a NodeIterator.

Soprano.QueryResultIterator queryResultIterator | ( |  | self ) |

Returns:
  The used QueryResultIterator or an invalid one if this DBusExportIterator does not export a QueryResultIterator.

bool registerIterator | ( | self, |
|  | QString | dbusObjectPath,
|  | QString | dbusClient=QString()
| ) |  |  |

Register the iterator under the given D-Bus object path. \sa QDBusConnection.registerObject

Parameters:

  | dbusObjectPath | The D-Bus object path to register the iterator under.

Parameters:

  | dbusClient | The optional D-Bus client which uses the iterator, i.e. which called the method that triggered the creation of the iterator. If set, the iterator will be closed once the client dies. In combination with setDeleteOnClose this class can thus be used in a fire-and-forget manner.

setDeleteOnClose | ( | self, |
|  | bool | deleteOnClose
| ) |  |  |

Set if the iterator should delete itself once it has been closed. The default value is false, i.e. the creator has to delete the instance.

Warning:
  This only works if the iterator is closed from the outside, i.e. by the D-Bus client.

\sa deleteOnClose

Soprano.StatementIterator statementIterator | ( |  | self ) |

Returns:
  The used StatementIterator or an invalid one if this DBusExportIterator does not export a StatementIterator.

unregisterIterator | ( |  | self ) |

Unregister the iterator from D-Bus. \sa QDBusConnection.unregisterObject