From 816fe6410dcc6266f087fa089ce7bed4b155e7d1 Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Sat, 15 Jun 2013 12:39:57 -0500 Subject: [PATCH] update documentation & code style --- websocketpp/utilities.hpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/websocketpp/utilities.hpp b/websocketpp/utilities.hpp index 7a0ce1dfc9..a648873554 100644 --- a/websocketpp/utilities.hpp +++ b/websocketpp/utilities.hpp @@ -34,7 +34,7 @@ namespace websocketpp { namespace utility { -/// Helper struct for case insensitive find +/// Helper functor for case insensitive find /** * Based on code from * http://stackoverflow.com/questions/3152241/case-insensitive-stdstring-find @@ -43,12 +43,24 @@ namespace utility { */ template struct my_equal { - my_equal( const std::locale& loc ) : loc_(loc) {} + /// Construct the functor with the given locale + /** + * @param [in] loc The locale to use for determining the case of values + */ + my_equal(std::locale const & loc ) : m_loc(loc) {} + + /// Perform a case insensitive comparison + /** + * @param ch1 The first value to compare + * @param ch2 The second value to compare + * @return Whether or not the two values are equal when both are converted + * to uppercase using the given locale. + */ bool operator()(charT ch1, charT ch2) { - return std::toupper(ch1, loc_) == std::toupper(ch2, loc_); + return std::toupper(ch1, m_loc) == std::toupper(ch2, m_loc); } private: - const std::locale& loc_; + std::locale const & m_loc; }; /// Find substring (case insensitive)