From fd7c713ea0895bf1824ebbd5ab4e5f3c4d2dfce0 Mon Sep 17 00:00:00 2001
From: Christian Beckmann <c.beckmann@donders.ru.nl>
Date: Fri, 11 May 2001 17:39:42 +0000
Subject: [PATCH] Added functionality to make options invisible (i.e. not
 appear in a usage line)

---
 options.h | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/options.h b/options.h
index 59636ae..c777cf8 100644
--- a/options.h
+++ b/options.h
@@ -43,12 +43,27 @@ namespace Utilities {
     */
     BaseOption(const string& k, const string& ht, bool c, ArgFlag f): 
       key_(k), help_text_(ht), arg_flag_(f), 
-      unset_(true), compulsory_(c) {}
+      unset_(true), compulsory_(c), visible_(true) {}
+    /**
+       @param k comma seperated list of key aliases
+       @param ht the help text to be printed for this option
+       @param c if true then this option is compulsory
+       @param f one of no_argument, requires_argument, optional_argument
+       @param v true or false -- display the option in usage
+       to indicate what arguments should be supplied
+    */
+    BaseOption(const string& k, const string& ht, bool c, ArgFlag f, bool v): 
+      key_(k), help_text_(ht), arg_flag_(f), 
+      unset_(true), compulsory_(c), visible_(v) {}
 
     /**
        @return true if the option is compulsory
     */
     bool compulsory() { return compulsory_; }
+    /**
+       @return true if the option should be visible
+    */
+    bool visible() { return visible_; }
     /**
        @return true if the option requires an argument
     */
@@ -97,7 +112,7 @@ namespace Utilities {
     ArgFlag arg_flag_;
 
   protected:
-    bool unset_, compulsory_;
+    bool unset_, compulsory_, visible_;
   };
 
   ostream& operator<<(ostream &os, const BaseOption& o);
@@ -122,6 +137,16 @@ namespace Utilities {
     Option(const string& k, const T& v, const string& ht,
 	   bool c, ArgFlag f = no_argument): 
       BaseOption(k, ht, c, f), default_(v), value_(v) {}
+  /** 
+	@param k Comma seperated list of key aliases
+	@param v Default value for this option
+	@param ht Help text to be printed when outputting usage
+	@param c If true then this option is compulsory
+	@param f This options argument requirements
+    */
+    Option(const string& k, const T& v, const string& ht,
+	   bool c, ArgFlag f, bool vis): 
+      BaseOption(k, ht, c, f, vis), default_(v), value_(v) {}
 
 
     /** 
-- 
GitLab