1/* -*- C++ -*-
2 This file implements the state handling in ThreadWeaver.
3
4 SPDX-FileCopyrightText: 2005-2013 Mirko Boehm <mirko@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7
8 $Id: State.cpp 20 2005-08-08 21:02:51Z mirko $
9*/
10
11#include "state.h"
12
13namespace ThreadWeaver
14{
15const char *const StateNames[NoOfStates] = {"InConstruction", "WorkingHard", "Suspending", "Suspended", "ShuttingDown", "Destructed"};
16
17class Q_DECL_HIDDEN State::Private
18{
19public:
20 Private(QueueInterface *theWeaver)
21 : weaver(theWeaver)
22 {
23 Q_ASSERT_X(sizeof StateNames / sizeof StateNames[0] == NoOfStates, "State::Private ctor", "Make sure to keep StateId and StateNames in sync!");
24 }
25
26 /** The Weaver we relate to. */
27 QueueInterface *const weaver;
28};
29
30State::State(QueueSignals *weaver)
31 : d(new Private(weaver))
32{
33}
34
35State::~State()
36{
37 delete d;
38}
39
40QString State::stateName() const
41{
42 return QLatin1String(StateNames[stateId()]);
43}
44
45void State::activated()
46{
47}
48
49QueueInterface *State::weaver()
50{
51 return d->weaver;
52}
53
54const QueueInterface *State::weaver() const
55{
56 return d->weaver;
57}
58
59}
60

source code of threadweaver/src/state.cpp