summaryrefslogtreecommitdiff
path: root/lib/cpp
diff options
context:
space:
mode:
authorcyy <cyyever@outlook.com>2019-01-13 16:01:43 +0800
committercyy <cyyever@outlook.com>2019-01-22 10:36:18 +0800
commitc349cdb2952497c5a1ecbf1dae84e2ce5aa6db1d (patch)
treecfb1405954889c2d02dabe7c091f9e2e0b75aae3 /lib/cpp
parentfc222b3a8741eda6f4ec874cf7e7d7b5c69ee630 (diff)
downloadthrift-c349cdb2952497c5a1ecbf1dae84e2ce5aa6db1d.tar.gz
add override and const
Diffstat (limited to 'lib/cpp')
-rw-r--r--lib/cpp/src/thrift/transport/TBufferTransports.h12
-rw-r--r--lib/cpp/src/thrift/transport/TFileTransport.h10
-rw-r--r--lib/cpp/src/thrift/transport/THeaderTransport.h4
-rw-r--r--lib/cpp/src/thrift/transport/THttpClient.h2
-rw-r--r--lib/cpp/src/thrift/transport/THttpServer.h4
-rw-r--r--lib/cpp/src/thrift/transport/TNonblockingServerSocket.h4
-rw-r--r--lib/cpp/src/thrift/transport/TPipe.cpp2
-rw-r--r--lib/cpp/src/thrift/transport/TPipe.h8
-rw-r--r--lib/cpp/src/thrift/transport/TPipeServer.h6
-rw-r--r--lib/cpp/src/thrift/transport/TSocket.cpp2
-rw-r--r--lib/cpp/src/thrift/transport/TSocket.h8
-rw-r--r--lib/cpp/src/thrift/transport/TTransport.h2
-rw-r--r--lib/cpp/src/thrift/transport/TTransportUtils.cpp2
-rw-r--r--lib/cpp/src/thrift/transport/TTransportUtils.h28
-rw-r--r--lib/cpp/src/thrift/transport/TVirtualTransport.h10
-rw-r--r--lib/cpp/src/thrift/transport/TZlibTransport.h2
16 files changed, 53 insertions, 53 deletions
diff --git a/lib/cpp/src/thrift/transport/TBufferTransports.h b/lib/cpp/src/thrift/transport/TBufferTransports.h
index c423f9cf4..701227535 100644
--- a/lib/cpp/src/thrift/transport/TBufferTransports.h
+++ b/lib/cpp/src/thrift/transport/TBufferTransports.h
@@ -235,7 +235,7 @@ public:
virtual void writeSlow(const uint8_t* buf, uint32_t len);
- void flush();
+ void flush() override;
/**
* Returns the origin of the underlying transport
@@ -291,7 +291,7 @@ public:
/**
* Wraps the transport into a buffered one.
*/
- virtual std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) {
+ std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) override {
return std::shared_ptr<TTransport>(new TBufferedTransport(trans));
}
};
@@ -354,11 +354,11 @@ public:
transport_->close();
}
- virtual uint32_t readSlow(uint8_t* buf, uint32_t len);
+ uint32_t readSlow(uint8_t* buf, uint32_t len) override;
- virtual void writeSlow(const uint8_t* buf, uint32_t len);
+ void writeSlow(const uint8_t* buf, uint32_t len) override;
- virtual void flush();
+ void flush() override;
uint32_t readEnd();
@@ -430,7 +430,7 @@ public:
/**
* Wraps the transport into a framed one.
*/
- virtual std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) {
+ std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) override {
return std::shared_ptr<TTransport>(new TFramedTransport(trans));
}
};
diff --git a/lib/cpp/src/thrift/transport/TFileTransport.h b/lib/cpp/src/thrift/transport/TFileTransport.h
index 4290eaa66..e7c1ca626 100644
--- a/lib/cpp/src/thrift/transport/TFileTransport.h
+++ b/lib/cpp/src/thrift/transport/TFileTransport.h
@@ -178,14 +178,14 @@ public:
// TODO: what is the correct behaviour for this?
// the log file is generally always open
- bool isOpen() { return true; }
+ bool isOpen() const override { return true; }
void write(const uint8_t* buf, uint32_t len);
void flush();
uint32_t readAll(uint8_t* buf, uint32_t len);
uint32_t read(uint8_t* buf, uint32_t len);
- bool peek();
+ bool peek() override;
// log-file specific functions
void seekToChunk(int32_t chunk);
@@ -260,9 +260,9 @@ public:
* We cannot use TVirtualTransport to provide these, since we need to inherit
* virtually from TTransport.
*/
- virtual uint32_t read_virt(uint8_t* buf, uint32_t len) { return this->read(buf, len); }
- virtual uint32_t readAll_virt(uint8_t* buf, uint32_t len) { return this->readAll(buf, len); }
- virtual void write_virt(const uint8_t* buf, uint32_t len) { this->write(buf, len); }
+ uint32_t read_virt(uint8_t* buf, uint32_t len) override { return this->read(buf, len); }
+ uint32_t readAll_virt(uint8_t* buf, uint32_t len) override { return this->readAll(buf, len); }
+ void write_virt(const uint8_t* buf, uint32_t len) override { this->write(buf, len); }
private:
// helper functions for writing to a file
diff --git a/lib/cpp/src/thrift/transport/THeaderTransport.h b/lib/cpp/src/thrift/transport/THeaderTransport.h
index e6c57e67f..350702dcf 100644
--- a/lib/cpp/src/thrift/transport/THeaderTransport.h
+++ b/lib/cpp/src/thrift/transport/THeaderTransport.h
@@ -103,7 +103,7 @@ public:
}
virtual uint32_t readSlow(uint8_t* buf, uint32_t len);
- virtual void flush();
+ void flush() override;
void resizeTransformBuffer(uint32_t additionalSize = 0);
@@ -264,7 +264,7 @@ public:
/**
* Wraps the transport into a header one.
*/
- virtual std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) {
+ std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) override {
return std::shared_ptr<TTransport>(new THeaderTransport(trans));
}
};
diff --git a/lib/cpp/src/thrift/transport/THttpClient.h b/lib/cpp/src/thrift/transport/THttpClient.h
index f4fb12a11..31f593fcc 100644
--- a/lib/cpp/src/thrift/transport/THttpClient.h
+++ b/lib/cpp/src/thrift/transport/THttpClient.h
@@ -34,7 +34,7 @@ public:
virtual ~THttpClient();
- virtual void flush();
+ void flush() override;
protected:
std::string host_;
diff --git a/lib/cpp/src/thrift/transport/THttpServer.h b/lib/cpp/src/thrift/transport/THttpServer.h
index c38606f49..d72cb13cd 100644
--- a/lib/cpp/src/thrift/transport/THttpServer.h
+++ b/lib/cpp/src/thrift/transport/THttpServer.h
@@ -32,7 +32,7 @@ public:
virtual ~THttpServer();
- virtual void flush();
+ void flush() override;
protected:
void readHeaders();
@@ -53,7 +53,7 @@ public:
/**
* Wraps the transport into a buffered one.
*/
- virtual std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) {
+ std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) override {
return std::shared_ptr<TTransport>(new THttpServer(trans));
}
};
diff --git a/lib/cpp/src/thrift/transport/TNonblockingServerSocket.h b/lib/cpp/src/thrift/transport/TNonblockingServerSocket.h
index 1586ff0bc..8466512ab 100644
--- a/lib/cpp/src/thrift/transport/TNonblockingServerSocket.h
+++ b/lib/cpp/src/thrift/transport/TNonblockingServerSocket.h
@@ -103,8 +103,8 @@ public:
int getListenPort();
- void listen();
- void close();
+ void listen() override;
+ void close() override;
protected:
std::shared_ptr<TSocket> acceptImpl();
diff --git a/lib/cpp/src/thrift/transport/TPipe.cpp b/lib/cpp/src/thrift/transport/TPipe.cpp
index 8a84457db..72af4fcd6 100644
--- a/lib/cpp/src/thrift/transport/TPipe.cpp
+++ b/lib/cpp/src/thrift/transport/TPipe.cpp
@@ -254,7 +254,7 @@ TPipe::~TPipe() {
//---------------------------------------------------------
// Transport callbacks
//---------------------------------------------------------
-bool TPipe::isOpen() {
+bool TPipe::isOpen() const {
return impl_.get() != NULL;
}
diff --git a/lib/cpp/src/thrift/transport/TPipe.h b/lib/cpp/src/thrift/transport/TPipe.h
index aa14f9558..ba149b109 100644
--- a/lib/cpp/src/thrift/transport/TPipe.h
+++ b/lib/cpp/src/thrift/transport/TPipe.h
@@ -63,16 +63,16 @@ public:
virtual ~TPipe();
// Returns whether the pipe is open & valid.
- virtual bool isOpen();
+ bool isOpen() const override;
// Checks whether more data is available in the pipe.
- virtual bool peek();
+ bool peek() override;
// Creates and opens the named/anonymous pipe.
- virtual void open();
+ void open() override;
// Shuts down communications on the pipe.
- virtual void close();
+ void close() override;
// Reads from the pipe.
virtual uint32_t read(uint8_t* buf, uint32_t len);
diff --git a/lib/cpp/src/thrift/transport/TPipeServer.h b/lib/cpp/src/thrift/transport/TPipeServer.h
index c9b13e5a6..871b6afab 100644
--- a/lib/cpp/src/thrift/transport/TPipeServer.h
+++ b/lib/cpp/src/thrift/transport/TPipeServer.h
@@ -60,9 +60,9 @@ public:
virtual ~TPipeServer();
// Standard transport callbacks
- virtual void interrupt();
- virtual void close();
- virtual void listen();
+ void interrupt() override;
+ void close() override;
+ void listen() override;
// Accessors
std::string getPipename();
diff --git a/lib/cpp/src/thrift/transport/TSocket.cpp b/lib/cpp/src/thrift/transport/TSocket.cpp
index c6c2bfa00..6d5f932c5 100644
--- a/lib/cpp/src/thrift/transport/TSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TSocket.cpp
@@ -190,7 +190,7 @@ try_again:
return numBytesAvailable > 0;
}
-bool TSocket::isOpen() {
+bool TSocket::isOpen() const {
return (socket_ != THRIFT_INVALID_SOCKET);
}
diff --git a/lib/cpp/src/thrift/transport/TSocket.h b/lib/cpp/src/thrift/transport/TSocket.h
index 4030d4646..9dcd2d63e 100644
--- a/lib/cpp/src/thrift/transport/TSocket.h
+++ b/lib/cpp/src/thrift/transport/TSocket.h
@@ -81,26 +81,26 @@ public:
*
* @return Is the socket alive?
*/
- virtual bool isOpen();
+ bool isOpen() const override;
/**
* Checks whether there is more data available in the socket to read.
*
* This call blocks until at least one byte is available or the socket is closed.
*/
- virtual bool peek();
+ bool peek() override;
/**
* Creates and opens the UNIX socket.
*
* @throws TTransportException If the socket could not connect
*/
- virtual void open();
+ void open() override;
/**
* Shuts down communications on the socket.
*/
- virtual void close();
+ void close() override;
/**
* Determines whether there is pending data to read or not.
diff --git a/lib/cpp/src/thrift/transport/TTransport.h b/lib/cpp/src/thrift/transport/TTransport.h
index d300f6bdc..0f9227799 100644
--- a/lib/cpp/src/thrift/transport/TTransport.h
+++ b/lib/cpp/src/thrift/transport/TTransport.h
@@ -73,7 +73,7 @@ public:
* This is used by a server to check if it should listen for another
* request.
*/
- virtual bool peek() const { return isOpen(); }
+ virtual bool peek() { return isOpen(); }
/**
* Opens the transport for communications.
diff --git a/lib/cpp/src/thrift/transport/TTransportUtils.cpp b/lib/cpp/src/thrift/transport/TTransportUtils.cpp
index 6f47c7972..eedcde1a7 100644
--- a/lib/cpp/src/thrift/transport/TTransportUtils.cpp
+++ b/lib/cpp/src/thrift/transport/TTransportUtils.cpp
@@ -111,7 +111,7 @@ TPipedFileReaderTransport::TPipedFileReaderTransport(
TPipedFileReaderTransport::~TPipedFileReaderTransport() {
}
-bool TPipedFileReaderTransport::isOpen() {
+bool TPipedFileReaderTransport::isOpen() const {
return TPipedTransport::isOpen();
}
diff --git a/lib/cpp/src/thrift/transport/TTransportUtils.h b/lib/cpp/src/thrift/transport/TTransportUtils.h
index 4c82dd3be..8d67763f8 100644
--- a/lib/cpp/src/thrift/transport/TTransportUtils.h
+++ b/lib/cpp/src/thrift/transport/TTransportUtils.h
@@ -112,9 +112,9 @@ public:
std::free(wBuf_);
}
- bool isOpen() { return srcTrans_->isOpen(); }
+ bool isOpen() const override { return srcTrans_->isOpen(); }
- bool peek() {
+ bool peek() override {
if (rPos_ >= rLen_) {
// Double the size of the underlying buffer if it is full
if (rLen_ == rBufSize_) {
@@ -132,9 +132,9 @@ public:
return (rLen_ > rPos_);
}
- void open() { srcTrans_->open(); }
+ void open() override { srcTrans_->open(); }
- void close() { srcTrans_->close(); }
+ void close() override { srcTrans_->close(); }
void setPipeOnRead(bool pipeVal) { pipeOnRead_ = pipeVal; }
@@ -181,8 +181,8 @@ public:
* We cannot use TVirtualTransport to provide these, since we need to inherit
* virtually from TTransport.
*/
- virtual uint32_t read_virt(uint8_t* buf, uint32_t len) { return this->read(buf, len); }
- virtual void write_virt(const uint8_t* buf, uint32_t len) { this->write(buf, len); }
+ uint32_t read_virt(uint8_t* buf, uint32_t len) override { return this->read(buf, len); }
+ void write_virt(const uint8_t* buf, uint32_t len) override { this->write(buf, len); }
protected:
std::shared_ptr<TTransport> srcTrans_;
@@ -216,7 +216,7 @@ public:
/**
* Wraps the base transport into a piped transport.
*/
- virtual std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> srcTrans) {
+ std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> srcTrans) override {
return std::shared_ptr<TTransport>(new TPipedTransport(srcTrans, dstTrans_));
}
@@ -246,10 +246,10 @@ public:
~TPipedFileReaderTransport();
// TTransport functions
- bool isOpen();
- bool peek();
- void open();
- void close();
+ bool isOpen() const override;
+ bool peek() override;
+ void open() override;
+ void close() override;
uint32_t read(uint8_t* buf, uint32_t len);
uint32_t readAll(uint8_t* buf, uint32_t len);
uint32_t readEnd();
@@ -270,9 +270,9 @@ public:
* We cannot use TVirtualTransport to provide these, since we need to inherit
* virtually from TTransport.
*/
- virtual uint32_t read_virt(uint8_t* buf, uint32_t len) { return this->read(buf, len); }
- virtual uint32_t readAll_virt(uint8_t* buf, uint32_t len) { return this->readAll(buf, len); }
- virtual void write_virt(const uint8_t* buf, uint32_t len) { this->write(buf, len); }
+ uint32_t read_virt(uint8_t* buf, uint32_t len) override { return this->read(buf, len); }
+ uint32_t readAll_virt(uint8_t* buf, uint32_t len) override { return this->readAll(buf, len); }
+ void write_virt(const uint8_t* buf, uint32_t len) override { this->write(buf, len); }
protected:
// shouldn't be used
diff --git a/lib/cpp/src/thrift/transport/TVirtualTransport.h b/lib/cpp/src/thrift/transport/TVirtualTransport.h
index 0cacf61d0..b5518cc75 100644
--- a/lib/cpp/src/thrift/transport/TVirtualTransport.h
+++ b/lib/cpp/src/thrift/transport/TVirtualTransport.h
@@ -84,23 +84,23 @@ public:
* Implementations of the *_virt() functions, to call the subclass's
* non-virtual implementation function.
*/
- virtual uint32_t read_virt(uint8_t* buf, uint32_t len) {
+ uint32_t read_virt(uint8_t* buf, uint32_t len) override {
return static_cast<Transport_*>(this)->read(buf, len);
}
- virtual uint32_t readAll_virt(uint8_t* buf, uint32_t len) {
+ uint32_t readAll_virt(uint8_t* buf, uint32_t len) override {
return static_cast<Transport_*>(this)->readAll(buf, len);
}
- virtual void write_virt(const uint8_t* buf, uint32_t len) {
+ void write_virt(const uint8_t* buf, uint32_t len) override {
static_cast<Transport_*>(this)->write(buf, len);
}
- virtual const uint8_t* borrow_virt(uint8_t* buf, uint32_t* len) {
+ const uint8_t* borrow_virt(uint8_t* buf, uint32_t* len) override {
return static_cast<Transport_*>(this)->borrow(buf, len);
}
- virtual void consume_virt(uint32_t len) { static_cast<Transport_*>(this)->consume(len); }
+ void consume_virt(uint32_t len) override { static_cast<Transport_*>(this)->consume(len); }
/*
* Provide a default readAll() implementation that invokes
diff --git a/lib/cpp/src/thrift/transport/TZlibTransport.h b/lib/cpp/src/thrift/transport/TZlibTransport.h
index b45ec4356..a9b26642d 100644
--- a/lib/cpp/src/thrift/transport/TZlibTransport.h
+++ b/lib/cpp/src/thrift/transport/TZlibTransport.h
@@ -231,7 +231,7 @@ public:
virtual ~TZlibTransportFactory() {}
- virtual std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) {
+ std::shared_ptr<TTransport> getTransport(std::shared_ptr<TTransport> trans) override {
return std::shared_ptr<TTransport>(new TZlibTransport(trans));
}
};