ThreadWeaver

qobjectdecorator.cpp
1 /* -*- C++ -*-
2  A decorator to make jobs into QObjects in ThreadWeaver.
3 
4  SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #include "qobjectdecorator.h"
10 #include "collection.h"
11 #include "managedjobpointer.h"
12 #include "sequence.h"
13 
14 namespace ThreadWeaver
15 {
16 QObjectDecorator::QObjectDecorator(JobInterface *decoratee, QObject *parent)
17  : QObject(parent)
18  , IdDecorator(decoratee)
19 {
20 }
21 
22 QObjectDecorator::QObjectDecorator(JobInterface *decoratee, bool autoDelete, QObject *parent)
23  : QObject(parent)
24  , IdDecorator(decoratee, autoDelete)
25 {
26 }
27 
28 void QObjectDecorator::defaultBegin(const JobPointer &self, Thread *thread)
29 {
30  Q_ASSERT(job());
31  Q_EMIT started(self);
32  job()->defaultBegin(self, thread);
33 }
34 
35 void QObjectDecorator::defaultEnd(const JobPointer &self, Thread *thread)
36 {
37  Q_ASSERT(job());
38  job()->defaultEnd(self, thread);
39  if (!self->success()) {
40  Q_EMIT failed(self);
41  }
42  Q_EMIT done(self);
43 }
44 
45 }
46 
47 #include "moc_qobjectdecorator.cpp"
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:10:21 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.