-
Notifications
You must be signed in to change notification settings - Fork 1
/
breakpoint.cpp
69 lines (61 loc) · 1.67 KB
/
breakpoint.cpp
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
#include "breakpoint.h"
#include <QStringList>
#include <QDebug>
#include <QRegExp>
void Breakpoint::parse(const QString &line)
{ // fill breakpoint from $line$
/*
$"1 breakpoint keep y 0x0040149e in main() at main.cpp:40\n"$
$"2 breakpoint del y 0x004014fc in main() at main.cpp:41\n"$
*/
QRegExp errorMatch("(keep|del)");
if(errorMatch.indexIn(line) == -1)
{
throw std::exception("Format exception");
}
QRegExp disposition(" keep ");
QRegExp enabled(" y ");
QRegExp frame("\\s[:\\w]*\\([\\w\\s:,]*\\)\\s"); // find string between whitespaces
// contains from characters, ':', whitespaces and breackets
QRegExp lineRegex(":\\d+");
if(disposition.indexIn(line) == -1)
{
mDisposition = Disposition::Delete;
}
else
{
mDisposition = Disposition::Keep;
}
mEnabled = enabled.indexIn(line) == -1 ? false : true;
lineRegex.indexIn(line);
QString lineFrame = lineRegex.cap();
mLine = lineFrame.split(':')[1].toInt();
frame.indexIn(line);
mWhat = frame.cap().trimmed();
}
Breakpoint::Breakpoint()
{
}
Breakpoint::Breakpoint(int line, QString what, bool enabled, Breakpoint::Disposition disposition):
mLine(line),
mWhat(what),
mEnabled(enabled),
mDisposition(disposition)
{
}
int Breakpoint::getLine() const
{
return mLine;
}
QString Breakpoint::getFrame() const
{
return mWhat;
}
bool Breakpoint::isEnabled() const
{
return mEnabled;
}
Breakpoint::Disposition Breakpoint::getDisposition() const
{
return mDisposition;
}