InfoXmlBackend Class Reference

Implements the InfoBackend for reading data from a directory with xml files. More...

#include <infoxmlbackend.h>

Inheritance diagram for InfoXmlBackend:

InfoBackend

List of all members.

Public Member Functions

 InfoXmlBackend (QObject *parent=0)
 ~InfoXmlBackend ()
virtual QString name () const
 Returns 'xml'.
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 registryPath ()
 Returns the full path to the registry directory.
static QString coreDeclPath ()
 Returns the full path to the core property declaration file.

Private Slots

void onDirectoryChanged (const QString &path)
 Called when the registry directory changed (ie.
void onFileChanged (const QString &path)
 Called when one of the parsed XML files changed.

Private Member Functions

void regenerateKeyDataList ()
 Clears all the stored data about the registry and parses it all over again.
void readKeyDataFromXml (const QString &path)
 Parses a given path file and adds it's contents to the hash.
void parseKey (const AssocTree &keyTree, const AssocTree &providerTree)
 Parse the given QVariant tree which is supposed to be a key tree.

Private Attributes

QFileSystemWatcher * watcher
 A watched object obsering the database file. Delivers synced notifications.
QHash< QString, InfoKeyDatakeyDataHash
 This hash contains the full state of registry in memory.
QHash< QString, QList
< ContextProviderInfo > > 
keyProvidersHash
 This hash contains providers for keys.
int countOfFilesInLastParse
 The number of xml files we parsed in last registry update.


Detailed Description

Implements the InfoBackend for reading data from a directory with xml files.

This class is not exported in the public API. It keeps all the data cached in the memory. It's assumed that this backend is not going to be used live in production systems and does not need to be ultra-fast (instead, implementation simplicity and corectness are preffered). For fast backend see the InfoCdbBackend.


Constructor & Destructor Documentation

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

InfoXmlBackend::~InfoXmlBackend (  ) 


Member Function Documentation

QString InfoXmlBackend::name (  )  const [virtual]

Returns 'xml'.

Implements InfoBackend.

QStringList InfoXmlBackend::listKeys (  )  const [virtual]

Returns the list of all the keys in the registry.

Implements InfoBackend.

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

Returns the documentation for the given key name.

Implements InfoBackend.

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

Returns true if the given key exists.

Implements InfoBackend.

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

Returns true if the given key is deprecated.

Implements InfoBackend.

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

Returns a list of providers for the given key.

Implements InfoBackend.

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

Returns the type information for the given key.

Implements InfoBackend.

QString InfoXmlBackend::registryPath (  )  [static]

Returns the full path to the registry directory.

Takes the CONTEXT_PROVIDERS env variable into account.

QString InfoXmlBackend::coreDeclPath (  )  [static]

Returns the full path to the core property declaration file.

Takes the CONTEXT_CORE_DECLARATIONS env variable into account.

void InfoXmlBackend::onDirectoryChanged ( const QString &  path  )  [private, slot]

Called when the registry directory changed (ie.

file removed or added). Triggers a whole registry rebuild + signal emissions. It detects a situation when a added/removed file was not a parsed(xml) file.

void InfoXmlBackend::onFileChanged ( const QString &  path  )  [private, slot]

Called when one of the parsed XML files changed.

This triggers a whole registry rebuild + signal emissions.

void InfoXmlBackend::regenerateKeyDataList (  )  [private]

Clears all the stored data about the registry and parses it all over again.

void InfoXmlBackend::readKeyDataFromXml ( const QString &  path  )  [private]

Parses a given path file and adds it's contents to the hash.

Also adds the file to the watcher (starts observing it).

void InfoXmlBackend::parseKey ( const AssocTree keyTree,
const AssocTree providerTree 
) [private]

Parse the given QVariant tree which is supposed to be a key tree.


Member Data Documentation

QFileSystemWatcher* InfoXmlBackend::watcher [private]

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

QHash<QString, InfoKeyData> InfoXmlBackend::keyDataHash [private]

This hash contains the full state of registry in memory.

QHash<QString, QList<ContextProviderInfo> > InfoXmlBackend::keyProvidersHash [private]

This hash contains providers for keys.

The number of xml files we parsed in last registry update.


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

Generated on Sun Apr 21 16:11:51 2013 for libcontextsubscriber by  doxygen 1.5.6