6 #include <stk_util/diag/Option.hpp> 7 #include <stk_util/diag/Trace.hpp> 8 #include <stk_util/diag/Writer_fwd.hpp> 14 OptionMaskParser::Mask
16 const char * mask)
const 19 const std::string mask_string(
mask);
23 std::string::const_iterator it0 = mask_string.begin();
24 std::string::const_iterator it1;
25 std::string::const_iterator it2;
26 std::string::const_iterator it3;
29 while (it0 != mask_string.end() && *it0 ==
' ')
32 if (it0 == mask_string.end())
35 for (it1 = it0; it1 != mask_string.end(); ++it1) {
36 if (*it1 ==
'(' || *it1 ==
':' || *it1 ==
',')
42 while (it2 != it0 && *(it2 - 1) ==
' ')
45 std::string name(it0, it2);
52 while (it2 != mask_string.end() && *it2 ==
' ')
57 for (; it1 != mask_string.end(); ++it1) {
60 else if (*it1 ==
')') {
69 while (it3 != it2 && *(it3 - 1) ==
' ')
73 for (; it1 != mask_string.end(); ++it1)
74 if (*it1 ==
':' || *it1 ==
',')
80 const std::string arg(it2, it3);
85 }
while (it1 != mask_string.end());
94 const std::string & name,
95 const std::string & arg)
const 102 std::istringstream mask_hex_stream(name.c_str());
112 OptionMaskParser::describe(
113 std::ostream & os)
const 115 os <<
"Specify a comma separated list of:" << std::endl;
116 for (OptionMaskNameMap::const_iterator it = m_optionMaskNameMap.begin(); it != m_optionMaskNameMap.end(); ++it)
117 (*it).second.describe(os);
124 OptionMaskName::describe(
125 std::ostream & os)
const 127 return os <<
" " << std::left <<
std::setw(20) << m_name <<
"\t" << m_description << std::endl;
_resetiosflags resetiosflags(std::ios_base::fmtflags flags)
Function resetiosflags clears the ios flags as a manipulator.
OptionMaskNameMap m_optionMaskNameMap
Mask name vector.
virtual void parseArg(const std::string &name, const std::string &arg) const
void mask(const std::string &name, const Mask l_mask, const std::string &description)
OptionMask m_optionMask
Most recently parsed mask.
virtual Mask parse(const char *mask) const
bool m_status
Result of most recent parse.
_setw setw(int width)
Function setw sets the width for the next field as a manipulator.
OptionMask Mask
Mask for this option.