1
//=============================================================================
3
// File : KviKvsTreeNodeHashReferenceAssert.cpp
4
// Creation date : Thu 16 Oct 2003 23:43:06 by Szymon Stefanek
6
// This file is part of the KVIrc IRC client distribution
7
// Copyright (C) 2003-2010 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 "KviKvsTreeNodeHashReferenceAssert.h"
26
#include "KviKvsRWEvaluationResult.h"
27
#include "KviKvsRunTimeContext.h"
28
#include "KviKvsVariant.h"
29
#include "KviLocale.h"
31
KviKvsTreeNodeHashReferenceAssert::KviKvsTreeNodeHashReferenceAssert(const QChar * pLocation,KviKvsTreeNodeData * pSource)
32
: KviKvsTreeNodeIndirectData(pLocation,pSource)
36
KviKvsTreeNodeHashReferenceAssert::~KviKvsTreeNodeHashReferenceAssert()
40
bool KviKvsTreeNodeHashReferenceAssert::isReadOnly()
42
return m_pSource->isReadOnly();
45
void KviKvsTreeNodeHashReferenceAssert::contextDescription(QString &szBuffer)
47
szBuffer = "Hash Reference Assert";
50
void KviKvsTreeNodeHashReferenceAssert::dump(const char * prefix)
52
qDebug("%s HashReferenceAssert",prefix);
55
bool KviKvsTreeNodeHashReferenceAssert::evaluateReadOnlyInObjectScope(KviKvsObject *o,KviKvsRunTimeContext * c,KviKvsVariant * pBuffer)
59
if(!m_pSource->evaluateReadOnlyInObjectScope(o,c,pBuffer))return false;
61
if(!m_pSource->evaluateReadOnly(c,pBuffer))return false;
64
if(!pBuffer->isHash())
66
if(!pBuffer->isNothing())
69
pBuffer->getTypeName(szType);
70
c->error(this,__tr2qs_ctx("Hash reference assert failed: the variable evaluated to type '%Q'","kvs"),&szType);
77
KviKvsRWEvaluationResult * KviKvsTreeNodeHashReferenceAssert::evaluateReadWriteInObjectScope(KviKvsObject *o,KviKvsRunTimeContext * c)
79
KviKvsRWEvaluationResult * r;
80
if(o)r = m_pSource->evaluateReadWriteInObjectScope(o,c);
81
else r = m_pSource->evaluateReadWrite(c);
87
bool KviKvsTreeNodeHashReferenceAssert::evaluateReadOnly(KviKvsRunTimeContext * c,KviKvsVariant * pBuffer)
89
return evaluateReadOnlyInObjectScope(0,c,pBuffer);
92
KviKvsRWEvaluationResult * KviKvsTreeNodeHashReferenceAssert::evaluateReadWrite(KviKvsRunTimeContext * c)
94
return evaluateReadWriteInObjectScope(0,c);