fixed writing address to std::stream
This commit is contained in:
parent
1885a332a3
commit
1ee18911ce
|
|
@ -299,6 +299,12 @@ public:
|
||||||
{
|
{
|
||||||
// start with the protocol and login
|
// start with the protocol and login
|
||||||
stream << (address._secure ? "amqps://" : "amqp://");
|
stream << (address._secure ? "amqps://" : "amqp://");
|
||||||
|
|
||||||
|
// do we have a login?
|
||||||
|
if (address._login) stream << address._login << "@";
|
||||||
|
|
||||||
|
// write hostname
|
||||||
|
stream << address._hostname;
|
||||||
|
|
||||||
// do we need a special portnumber?
|
// do we need a special portnumber?
|
||||||
if (address._port != 5672) stream << ":" << address._port;
|
if (address._port != 5672) stream << ":" << address._port;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* This class combines login, password and vhost
|
* This class combines login, password and vhost
|
||||||
*
|
*
|
||||||
* @copyright 2014 Copernica BV
|
* @copyright 2014 - 2018 Copernica BV
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -65,7 +65,25 @@ public:
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
*/
|
*/
|
||||||
virtual ~Login() {}
|
virtual ~Login() = default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cast to boolean: is the login set?
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
operator bool () const
|
||||||
|
{
|
||||||
|
return !_user.empty() || !_password.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Negate operator: is it not set
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
bool operator! () const
|
||||||
|
{
|
||||||
|
return _user.empty() && _password.empty();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the user name
|
* Retrieve the user name
|
||||||
|
|
@ -143,7 +161,7 @@ public:
|
||||||
friend std::ostream &operator<<(std::ostream &stream, const Login &login)
|
friend std::ostream &operator<<(std::ostream &stream, const Login &login)
|
||||||
{
|
{
|
||||||
// write username and password
|
// write username and password
|
||||||
return stream << login._user << "@" << login._password;
|
return stream << login._user << ":" << login._password;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue