Skip to content

Commit

Permalink
error collectors correction
Browse files Browse the repository at this point in the history
  • Loading branch information
farhangnaderi committed Nov 18, 2024
1 parent 86dcc62 commit ed9d0cf
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
rm -rf /usr/local/var/homebrew/locks
brew cleanup -s
brew update
brew install mosquitto zeromq qt@5 abseil
brew install mosquitto zeromq qt@5
- name: Build PlotJuggler
run: |
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/ros1.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ros2
name: ros1

on: [push, pull_request]

Expand All @@ -7,8 +7,7 @@ jobs:
strategy:
matrix:
env:
- {ROS_DISTRO: humble, ROS_REPO: main}
- {ROS_DISTRO: iron, ROS_REPO: main}
- {ROS_DISTRO: noetic, ROS_REPO: main}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ jobs:
libprotoc-dev \
libzmq3-dev \
liblz4-dev libzstd-dev
if [[ "${{ matrix.ubuntu-distro }}" == "ubuntu-22.04" ]]; then
sudo apt -y install libabsl-dev;
elif [[ "${{ matrix.ubuntu-distro }}" == "ubuntu-20.04" ]]; then
git clone https://github.com/abseil/abseil-cpp.git;
cd abseil-cpp;
mkdir build;
cd build;
cmake ..;
make -j$(nproc);
sudo make install;
fi
- name: Build Plotjuggler
run: |
Expand Down
72 changes: 39 additions & 33 deletions plotjuggler_plugins/ParserProtobuf/error_collectors.h
Original file line number Diff line number Diff line change
@@ -1,39 +1,45 @@
#include "error_collectors.h"
#include <QMessageBox>
#include <QDebug>
#ifndef ERROR_COLLECTORS_H
#define ERROR_COLLECTORS_H

void FileErrorCollector::AddError(const std::string& filename, int line, int,
const std::string& message)
{
auto msg = QString("File: [%1] Line: [%2] Message: %3\n\n")
.arg(QString::fromStdString(filename))
.arg(line)
.arg(QString::fromStdString(message));
#include <google/protobuf/io/tokenizer.h>
#include <google/protobuf/compiler/importer.h>

_errors.push_back(msg);
}
#include <QStringList>

void FileErrorCollector::AddWarning(const std::string& filename, int line, int,
const std::string& message)
{
auto msg = QString("Warning [%1] line %2: %3")
.arg(QString::fromStdString(filename))
.arg(line)
.arg(QString::fromStdString(message));
qDebug() << msg;
}

void IoErrorCollector::AddError(int line, google::protobuf::io::ColumnNumber,
const std::string& message)
class IoErrorCollector : public google::protobuf::io::ErrorCollector
{
_errors.push_back(
QString("Line: [%1] Message: %2\n").arg(line).arg(QString::fromStdString(message)));
}
public:
void AddError(int line, google::protobuf::io::ColumnNumber column,
const std::string& message);

void AddWarning(int line, google::protobuf::io::ColumnNumber column,
const std::string& message);

const QStringList& errors()
{
return _errors;
}

private:
QStringList _errors;
};

void IoErrorCollector::AddWarning(int line, google::protobuf::io::ColumnNumber column,
const std::string& message)
class FileErrorCollector : public google::protobuf::compiler::MultiFileErrorCollector
{
qDebug() << QString("Line: [%1] Message: %2\n")
.arg(line)
.arg(QString::fromStdString(message));
}
public:
void AddError(const std::string& filename, int line, int,
const std::string& message);

void AddWarning(const std::string& filename, int line, int,
const std::string& message);

const QStringList& errors()
{
return _errors;
}

private:
QStringList _errors;
};

#endif // ERROR_COLLECTORS_H

0 comments on commit ed9d0cf

Please sign in to comment.