65 #include "rnr/rnrconfig.h" 80 CmdExtArg::CmdExtArg()
86 m_eCvtType = CvtTypeUndef;
92 CmdExtArg::CmdExtArg(
const int &nCmdUid,
93 const int &nFormIndex,
95 const int &nArgInstance,
96 const string &strArg) :
98 m_nFormIndex(nFormIndex),
99 m_nArgIndex(nArgIndex),
100 m_nArgInstance(nArgInstance),
103 m_eCvtType = CvtTypeUndef;
123 CmdExtArg::~CmdExtArg()
141 void CmdExtArg::s(
const string &strVal)
143 m_strCvtVal = strVal;
144 m_eCvtType = CvtTypeString;
147 void CmdExtArg::e(
const long eVal)
149 m_strCvtVal = m_strArg;
151 m_eCvtType = CvtTypeEnum;
154 void CmdExtArg::b(
const bool bVal)
157 m_eCvtType = CvtTypeBoolean;
160 void CmdExtArg::i(
const long lVal)
163 m_eCvtType = CvtTypeInteger;
166 void CmdExtArg::f(
const double fVal)
169 m_eCvtType = CvtTypeFpn;
174 return (type() == rval.
type()) && (arg() == rval.
arg());
177 bool CmdExtArg::operator==(
const std::string &rval)
const 179 return ((type() == CvtTypeString) || (type() == CvtTypeEnum)) &&
183 bool CmdExtArg::operator==(
const char*
const &rval)
const 190 return ((type() == CvtTypeString) || (type() == CvtTypeEnum)) &&
191 (strcmp(s().c_str(), rval) == 0);
194 bool CmdExtArg::operator==(
const bool &rval)
const 196 return (type() == CvtTypeBoolean) && (b() == rval);
199 bool CmdExtArg::operator==(
const long &rval)
const 201 return ((type() == CvtTypeEnum) || (type() == CvtTypeInteger)) &&
205 bool CmdExtArg::operator==(
const double &rval)
const 207 return (type() == CvtTypeFpn) && (f() == rval);
214 case CmdExtArg::CvtTypeString:
217 case CmdExtArg::CvtTypeEnum:
220 case CmdExtArg::CvtTypeBoolean:
223 case CmdExtArg::CvtTypeInteger:
226 case CmdExtArg::CvtTypeFpn:
229 case CmdExtArg::CvtTypeUndef:
CvtType m_eCvtType
converted type
Command line extended argument interface.
std::string m_strArg
argument unconverted raw value string
Command EXTended ARGument class holding parsed command context and the raw and converted argmument va...
const std::string & s() const
Get the converted string value.
int m_nCmdUid
command definition unique id
int m_nArgIndex
argument definition index
CvtType type() const
Get the converted argument type.
long i() const
Get the converted integer value.
const int NoUid
Special values.
std::string m_strCvtVal
converted string value
double m_fCvtVal
converted float-point number value
int m_nArgInstance
argument instance (FUTURE)
const std::string undefstring
"undef" string
bool m_bCvtVal
converted boolean value
bool b() const
Get the converted boolean value.
int m_nFormIndex
form definition index
const int NoIndex
no index
const std::string & arg() const
Get raw source argument string (or a pirate grunting).
double f() const
Get the converted floating-point number value.
Command line core data types.
std::ostream & operator<<(std::ostream &os, const timespec &obj)
A timespec insertion operator.
long m_lCvtVal
converted integer/index value