From ed9d0cff5e50aafe98706450e15274c1967ad547 Mon Sep 17 00:00:00 2001 From: farhangnaderi Date: Sun, 17 Nov 2024 22:24:53 -0500 Subject: [PATCH] error collectors correction --- .github/workflows/macos.yaml | 2 +- .github/workflows/ros1.yaml | 5 +- .github/workflows/ubuntu.yaml | 11 --- .../ParserProtobuf/error_collectors.h | 72 ++++++++++--------- 4 files changed, 42 insertions(+), 48 deletions(-) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index af72609a8..b3a0d17a9 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -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: | diff --git a/.github/workflows/ros1.yaml b/.github/workflows/ros1.yaml index 53cb664d7..c972e5429 100644 --- a/.github/workflows/ros1.yaml +++ b/.github/workflows/ros1.yaml @@ -1,4 +1,4 @@ -name: ros2 +name: ros1 on: [push, pull_request] @@ -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 diff --git a/.github/workflows/ubuntu.yaml b/.github/workflows/ubuntu.yaml index 4c5d6e33f..a48298659 100644 --- a/.github/workflows/ubuntu.yaml +++ b/.github/workflows/ubuntu.yaml @@ -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: | diff --git a/plotjuggler_plugins/ParserProtobuf/error_collectors.h b/plotjuggler_plugins/ParserProtobuf/error_collectors.h index 3768499bf..d3e9c5291 100644 --- a/plotjuggler_plugins/ParserProtobuf/error_collectors.h +++ b/plotjuggler_plugins/ParserProtobuf/error_collectors.h @@ -1,39 +1,45 @@ -#include "error_collectors.h" -#include -#include +#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 +#include - _errors.push_back(msg); -} +#include -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)); -} \ No newline at end of file +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 \ No newline at end of file