You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2012/07/13 23:11:46 UTC
svn commit: r1361401 - in /incubator/mesos/trunk: src/flags/flags.hpp
third_party/libprocess/include/stout/stringify.hpp
Author: benh
Date: Fri Jul 13 21:11:46 2012
New Revision: 1361401
URL: http://svn.apache.org/viewvc?rev=1361401&view=rev
Log:
Added a specialized version of stringify for bool and updated Flags.
Modified:
incubator/mesos/trunk/src/flags/flags.hpp
incubator/mesos/trunk/third_party/libprocess/include/stout/stringify.hpp
Modified: incubator/mesos/trunk/src/flags/flags.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/flags/flags.hpp?rev=1361401&r1=1361400&r2=1361401&view=diff
==============================================================================
--- incubator/mesos/trunk/src/flags/flags.hpp (original)
+++ incubator/mesos/trunk/src/flags/flags.hpp Fri Jul 13 21:11:46 2012
@@ -181,9 +181,12 @@ void FlagsBase::add(
? " (default: " // On same line, add space.
: "(default: "; // On newline.
- flag.help += flag.boolean
- ? (m2 ? "true" : "false")
- : stringify(m2);
+ // Update the help string to include the default value.
+ flag.help += help.size() > 0 && help.find_last_of("\n\r") != help.size() - 1
+ ? " (default: " // On same line, add space.
+ : "(default: "; // On newline.
+ flag.help += stringify(m2);
+ flag.help += ")";
flag.help += ")";
Modified: incubator/mesos/trunk/third_party/libprocess/include/stout/stringify.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/libprocess/include/stout/stringify.hpp?rev=1361401&r1=1361400&r2=1361401&view=diff
==============================================================================
--- incubator/mesos/trunk/third_party/libprocess/include/stout/stringify.hpp (original)
+++ incubator/mesos/trunk/third_party/libprocess/include/stout/stringify.hpp Fri Jul 13 21:11:46 2012
@@ -23,6 +23,13 @@ std::string stringify(T t)
}
+template <>
+inline std::string stringify(bool b)
+{
+ return b ? "true" : "false";
+}
+
+
template <typename T>
std::string stringify(const std::set<T>& set)
{