#include <infoxmlbackend.h>
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, InfoKeyData > | keyDataHash |
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. |
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.
InfoXmlBackend::InfoXmlBackend | ( | QObject * | parent = 0 |
) | [explicit] |
InfoXmlBackend::~InfoXmlBackend | ( | ) |
QString InfoXmlBackend::name | ( | ) | const [virtual] |
QStringList InfoXmlBackend::listKeys | ( | ) | const [virtual] |
QString InfoXmlBackend::docForKey | ( | QString | key | ) | const [virtual] |
bool InfoXmlBackend::keyDeclared | ( | QString | key | ) | const [virtual] |
bool InfoXmlBackend::keyDeprecated | ( | QString | key | ) | const [virtual] |
const QList< ContextProviderInfo > InfoXmlBackend::providersForKey | ( | QString | key | ) | const [virtual] |
ContextTypeInfo InfoXmlBackend::typeInfoForKey | ( | QString | key | ) | const [virtual] |
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.
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.
int InfoXmlBackend::countOfFilesInLastParse [private] |
The number of xml files we parsed in last registry update.