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
|
diff --git a/plotjuggler_plugins/ParserProtobuf/error_collectors.cpp b/plotjuggler_plugins/ParserProtobuf/error_collectors.cpp
index 761e0b73..09df86f3 100644
--- a/plotjuggler_plugins/ParserProtobuf/error_collectors.cpp
+++ b/plotjuggler_plugins/ParserProtobuf/error_collectors.cpp
@@ -2,38 +2,38 @@
#include <QMessageBox>
#include <QDebug>
-void FileErrorCollector::AddError(const std::string& filename, int line, int,
- const std::string& message)
+void FileErrorCollector::RecordError(const absl::string_view filename, int line, int,
+ const absl::string_view message)
{
auto msg = QString("File: [%1] Line: [%2] Message: %3\n\n")
- .arg(QString::fromStdString(filename))
+ .arg(QString::fromStdString(std::string{filename}))
.arg(line)
- .arg(QString::fromStdString(message));
+ .arg(QString::fromStdString(std::string{message}));
_errors.push_back(msg);
}
-void FileErrorCollector::AddWarning(const std::string& filename, int line, int,
- const std::string& message)
+void FileErrorCollector::RecordWarning(const absl::string_view filename, int line, int,
+ const absl::string_view message)
{
auto msg = QString("Warning [%1] line %2: %3")
- .arg(QString::fromStdString(filename))
+ .arg(QString::fromStdString(std::string{filename}))
.arg(line)
- .arg(QString::fromStdString(message));
+ .arg(QString::fromStdString(std::string{message}));
qDebug() << msg;
-}
+}
-void IoErrorCollector::AddError(int line, google::protobuf::io::ColumnNumber,
- const std::string& message)
+void IoErrorCollector::RecordError(int line, google::protobuf::io::ColumnNumber,
+ const absl::string_view message)
{
_errors.push_back(
- QString("Line: [%1] Message: %2\n").arg(line).arg(QString::fromStdString(message)));
+ QString("Line: [%1] Message: %2\n").arg(line).arg(QString::fromStdString(std::string{message})));
}
-void IoErrorCollector::AddWarning(int line, google::protobuf::io::ColumnNumber column,
- const std::string& message)
+void IoErrorCollector::RecordWarning(int line, google::protobuf::io::ColumnNumber column,
+ const absl::string_view message)
{
qDebug() << QString("Line: [%1] Message: %2\n")
.arg(line)
- .arg(QString::fromStdString(message));
+ .arg(QString::fromStdString(std::string{message}));
}
diff --git a/plotjuggler_plugins/ParserProtobuf/error_collectors.h b/plotjuggler_plugins/ParserProtobuf/error_collectors.h
index f70a881f..e9483ebf 100644
--- a/plotjuggler_plugins/ParserProtobuf/error_collectors.h
+++ b/plotjuggler_plugins/ParserProtobuf/error_collectors.h
@@ -6,14 +6,18 @@
#include <QStringList>
+#include "absl/strings/string_view.h"
+
class IoErrorCollector : public google::protobuf::io::ErrorCollector
{
public:
- void AddError(int line, google::protobuf::io::ColumnNumber column,
- const std::string& message) override;
- void AddWarning(int line, google::protobuf::io::ColumnNumber column,
- const std::string& message) override;
+
+ void RecordError(int line, google::protobuf::io::ColumnNumber column,
+ const absl::string_view message) override;
+
+ void RecordWarning(int line, google::protobuf::io::ColumnNumber column,
+ const absl::string_view message) override;
const QStringList& errors()
{
@@ -27,11 +31,11 @@ private:
class FileErrorCollector : public google::protobuf::compiler::MultiFileErrorCollector
{
public:
- void AddError(const std::string& filename, int line, int,
- const std::string& message) override;
+ void RecordError(const absl::string_view filename, int line, int,
+ const absl::string_view message) override;
- void AddWarning(const std::string& filename, int line, int,
- const std::string& message) override;
+ void RecordWarning(const absl::string_view filename, int line, int,
+ const absl::string_view message) override;
const QStringList& errors()
{
|