xbmc
MusicLibraryJob.h
1 /*
2  * Copyright (C) 2017-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 CMusicDatabase;
14 
19 class CMusicLibraryJob : public CJob
20 {
21 public:
22  ~CMusicLibraryJob() override;
23 
27  virtual bool CanBeCancelled() const { return false; }
28 
33  virtual bool Cancel() { return false; }
34 
35  // implementation of CJob
36  bool DoWork() override;
37  const char *GetType() const override { return "MusicLibraryJob"; }
38  bool operator==(const CJob* job) const override { return false; }
39 
40 protected:
42 
49  virtual bool Work(CMusicDatabase &db) = 0;
50 };
Base class for jobs that are executed asynchronously.
Definition: Job.h:109
Class to store and read tag information.
Definition: MusicDatabase.h:98
Basic implementation/interface of a CJob which interacts with the music database. ...
Definition: MusicLibraryJob.h:19
virtual bool Cancel()
Tries to cancel the running job.
Definition: MusicLibraryJob.h:33
bool DoWork() override
Main workhorse function of CJob instances.
Definition: MusicLibraryJob.cpp:17
const char * GetType() const override
Function that returns the type of job.
Definition: MusicLibraryJob.h:37
virtual bool Work(CMusicDatabase &db)=0
Worker method to be implemented by an actual implementation.
virtual bool CanBeCancelled() const
Whether the job can be cancelled or not.
Definition: MusicLibraryJob.h:27