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 2018/11/13 00:26:22 UTC

[mesos] 02/03: Removed some generic flag parsers that are now in stout.

This is an automated email from the ASF dual-hosted git repository.

benh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 6ce9ad94b1ab32cdfc071b86dbca3d980817d991
Author: Benjamin Hindman <be...@gmail.com>
AuthorDate: Sun Jul 15 09:54:54 2018 -0700

    Removed some generic flag parsers that are now in stout.
    
    Review: https://reviews.apache.org/r/67956
---
 src/common/parse.hpp | 47 -----------------------------------------------
 1 file changed, 47 deletions(-)

diff --git a/src/common/parse.hpp b/src/common/parse.hpp
index 03814e3..cb55eab 100644
--- a/src/common/parse.hpp
+++ b/src/common/parse.hpp
@@ -130,53 +130,6 @@ inline Try<hashmap<std::string, std::string>> parse(const std::string& value)
 }
 
 
-// TODO(klueska): Generalize this parser to take any comma separated
-// list and convert it to its appropriate type (i.e., not just for
-// unsigned ints). Issues could arise when the generic type is a
-// string that contains commas though, so generalizing this is not as
-// straightforward as it looks at first glance.
-template <>
-inline Try<std::vector<unsigned int>> parse(const std::string& value)
-{
-  std::vector<unsigned int> result;
-
-  foreach (const std::string& token, strings::tokenize(value, ",")) {
-    Try<unsigned int> number = numify<unsigned int>(token);
-
-    if (number.isError()) {
-      return Error("Failed to numify '" + token + "': " + number.error());
-    }
-
-    result.push_back(number.get());
-  }
-
-  return result;
-}
-
-
-// NOTE: Strings in the set cannot contain commas, since that
-// is the delimiter and we provide no way to escape it.
-//
-// TODO(klueska): Generalize this parser to take any comma separated
-// list and convert it to its appropriate type (i.e., not just for
-// unsigned ints).
-template <>
-inline Try<std::set<std::string>> parse(const std::string& value)
-{
-  std::set<std::string> result;
-
-  foreach (const std::string& token, strings::tokenize(value, ",")) {
-    if (result.count(token) > 0) {
-      return Error("Duplicate token '" + token + "'");
-    }
-
-    result.insert(token);
-  }
-
-  return result;
-}
-
-
 template <>
 inline Try<mesos::CapabilityInfo> parse(const std::string& value)
 {