THRIFT-2729: C++ - .clang-format created and applied
Client: C++
Patch: Konrad Grochowski
make style command added
diff --git a/lib/cpp/test/processor/ServerThread.h b/lib/cpp/test/processor/ServerThread.h
index f7fa0d5..eed3469 100644
--- a/lib/cpp/test/processor/ServerThread.h
+++ b/lib/cpp/test/processor/ServerThread.h
@@ -26,13 +26,15 @@
#include "EventLog.h"
-namespace apache { namespace thrift { namespace test {
+namespace apache {
+namespace thrift {
+namespace test {
/**
* A helper class to tell ServerThread how to create the server
*/
class ServerState {
- public:
+public:
virtual ~ServerState() {}
/**
@@ -50,8 +52,7 @@
* start serving traffic. It is invoked from the server thread, rather than
* the main thread.
*/
- virtual boost::shared_ptr<server::TServerEventHandler>
- getServerEventHandler() {
+ virtual boost::shared_ptr<server::TServerEventHandler> getServerEventHandler() {
return boost::shared_ptr<server::TServerEventHandler>();
}
@@ -61,17 +62,16 @@
* Subclasses may override this method if they wish to record the final
* port that was used for the server.
*/
- virtual void bindSuccessful(uint16_t /*port*/) {
- }
+ virtual void bindSuccessful(uint16_t /*port*/) {}
};
/**
* ServerThread starts a thrift server running in a separate thread.
*/
class ServerThread {
- public:
- ServerThread(const boost::shared_ptr<ServerState>& state, bool autoStart) :
- helper_(new Helper(this)),
+public:
+ ServerThread(const boost::shared_ptr<ServerState>& state, bool autoStart)
+ : helper_(new Helper(this)),
port_(0),
running_(false),
serving_(false),
@@ -85,9 +85,7 @@
void start();
void stop();
- uint16_t getPort() const {
- return port_;
- }
+ uint16_t getPort() const { return port_; }
~ServerThread() {
if (running_) {
@@ -99,26 +97,20 @@
}
}
- protected:
+protected:
// Annoying. thrift forces us to use shared_ptr, so we have to use
// a helper class that we can allocate on the heap and give to thrift.
// It would be simpler if we could just make Runnable and TServerEventHandler
// private base classes of ServerThread.
- class Helper : public concurrency::Runnable,
- public server::TServerEventHandler {
- public:
- Helper(ServerThread* serverThread)
- : serverThread_(serverThread) {}
+ class Helper : public concurrency::Runnable, public server::TServerEventHandler {
+ public:
+ Helper(ServerThread* serverThread) : serverThread_(serverThread) {}
- void run() {
- serverThread_->run();
- }
+ void run() { serverThread_->run(); }
- void preServe() {
- serverThread_->preServe();
- }
+ void preServe() { serverThread_->preServe(); }
- private:
+ private:
ServerThread* serverThread_;
};
@@ -137,7 +129,8 @@
boost::shared_ptr<server::TServer> server_;
boost::shared_ptr<concurrency::Thread> thread_;
};
-
-}}} // apache::thrift::test
+}
+}
+} // apache::thrift::test
#endif // _THRIFT_TEST_SERVERTHREAD_H_