You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdewebdev/quanta/components/debugger/debuggerbreakpoint.cpp

182 lines
4.2 KiB

/***************************************************************************
debuggerbreakpoint.cpp
----------------------
begin : 2004-04-04
copyright : (C) 2004 Thiago Silva
***************************************************************************/
/****************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "debuggerbreakpoint.h"
#include <kdebug.h>
DebuggerBreakpoint::DebuggerBreakpoint()
: m_line(1)//, m_state(0)
{}
DebuggerBreakpoint::DebuggerBreakpoint( const DebuggerBreakpoint & bp )
{
m_conditionExpr = bp.condition();
m_filePath = bp.filePath();
m_class = bp.inClass();
m_function = bp.inFunction();
m_line = bp.line();
m_state = bp.state();
m_key = bp.key();
m_type = bp.type();
}
DebuggerBreakpoint::DebuggerBreakpoint( const DebuggerBreakpoint * bp )
{
m_conditionExpr = bp->condition();
m_filePath = bp->filePath();
m_class = bp->inClass();
m_function = bp->inFunction();
m_line = bp->line();
m_state = bp->state();
m_key = bp->key();
m_type = bp->type();
}
DebuggerBreakpoint::DebuggerBreakpoint(const TQString& filePath, int line)
{
m_filePath = filePath;
m_line = line;
m_type = DebuggerBreakpoint::LineBreakpoint;
m_state = DebuggerBreakpoint::Undefined;
}
DebuggerBreakpoint::DebuggerBreakpoint(const Types type,
const TQString& conditionExpr, const TQString& filePath,
const TQString& inClass, const TQString& inFunction)
{
m_conditionExpr = conditionExpr;
m_filePath = filePath;
m_class = inClass;
m_function = inFunction;
m_line = 0;
m_type = type;
m_state = DebuggerBreakpoint::Undefined;
}
DebuggerBreakpoint::~DebuggerBreakpoint()
{}
void DebuggerBreakpoint::setFilePath(const TQString& filePath)
{
m_filePath = filePath;
}
void DebuggerBreakpoint::setClass(const TQString& newclass)
{
m_class = newclass;
}
void DebuggerBreakpoint::setFunction(const TQString& function)
{
m_function = function;
}
void DebuggerBreakpoint::setLine(int line)
{
m_line = line;
}
void DebuggerBreakpoint::setCondition(const TQString& expression)
{
m_conditionExpr = expression;
}
void DebuggerBreakpoint::setValue(const TQString& value)
{
m_value = value;
}
void DebuggerBreakpoint::setState(int state)
{
m_state = state;
}
void DebuggerBreakpoint::setType(DebuggerBreakpoint::Types type )
{
m_type = type;
}
void DebuggerBreakpoint::setKey(const TQString& value)
{
m_key = value;
}
const TQString& DebuggerBreakpoint::key() const
{
return m_key;
}
const TQString& DebuggerBreakpoint::filePath() const
{
return m_filePath;
}
const TQString& DebuggerBreakpoint::value() const
{
return m_value;
}
const TQString& DebuggerBreakpoint::inClass() const
{
return m_class;
}
const TQString& DebuggerBreakpoint::inFunction() const
{
return m_function;
}
DebuggerBreakpoint::Types DebuggerBreakpoint::type() const
{
return m_type;
}
int DebuggerBreakpoint::line() const
{
return m_line;
}
const TQString& DebuggerBreakpoint::condition() const
{
return m_conditionExpr;
}
int DebuggerBreakpoint::state() const
{
return m_state;
}
bool DebuggerBreakpoint::operator == (DebuggerBreakpoint bp) const
{
// If they key matches
if(!m_key.isEmpty() && bp.key() == m_key)
return true;
// Or everything else...
if(bp.filePath() == m_filePath
&& (bp.line() == m_line || m_type != DebuggerBreakpoint::LineBreakpoint)
&& bp.type() == m_type
&& bp.inClass() == m_class
&& bp.inFunction() == m_function
&& bp.condition() == m_conditionExpr
)
return true;
return false;
}