AAO DRAMA/DRAMA2 C++ Interface
Public Member Functions | Protected Member Functions | List of all members
drama::gitarg::Bool Class Reference

Detailed Description

A class which reads Boolean values from SDS argument structures.

This is a C++ class which provides an interface to GitArgGetL(). It Implements a boolean type which includes the operation gitarg::Bool::Get , to fetch its value from an SDS structure.

By default, the string combinations "YES/NO" and "TRUE/FALSE" are accepted as Boolean values, with any input string being converted to upper case and abbreviations being accepted. There is also a constructor which does the Get() operation.

By overriding the method Lookup() in a sub-class, you can supply alternative lists of True/False strings.

See also
GitArgGetL()

#include "gitarg.hh"

Public Member Functions

 Bool (bool initVal=false)
 Simple constructor with a default value of false. More...
 
 Bool (const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const bool Default=false, const Flags flags=(Flags::Upper|Flags::Abbrev|Flags::KeepErr))
 Constructor which constructs the value from an item in an SDS structure. More...
 
virtual ~Bool ()
 Destructor. More...
 
virtual void Get (const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const bool Default=false, const Flags flags=(Flags::Upper|Flags::Abbrev|Flags::KeepErr))
 Get the value of the object from an SDS struture. More...
 
 operator bool () const
 Conversion operator - given gitarg::Bool, return a bool. More...
 
Bool operator= (const bool src)
 Assign a bool to this gitarg::Bool item. More...
 

Protected Member Functions

virtual const GitLogStrType * Lookup ()
 Return a pointer to an array of enum strings equivalents. More...
 

Constructor & Destructor Documentation

drama::gitarg::Bool::Bool ( bool  initVal = false)
inline

Simple constructor with a default value of false.

drama::gitarg::Bool::Bool ( const sds::Id Id,
const std::string &  Name = "Argument1",
const int  Position = 1,
const bool  Default = false,
const Flags  flags = (Flags::Upper|Flags::Abbrev|Flags::KeepErr) 
)
inline

Constructor which constructs the value from an item in an SDS structure.

The value is fetched from the named item (arg #2) within the SDS structure specified. or the Position (constructor arg #3) item in the structure if the item named does not exist.

Parameters
IdThe SDS structure.
NameThe name of the item within the structure.
PositionIf the item does not exist by the name, then presume this position.
DefaultThe default value.
flagsWhich GIT Flags to apply. If you specify KeepErr, then an exception is throw if the value in the SDS structure is invalid. If you don't specify KeepErr and and the SDS structure does not contain a value item, then the value is set to the supplied default.

References drama::Default, and Get().

virtual drama::gitarg::Bool::~Bool ( )
inlinevirtual

Destructor.

Member Function Documentation

virtual void drama::gitarg::Bool::Get ( const sds::Id Id,
const std::string &  Name = "Argument1",
const int  Position = 1,
const bool  Default = false,
const Flags  flags = (Flags::Upper|Flags::Abbrev|Flags::KeepErr) 
)
inlinevirtual

Get the value of the object from an SDS struture.

(arg #2) within the SDS structure specified. or the Position (constructor arg #3) item in the structure if the item named does not exist.

Parameters
IdThe SDS structure.
NameThe name of the item within the structure.
PositionIf the item does not exist by the name, then presume this position.
DefaultThe default value.
flagsWhich GIT Flags to apply. If you specify KeepErr, then an exception is throw if the value in the SDS structure is invalid. If you don't specify KeepErr and and the SDS structure does not contain a value item, then the value is set to the supplied default.

References drama::Default, DramaTHROW, and Lookup().

Referenced by Bool().

virtual const GitLogStrType* drama::gitarg::Bool::Lookup ( )
inlineprotectedvirtual

Return a pointer to an array of enum strings equivalents.

The result here is passed to GitArgGetS(), hence the old C style interface we use here.

Returns
a pointer to a array of pointer to GitLogStrType, which contains pointers to pairs of true/false values. The last entry in the array must contain a pair of null pointers to terminate the array.

Referenced by Get().

drama::gitarg::Bool::operator bool ( ) const
inline

Conversion operator - given gitarg::Bool, return a bool.

Bool drama::gitarg::Bool::operator= ( const bool  src)
inline

Assign a bool to this gitarg::Bool item.

Parameters
srcSource value

The documentation for this class was generated from the following file:

Click here for the DRAMA home page and here for the AAO home page.

For more information, contact tjf@aao.gov.au 

Generated on Mon Feb 22 2016 15:57:53 for AAO DRAMA/DRAMA2 C++ Interface by doxygen 1.8.10