InfoCdbBackend Class Reference

Implements the InfoBackend for reading data from a cdb database. More...

#include <infocdbbackend.h>

Inheritance diagram for InfoCdbBackend:

InfoBackend

List of all members.

Public Member Functions

 InfoCdbBackend (QObject *parent=0)
 ~InfoCdbBackend ()
virtual QString name () const
 Returns 'cdb'.
virtual QStringList listKeys () const
 Returns the list of all the keys in the registry.
virtual QString docForKey (QString key) const
 Returns the documentation for the given key name.
virtual bool keyDeclared (QString key) const
 Returns true if the given key exists.
virtual bool keyDeprecated (QString key) const
 Returns true if the given key is deprecated.
virtual const QList
< ContextProviderInfo
providersForKey (QString key) const
 Returns a list of providers for the given key.
virtual ContextTypeInfo typeInfoForKey (QString key) const
 Returns the type information for the given key.

Static Public Member Functions

static QString databaseDirectory ()
 Returns the full path to the database directory.
static QString databasePath ()
 Returns the full path to the database.
static bool databaseExists ()
 Returns true if the database file is present.

Private Slots

void onDatabaseDirectoryChanged (const QString &path)
 Called when the database directory changes.

Private Member Functions

void watch ()
void checkCompatibility ()
 Update the database compatibility field.

Static Private Member Functions

static QStringList variantListToStringList (const QVariantList &l)

Private Attributes

QFileSystemWatcher * watcher
 A watched object obsering the database file. Delivers synced notifications.
CDBReader reader
 The cdb reader object used to access the cdb database.
bool databaseCompatible
 If the currently open database is compatible (versions match).
quint64 lastInode


Detailed Description

Implements the InfoBackend for reading data from a cdb database.

This class is not exported in the public API. It does not cache any data to optimize the memory consumption. It's assumed that most data is anyways cached (as needed) in the ContextPropertyInfo and the cdb key-based access (no enumetation) is fast anyways. It observers the cache.cdb with a file system watcher.


Constructor & Destructor Documentation

InfoCdbBackend::InfoCdbBackend ( QObject *  parent = 0  )  [explicit]

InfoCdbBackend::~InfoCdbBackend (  ) 


Member Function Documentation

QString InfoCdbBackend::name (  )  const [virtual]

Returns 'cdb'.

Implements InfoBackend.

QStringList InfoCdbBackend::listKeys (  )  const [virtual]

Returns the list of all the keys in the registry.

Implements InfoBackend.

QString InfoCdbBackend::docForKey ( QString  key  )  const [virtual]

Returns the documentation for the given key name.

Implements InfoBackend.

bool InfoCdbBackend::keyDeclared ( QString  key  )  const [virtual]

Returns true if the given key exists.

Implements InfoBackend.

bool InfoCdbBackend::keyDeprecated ( QString  key  )  const [virtual]

Returns true if the given key is deprecated.

Implements InfoBackend.

const QList< ContextProviderInfo > InfoCdbBackend::providersForKey ( QString  key  )  const [virtual]

Returns a list of providers for the given key.

Implements InfoBackend.

ContextTypeInfo InfoCdbBackend::typeInfoForKey ( QString  key  )  const [virtual]

Returns the type information for the given key.

Implements InfoBackend.

QString InfoCdbBackend::databaseDirectory (  )  [static]

Returns the full path to the database directory.

Takes the CONTEXT_PROVIDERS env variable into account.

QString InfoCdbBackend::databasePath (  )  [static]

Returns the full path to the database.

Takes the CONTEXT_PROVIDERS env variable into account.

bool InfoCdbBackend::databaseExists (  )  [static]

Returns true if the database file is present.

void InfoCdbBackend::watch (  )  [private]

QStringList InfoCdbBackend::variantListToStringList ( const QVariantList &  l  )  [static, private]

void InfoCdbBackend::checkCompatibility (  )  [private]

Update the database compatibility field.

void InfoCdbBackend::onDatabaseDirectoryChanged ( const QString &  path  )  [private, slot]

Called when the database directory changes.

Reopens the database and emits the change signal if the inode of the database has been modified.


Member Data Documentation

QFileSystemWatcher* InfoCdbBackend::watcher [private]

A watched object obsering the database file. Delivers synced notifications.

The cdb reader object used to access the cdb database.

If the currently open database is compatible (versions match).

quint64 InfoCdbBackend::lastInode [private]


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

Generated on Thu Feb 21 18:31:19 2013 for libcontextsubscriber by  doxygen 1.5.6