File indexing completed on 2024-11-24 04:44:34
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2009 Kevin Krammer <kevin.krammer@gmx.at> 0003 SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net> 0004 SPDX-FileContributor: Kevin Krammer <krake@kdab.com> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #pragma once 0010 0011 #include "akonadi-filestore_export.h" 0012 0013 #include <KJob> 0014 0015 #include <memory> 0016 0017 namespace Akonadi 0018 { 0019 namespace FileStore 0020 { 0021 class AbstractJobSession; 0022 class CollectionCreateJob; 0023 class CollectionDeleteJob; 0024 class CollectionFetchJob; 0025 class CollectionModifyJob; 0026 class CollectionMoveJob; 0027 class ItemCreateJob; 0028 class ItemDeleteJob; 0029 class ItemFetchJob; 0030 class ItemModifyJob; 0031 class ItemMoveJob; 0032 class StoreCompactJob; 0033 class JobPrivate; 0034 0035 /** 0036 */ 0037 class AKONADI_FILESTORE_EXPORT Job : public KJob 0038 { 0039 friend class AbstractJobSession; 0040 0041 Q_OBJECT 0042 0043 public: 0044 class Visitor 0045 { 0046 public: 0047 virtual ~Visitor() = default; 0048 0049 virtual bool visit(Job *job) = 0; 0050 0051 virtual bool visit(CollectionCreateJob *job) = 0; 0052 0053 virtual bool visit(CollectionDeleteJob *job) = 0; 0054 0055 virtual bool visit(CollectionFetchJob *job) = 0; 0056 0057 virtual bool visit(CollectionModifyJob *job) = 0; 0058 0059 virtual bool visit(CollectionMoveJob *job) = 0; 0060 0061 virtual bool visit(ItemCreateJob *job) = 0; 0062 0063 virtual bool visit(ItemDeleteJob *job) = 0; 0064 0065 virtual bool visit(ItemFetchJob *job) = 0; 0066 0067 virtual bool visit(ItemModifyJob *job) = 0; 0068 0069 virtual bool visit(ItemMoveJob *job) = 0; 0070 0071 virtual bool visit(StoreCompactJob *job) = 0; 0072 }; 0073 0074 enum ErrorCodes { 0075 InvalidStoreState = KJob::UserDefinedError + 1, 0076 InvalidJobContext, 0077 }; 0078 0079 explicit Job(AbstractJobSession *session = nullptr); 0080 0081 ~Job() override; 0082 0083 void start() override; 0084 0085 virtual bool accept(Visitor *visitor); 0086 0087 private: 0088 std::unique_ptr<JobPrivate> const d; 0089 }; 0090 } 0091 }