mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
add override and const
This commit is contained in:
parent
fc222b3a87
commit
c349cdb295
@ -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));
|
||||
}
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
virtual ~THttpClient();
|
||||
|
||||
virtual void flush();
|
||||
void flush() override;
|
||||
|
||||
protected:
|
||||
std::string host_;
|
||||
|
@ -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));
|
||||
}
|
||||
};
|
||||
|
@ -103,8 +103,8 @@ public:
|
||||
|
||||
int getListenPort();
|
||||
|
||||
void listen();
|
||||
void close();
|
||||
void listen() override;
|
||||
void close() override;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<TSocket> acceptImpl();
|
||||
|
@ -254,7 +254,7 @@ TPipe::~TPipe() {
|
||||
//---------------------------------------------------------
|
||||
// Transport callbacks
|
||||
//---------------------------------------------------------
|
||||
bool TPipe::isOpen() {
|
||||
bool TPipe::isOpen() const {
|
||||
return impl_.get() != NULL;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -190,7 +190,7 @@ try_again:
|
||||
return numBytesAvailable > 0;
|
||||
}
|
||||
|
||||
bool TSocket::isOpen() {
|
||||
bool TSocket::isOpen() const {
|
||||
return (socket_ != THRIFT_INVALID_SOCKET);
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -111,7 +111,7 @@ TPipedFileReaderTransport::TPipedFileReaderTransport(
|
||||
TPipedFileReaderTransport::~TPipedFileReaderTransport() {
|
||||
}
|
||||
|
||||
bool TPipedFileReaderTransport::isOpen() {
|
||||
bool TPipedFileReaderTransport::isOpen() const {
|
||||
return TPipedTransport::isOpen();
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user