]> git.saurik.com Git - wxWidgets.git/commitdiff
Added Reset() to command line parser and called it from Parse(), so
authorJulian Smart <julian@anthemion.co.uk>
Tue, 22 Aug 2000 14:00:47 +0000 (14:00 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 22 Aug 2000 14:00:47 +0000 (14:00 +0000)
that you can call Parse() multiple times and get the desired result.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8158 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/splitevt.tex
include/wx/cmdline.h
src/common/cmdline.cpp

index 759204f5311112196ae710fa5ce4695b6504845d..ffaff7fcf20f6543dcefc0537613ad8f9bc07ccf 100644 (file)
@@ -101,7 +101,7 @@ wxEVT\_COMMAND\_SPLITTER\_UNSPLIT events.
 
 \membersection{wxSplitterEvent::SetSashPosition}\label{wxsplittereventsetsashposition}
 
-\func{void}{SetSashPosition}{\param{int}{pos}}
+\func{void}{SetSashPosition}{\param{int}{ pos}}
 
 In the case of wxEVT\_COMMAND\_SPLITTER\_SASH\_POS\_CHANGED events,
 sets the the new sash position. In the case of
index 7e10524d01c9f86279a606e1e5caea50a722b8b1..6ac61e93619d69ce0abc6cd7aba5c37b2fc86867 100644 (file)
@@ -187,6 +187,9 @@ public:
     // gets the value of Nth parameter (as string only for now)
     wxString GetParam(size_t n = 0u) const;
 
+       // Resets switches and options
+       void Reset();
+
 private:
     // common part of all ctors
     void Init();
index a8764a296f9b635b49de4bff10d9fd31b86bbfd6..29399558f533abbbed8adb1523639cb5d3a9dd2d 100644 (file)
@@ -98,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:
@@ -475,6 +475,18 @@ wxString wxCmdLineParser::GetParam(size_t n) const
     return m_data->m_parameters[n];
 }
 
+// Resets switches and options
+void wxCmdLineParser::Reset()
+{
+       unsigned int i;
+       for (i = 0; i < m_data->m_options.Count(); i++)
+       {
+               wxCmdLineOption& opt = m_data->m_options[(size_t)i];
+               opt.SetHasValue(FALSE);
+       }
+}
+
+
 // ----------------------------------------------------------------------------
 // the real work is done here
 // ----------------------------------------------------------------------------
@@ -490,6 +502,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();