forked from BoomerangDecompiler/boomerang
-
Notifications
You must be signed in to change notification settings - Fork 1
/
log.cpp
90 lines (78 loc) · 1.66 KB
/
log.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include "log.h"
#include "statement.h"
#include "rtl.h"
#include "exp.h"
#include "managed.h"
#include "boomerang.h"
#include <QTextStream>
#include <sstream>
Log &Log::operator<<(const Instruction *s) {
QString tgt;
QTextStream st(&tgt);
s->print(st);
*this << tgt;
return *this;
}
Log &Log::operator<<(const Exp *e) {
QString tgt;
QTextStream st(&tgt);
e->print(st);
*this << tgt;
return *this;
}
Log &Log::operator<<(const SharedType &ty) {
std::ostringstream st;
st << ty;
*this << st.str().c_str();
return *this;
}
Log &Log::operator<<(const Printable &p) {
*this << p.toString();
return *this;
}
Log &Log::operator<<(const RTL *r) {
QString tgt;
QTextStream st(&tgt);
r->print(st);
*this << tgt;
return *this;
}
Log &Log::operator<<(const LocationSet *l) {
QString tgt;
QTextStream st(&tgt);
st << l;
*this << tgt;
return *this;
}
Log &Log::operator<<(int i) {
*this << QString::number(i);
return *this;
}
Log &Log::operator<<(size_t i) {
*this << QString::number(i);
return *this;
}
Log &Log::operator<<(char c) {
*this << QString(c);
return *this;
}
Log &Log::operator<<(double d) {
*this << QString::number(d);
return *this;
}
Log &Log::operator<<(ADDRESS a) {
*this << "0x" << QString::number(a.m_value, 16);
return *this;
}
Log &FileLogger::operator<<(const QString &str) {
out << str.toStdString() << std::flush;
return *this;
}
Log &SeparateLogger::operator<<(const QString &str) {
(*out) << str.toStdString() << std::flush;
return *this;
}
SeparateLogger::~SeparateLogger() {
out->close();
out = nullptr;
}