Add overrides in C++ code.

pull/5375/head
Arun Olappamanna Vasudevan 6 years ago committed by Arun Olappamanna Vasudevan
parent 59133296a6
commit 45a595d249
  1. 2
      src/google/protobuf/reflection_internal.h
  2. 2
      src/google/protobuf/util/internal/default_value_objectwriter.h
  3. 29
      src/google/protobuf/util/internal/json_objectwriter.h
  4. 16
      src/google/protobuf/util/json_util.cc

@ -203,7 +203,7 @@ class MapFieldAccessor final : public RandomAccessRepeatedFieldAccessor {
public: public:
MapFieldAccessor() {} MapFieldAccessor() {}
virtual ~MapFieldAccessor() {} virtual ~MapFieldAccessor() {}
virtual bool IsEmpty(const Field* data) const { bool IsEmpty(const Field* data) const override {
return GetRepeatedField(data)->empty(); return GetRepeatedField(data)->empty();
} }
int Size(const Field* data) const override { int Size(const Field* data) const override {

@ -119,7 +119,7 @@ class PROTOBUF_EXPORT DefaultValueObjectWriter : public ObjectWriter {
DefaultValueObjectWriter* RenderBytes(StringPiece name, DefaultValueObjectWriter* RenderBytes(StringPiece name,
StringPiece value) override; StringPiece value) override;
virtual DefaultValueObjectWriter* RenderNull(StringPiece name); DefaultValueObjectWriter* RenderNull(StringPiece name) override;
// Register the callback for scrubbing of fields. Owership of // Register the callback for scrubbing of fields. Owership of
// field_scrub_callback pointer is also transferred to this class // field_scrub_callback pointer is also transferred to this class

@ -95,21 +95,20 @@ class PROTOBUF_EXPORT JsonObjectWriter : public StructuredObjectWriter {
virtual ~JsonObjectWriter(); virtual ~JsonObjectWriter();
// ObjectWriter methods. // ObjectWriter methods.
virtual JsonObjectWriter* StartObject(StringPiece name); JsonObjectWriter* StartObject(StringPiece name) override;
virtual JsonObjectWriter* EndObject(); JsonObjectWriter* EndObject() override;
virtual JsonObjectWriter* StartList(StringPiece name); JsonObjectWriter* StartList(StringPiece name) override;
virtual JsonObjectWriter* EndList(); JsonObjectWriter* EndList() override;
virtual JsonObjectWriter* RenderBool(StringPiece name, bool value); JsonObjectWriter* RenderBool(StringPiece name, bool value) override;
virtual JsonObjectWriter* RenderInt32(StringPiece name, int32 value); JsonObjectWriter* RenderInt32(StringPiece name, int32 value) override;
virtual JsonObjectWriter* RenderUint32(StringPiece name, uint32 value); JsonObjectWriter* RenderUint32(StringPiece name, uint32 value) override;
virtual JsonObjectWriter* RenderInt64(StringPiece name, int64 value); JsonObjectWriter* RenderInt64(StringPiece name, int64 value) override;
virtual JsonObjectWriter* RenderUint64(StringPiece name, uint64 value); JsonObjectWriter* RenderUint64(StringPiece name, uint64 value) override;
virtual JsonObjectWriter* RenderDouble(StringPiece name, double value); JsonObjectWriter* RenderDouble(StringPiece name, double value) override;
virtual JsonObjectWriter* RenderFloat(StringPiece name, float value); JsonObjectWriter* RenderFloat(StringPiece name, float value) override;
virtual JsonObjectWriter* RenderString(StringPiece name, JsonObjectWriter* RenderString(StringPiece name, StringPiece value) override;
StringPiece value); JsonObjectWriter* RenderBytes(StringPiece name, StringPiece value) override;
virtual JsonObjectWriter* RenderBytes(StringPiece name, StringPiece value); JsonObjectWriter* RenderNull(StringPiece name) override;
virtual JsonObjectWriter* RenderNull(StringPiece name);
virtual JsonObjectWriter* RenderNullAsEmpty(StringPiece name); virtual JsonObjectWriter* RenderNullAsEmpty(StringPiece name);
void set_use_websafe_base64_for_bytes(bool value) { void set_use_websafe_base64_for_bytes(bool value) {

@ -129,9 +129,9 @@ class StatusErrorListener : public converter::ErrorListener {
util::Status GetStatus() { return status_; } util::Status GetStatus() { return status_; }
virtual void InvalidName(const converter::LocationTrackerInterface& loc, void InvalidName(const converter::LocationTrackerInterface& loc,
StringPiece unknown_name, StringPiece unknown_name,
StringPiece message) { StringPiece message) override {
string loc_string = GetLocString(loc); string loc_string = GetLocString(loc);
if (!loc_string.empty()) { if (!loc_string.empty()) {
loc_string.append(" "); loc_string.append(" ");
@ -141,17 +141,17 @@ class StatusErrorListener : public converter::ErrorListener {
StrCat(loc_string, unknown_name, ": ", message)); StrCat(loc_string, unknown_name, ": ", message));
} }
virtual void InvalidValue(const converter::LocationTrackerInterface& loc, void InvalidValue(const converter::LocationTrackerInterface& loc,
StringPiece type_name, StringPiece type_name,
StringPiece value) { StringPiece value) override {
status_ = util::Status( status_ = util::Status(
util::error::INVALID_ARGUMENT, util::error::INVALID_ARGUMENT,
StrCat(GetLocString(loc), ": invalid value ", string(value), StrCat(GetLocString(loc), ": invalid value ", string(value),
" for type ", string(type_name))); " for type ", string(type_name)));
} }
virtual void MissingField(const converter::LocationTrackerInterface& loc, void MissingField(const converter::LocationTrackerInterface& loc,
StringPiece missing_name) { StringPiece missing_name) override {
status_ = util::Status(util::error::INVALID_ARGUMENT, status_ = util::Status(util::error::INVALID_ARGUMENT,
StrCat(GetLocString(loc), ": missing field ", StrCat(GetLocString(loc), ": missing field ",
string(missing_name))); string(missing_name)));

Loading…
Cancel
Save