-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogger.cpp
More file actions
68 lines (59 loc) · 1.54 KB
/
Logger.cpp
File metadata and controls
68 lines (59 loc) · 1.54 KB
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
#include "Logger.h"
#include <sstream>
#include <QDebug>
void Logger::dumpText(PieceListText & text)
{
Piece * piece = text.getFirst();
QString str;
str += "|";
while (piece != nullptr)
{
str += QString::fromStdString(piece->getText()) + "|";
piece = piece->getNext();
}
qDebug() << str;
}
void Logger::dumpTextList(PieceListText & text)
{
Piece * piece = text.getFirst();
int cnt = 0;
while (piece != nullptr)
{
qDebug() << "Piece " << cnt << "\n";
qDebug() << "Text: " << QString::fromStdString(piece->getText()) << "\n";
qDebug() << "Size: " << piece->getLength() << "\n";
qDebug() << "File: " << QString::fromStdString(piece->getFile()) << "\n";
qDebug() << "Pos: " << piece->getFilePos() << "\n";
qDebug() << " ---------------------------------------------------------" << "\n";
piece = piece->getNext();
cnt++;
}
qDebug() << "Total Size: " << text.getLength() << "\n";
}
std::string Logger::getText(PieceListText & text)
{
Piece * piece = text.getFirst();
std::stringstream s;
while (piece != nullptr)
{
s << piece->getText();
piece = piece->getNext();
}
return s.str();
}
void Logger::debugPrint(std::string const& text)
{
qDebug() << QString::fromStdString(text) << "\n";
}
void Logger::dumpText(Piece * p)
{
Piece * piece = p;
QString str;
str += "|";
while (piece != nullptr)
{
str += QString::fromStdString(piece->getText()) + "|";
piece = piece->getNext();
}
qDebug() << str;
}