Removed the non-member pointer overloads of `FlagsBase::add`.

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


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

Branch: refs/heads/master
Commit: 92fb8e7ee2280b5b5784eeee0fd3d2f5f3e3814c
Parents: f441eb9
Author: Benjamin Bannier <benjamin.bann...@mesosphere.io>
Authored: Tue Oct 18 03:29:54 2016 -0400
Committer: Michael Park <mp...@apache.org>
Committed: Tue Oct 18 06:09:42 2016 -0400

----------------------------------------------------------------------
 3rdparty/stout/include/stout/flags/flags.hpp | 212 ----------------------
 1 file changed, 212 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/92fb8e7e/3rdparty/stout/include/stout/flags/flags.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/flags/flags.hpp 
b/3rdparty/stout/include/stout/flags/flags.hpp
index de029d2..15446de 100644
--- a/3rdparty/stout/include/stout/flags/flags.hpp
+++ b/3rdparty/stout/include/stout/flags/flags.hpp
@@ -182,99 +182,6 @@ public:
   // `Option` infers a character array type, which causes problems in the
   // current implementation of `Option`. See MESOS-5471.
 
-  template <typename T1, typename T2, typename F>
-  void add(
-      T1* t1,
-      const Name& name,
-      const Option<Name>& alias,
-      const std::string& help,
-      const T2* t2,
-      F validate);
-
-  template <typename T1, typename T2, typename F>
-  void add(
-      T1* t1,
-      const Name& name,
-      const std::string& help,
-      const T2& t2,
-      F validate)
-  {
-    add(t1, name, None(), help, &t2, validate);
-  }
-
-  template <typename T1, typename T2>
-  void add(
-      T1* t1,
-      const Name& name,
-      const std::string& help,
-      const T2& t2)
-  {
-    add(t1, name, None(), help, &t2, [](const T1&) { return None(); });
-  }
-
-  template <typename T1>
-  void add(
-      T1* t1,
-      const Name& name,
-      const std::string& help)
-  {
-    add(t1,
-        name,
-        None(),
-        help,
-        static_cast<const T1*>(nullptr),
-        [](const T1&) { return None(); });
-  }
-
-  template <typename T1, typename T2>
-  void add(
-      T1* t1,
-      const Name& name,
-      const Option<Name>& alias,
-      const std::string& help,
-      const T2& t2)
-  {
-    add(t1, name, alias, help, &t2, [](const T1&) { return None(); });
-  }
-
-  template <typename T, typename F>
-  void add(
-      Option<T>* option,
-      const Name& name,
-      const Option<Name>& alias,
-      const std::string& help,
-      F validate);
-
-  template <typename T, typename F>
-  void add(
-      Option<T>* option,
-      const Name& name,
-      const std::string& help,
-      F validate)
-  {
-    add(option, name, None(), help, validate);
-  }
-
-  template <typename T>
-  void add(
-      Option<T>* option,
-      const Name& name,
-      const std::string& help)
-  {
-    add(option, name, None(), help, [](const Option<T>&) { return None(); });
-  }
-
-  template <typename T>
-  void add(
-      Option<T>* option,
-      const Name& name,
-      const Option<Name>& alias,
-      const std::string& help)
-  {
-    add(option, name, alias, help, [](const Option<T>&) { return None(); });
-  }
-
-protected:
   template <typename Flags, typename T1, typename T2, typename F>
   void add(
       T1 Flags::*t1,
@@ -381,7 +288,6 @@ protected:
 
   void add(const Flag& flag);
 
-public:
   // TODO(marco): IMO the entire --help functionality should be
   // encapsulated inside the FlagsBase class.
   // For now, exposing this for the caller(s) to decide what to
@@ -419,124 +325,6 @@ private:
 };
 
 
-template <typename T1, typename T2, typename F>
-void FlagsBase::add(
-    T1* t1,
-    const Name& name,
-    const Option<Name>& alias,
-    const std::string& help,
-    const T2* t2,
-    F validate)
-{
-  // Don't bother adding anything if the pointer is `nullptr`.
-  if (t1 == nullptr) {
-    return;
-  }
-
-  Flag flag;
-  flag.name = name;
-  flag.alias = alias;
-  flag.help = help;
-  flag.boolean = typeid(T1) == typeid(bool);
-
-  if (t2 != nullptr) {
-    *t1 = *t2; // Set the default.
-    flag.required = false;
-  } else {
-    flag.required = true;
-  }
-
-  // NOTE: We need to take FlagsBase* (or const FlagsBase&) as the
-  // first argument to match the function signature of the 'load',
-  // 'stringify', and 'validate' lambdas used in other overloads of
-  // FlagsBase::add. Since we don't need to use the pointer here we
-  // don't name it as a parameter.
-
-  flag.load = [t1](FlagsBase*, const std::string& value) -> Try<Nothing> {
-    // NOTE: 'fetch' "retrieves" the value if necessary and then
-    // invokes 'parse'. See 'fetch' for more details.
-    Try<T1> t = fetch<T1>(value);
-    if (t.isSome()) {
-      *t1 = t.get();
-    } else {
-      return Error("Failed to load value '" + value + "': " + t.error());
-    }
-
-    return Nothing();
-  };
-
-  flag.stringify = [t1](const FlagsBase&) -> Option<std::string> {
-    return stringify(*t1);
-  };
-
-  flag.validate = [t1, validate](const FlagsBase&) -> Option<Error> {
-    return validate(*t1);
-  };
-
-  // 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.
-  if (t2 != nullptr) {
-    flag.help += stringify(*t2);
-  }
-  flag.help += ")";
-
-  add(flag);
-}
-
-
-template <typename T, typename F>
-void FlagsBase::add(
-    Option<T>* option,
-    const Name& name,
-    const Option<Name>& alias,
-    const std::string& help,
-    F validate)
-{
-  // Don't bother adding anything if the pointer is `nullptr`.
-  if (option == nullptr) {
-    return;
-  }
-
-  Flag flag;
-  flag.name = name;
-  flag.alias = alias;
-  flag.help = help;
-  flag.boolean = typeid(T) == typeid(bool);
-  flag.required = false;
-
-  // NOTE: See comment above in T* overload of FlagsBase::add for why
-  // we need to take the FlagsBase* parameter.
-
-  flag.load = [option](FlagsBase*, const std::string& value) -> Try<Nothing> {
-    // NOTE: 'fetch' "retrieves" the value if necessary and then
-    // invokes 'parse'. See 'fetch' for more details.
-    Try<T> t = fetch<T>(value);
-    if (t.isSome()) {
-      *option = Some(t.get());
-    } else {
-      return Error("Failed to load value '" + value + "': " + t.error());
-    }
-
-    return Nothing();
-  };
-
-  flag.stringify = [option](const FlagsBase&) -> Option<std::string> {
-    if (option->isSome()) {
-      return stringify(option->get());
-    }
-    return None();
-  };
-
-  flag.validate = [option, validate](const FlagsBase&) -> Option<Error> {
-    return validate(*option);
-  };
-
-  add(flag);
-}
-
-
 template <typename Flags, typename T1, typename T2, typename F>
 void FlagsBase::add(
     T1 Flags::*t1,

Reply via email to