cmdopt: add present option

This commit is contained in:
Danny Robson 2015-06-30 22:07:02 +10:00
parent 42fffeea46
commit fab5891efe
2 changed files with 38 additions and 0 deletions

View File

@ -138,6 +138,30 @@ null::execute (const char *restrict)
}
///////////////////////////////////////////////////////////////////////////////
present::present (std::string _name, bool &_data):
base (std::move (_name)),
m_data (_data)
{ ; }
//-----------------------------------------------------------------------------
void
present::execute (void)
{
seen (true);
}
//-----------------------------------------------------------------------------
void
present::finish (void)
{
m_data = seen ();
base::finish ();
}
//-----------------------------------------------------------------------------
namespace util { namespace cmdopt { namespace option {
template class value<uint16_t>;

View File

@ -60,6 +60,20 @@ namespace util { namespace cmdopt {
};
class present : public base {
public:
present (std::string name, bool&);
using base::execute;
virtual void execute (void) override;
virtual void finish (void) override;
private:
bool &m_data;
};
template <typename T>
class value : public base {
public: