X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fgetopt.cpp;h=be1d151a3ee8e704af0b10b79ed42c7a8b787572;hb=ae48dac6a368dbf68b1ec976254a5f896c5b737b;hp=8fd13a0c0593bc28dab3f276597b8de8a2cf6dd7;hpb=c76bd823b81d723d8cd4531631a4b18544f1981a;p=libs%2Fcore.git diff --git a/source/core/getopt.cpp b/source/core/getopt.cpp index 8fd13a0..be1d151 100644 --- a/source/core/getopt.cpp +++ b/source/core/getopt.cpp @@ -247,4 +247,22 @@ GetOpt::OptBase &GetOpt::OptBase::set_help(const string &h, const string &m) return *this; } +void GetOpt::OptBase::process() +{ + if(arg_type==REQUIRED_ARG) + throw UsageError("--"+lng+" requires an argument"); + ++seen_count; + + store(); +} + +void GetOpt::OptBase::process(const string &arg) +{ + if(arg_type==NO_ARG) + throw UsageError("--"+lng+" takes no argument"); + ++seen_count; + + store(arg); +} + } // namespace Msp