summaryrefslogtreecommitdiff
path: root/tutorial
diff options
context:
space:
mode:
authorSebastian Zenker <sebastian.zenker@gmx.de>2019-01-29 15:48:12 +0100
committerJames E. King III <jking@apache.org>2019-01-29 09:48:12 -0500
commit042580f53441efe1bc5c80c89351fcb30740659e (patch)
treefb6504554a4dfa07dc4de09394be0f69a2b38cfd /tutorial
parentaa0c8b35d8f78812de1d7803d6277a37d2ed593a (diff)
downloadthrift-042580f53441efe1bc5c80c89351fcb30740659e.tar.gz
THRIFT-4762: Applied some C++11 refactorings to the runtime library and compiler (#1719)
* make use of C++11 override keyword * added const specifier to TTransport::getOrigin() * added more const correctness to the compiler * make use of auto keyword * replaced usage of NULL with nullptr * make use of explicitly-defaulted function definition * extended changelog
Diffstat (limited to 'tutorial')
-rw-r--r--tutorial/cpp/CppServer.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/tutorial/cpp/CppServer.cpp b/tutorial/cpp/CppServer.cpp
index 3b5ce4012..635afefda 100644
--- a/tutorial/cpp/CppServer.cpp
+++ b/tutorial/cpp/CppServer.cpp
@@ -46,16 +46,16 @@ using namespace shared;
class CalculatorHandler : public CalculatorIf {
public:
- CalculatorHandler() {}
+ CalculatorHandler() = default;
- void ping() { cout << "ping()" << endl; }
+ void ping() override { cout << "ping()" << endl; }
- int32_t add(const int32_t n1, const int32_t n2) {
+ int32_t add(const int32_t n1, const int32_t n2) override {
cout << "add(" << n1 << ", " << n2 << ")" << endl;
return n1 + n2;
}
- int32_t calculate(const int32_t logid, const Work& work) {
+ int32_t calculate(const int32_t logid, const Work& work) override {
cout << "calculate(" << logid << ", " << work << ")" << endl;
int32_t val;
@@ -94,12 +94,12 @@ public:
return val;
}
- void getStruct(SharedStruct& ret, const int32_t logid) {
+ void getStruct(SharedStruct& ret, const int32_t logid) override {
cout << "getStruct(" << logid << ")" << endl;
ret = log[logid];
}
- void zip() { cout << "zip()" << endl; }
+ void zip() override { cout << "zip()" << endl; }
protected:
map<int32_t, SharedStruct> log;
@@ -113,8 +113,8 @@ protected:
*/
class CalculatorCloneFactory : virtual public CalculatorIfFactory {
public:
- virtual ~CalculatorCloneFactory() {}
- virtual CalculatorIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo)
+ ~CalculatorCloneFactory() override = default;
+ CalculatorIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) override
{
std::shared_ptr<TSocket> sock = std::dynamic_pointer_cast<TSocket>(connInfo.transport);
cout << "Incoming connection\n";
@@ -124,7 +124,7 @@ class CalculatorCloneFactory : virtual public CalculatorIfFactory {
cout << "\tPeerPort: " << sock->getPeerPort() << "\n";
return new CalculatorHandler;
}
- virtual void releaseHandler( ::shared::SharedServiceIf* handler) {
+ void releaseHandler( ::shared::SharedServiceIf* handler) override {
delete handler;
}
};