language/duchain
KDevelop::ItemRepositoryRegistry Class Reference
Manages a set of item-repositores and allows loading/storing them all at once from/to disk. More...
#include <itemrepository.h>
Public Member Functions | |
| ItemRepositoryRegistry (QString openPath=QString(), KLockFile::Ptr lock=KLockFile::Ptr()) | |
| void | close () |
| int | finalCleanup () |
| QAtomicInt & | getCustomCounter (const QString &identity, int initialValue) |
| void | lockForWriting () |
| QMutex & | mutex () |
| bool | open (const QString &path, bool clear=false, KLockFile::Ptr lock=KLockFile::Ptr()) |
| QString | path () const |
| void | printAllStatistics () const |
| void | registerRepository (AbstractItemRepository *repository, AbstractRepositoryManager *manager) |
| void | shutdown () |
| void | store () |
| void | unlockForWriting () |
| void | unRegisterRepository (AbstractItemRepository *repository) |
Detailed Description
Manages a set of item-repositores and allows loading/storing them all at once from/to disk.
Does not automatically store contained repositories on destruction. For the global standard registry, the storing is triggered from within duchain, so you don't need to care about it.
Definition at line 140 of file itemrepository.h.
Member Function Documentation
| void KDevelop::ItemRepositoryRegistry::close | ( | ) |
- Warning:
- The current state is not stored to disk.
Definition at line 382 of file itemrepository.cpp.
| int KDevelop::ItemRepositoryRegistry::finalCleanup | ( | ) |
Does a big cleanup, removing all non-persistent items in the repositories Returns whether something was removed(Count of removed bytes).
Definition at line 369 of file itemrepository.cpp.
| QAtomicInt & KDevelop::ItemRepositoryRegistry::getCustomCounter | ( | const QString & | identity, | |
| int | initialValue | |||
| ) |
Returns a custom counter, identified by the given identity, that is persistently stored in the repository directory.
If the counter didn't exist before, it will be initialized with initialValue
Definition at line 55 of file itemrepository.cpp.
| void KDevelop::ItemRepositoryRegistry::lockForWriting | ( | ) |
Call this to lock the directory for writing.
When KDevelop crashes while the directory is locked for writing, it will know that the directory content is inconsistent, and discard it while next startup.
Definition at line 152 of file itemrepository.cpp.
| QMutex & KDevelop::ItemRepositoryRegistry::mutex | ( | ) |
Returns the global item-repository mutex. This can be used to protect the initialization.
Definition at line 51 of file itemrepository.cpp.
| bool KDevelop::ItemRepositoryRegistry::open | ( | const QString & | path, | |
| bool | clear = false, |
|||
| KLockFile::Ptr | lock = KLockFile::Ptr() | |||
| ) |
Path is supposed to be a shared directory-name that the item-repositories are to be loaded from.
- Parameters:
-
clear Whether a fresh start should be done, and all repositories cleared If this returns false, loading has failed, and all repositories have been discarded.
- Note:
- Currently the given path must reference a hidden directory, just to make sure we're not accidentally deleting something important
- Todo:
- Ask the user
Increase the crash-count. It will be reset of kdevelop is shut down cleanly.
Increase the crash-count. It will be reset of kdevelop is shut down cleanly.
Definition at line 227 of file itemrepository.cpp.
| QString KDevelop::ItemRepositoryRegistry::path | ( | ) | const |
Returns the path currently set.
Definition at line 146 of file itemrepository.cpp.
| void KDevelop::ItemRepositoryRegistry::printAllStatistics | ( | ) | const |
Prints the statistics ofall registered item-repositories to the command line using kDebug().
Definition at line 361 of file itemrepository.cpp.
| void KDevelop::ItemRepositoryRegistry::registerRepository | ( | AbstractItemRepository * | repository, | |
| AbstractRepositoryManager * | manager | |||
| ) |
The registered repository will automatically be opened with the current path, if one is set.
Definition at line 134 of file itemrepository.cpp.
| void KDevelop::ItemRepositoryRegistry::shutdown | ( | ) |
Must be called somewhere at the end of the shutdown sequence, to indicate that the application has been closed gracefully.
Definition at line 399 of file itemrepository.cpp.
| void KDevelop::ItemRepositoryRegistry::store | ( | ) |
Should be called on a regular basis: Stores all repositories to disk, and eventually unloads unneeded data to save memory.
Definition at line 335 of file itemrepository.cpp.
| void KDevelop::ItemRepositoryRegistry::unlockForWriting | ( | ) |
Call this when you're ready writing, after lockForWriting has been called.
Definition at line 160 of file itemrepository.cpp.
| void KDevelop::ItemRepositoryRegistry::unRegisterRepository | ( | AbstractItemRepository * | repository | ) |
The registered repository will automatically be closed if it was open.
Definition at line 166 of file itemrepository.cpp.
The documentation for this class was generated from the following files:
KDE 4.4 API Reference