From 05059ec37280e3db90c58b93d1253209ad42a14a Mon Sep 17 00:00:00 2001 From: Michael van der Werve Date: Mon, 5 Oct 2020 15:43:36 +0200 Subject: [PATCH] case insensitive comparisons --- include/amqpcpp/address.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/include/amqpcpp/address.h b/include/amqpcpp/address.h index 796ac42..8732e49 100644 --- a/include/amqpcpp/address.h +++ b/include/amqpcpp/address.h @@ -27,6 +27,21 @@ namespace AMQP { */ 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: /** * The auth method @@ -62,7 +77,7 @@ private: * Extra provided options after the question mark /vhost?option=value * @var std::map */ - std::map _options; + std::map _options; /** * The default port @@ -256,7 +271,7 @@ public: * Get access to the options * @return std::map */ - const std::map &options() const + const decltype(_options) &options() const { return _options; }