Repository: mesos
Updated Branches:
  refs/heads/master c6643f71c -> 04f8302c0


Added << operator to stout::flags.

Review: https://reviews.apache.org/r/32105


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6a342297
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6a342297
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6a342297

Branch: refs/heads/master
Commit: 6a342297ab9734bafb681692666ebaa5a5265b56
Parents: c6643f7
Author: Joerg Schad <[email protected]>
Authored: Fri Mar 27 16:00:17 2015 +0100
Committer: Till Toenshoff <[email protected]>
Committed: Fri Mar 27 16:00:17 2015 +0100

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/flags/flags.hpp    | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6a342297/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp 
b/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp
index aedb6ab..fb383b4 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/flags/flags.hpp
@@ -15,6 +15,7 @@
 #define __STOUT_FLAGS_FLAGS_HPP__
 
 #include <map>
+#include <ostream>
 #include <string>
 #include <typeinfo> // For typeid.
 
@@ -583,6 +584,21 @@ inline std::string FlagsBase::usage() const
   return usage;
 }
 
+
+inline std::ostream& operator << (std::ostream& stream, const FlagsBase& flags)
+{
+  std::vector<std::string> _flags;
+
+  foreachvalue (const flags::Flag& flag, flags) {
+    const Option<std::string>& value = flag.stringify(flags);
+    if (value.isSome()) {
+      _flags.push_back("--" + flag.name + "=\"" + value.get() + '"');
+    }
+  }
+
+  return stream << strings::join(" ", _flags);
+}
+
 } // namespace flags {
 
 #endif // __STOUT_FLAGS_FLAGS_HPP__

Reply via email to