optional_unlabeled_tracker.hpp
Go to the documentation of this file.
00001 
00011 /*****************************************************************************
00012 ** Ifdefs
00013 *****************************************************************************/
00014 
00015 #ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H
00016 #define TCLAP_OPTIONAL_UNLABELED_TRACKER_H
00017 
00018 #include <string>
00019 
00020 namespace ecl {
00021 
00022 class OptionalUnlabeledTracker
00023 {
00024 
00025         public:
00026 
00027                 static void check( bool req, const std::string& argName );
00028 
00029                 static void gotOptional() { alreadyOptionalRef() = true; }
00030 
00031                 static bool& alreadyOptional() { return alreadyOptionalRef(); }
00032 
00033         private:
00034 
00035                 static bool& alreadyOptionalRef() { static bool ct = false; return ct; }
00036 };
00037 
00038 
00039 inline void OptionalUnlabeledTracker::check( bool req, const std::string& argName )
00040 {
00041     if ( OptionalUnlabeledTracker::alreadyOptional() )
00042         throw( SpecificationException(
00043         "You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg",
00044                         argName ) );
00045 
00046     if ( !req )
00047         OptionalUnlabeledTracker::gotOptional();
00048 }
00049 
00050 }; // namespace ecl
00051 
00052 
00053 #endif


ecl_command_line
Author(s): Daniel Stonier
autogenerated on Mon Jul 3 2017 02:21:07