• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

ThreadWeaver

  • threadweaver
  • Weaver
State.cpp
Go to the documentation of this file.
1/* -*- C++ -*-
2
3This file implements the state handling in ThreadWeaver.
4
5$ Author: Mirko Boehm $
6$ Copyright: (C) 2005-2013 Mirko Boehm $
7$ Contact: mirko@kde.org
8http://www.kde.org
9http://creative-destruction.me $
10
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Library General Public
13 License as published by the Free Software Foundation; either
14 version 2 of the License, or (at your option) any later version.
15
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Library General Public License for more details.
20
21 You should have received a copy of the GNU Library General Public License
22 along with this library; see the file COPYING.LIB. If not, write to
23 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 Boston, MA 02110-1301, USA.
25
26$Id: State.cpp 20 2005-08-08 21:02:51Z mirko $
27*/
28
29#include "State.h"
30
31#include <QtCore/QString>
32
33using namespace ThreadWeaver;
34
35const QString StateNames[NoOfStates] = {
36 "InConstruction",
37 "WorkingHard",
38 "Suspending",
39 "Suspended",
40 "ShuttingDown",
41 "Destructed"
42};
43
44class State::Private
45{
46public:
47 Private ( WeaverInterface* theWeaver )
48 : weaver( theWeaver )
49 {
50 Q_ASSERT_X( sizeof StateNames / sizeof StateNames[0] == NoOfStates, "State::Private ctor",
51 "Make sure to keep StateId and StateNames in sync!" );
52 }
53
55 WeaverInterface *weaver;
56};
57
58
59State::State ( WeaverInterface *weaver )
60 : d ( new Private ( weaver ) )
61{
62}
63
64State::~State()
65{
66 delete d;
67}
68
69QString State::stateName () const
70{
71 return StateNames[ stateId() ];
72}
73
74void State::activated()
75{
76}
77
78WeaverInterface* State::weaver()
79{
80 return d->weaver;
81}
StateNames
const QString StateNames[NoOfStates]
Definition: State.cpp:35
State.h
ThreadWeaver::State::weaver
WeaverInterface * weaver()
The Weaver interface this state handles.
Definition: State.cpp:78
ThreadWeaver::State::activated
virtual void activated()
The state has been changed so that this object is responsible for state handling.
Definition: State.cpp:74
ThreadWeaver::State::State
State(WeaverInterface *weaver)
Default constructor.
Definition: State.cpp:59
ThreadWeaver::State::d
Private *const d
Definition: State.h:108
ThreadWeaver::State::stateName
QString stateName() const
The ID of the current state.
Definition: State.cpp:69
ThreadWeaver::State::stateId
virtual StateId stateId() const =0
The state Id.
ThreadWeaver::State::~State
virtual ~State()
Destructor.
Definition: State.cpp:64
ThreadWeaver::WeaverInterface
WeaverInterface provides a common interface for weaver implementations.
Definition: WeaverInterface.h:61
ThreadWeaver
Definition: DebuggingAids.h:51
ThreadWeaver::NoOfStates
@ NoOfStates
Not a state, but a sentinel for the number of defined states.
Definition: State.h:68
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

ThreadWeaver

Skip menu "ThreadWeaver"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal