The "negated" flag of wxCmdLineOption struct was not reset by Reset() so
parsing a command line with a negatable option once influenced the result of
parsing it the next time because the old value was kept.
Do clear it now to allow calling Parse() several times without side effects.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68315
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
- m_hasVal = false;
- m_isNegated = false;
}
// can't use union easily here, so just store all possible data fields, we
}
// can't use union easily here, so just store all possible data fields, we
{ Check(wxCMD_LINE_VAL_DATE); m_dateVal = val; m_hasVal = true; }
#endif // wxUSE_DATETIME
{ Check(wxCMD_LINE_VAL_DATE); m_dateVal = val; m_hasVal = true; }
#endif // wxUSE_DATETIME
- void SetHasValue(bool hasValue = true) { m_hasVal = hasValue; }
+ void SetHasValue() { m_hasVal = true; }
bool HasValue() const { return m_hasVal; }
void SetNegated() { m_isNegated = true; }
bool IsNegated() const { return m_isNegated; }
bool HasValue() const { return m_hasVal; }
void SetNegated() { m_isNegated = true; }
bool IsNegated() const { return m_isNegated; }
+ // Reset to the initial state, called before parsing another command line.
+ void Reset()
+ {
+ m_hasVal =
+ m_isNegated = false;
+ }
+
public:
wxCmdLineEntryType kind;
wxString shortName,
public:
wxCmdLineEntryType kind;
wxString shortName,
{
for ( size_t i = 0; i < m_data->m_options.GetCount(); i++ )
{
{
for ( size_t i = 0; i < m_data->m_options.GetCount(); i++ )
{
- wxCmdLineOption& opt = m_data->m_options[i];
- opt.SetHasValue(false);
+ m_data->m_options[i].Reset();