aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/stubs
diff options
context:
space:
mode:
authorGravatar Feng Xiao <xfxyjwf@gmail.com>2018-06-25 13:52:55 -0700
committerGravatar GitHub <noreply@github.com>2018-06-25 13:52:55 -0700
commit0b0890b36d01bf7b372cb237998ee793f5cdc433 (patch)
tree20f4e0b1ad1f74f794f2cb45110841f2b26af23b /src/google/protobuf/stubs
parentd9ccd0c0e6bbda9bf4476088eeb46b02d7dcd327 (diff)
parent6f88e12f9dee4a658913b475e7680952c6ff3cac (diff)
Merge pull request #4608 from khuzemap/master
Add "override" keyword for overridden virtual functions
Diffstat (limited to 'src/google/protobuf/stubs')
-rw-r--r--src/google/protobuf/stubs/bytestream.h24
-rw-r--r--src/google/protobuf/stubs/callback.h22
2 files changed, 23 insertions, 23 deletions
diff --git a/src/google/protobuf/stubs/bytestream.h b/src/google/protobuf/stubs/bytestream.h
index 86510d14..b9b43db0 100644
--- a/src/google/protobuf/stubs/bytestream.h
+++ b/src/google/protobuf/stubs/bytestream.h
@@ -162,7 +162,7 @@ class LIBPROTOBUF_EXPORT ByteSource {
class LIBPROTOBUF_EXPORT UncheckedArrayByteSink : public ByteSink {
public:
explicit UncheckedArrayByteSink(char* dest) : dest_(dest) {}
- virtual void Append(const char* data, size_t n);
+ virtual void Append(const char* data, size_t n) override;
// Returns the current output pointer so that a caller can see how many bytes
// were produced.
@@ -190,7 +190,7 @@ class LIBPROTOBUF_EXPORT UncheckedArrayByteSink : public ByteSink {
class LIBPROTOBUF_EXPORT CheckedArrayByteSink : public ByteSink {
public:
CheckedArrayByteSink(char* outbuf, size_t capacity);
- virtual void Append(const char* bytes, size_t n);
+ virtual void Append(const char* bytes, size_t n) override;
// Returns the number of bytes actually written to the sink.
size_t NumberOfBytesWritten() const { return size_; }
@@ -227,7 +227,7 @@ class LIBPROTOBUF_EXPORT GrowingArrayByteSink : public strings::ByteSink {
public:
explicit GrowingArrayByteSink(size_t estimated_size);
virtual ~GrowingArrayByteSink();
- virtual void Append(const char* bytes, size_t n);
+ virtual void Append(const char* bytes, size_t n) override;
// Returns the allocated buffer, and sets nbytes to its size. The caller takes
// ownership of the buffer and must delete it with delete[].
@@ -256,7 +256,7 @@ class LIBPROTOBUF_EXPORT GrowingArrayByteSink : public strings::ByteSink {
class LIBPROTOBUF_EXPORT StringByteSink : public ByteSink {
public:
explicit StringByteSink(string* dest) : dest_(dest) {}
- virtual void Append(const char* data, size_t n);
+ virtual void Append(const char* data, size_t n) override;
private:
string* dest_;
@@ -273,7 +273,7 @@ class LIBPROTOBUF_EXPORT StringByteSink : public ByteSink {
class LIBPROTOBUF_EXPORT NullByteSink : public ByteSink {
public:
NullByteSink() {}
- virtual void Append(const char *data, size_t n) {}
+ virtual void Append(const char *data, size_t n) override {}
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(NullByteSink);
@@ -296,9 +296,9 @@ class LIBPROTOBUF_EXPORT ArrayByteSource : public ByteSource {
public:
explicit ArrayByteSource(StringPiece s) : input_(s) {}
- virtual size_t Available() const;
- virtual StringPiece Peek();
- virtual void Skip(size_t n);
+ virtual size_t Available() const override;
+ virtual StringPiece Peek() override;
+ virtual void Skip(size_t n) override;
private:
StringPiece input_;
@@ -328,13 +328,13 @@ class LIBPROTOBUF_EXPORT LimitByteSource : public ByteSource {
// Returns at most "limit" bytes from "source".
LimitByteSource(ByteSource* source, size_t limit);
- virtual size_t Available() const;
- virtual StringPiece Peek();
- virtual void Skip(size_t n);
+ virtual size_t Available() const override;
+ virtual StringPiece Peek() override;
+ virtual void Skip(size_t n) override;
// We override CopyTo so that we can forward to the underlying source, in
// case it has an efficient implementation of CopyTo.
- virtual void CopyTo(ByteSink* sink, size_t n);
+ virtual void CopyTo(ByteSink* sink, size_t n) override;
private:
ByteSource* source_;
diff --git a/src/google/protobuf/stubs/callback.h b/src/google/protobuf/stubs/callback.h
index 6888f136..dae972f2 100644
--- a/src/google/protobuf/stubs/callback.h
+++ b/src/google/protobuf/stubs/callback.h
@@ -125,7 +125,7 @@ class LIBPROTOBUF_EXPORT FunctionClosure0 : public Closure {
: function_(function), self_deleting_(self_deleting) {}
~FunctionClosure0();
- void Run() {
+ void Run() override {
bool needs_delete = self_deleting_; // read in case callback deletes
function_();
if (needs_delete) delete this;
@@ -145,7 +145,7 @@ class MethodClosure0 : public Closure {
: object_(object), method_(method), self_deleting_(self_deleting) {}
~MethodClosure0() {}
- void Run() {
+ void Run() override {
bool needs_delete = self_deleting_; // read in case callback deletes
(object_->*method_)();
if (needs_delete) delete this;
@@ -168,7 +168,7 @@ class FunctionClosure1 : public Closure {
arg1_(arg1) {}
~FunctionClosure1() {}
- void Run() {
+ void Run() override {
bool needs_delete = self_deleting_; // read in case callback deletes
function_(arg1_);
if (needs_delete) delete this;
@@ -191,7 +191,7 @@ class MethodClosure1 : public Closure {
arg1_(arg1) {}
~MethodClosure1() {}
- void Run() {
+ void Run() override {
bool needs_delete = self_deleting_; // read in case callback deletes
(object_->*method_)(arg1_);
if (needs_delete) delete this;
@@ -215,7 +215,7 @@ class FunctionClosure2 : public Closure {
arg1_(arg1), arg2_(arg2) {}
~FunctionClosure2() {}
- void Run() {
+ void Run() override {
bool needs_delete = self_deleting_; // read in case callback deletes
function_(arg1_, arg2_);
if (needs_delete) delete this;
@@ -239,7 +239,7 @@ class MethodClosure2 : public Closure {
arg1_(arg1), arg2_(arg2) {}
~MethodClosure2() {}
- void Run() {
+ void Run() override {
bool needs_delete = self_deleting_; // read in case callback deletes
(object_->*method_)(arg1_, arg2_);
if (needs_delete) delete this;
@@ -262,7 +262,7 @@ class FunctionResultCallback_0_0 : public ResultCallback<R> {
: function_(function), self_deleting_(self_deleting) {}
~FunctionResultCallback_0_0() {}
- R Run() {
+ R Run() override {
bool needs_delete = self_deleting_; // read in case callback deletes
R result = function_();
if (needs_delete) delete this;
@@ -284,7 +284,7 @@ class FunctionResultCallback_1_0 : public ResultCallback<R> {
: function_(function), self_deleting_(self_deleting), p1_(p1) {}
~FunctionResultCallback_1_0() {}
- R Run() {
+ R Run() override {
bool needs_delete = self_deleting_; // read in case callback deletes
R result = function_(p1_);
if (needs_delete) delete this;
@@ -306,7 +306,7 @@ class FunctionResultCallback_0_1 : public ResultCallback1<R, Arg1> {
: function_(function), self_deleting_(self_deleting) {}
~FunctionResultCallback_0_1() {}
- R Run(Arg1 a1) {
+ R Run(Arg1 a1) override {
bool needs_delete = self_deleting_; // read in case callback deletes
R result = function_(a1);
if (needs_delete) delete this;
@@ -328,7 +328,7 @@ class FunctionResultCallback_1_1 : public ResultCallback1<R, A1> {
: function_(function), self_deleting_(self_deleting), p1_(p1) {}
~FunctionResultCallback_1_1() {}
- R Run(A1 a1) {
+ R Run(A1 a1) override {
bool needs_delete = self_deleting_; // read in case callback deletes
R result = function_(p1_, a1);
if (needs_delete) delete this;
@@ -387,7 +387,7 @@ class MethodResultCallback_5_2 : public ResultCallback2<R, A1, A2> {
p5_(p5) {}
~MethodResultCallback_5_2() {}
- R Run(A1 a1, A2 a2) {
+ R Run(A1 a1, A2 a2) override {
bool needs_delete = self_deleting_;
R result = (object_->*method_)(p1_, p2_, p3_, p4_, p5_, a1, a2);
if (needs_delete) delete this;