Reset negatable switches correctly in wxCmdLineParser::Reset().
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
This commit is contained in:
parent
6607ee151a
commit
dd18cc6594
@ -106,8 +106,7 @@ struct wxCmdLineOption
|
||||
type = typ;
|
||||
flags = fl;
|
||||
|
||||
m_hasVal = false;
|
||||
m_isNegated = false;
|
||||
Reset();
|
||||
}
|
||||
|
||||
// can't use union easily here, so just store all possible data fields, we
|
||||
@ -142,12 +141,19 @@ struct wxCmdLineOption
|
||||
{ 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; }
|
||||
|
||||
// Reset to the initial state, called before parsing another command line.
|
||||
void Reset()
|
||||
{
|
||||
m_hasVal =
|
||||
m_isNegated = false;
|
||||
}
|
||||
|
||||
public:
|
||||
wxCmdLineEntryType kind;
|
||||
wxString shortName,
|
||||
@ -637,8 +643,7 @@ void wxCmdLineParser::Reset()
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user