X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/de53ac1ee1d7a5c283cff6fdd56af99b2a8e99f1..c97e7fa8dbda704c9c9cdb61c22ebdf9b692e114:/src/common/cmdline.cpp?ds=sidebyside diff --git a/src/common/cmdline.cpp b/src/common/cmdline.cpp index 9437f57147..3d8401f815 100644 --- a/src/common/cmdline.cpp +++ b/src/common/cmdline.cpp @@ -41,7 +41,6 @@ #include "wx/datetime.h" #include "wx/cmdline.h" -#include "wx/app.h" // ---------------------------------------------------------------------------- // private functions @@ -99,7 +98,7 @@ struct wxCmdLineOption void SetDateVal(const wxDateTime val) { Check(wxCMD_LINE_VAL_DATE); m_dateVal = val; m_hasVal = TRUE; } - void SetHasValue() { m_hasVal = TRUE; } + void SetHasValue(bool hasValue = TRUE) { m_hasVal = hasValue; } bool HasValue() const { return m_hasVal; } public: @@ -476,6 +475,17 @@ wxString wxCmdLineParser::GetParam(size_t n) const return m_data->m_parameters[n]; } +// Resets switches and options +void wxCmdLineParser::Reset() +{ + for ( size_t i = 0; i < m_data->m_options.Count(); i++ ) + { + wxCmdLineOption& opt = m_data->m_options[i]; + opt.SetHasValue(FALSE); + } +} + + // ---------------------------------------------------------------------------- // the real work is done here // ---------------------------------------------------------------------------- @@ -491,6 +501,8 @@ int wxCmdLineParser::Parse() size_t countParam = m_data->m_paramDesc.GetCount(); + Reset(); + // parse everything wxString arg; size_t count = m_data->m_arguments.GetCount();