logo       
Google Custom Search
    AddThis Social Bookmark Button

Fresco/Prague/include/Prague/Sys GetOpt.hh,1.10,1.11: msg#00145

Subject: Fresco/Prague/include/Prague/Sys GetOpt.hh,1.10,1.11
Update of /cvs/fresco/Fresco/Prague/include/Prague/Sys
In directory purcel:/tmp/cvs-serv12281/Prague/include/Prague/Sys

Modified Files:
        GetOpt.hh 
Log Message:
Patch for bug153: Prague::GetOpt::add(...) should check for pre-existing matches
(closing that bug)



Index: GetOpt.hh
===================================================================
RCS file: /cvs/fresco/Fresco/Prague/include/Prague/Sys/GetOpt.hh,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- GetOpt.hh   28 Dec 2002 05:33:49 -0000      1.10
+++ GetOpt.hh   31 Jan 2003 05:42:09 -0000      1.11
@@ -54,6 +54,16 @@
     virtual const char* what() const throw() { return (std::string("no such 
option ") + my_option).c_str();}
     const std::string my_option;
   };
+  class DuplicateOption : public std::exception
+  {
+  public:
+    DuplicateOption(const char o) throw()
+      : my_option(std::string("-") + o) {}
+    virtual ~DuplicateOption() throw() {}
+    virtual const char* what() const throw() { return (std::string("option 
already added: ") + my_option).c_str();}
+  private:
+    const std::string my_option;
+  };
 private:
   struct cell
   {
@@ -78,7 +88,7 @@
   //. parse the given args
   int parse(char *args);
   //. register an option
-  void add(char o, const std::string &option, type, const std::string & = "no 
description available");
+  void add(char o, const std::string &option, type, const std::string & = "no 
description available") throw (DuplicateOption);
   //. return whether the option was issued
   bool is_set(char o) const throw (NoSuchOption);
   //. return whether the option was issued



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>