From b55bdc9c0bb68236aa2de0a8eaec9f4c80cc2769 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Wed, 5 Sep 2018 23:54:48 +0200 Subject: Code style and clarity. --- examples/example6_tracer.hpp | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'examples/example6_tracer.hpp') diff --git a/examples/example6_tracer.hpp b/examples/example6_tracer.hpp index 8f57f56c..27090cf7 100644 --- a/examples/example6_tracer.hpp +++ b/examples/example6_tracer.hpp @@ -1,25 +1,29 @@ /** Tracer used to demonstrate logging communication between client and server. */ +class myTracer : public vmime::net::tracer { -class myTracer : public vmime::net::tracer -{ public: - myTracer(const vmime::shared_ptr & stream, - const vmime::shared_ptr & serv, const int connectionId) - : m_stream(stream), m_service(serv), m_connectionId(connectionId) - { + myTracer( + const vmime::shared_ptr & stream, + const vmime::shared_ptr & serv, + const int connectionId + ) + : m_stream(stream), + m_service(serv), + m_connectionId(connectionId) { + } - void traceSend(const vmime::string& line) - { + void traceSend(const vmime::string& line) { + *m_stream << "[" << m_service->getProtocolName() << ":" << m_connectionId << "] C: " << line << std::endl; } - void traceReceive(const vmime::string& line) - { + void traceReceive(const vmime::string& line) { + *m_stream << "[" << m_service->getProtocolName() << ":" << m_connectionId << "] S: " << line << std::endl; } @@ -31,18 +35,21 @@ private: const int m_connectionId; }; -class myTracerFactory : public vmime::net::tracerFactory -{ + +class myTracerFactory : public vmime::net::tracerFactory { + public: myTracerFactory(const vmime::shared_ptr & stream) - : m_stream(stream) - { + : m_stream(stream) { + } - vmime::shared_ptr create - (const vmime::shared_ptr & serv, const int connectionId) - { + vmime::shared_ptr create( + const vmime::shared_ptr & serv, + const int connectionId + ) { + return vmime::make_shared (m_stream, serv, connectionId); } @@ -50,4 +57,3 @@ private: vmime::shared_ptr m_stream; }; - -- cgit v1.2.3