OptionalUnlabeledTracker.h
Go to the documentation of this file.
00001 
00002 
00003 /****************************************************************************** 
00004  * 
00005  *  file:  OptionalUnlabeledTracker.h
00006  * 
00007  *  Copyright (c) 2005, Michael E. Smoot .
00008  *  All rights reverved.
00009  * 
00010  *  See the file COPYING in the top directory of this distribution for
00011  *  more information.
00012  *  
00013  *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 
00014  *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
00015  *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
00016  *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
00017  *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
00018  *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
00019  *  DEALINGS IN THE SOFTWARE.  
00020  *  
00021  *****************************************************************************/ 
00022 
00023 
00024 #ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H
00025 #define TCLAP_OPTIONAL_UNLABELED_TRACKER_H
00026 
00027 #include <string>
00028 
00029 namespace TCLAP {
00030 
00031 class OptionalUnlabeledTracker
00032 {
00033 
00034         public:
00035 
00036                 static void check( bool req, const std::string& argName );
00037 
00038                 static void gotOptional() { alreadyOptionalRef() = true; }
00039 
00040                 static bool& alreadyOptional() { return alreadyOptionalRef(); } 
00041 
00042         private:
00043 
00044                 static bool& alreadyOptionalRef() { static bool ct = false; return ct; }
00045 };
00046 
00047 
00048 inline void OptionalUnlabeledTracker::check( bool req, const std::string& argName )
00049 {
00050     if ( OptionalUnlabeledTracker::alreadyOptional() )
00051         throw( SpecificationException(
00052         "You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg",
00053                         argName ) );
00054 
00055     if ( !req )
00056         OptionalUnlabeledTracker::gotOptional();
00057 }
00058 
00059 
00060 } // namespace TCLAP
00061 
00062 #endif


mapstitch
Author(s): Philipp M. Scholl
autogenerated on Mon Oct 6 2014 02:09:53