Apply clang-format to source tree
[alexxy/gromacs.git] / src / gromacs / utility / stringcompare.h
index 211a4b67ab6705ca0816bec21c19ca85a6627a4c..9aad20897d069938c9916b62fc988dcd8fb370fd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -76,33 +76,31 @@ enum class StringCompareType
  */
 class StringCompare
 {
-    public:
-        /*! \brief
-         * Creates a comparer with the given type
-         *
-         * This is not explicit, which allows passing \ref StringCompareType
-         * directly to, e.g., `std::map` constructors.
-         */
-        StringCompare(StringCompareType type = StringCompareType::Exact)
-            : type_(type) {}
+public:
+    /*! \brief
+     * Creates a comparer with the given type
+     *
+     * This is not explicit, which allows passing \ref StringCompareType
+     * directly to, e.g., `std::map` constructors.
+     */
+    StringCompare(StringCompareType type = StringCompareType::Exact) : type_(type) {}
 
-        //! The comparison operation.
-        bool operator()(const std::string &a, const std::string &b) const
+    //! The comparison operation.
+    bool operator()(const std::string& a, const std::string& b) const
+    {
+        switch (type_)
         {
-            switch (type_)
-            {
-                case StringCompareType::Exact:
-                    return a < b;
-                case StringCompareType::CaseInsensitive:
-                    return gmx_strcasecmp(a.c_str(), b.c_str()) < 0;
-                case StringCompareType::CaseAndDashInsensitive:
-                    return gmx_strcasecmp_min(a.c_str(), b.c_str()) < 0;
-            }
-            return a < b;
+            case StringCompareType::Exact: return a < b;
+            case StringCompareType::CaseInsensitive:
+                return gmx_strcasecmp(a.c_str(), b.c_str()) < 0;
+            case StringCompareType::CaseAndDashInsensitive:
+                return gmx_strcasecmp_min(a.c_str(), b.c_str()) < 0;
         }
+        return a < b;
+    }
 
-    private:
-        StringCompareType type_;
+private:
+    StringCompareType type_;
 };
 
 } // namespace gmx