BASIS  version 1.2.3 (revision 2104)
ArgTraits.h
00001 // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
00002 
00003 /******************************************************************************
00004  *
00005  *  file:  ArgTraits.h
00006  *
00007  *  Copyright (c) 2007, Daniel Aarno, 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 // This is an internal tclap file, you should probably not have to
00024 // include this directly
00025 
00026 #ifndef TCLAP_ARGTRAITS_H
00027 #define TCLAP_ARGTRAITS_H
00028 
00029 namespace TCLAP {
00030 
00031 // We use two empty structs to get compile type specialization
00032 // function to work
00033 
00034 /**
00035  * A value like argument value type is a value that can be set using
00036  * operator>>. This is the default value type.
00037  */
00038 struct ValueLike {
00039     typedef ValueLike ValueCategory;
00040     virtual ~ValueLike() {}
00041 };
00042 
00043 /**
00044  * A string like argument value type is a value that can be set using
00045  * operator=(string). Usefull if the value type contains spaces which
00046  * will be broken up into individual tokens by operator>>.
00047  */
00048 struct StringLike {
00049     virtual ~StringLike() {}
00050 };
00051 
00052 /**
00053  * A class can inherit from this object to make it have string like
00054  * traits. This is a compile time thing and does not add any overhead
00055  * to the inherenting class.
00056  */
00057 struct StringLikeTrait {
00058     typedef StringLike ValueCategory;
00059     virtual ~StringLikeTrait() {}
00060 };
00061 
00062 /**
00063  * A class can inherit from this object to make it have value like
00064  * traits. This is a compile time thing and does not add any overhead
00065  * to the inherenting class.
00066  */
00067 struct ValueLikeTrait {
00068     typedef ValueLike ValueCategory;
00069     virtual ~ValueLikeTrait() {}
00070 };
00071 
00072 /**
00073  * Arg traits are used to get compile type specialization when parsing
00074  * argument values. Using an ArgTraits you can specify the way that
00075  * values gets assigned to any particular type during parsing. The two
00076  * supported types are StringLike and ValueLike.
00077  */
00078 template<typename T>
00079 struct ArgTraits {
00080     typedef typename T::ValueCategory ValueCategory;
00081     virtual ~ArgTraits() {}
00082     //typedef ValueLike ValueCategory;
00083 };
00084 
00085 #endif
00086 
00087 } // namespace