1
//=============================================================================
3
// File : kvi_kvs_treenode_instructionblock.cpp
4
// Creation date : Thu 09 Oct 2003 01:44:31 by Szymon Stefanek
6
// This file is part of the KVIrc IRC client distribution
7
// Copyright (C) 2003-2008 Szymon Stefanek <pragma at kvirc dot net>
9
// This program is FREE software. You can redistribute it and/or
10
// modify it under the terms of the GNU General Public License
11
// as published by the Free Software Foundation; either version 2
12
// of the License, or (at your opinion) any later version.
14
// This program is distributed in the HOPE that it will be USEFUL,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
// See the GNU General Public License for more details.
19
// You should have received a copy of the GNU General Public License
20
// along with this program. If not, write to the Free Software Foundation,
21
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
//=============================================================================
25
#include "kvi_kvs_treenode_instructionblock.h"
26
#include "kvi_kvs_runtimecontext.h"
28
KviKvsTreeNodeInstructionBlock::KviKvsTreeNodeInstructionBlock(const QChar * pLocation)
29
: KviKvsTreeNodeInstruction(pLocation)
31
m_pInstructionList = new KviPointerList<KviKvsTreeNodeInstruction>;
32
m_pInstructionList->setAutoDelete(true);
35
KviKvsTreeNodeInstructionBlock::~KviKvsTreeNodeInstructionBlock()
37
delete m_pInstructionList;
40
void KviKvsTreeNodeInstructionBlock::contextDescription(QString &szBuffer)
42
szBuffer = "Instruction Block";
45
void KviKvsTreeNodeInstructionBlock::dump(const char * prefix)
47
qDebug("%s InstructionBlock",prefix);
50
for(KviKvsTreeNodeInstruction * i = m_pInstructionList->first();i;i = m_pInstructionList->next())
52
i->dump(tmp.toUtf8().data());
56
KviKvsTreeNodeInstruction * KviKvsTreeNodeInstructionBlock::releaseFirst()
58
m_pInstructionList->setAutoDelete(false);
59
KviKvsTreeNodeInstruction * i = m_pInstructionList->first();
63
m_pInstructionList->removeFirst();
65
m_pInstructionList->setAutoDelete(true);
69
void KviKvsTreeNodeInstructionBlock::addInstruction(KviKvsTreeNodeInstruction * i)
71
m_pInstructionList->append(i);
75
bool KviKvsTreeNodeInstructionBlock::execute(KviKvsRunTimeContext * c)
77
// to accomodate recursion we need to use an iterator here
78
KviPointerListIterator<KviKvsTreeNodeInstruction> it(*m_pInstructionList);
79
while(KviKvsTreeNodeInstruction * i = it.current())
81
if(!i->execute(c))return false;