From 5f4994df03d1c38b6674d410d500d99cdf201531 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 22 Nov 2011 13:18:58 +0000 Subject: [PATCH] Added convenient wxCmdLineParser::AddLong{Option,Switch}() wrappers. The new functions simply call Add{Option,Switch}() with an empty first argument but using them makes the code more readable. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69797 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + include/wx/cmdline.h | 13 +++++++++++++ interface/wx/cmdline.h | 26 ++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index 7cb9c4efb5..bce8f8c7ae 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -458,6 +458,7 @@ All: - Fix parsing of negated long options in wxCmdLineParser (roed_bis). - Fix crash in wxArray::insert() overload taking iterator range (wsu). - Added wxEventFilter class and wxEvtHandler::{Add,Remove}Filter(). +- Added convenient wxCmdLineParser::AddLong{Option,Switch}() wrappers. All (GUI): diff --git a/include/wx/cmdline.h b/include/wx/cmdline.h index 86bbc2d5ca..28d110c9b9 100644 --- a/include/wx/cmdline.h +++ b/include/wx/cmdline.h @@ -183,12 +183,25 @@ public: void AddSwitch(const wxString& name, const wxString& lng = wxEmptyString, const wxString& desc = wxEmptyString, int flags = 0); + void AddLongSwitch(const wxString& lng, + const wxString& desc = wxEmptyString, + int flags = 0) + { + AddSwitch(wxString(), lng, desc, flags); + } // an option taking a value of the given type void AddOption(const wxString& name, const wxString& lng = wxEmptyString, const wxString& desc = wxEmptyString, wxCmdLineParamType type = wxCMD_LINE_VAL_STRING, int flags = 0); + void AddLongOption(const wxString& lng, + const wxString& desc = wxEmptyString, + wxCmdLineParamType type = wxCMD_LINE_VAL_STRING, + int flags = 0) + { + AddOption(wxString(), lng, desc, type, flags); + } // a parameter void AddParam(const wxString& desc = wxEmptyString, diff --git a/interface/wx/cmdline.h b/interface/wx/cmdline.h index a9b7630e9a..479239781c 100644 --- a/interface/wx/cmdline.h +++ b/interface/wx/cmdline.h @@ -336,6 +336,32 @@ public: */ ~wxCmdLineParser(); + /** + Adds an option with only long form. + + This is just a convenient wrapper for AddOption() passing an empty + string as short option name. + + @since 2.9.3 + */ + void AddLongOption(const wxString& lng, + const wxString& desc = wxEmptyString, + wxCmdLineParamType type = wxCMD_LINE_VAL_STRING, + int flags = 0); + + /** + Adds a switch with only long form. + + This is just a convenient wrapper for AddSwitch() passing an empty + string as short switch name. + + @since 2.9.3 + */ + + void AddLongSwitch(const wxString& lng, + const wxString& desc = wxEmptyString, + int flags = 0); + /** Add an option @a name with an optional long name @a lng (no long name if it is empty, which is default) taking a value of the given type -- 2.47.2