File indexing completed on 2024-05-05 04:38:08

0001 /*
0002     SPDX-FileCopyrightText: 2008 David Nolden <david.nolden.kdevelop@art-master.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-only
0005 */
0006 
0007 #ifndef ABSTRACTITEMREPOSITORY_H
0008 #define ABSTRACTITEMREPOSITORY_H
0009 
0010 #include "serializationexport.h"
0011 
0012 #include <QtGlobal>
0013 
0014 class QString;
0015 
0016 namespace KDevelop {
0017 /// Returns a version-number that is used to reset the item-repository after incompatible layout changes.
0018 KDEVPLATFORMSERIALIZATION_EXPORT uint staticItemRepositoryVersion();
0019 
0020 /// The interface class for an item-repository object.
0021 class KDEVPLATFORMSERIALIZATION_EXPORT AbstractItemRepository
0022 {
0023 public:
0024     virtual ~AbstractItemRepository();
0025     /// @param path A shared directory-name that the item-repository is to be loaded from.
0026     /// @returns    Whether the repository has been opened successfully.
0027     virtual bool open(const QString& path) = 0;
0028     virtual void close(bool doStore = false) = 0;
0029     /// Stores the repository contents to disk, eventually unloading unused data to save memory.
0030     virtual void store() = 0;
0031     /// Does a big cleanup, removing all non-persistent items in the repositories.
0032     /// @returns Count of bytes of data that have been removed.
0033     virtual int finalCleanup() = 0;
0034     virtual QString repositoryName() const = 0;
0035     virtual QString printStatistics() const = 0;
0036 
0037     /// lock the repository
0038     virtual void lock() = 0;
0039     /// unlock the repository
0040     virtual void unlock() = 0;
0041 };
0042 }
0043 
0044 #endif // ABSTRACTITEMREPOSITORY_H