File indexing completed on 2024-04-21 03:51:45
0001 /* 0002 This file is part of the KDE Baloo Project 0003 SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in> 0004 0005 SPDX-License-Identifier: LGPL-2.1-or-later 0006 */ 0007 0008 #ifndef BALOO_PENDINGFILE_H 0009 #define BALOO_PENDINGFILE_H 0010 0011 #include <QString> 0012 #include <QObject> 0013 0014 namespace Baloo { 0015 0016 /** 0017 * Represents a file which needs to be indexed. 0018 */ 0019 class PendingFile 0020 { 0021 public: 0022 explicit PendingFile(const QString& path); 0023 0024 QString path() const; 0025 0026 void setAttributeChanged() { m_attributesChanged = true; } 0027 void setClosedOnWrite() { m_closedOnWrite = true; } 0028 void setModified() { m_modified = true; } 0029 void setCreated() { m_created = true; } 0030 void setDeleted() { m_deleted = true; } 0031 0032 bool isNewFile() const; 0033 bool shouldIndexContents() const; 0034 bool shouldIndexXAttrOnly() const; 0035 bool shouldRemoveIndex() const; 0036 0037 bool operator == (const PendingFile& rhs) const { 0038 return m_path == rhs.m_path; 0039 } 0040 0041 /** 0042 * Takes a PendingFile \p file and merges its flags into 0043 * the current PendingFile 0044 */ 0045 void merge(const PendingFile& file); 0046 0047 private: 0048 QString m_path; 0049 0050 bool m_created : 1; 0051 bool m_closedOnWrite : 1; 0052 bool m_attributesChanged : 1; 0053 bool m_deleted : 1; 0054 bool m_modified : 1; 0055 0056 void printFlags() const; 0057 }; 0058 0059 } 0060 0061 Q_DECLARE_TYPEINFO(Baloo::PendingFile, Q_RELOCATABLE_TYPE); 0062 0063 #endif // BALOO_PENDINGFILE_H