File indexing completed on 2024-05-12 04:38:06

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 KDEVPLATFORM_MODIFICATIONREVISIONSET_H
0008 #define KDEVPLATFORM_MODIFICATIONREVISIONSET_H
0009 
0010 #include "modificationrevision.h"
0011 
0012 namespace KDevelop {
0013 /**
0014  * This class represents a set of modification-revisions assigned to file-names.
0015  * It is safe to store this class in the disk-mapped internal duchain data structures.
0016  * */
0017 
0018 class KDEVPLATFORMLANGUAGE_EXPORT ModificationRevisionSet
0019 {
0020 public:
0021     explicit ModificationRevisionSet(uint index = 0);
0022 
0023     static void clearCache();
0024 
0025     void clear();
0026 
0027     uint index() const
0028     {
0029         return m_index;
0030     }
0031 
0032     ///Returns the count of file dependencies in this set
0033     uint size() const;
0034 
0035     void addModificationRevision(const IndexedString& url, const ModificationRevision& revision);
0036 
0037     ///Returns true if the modification-revision was contained before.
0038     bool removeModificationRevision(const IndexedString& url, const ModificationRevision& revision);
0039 
0040     bool needsUpdate() const;
0041 
0042     QString toString() const;
0043 
0044     bool operator!=(const ModificationRevisionSet& rhs) const
0045     {
0046         return m_index != rhs.m_index;
0047     }
0048 
0049     bool operator==(const ModificationRevisionSet& rhs) const
0050     {
0051         return m_index == rhs.m_index;
0052     }
0053 
0054     ModificationRevisionSet& operator+=(const ModificationRevisionSet& rhs);
0055     ModificationRevisionSet& operator-=(const ModificationRevisionSet& rhs);
0056 
0057 private:
0058     uint m_index;
0059 };
0060 }
0061 
0062 #endif // KDEVPLATFORM_MODIFICATIONREVISIONSET_H