Merge pull request #363 from CopernicaMarketingSoftware/icase-address-options
Case-insensitive comparison in address options.
This commit is contained in:
commit
0e876055ec
|
|
@ -27,6 +27,21 @@ namespace AMQP {
|
||||||
*/
|
*/
|
||||||
class Address
|
class Address
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* Helper class to do case insensitive comparison
|
||||||
|
*/
|
||||||
|
struct icasecmp
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Comparison operator <. Should exhibit SWO.
|
||||||
|
* @param lhs
|
||||||
|
* @param rhs
|
||||||
|
* @return bool lhs < rhs
|
||||||
|
*/
|
||||||
|
bool operator() (const std::string& lhs, const std::string& rhs) const { return strcasecmp(lhs.c_str(), rhs.c_str()) < 0; }
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* The auth method
|
* The auth method
|
||||||
|
|
@ -62,7 +77,7 @@ private:
|
||||||
* Extra provided options after the question mark /vhost?option=value
|
* Extra provided options after the question mark /vhost?option=value
|
||||||
* @var std::map<std::string,std::string>
|
* @var std::map<std::string,std::string>
|
||||||
*/
|
*/
|
||||||
std::map<std::string, std::string> _options;
|
std::map<std::string, std::string, icasecmp> _options;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default port
|
* The default port
|
||||||
|
|
@ -256,7 +271,7 @@ public:
|
||||||
* Get access to the options
|
* Get access to the options
|
||||||
* @return std::map<std::string,std::string>
|
* @return std::map<std::string,std::string>
|
||||||
*/
|
*/
|
||||||
const std::map<std::string,std::string> &options() const
|
const decltype(_options) &options() const
|
||||||
{
|
{
|
||||||
return _options;
|
return _options;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue