42 Commits

Author SHA1 Message Date
Daniel Aarno
5879dff268 Fixed more typos 2017-12-26 14:00:18 +01:00
Daniel Aarno
4c04f3e965 Fixed typo 2017-12-26 14:00:13 +01:00
mes5k
cbc24a3b58 fixed minor memory leak 2011-04-09 18:05:35 +00:00
mes5k
82d187771b minor reformatting 2011-01-02 23:10:18 +00:00
mes5k
e9dfb0394b fixed all effective c++ warnings based on patch from Andrew Marlow 2011-01-02 18:50:47 +00:00
mes5k
65376234b2 added support for resetting a command line 2009-01-10 00:05:57 +00:00
zeekec
a15700d36d Rethrow ExitExceptions if we're not handling exceptions. 2008-08-19 22:18:47 +00:00
zeekec
3431fcfd78 Allow internal handling of parse errors to be turned off.
This allows exceptions for parse errors to be propagated to the caller.  Exiting
the program in parse is a bad idea generally, as we have no way of knowing what
cleanup needs to be done in the main program.
2008-07-21 17:20:57 +00:00
mes5k
20d8d8b531 added length checks to strings that can otherwise break with Metroworks compilers 2008-05-23 22:15:45 +00:00
mes5k
3568b89480 added a new include to support exit in environments where it isnt defined 2008-05-13 19:04:40 +00:00
macbishop
847b8c9478 Run CmdLine::parse with argv as pointer to const pointer to const char 2007-05-02 20:11:18 +00:00
mes5k
df1f8e9938 added a new parse method that accepts a vector 2007-03-04 19:08:17 +00:00
macbishop
e0a835388b Catch ExitException and exit. This allows all resources used during
parsing to be released, bug 1662188.
2007-02-17 14:59:30 +00:00
mes5k
6b2cb3ab1d moved exit from CmdLine to StdOutput to provide users more control over when/how the exit happens 2006-11-26 18:32:04 +00:00
mes5k
54db78bd97 printing more useful message when missing required args and catching ArgException reference 2006-11-04 22:05:32 +00:00
mes5k
1a066c1d42 removed a deprecated constructor 2006-05-15 00:36:36 +00:00
mes5k
14d1dc69bf added gcc warning patch 2005-09-10 23:25:43 +00:00
zeekec
c2004dd60c Made deleteOnExit's protected to facilitate derivation. 2005-02-01 21:35:37 +00:00
mes5k
e348535416 removed -v from version switch 2005-01-24 03:18:57 +00:00
mes5k
2f941785c3 added a bool to the constructor that allows automatic -h and -v to be turned off 2005-01-24 00:26:41 +00:00
mes5k
efdd70ec6f added Constraint includes 2005-01-07 03:01:34 +00:00
mes5k
aa7d526623 fixed output bug 2005-01-05 18:22:15 +00:00
mes5k
3c4771b03c fixed output memory leak 2005-01-04 20:21:20 +00:00
mes5k
dda57405ab removed ostream include 2004-12-03 19:39:04 +00:00
mes5k
e02172004f cleaned up iterator names 2004-12-01 03:11:25 +00:00
mes5k
6f2d4828a8 changed output around 2004-11-05 05:07:12 +00:00
mes5k
b1cb010ec6 catch by ref 2004-10-22 01:02:32 +00:00
mes5k
cf64287c40 cleaned up some includes and added ifdefs for sstream 2004-10-21 03:04:13 +00:00
mes5k
885da739a6 made destructor virtual 2004-10-14 17:44:17 +00:00
mes5k
fdd28e3711 moved all output handling into separate methods 2004-10-14 17:20:12 +00:00
mes5k
babf6baac6 added new Exception classes 2004-09-27 21:30:57 +00:00
mes5k
ad7f3fdab3 minor formatting 2004-09-26 23:54:16 +00:00
macbishop
35aa53232d Moving the implementation of tclap to the header files presented me with two
major problems. 1) There where static functions and variables that could cause
link errors if tclap where used in different files (e.g. file1.cc and file2.cc
included tclap then compiling both files would give hard symbols for some
variables which would produce multiple definition when linking) 2) The
dependencies of tclap was a bit strange (CmdLine depends on Args and Args
depends on CmdLine for instance)

The first problem I solved by removing all static variables putting them in
static member functions (which are weak-symbols). So for instance every where
there previously was something like x = _delimiter there now is x = delimiter()
or in case of write acces delimiterRef() = x instead of _delimiter = x (I had
to append the Ref because there where already functions with the same name as
the variables). To solve the problem with static functions I simply inlined
them. This causes the compiler to produce a weak symbol or inline if
appropriate. We can put the functions inside the class declaration later to
make the code look better. This worked fine in all but two cases. In the
ValueArg and MultiArg classes I had to do a "hack" to work around the
specialization template for extractValue<std::string>. The code for this is
very simple but it might look strange an stupid at first but it is only to
resolve the specialisation to a weak symbol. What I did was I put the
implementations of extractValue in a helper class and I could then create a
specialized class instead of function and everything worked out. I think now in
retrospect there might be better solutions to this but I'll think a bit more on
it (maybe some type of inlining on the specialized version would suffice but
I'm not sure).

To handle the dependencies I had to do some rewriting. The first step was to
introduce a new class CmdLineInterface that is a purely abstract base of
CmdLine that specifies the functions needed by Arg and friends. Thus Arg
classes now takes an CmdLineInterface object as input instead (however only
CmdLine can ever be instantiated of-course). With this extra class cleaning up
the dependencies was quite simple, I've attached a dependency graph to the mail
(depgraph.png). I also cleaned up the #includes so now only what actually needs
inclusion is included. A nice side effect of this is that the impl. of CmdLine
is now put back into CmdLine.h (where I guess you wanted it) which (recursivly)
includes everything else needed.

Just to make things clear for myself regarding the class dependencies I made a
class TCLAP::Exception that inherits from std::exception and is a base of
ArgException (Exception does nothing currently). If we don't want the Exception
class it can be removed, however I think it could be a nice logic to have a
base Exception class that every exception inherits from, but we can discuss
that when we decide how to handle exceptions.
2004-09-26 18:27:47 +00:00
mes5k
6cd0c3db78 changed ifndef labels 2004-09-18 16:54:21 +00:00
mes5k
e1d1339530 added usage stuff 2004-08-11 02:45:27 +00:00
mes5k
59b98dd182 xor stuff 2004-02-04 03:20:00 +00:00
mes5k
510f1435e0 fix for strings with spaces 2004-01-30 04:36:51 +00:00
mes5k
6f5b735414 added backward compatibility 2004-01-08 05:30:05 +00:00
mes5k
377f9384fa fixed combined switch stuff and added doxygen comments 2004-01-08 04:59:26 +00:00
mes5k
bbbadfddc9 delimiter changes 2003-12-22 01:48:53 +00:00
mes5k
aca51c23a8 big update 2003-04-03 17:59:34 +00:00
mes5k
ea987fad7a Initial revision 2003-03-19 02:39:58 +00:00