Skip to content

Commit

Permalink
Migrate to new Protobuf API (#5)
Browse files Browse the repository at this point in the history
AddWarning() and AddError() have been deprecated in Protobuf v22
in favor of RecordWarning() and RecordError() using std::string_view.

The deprecated functions have been removed in Protobuf v26
  • Loading branch information
mering authored Jun 1, 2024
1 parent 9b3d221 commit 73e4cc3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions protobuf-matchers/protocol-buffer-matchers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ class StringErrorCollector : public google::protobuf::io::ErrorCollector {
explicit StringErrorCollector(std::string* error_text)
: error_text_(error_text) {}

void AddError(int line, int column, const std::string& message) override {
void RecordError(int line, int column, std::string_view message) override {
std::ostringstream stream;
stream << line << '(' << column << "): " << message << std::endl;
*error_text_ += stream.str();
}

void AddWarning(int line, int column, const std::string& message) override {
void RecordWarning(int line, int column, std::string_view message) override {
std::ostringstream stream;
stream << line << '(' << column << "): " << message << std::endl;
*error_text_ += stream.str();
Expand Down

0 comments on commit 73e4cc3

Please sign in to comment.