summaryrefslogtreecommitdiffstats
path: root/quanta/components/debugger/debuggerbreakpoint.cpp
blob: ae8ed6cbc58b5477a6b85f78160306e318df7f41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/***************************************************************************
                          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 QString& filePath, int line)
{
  m_filePath = filePath;
  m_line     = line;
  m_type     = DebuggerBreakpoint::LineBreakpoint;
  m_state    = DebuggerBreakpoint::Undefined;
}

DebuggerBreakpoint::DebuggerBreakpoint(const Types type,
                                       const QString& conditionExpr, const QString& filePath, 
                                       const QString& inClass, const QString& 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 QString& filePath)
{
  m_filePath = filePath;
}

void DebuggerBreakpoint::setClass(const QString& newclass)
{
  m_class = newclass;
}

void DebuggerBreakpoint::setFunction(const QString& function)
{
  m_function = function;
}

void DebuggerBreakpoint::setLine(int line)
{
  m_line = line;
}

void DebuggerBreakpoint::setCondition(const QString& expression)
{
  m_conditionExpr = expression;
}

void DebuggerBreakpoint::setValue(const QString& 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 QString& value)
{
  m_key = value;
}

const QString& DebuggerBreakpoint::key() const
{
  return m_key;
}

const QString& DebuggerBreakpoint::filePath() const
{
  return m_filePath;
}

const QString& DebuggerBreakpoint::value() const
{
  return m_value;
}

const QString& DebuggerBreakpoint::inClass() const
{
  return m_class;
}
const QString& DebuggerBreakpoint::inFunction() const
{
  return m_function;
}

DebuggerBreakpoint::Types DebuggerBreakpoint::type() const
{
  return m_type;
}

int DebuggerBreakpoint::line() const
{
  return m_line;
}

const QString& 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;
  
}