KTutorial  0.5.1
WaitForNot.cpp
00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Daniel Calviño Sánchez <danxuliu@gmail.com>     *
00003  *   Copyright (C) 2009 by Daniel Calviño Sánchez <danxuliu@gmail.com>     *
00004  *   Copyright (C) 2010 by Daniel Calviño Sánchez <danxuliu@gmail.com>     *
00005  *   Copyright (C) 2012 by Daniel Calviño Sánchez <danxuliu@gmail.com>     *
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; If not, see <http://www.gnu.org/licenses/>.  *
00019  ***************************************************************************/
00020 
00021 #include "WaitForNot.h"
00022 #include "WaitForNot_p.h"
00023 
00024 namespace ktutorial {
00025 
00026 //public:
00027 
00028 WaitForNot::WaitForNot(): WaitFor(),
00029     d(new WaitForNotPrivate()) {
00030     d->mWaitFor = 0;
00031 }
00032 
00033 WaitForNot::WaitForNot(WaitFor* waitFor): WaitFor(),
00034     d(new WaitForNotPrivate()) {
00035     setNegatedWaitFor(waitFor);
00036 }
00037 
00038 WaitForNot::~WaitForNot() {
00039     delete d;
00040 }
00041 
00042 void WaitForNot::setNegatedWaitFor(WaitFor* waitFor) {
00043     d->mWaitFor = waitFor;
00044     d->mWaitFor->setParent(this);
00045 }
00046 
00047 bool WaitForNot::conditionMet() const {
00048     return !d->mWaitFor->conditionMet();
00049 }
00050 
00051 void WaitForNot::setActive(bool active) {
00052     WaitFor::setActive(active);
00053     d->mWaitFor->setActive(active);
00054 }
00055 
00056 //protected:
00057 
00058 WaitFor* WaitForNot::waitFor() const {
00059     return d->mWaitFor;
00060 }
00061 
00062 }