]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/cmdline.cpp
Added RTLD_GLOBAL to dlopen() flags which is needed if libraries depend
[wxWidgets.git] / src / common / cmdline.cpp
index 6fc133bc4e760bb02b9308ab403df2ca0ea79133..d98bb96d48fa1f0b9c89b111badc61976d90d537 100644 (file)
@@ -37,6 +37,8 @@
     #include "wx/filefn.h"
 #endif //WX_PRECOMP
 
+#include <ctype.h>
+
 #include "wx/datetime.h"
 #include "wx/cmdline.h"
 
@@ -77,7 +79,7 @@ struct wxCmdLineOption
     // types increases, so always use the accessor functions and don't access
     // the fields directly!)
 
-    void Check(wxCmdLineParamType typ) const
+    void Check(wxCmdLineParamType WXUNUSED_UNLESS_DEBUG(typ)) const
     {
         wxASSERT_MSG( type == typ, _T("type mismatch in wxCmdLineOption") );
     }
@@ -142,8 +144,8 @@ struct wxCmdLineParserData
 {
     // options
     wxString m_switchChars;     // characters which may start an option
-
     bool m_enableLongOptions;   // TRUE if long options are enabled
+    wxString m_logo;            // some extra text to show in Usage()
 
     // cmd line data
     wxArrayString m_arguments;  // == argv, argc == m_arguments.GetCount()
@@ -188,7 +190,7 @@ void wxCmdLineParserData::SetArguments(int argc, char **argv)
     }
 }
 
-void wxCmdLineParserData::SetArguments(const wxString& cmdline)
+void wxCmdLineParserData::SetArguments(const wxString& WXUNUSED(cmdline))
 {
     // either use wxMSW wxApp::ConvertToStandardCommandArgs() or move its logic
     // here and use this method from it - but don't duplicate the code
@@ -264,6 +266,11 @@ void wxCmdLineParser::EnableLongOptions(bool enable)
     m_data->m_enableLongOptions = enable;
 }
 
+void wxCmdLineParser::SetLogo(const wxString& logo)
+{
+    m_data->m_logo = logo;
+}
+
 // ----------------------------------------------------------------------------
 // command line construction
 // ----------------------------------------------------------------------------
@@ -275,7 +282,8 @@ void wxCmdLineParser::SetDesc(const wxCmdLineEntryDesc *desc)
         switch ( desc->kind )
         {
             case wxCMD_LINE_SWITCH:
-                AddSwitch(desc->shortName, desc->longName, desc->description);
+                AddSwitch(desc->shortName, desc->longName, desc->description,
+                          desc->flags);
                 break;
 
             case wxCMD_LINE_OPTION:
@@ -340,14 +348,12 @@ void wxCmdLineParser::AddParam(const wxString& desc,
         wxCmdLineParam& param = m_data->m_paramDesc.Last();
 
         wxASSERT_MSG( !(param.flags & wxCMD_LINE_PARAM_MULTIPLE),
-                      _T("all parameters after the one with "
-                         "wxCMD_LINE_PARAM_MULTIPLE style will be ignored") );
+                      _T("all parameters after the one with wxCMD_LINE_PARAM_MULTIPLE style will be ignored") );
 
         if ( !(flags & wxCMD_LINE_PARAM_OPTIONAL) )
         {
             wxASSERT_MSG( !(param.flags & wxCMD_LINE_PARAM_OPTIONAL),
-                          _T("a required parameter can't follow an "
-                             "optional one") );
+                          _T("a required parameter can't follow an optional one") );
         }
     }
 #endif // Debug
@@ -581,8 +587,7 @@ int wxCmdLineParser::Parse()
 
                     if ( *p++ != _T('=') )
                     {
-                        wxLogError(_("Option '%s' requires a value, '=' "
-                                     "expected."), name.c_str());
+                        wxLogError(_("Option '%s' requires a value, '=' expected."), name.c_str());
 
                         ok = FALSE;
                     }
@@ -641,9 +646,7 @@ int wxCmdLineParser::Parse()
                                 }
                                 else
                                 {
-                                    wxLogError(_("'%s' is not a correct "
-                                                 "numeric value for option "
-                                                 "'%s'."),
+                                    wxLogError(_("'%s' is not a correct numeric value for option '%s'."),
                                                value.c_str(), name.c_str());
 
                                     ok = FALSE;
@@ -657,8 +660,7 @@ int wxCmdLineParser::Parse()
                                 const wxChar *res = dt.ParseDate(value);
                                 if ( !res || *res )
                                 {
-                                    wxLogError(_("Option '%s': '%s' cannot "
-                                                  "be converted to a date."),
+                                    wxLogError(_("Option '%s': '%s' cannot be converted to a date."),
                                                name.c_str(), value.c_str());
 
                                     ok = FALSE;
@@ -691,9 +693,7 @@ int wxCmdLineParser::Parse()
                 else
                 {
                     wxASSERT_MSG( currentParam == countParam - 1,
-                                  _T("all parameters after the one with "
-                                     "wxCMD_LINE_PARAM_MULTIPLE style "
-                                     "are ignored") );
+                                  _T("all parameters after the one with wxCMD_LINE_PARAM_MULTIPLE style are ignored") );
 
                     // remember that we did have this last repeatable parameter
                     hadRepeatableParam = TRUE;
@@ -842,6 +842,11 @@ void wxCmdLineParser::Usage()
         }
     }
 
+    if ( !!m_data->m_logo )
+    {
+        wxLogMessage(m_data->m_logo);
+    }
+
     wxLogMessage(brief);
     wxLogMessage(detailed);
 }