kodi
VideoLibraryJob.h
1 /*
2  * Copyright (C) 2014-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "utils/Job.h"
12 
13 class CVideoDatabase;
14 
19 class CVideoLibraryJob : public CJob
20 {
21 public:
22  ~CVideoLibraryJob() override;
23 
27  virtual bool CanBeCancelled() const { return false; }
28 
34  virtual bool Cancel() { return false; }
35 
36  // implementation of CJob
37  bool DoWork() override;
38  const char *GetType() const override { return "VideoLibraryJob"; }
39  bool operator==(const CJob* job) const override { return false; }
40 
41 protected:
43 
50  virtual bool Work(CVideoDatabase &db) = 0;
51 };
virtual bool CanBeCancelled() const
Whether the job can be cancelled or not.
Definition: VideoLibraryJob.h:27
Base class for jobs that are executed asynchronously.
Definition: Job.h:109
bool DoWork() override
Main workhorse function of CJob instances.
Definition: VideoLibraryJob.cpp:17
Basic implementation/interface of a CJob which interacts with the video database. ...
Definition: VideoLibraryJob.h:19
virtual bool Cancel()
Tries to cancel the running job.
Definition: VideoLibraryJob.h:34
Definition: VideoDatabase.h:419
const char * GetType() const override
Function that returns the type of job.
Definition: VideoLibraryJob.h:38
virtual bool Work(CVideoDatabase &db)=0
Worker method to be implemented by an actual implementation.