cmdopt: add present option
This commit is contained in:
parent
42fffeea46
commit
fab5891efe
24
cmdopt.cpp
24
cmdopt.cpp
@ -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>;
|
||||
|
14
cmdopt.hpp
14
cmdopt.hpp
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user