ThreadWeaver
State.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "State.h"
00030
00031 #include <QtCore/QString>
00032
00033 using namespace ThreadWeaver;
00034
00035 const QString StateNames[NoOfStates] = {
00036 "InConstruction",
00037 "WorkingHard",
00038 "Suspending",
00039 "Suspended",
00040 "ShuttingDown",
00041 "Destructed"
00042 };
00043
00044 class State::Private
00045 {
00046 public:
00047 Private ( WeaverInterface* theWeaver )
00048 : weaver( theWeaver )
00049 {
00050 Q_ASSERT_X( sizeof StateNames / sizeof StateNames[0] == NoOfStates, "State::Private ctor",
00051 "Make sure to keep StateId and StateNames in sync!" );
00052 }
00053
00055 WeaverInterface *weaver;
00056 };
00057
00058
00059 State::State ( WeaverInterface *weaver )
00060 : d ( new Private ( weaver ) )
00061 {
00062 }
00063
00064 State::~State()
00065 {
00066 delete d;
00067 }
00068
00069 QString State::stateName () const
00070 {
00071 return StateNames[ stateId() ];
00072 }
00073
00074 void State::activated()
00075 {
00076 }
00077
00078 WeaverInterface* State::weaver()
00079 {
00080 return d->weaver;
00081 }