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
|
diff --git i/plotjuggler_plugins/ParserProtobuf/error_collectors.cpp w/plotjuggler_plugins/ParserProtobuf/error_collectors.cpp
index 761e0b73..30eca516 100644
--- i/plotjuggler_plugins/ParserProtobuf/error_collectors.cpp
+++ w/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 i/plotjuggler_plugins/ParserProtobuf/error_collectors.h w/plotjuggler_plugins/ParserProtobuf/error_collectors.h
index 8abfa5e0..ef5702af 100644
--- i/plotjuggler_plugins/ParserProtobuf/error_collectors.h
+++ w/plotjuggler_plugins/ParserProtobuf/error_collectors.h
@@ -9,11 +9,11 @@
class IoErrorCollector : public google::protobuf::io::ErrorCollector
{
public:
- void AddError(int line, google::protobuf::io::ColumnNumber column,
- const std::string& message);
+ void RecordError(int line, google::protobuf::io::ColumnNumber column,
+ const absl::string_view message);
- void AddWarning(int line, google::protobuf::io::ColumnNumber column,
- const std::string& message);
+ void RecordWarning(int line, google::protobuf::io::ColumnNumber column,
+ const absl::string_view message);
const QStringList& errors()
{
@@ -27,11 +27,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()
{
diff --git i/plotjuggler_plugins/ParserProtobuf/protobuf_factory.cpp w/plotjuggler_plugins/ParserProtobuf/protobuf_factory.cpp
index 10d30d8d..ec9ed7d4 100644
--- i/plotjuggler_plugins/ParserProtobuf/protobuf_factory.cpp
+++ w/plotjuggler_plugins/ParserProtobuf/protobuf_factory.cpp
@@ -83,7 +83,7 @@ void ParserFactoryProtobuf::importFile(QString filename)
for (int i = 0; i < info.file_descriptor->message_type_count(); i++)
{
- const std::string& type_name = info.file_descriptor->message_type(i)->name();
+ const std::string& type_name = std::string{info.file_descriptor->message_type(i)->name()};
auto descriptor = info.file_descriptor->FindMessageTypeByName(type_name);
QString type_qname = QString::fromStdString(type_name);
info.descriptors.insert({ type_qname, descriptor });
diff --git i/plotjuggler_plugins/ParserProtobuf/protobuf_parser.cpp w/plotjuggler_plugins/ParserProtobuf/protobuf_parser.cpp
index 91208914..1947a0bf 100644
--- i/plotjuggler_plugins/ParserProtobuf/protobuf_parser.cpp
+++ w/plotjuggler_plugins/ParserProtobuf/protobuf_parser.cpp
@@ -59,7 +59,7 @@ bool ProtobufParser::parseMessage(const MessageRef serialized_msg, double& times
auto field = descriptor->field(index);
std::string key =
- prefix.empty() ? field->name() : fmt::format("{}/{}", prefix, field->name());
+ prefix.empty() ? std::string{field->name()} : fmt::format("{}/{}", prefix, field->name());
if (is_map)
{
// Map messages only have 2 fields: key and value. The key will be represented in
@@ -159,7 +159,7 @@ bool ProtobufParser::parseMessage(const MessageRef serialized_msg, double& times
reflection->GetRepeatedEnum(msg, field, index);
auto& series = this->getStringSeries(key + suffix);
- series.pushBack({ timestamp, tmp->name() });
+ series.pushBack({ timestamp, std::string{tmp->name()} });
is_double = false;
}
break;
|