File indexing completed on 2024-05-12 04:37:43

0001 /*
0002     SPDX-FileCopyrightText: 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-only
0005 */
0006 
0007 #ifndef KDEVPLATFORM_DATAACCESSREPOSITORY_H
0008 #define KDEVPLATFORM_DATAACCESSREPOSITORY_H
0009 
0010 #include <language/languageexport.h>
0011 #include <language/editor/rangeinrevision.h>
0012 #include "dataaccess.h"
0013 
0014 namespace KDevelop {
0015 class DataAccessRepositoryPrivate;
0016 
0017 /**
0018  * @brief Stores all the data accesses in a file
0019  *
0020  * Provides the data accesses in a file and provides different ways to accessing them
0021  */
0022 class KDEVPLATFORMLANGUAGE_EXPORT DataAccessRepository
0023 {
0024 public:
0025     DataAccessRepository();
0026     ~DataAccessRepository();
0027 
0028     /** Constructs a DataAccess instance and adds it to the repository */
0029     void addModification(const KDevelop::CursorInRevision& cursor, KDevelop::DataAccess::DataAccessFlags flags,
0030                          const KDevelop::RangeInRevision& range = RangeInRevision::invalid());
0031 
0032     /** Clears the whole structure as if it was never used before */
0033     void clear();
0034 
0035     /** @returns all the data access stored in this repository */
0036     QList<DataAccess*> modifications() const;
0037 
0038     /** @returns the access located at the position specified by @p cursor */
0039     DataAccess* accessAt(const KDevelop::CursorInRevision& cursor) const;
0040 
0041     /** @returns all the data accesses inside the @p range range */
0042     QList<DataAccess*> accessesInRange(const KDevelop::RangeInRevision& range) const;
0043 
0044 private:
0045     const QScopedPointer<class DataAccessRepositoryPrivate> d_ptr;
0046     Q_DECLARE_PRIVATE(DataAccessRepository)
0047 };
0048 }
0049 #endif