added operator<< to write a amqp address to a stream
This commit is contained in:
parent
acd6698db3
commit
27ac6aeea5
|
|
@ -236,6 +236,30 @@ public:
|
||||||
// the opposite of operator==
|
// the opposite of operator==
|
||||||
return !operator==(that);
|
return !operator==(that);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Friend function to allow writing the address to a stream
|
||||||
|
* @param stream
|
||||||
|
* @param address
|
||||||
|
* @return std::ostream
|
||||||
|
*/
|
||||||
|
friend std::ostream &operator<<(std::ostream &stream, const Address &address)
|
||||||
|
{
|
||||||
|
// start with the protocol and login
|
||||||
|
stream << "amqp://" << address._login;
|
||||||
|
|
||||||
|
// do we need a special portnumber?
|
||||||
|
if (address._port != 5672) stream << ":" << address._port;
|
||||||
|
|
||||||
|
// append default vhost
|
||||||
|
stream << "/";
|
||||||
|
|
||||||
|
// do we have a special vhost?
|
||||||
|
if (address._vhost != "/") stream << address._vhost;
|
||||||
|
|
||||||
|
// done
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,18 @@ public:
|
||||||
return !operator==(that);
|
return !operator==(that);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Friend function to allow writing the login to a stream
|
||||||
|
* @param stream
|
||||||
|
* @param login
|
||||||
|
* @return std::ostream
|
||||||
|
*/
|
||||||
|
friend std::ostream &operator<<(std::ostream &stream, const Login &login)
|
||||||
|
{
|
||||||
|
// write username and password
|
||||||
|
return stream << login._user << "@" << login._password;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue