Fresco/Prague/src/Sys GetOpt.cc,1.10,1.11

Neil John Pilgrim <[email protected]>
Newsgroups gmane.comp.video.fresco.cvs
Message-ID <[email protected]>
Update of /cvs/fresco/Fresco/Prague/src/Sys
In directory purcel:/tmp/cvs-serv12281/Prague/src/Sys

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



Index: GetOpt.cc
===================================================================
RCS file: /cvs/fresco/Fresco/Prague/src/Sys/GetOpt.cc,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- GetOpt.cc	28 Dec 2002 05:33:49 -0000	1.10
+++ GetOpt.cc	31 Jan 2003 05:42:09 -0000	1.11
@@ -28,8 +28,10 @@
 GetOpt::GetOpt(const char *program, const char *use) : p(program), u(use) {}
 GetOpt::~GetOpt() {}
 
-void GetOpt::add(char o, const std::string &opt, type t, const std::string &desc)
+void GetOpt::add(char o, const std::string &opt, type t, const std::string &desc) throw (DuplicateOption)
 {
+   table_t::const_iterator i = find(o);
+   if (i != table.end()) throw DuplicateOption(o);
    table.push_back(cell(o, opt, t, desc));
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.