Add appendIf(..) method and tests for MessageStringCollector
[alexxy/gromacs.git] / src / gromacs / utility / message_string_collector.h
similarity index 92%
rename from src/gromacs/utility/messagestringcollector.h
rename to src/gromacs/utility/message_string_collector.h
index 8b1595fd4330ea6a170789ba9c015b2a5e75309d..a75851d7aaac0f282cbf53cd94fa6755fea1138b 100644 (file)
@@ -40,8 +40,8 @@
  * \inlibraryapi
  * \ingroup module_utility
  */
-#ifndef GMX_UTILITY_MESSAGESTRINGCOLLECTOR_H
-#define GMX_UTILITY_MESSAGESTRINGCOLLECTOR_H
+#ifndef GMX_UTILITY_MESSAGE_STRING_COLLECTOR_H
+#define GMX_UTILITY_MESSAGE_STRING_COLLECTOR_H
 
 #include <memory>
 #include <string>
@@ -87,6 +87,14 @@ public:
      * Adds a new message.
      */
     void append(const std::string& message);
+    /*! \brief
+     * Adds a new message if the condition is satisfied..
+     */
+    void appendIf(bool condition, const char* message);
+    /*! \brief
+     * Adds a new message if the condition is satisfied.
+     */
+    void appendIf(bool condition, const std::string& message);
     /*! \brief
      * Ends a context started with startContext().
      *
@@ -177,4 +185,4 @@ private:
 
 } // namespace gmx
 
-#endif
+#endif // GMX_UTILITY_MESSAGE_STRING_COLLECTOR_H