From acda90655dc9b1f3045b731af2303825549525d7 Mon Sep 17 00:00:00 2001 From: Michael van der Werve Date: Tue, 19 Aug 2014 14:54:30 +0200 Subject: [PATCH] login and vhost can now be fetched from the connection class --- include/connection.h | 18 ++++++++++++++++++ include/connectionimpl.h | 6 +++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/include/connection.h b/include/connection.h index 358396b..1a4c0f1 100644 --- a/include/connection.h +++ b/include/connection.h @@ -58,6 +58,24 @@ public: * Destructor */ virtual ~Connection() {} + + /** + * Retrieve the login data + * @return Login + */ + const Login &login() const + { + return _implementation.login(); + } + + /** + * Retrieve the vhost + * @return string + */ + const std::string &vhost() const + { + return _implemention.vhost(); + } /** * Parse data that was recevied from RabbitMQ diff --git a/include/connectionimpl.h b/include/connectionimpl.h index 53adf0c..b1e31c2 100644 --- a/include/connectionimpl.h +++ b/include/connectionimpl.h @@ -145,7 +145,7 @@ public: * Are we fully connected? * @return bool */ - bool connected() + bool connected() const { // state must be connected return _state == state_connected; @@ -160,7 +160,7 @@ public: * Retrieve the login data * @return Login */ - Login &login() + const Login &login() const { return _login; } @@ -169,7 +169,7 @@ public: * Retrieve the vhost * @return string */ - std::string &vhost() + const std::string &vhost() const { return _vhost; }