Filter: Added a mechanism to override ::safety

This commit is contained in:
Paul Beckingham 2015-07-12 22:02:11 -04:00
parent 157f191546
commit f0c8330ebf
2 changed files with 28 additions and 16 deletions

View file

@ -58,6 +58,7 @@ bool domSource (const std::string& identifier, Variant& value)
Filter::Filter () Filter::Filter ()
: _startCount (0) : _startCount (0)
, _endCount (0) , _endCount (0)
, _safety (true)
{ {
} }
@ -260,6 +261,8 @@ bool Filter::pendingOnly ()
// Disaster avoidance mechanism. If a WRITECMD has no filter, then it can cause // Disaster avoidance mechanism. If a WRITECMD has no filter, then it can cause
// all tasks to be modified. This is usually not intended. // all tasks to be modified. This is usually not intended.
void Filter::safety () void Filter::safety ()
{
if (_safety)
{ {
for (auto& a : context.cli2._args) for (auto& a : context.cli2._args)
{ {
@ -284,5 +287,12 @@ void Filter::safety ()
} }
} }
} }
}
////////////////////////////////////////////////////////////////////////////////
void Filter::disableSafety ()
{
_safety = false;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -44,10 +44,12 @@ public:
void subset (std::vector <Task>&, bool applyContext = true); void subset (std::vector <Task>&, bool applyContext = true);
bool pendingOnly (); bool pendingOnly ();
void safety (); void safety ();
void disableSafety ();
private: private:
int _startCount; int _startCount;
int _endCount; int _endCount;
bool _safety;
}; };
#endif #endif