X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e9c54ec33655bfa9a57eb7955b114621fb940e1f..5e0d7b6bce53ad3ceb3c832925c25d2e614a0d62:/src/common/cmdline.cpp diff --git a/src/common/cmdline.cpp b/src/common/cmdline.cpp index 9697a6d3ac..87c1c8ecee 100644 --- a/src/common/cmdline.cpp +++ b/src/common/cmdline.cpp @@ -6,7 +6,7 @@ // Created: 05.01.00 // RCS-ID: $Id$ // Copyright: (c) 2000 Vadim Zeitlin -// Licence: wxWindows license +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -86,6 +86,7 @@ struct wxCmdLineOption GetLongOptionName(lng).Len() == lng.Len(), wxT("Long option contains invalid characters") ); + kind = k; @@ -113,15 +114,19 @@ struct wxCmdLineOption { Check(wxCMD_LINE_VAL_NUMBER); return m_longVal; } const wxString& GetStrVal() const { Check(wxCMD_LINE_VAL_STRING); return m_strVal; } +#if wxUSE_DATETIME const wxDateTime& GetDateVal() const { Check(wxCMD_LINE_VAL_DATE); return m_dateVal; } +#endif // wxUSE_DATETIME void SetLongVal(long val) { Check(wxCMD_LINE_VAL_NUMBER); m_longVal = val; m_hasVal = TRUE; } void SetStrVal(const wxString& val) { Check(wxCMD_LINE_VAL_STRING); m_strVal = val; m_hasVal = TRUE; } +#if wxUSE_DATETIME void SetDateVal(const wxDateTime val) { Check(wxCMD_LINE_VAL_DATE); m_dateVal = val; m_hasVal = TRUE; } +#endif // wxUSE_DATETIME void SetHasValue(bool hasValue = TRUE) { m_hasVal = hasValue; } bool HasValue() const { return m_hasVal; } @@ -139,7 +144,9 @@ private: long m_longVal; wxString m_strVal; +#if wxUSE_DATETIME wxDateTime m_dateVal; +#endif // wxUSE_DATETIME }; struct wxCmdLineParam @@ -458,6 +465,7 @@ bool wxCmdLineParser::Found(const wxString& name, long *value) const return TRUE; } +#if wxUSE_DATETIME bool wxCmdLineParser::Found(const wxString& name, wxDateTime *value) const { int i = m_data->FindOption(name); @@ -476,6 +484,7 @@ bool wxCmdLineParser::Found(const wxString& name, wxDateTime *value) const return TRUE; } +#endif // wxUSE_DATETIME size_t wxCmdLineParser::GetParamCount() const { @@ -561,7 +570,7 @@ int wxCmdLineParser::Parse(bool showUsage) optInd = m_data->FindOptionByLongName(name); if ( optInd == wxNOT_FOUND ) { - errorMsg << wxString::Format(_("Unknown long option '%s'"), name.c_str()) << "\n"; + errorMsg << wxString::Format(_("Unknown long option '%s'"), name.c_str()) << wxT("\n"); } } else @@ -570,7 +579,7 @@ int wxCmdLineParser::Parse(bool showUsage) // Print the argument including leading "--" name.Prepend( wxT("--") ); - errorMsg << wxString::Format(_("Unknown option '%s'"), name.c_str()) << "\n"; + errorMsg << wxString::Format(_("Unknown option '%s'"), name.c_str()) << wxT("\n"); } } @@ -591,7 +600,7 @@ int wxCmdLineParser::Parse(bool showUsage) { // we couldn't find a valid option name in the // beginning of this string - errorMsg << wxString::Format(_("Unknown option '%s'"), name.c_str()) << "\n"; + errorMsg << wxString::Format(_("Unknown option '%s'"), name.c_str()) << wxT("\n"); break; } @@ -663,7 +672,7 @@ int wxCmdLineParser::Parse(bool showUsage) if ( *p++ != _T('=') ) { - errorMsg << wxString::Format(_("Option '%s' requires a value, '=' expected."), name.c_str()) << "\n"; + errorMsg << wxString::Format(_("Option '%s' requires a value, '=' expected."), name.c_str()) << wxT("\n"); ok = FALSE; } @@ -684,7 +693,7 @@ int wxCmdLineParser::Parse(bool showUsage) { // ... but there is none errorMsg << wxString::Format(_("Option '%s' requires a value."), - name.c_str()) << "\n"; + name.c_str()) << wxT("\n"); ok = FALSE; } @@ -701,7 +710,7 @@ int wxCmdLineParser::Parse(bool showUsage) if ( opt.flags & wxCMD_LINE_NEEDS_SEPARATOR ) { errorMsg << wxString::Format(_("Separator expected after the option '%s'."), - name.c_str()) << "\n"; + name.c_str()) << wxT("\n"); ok = FALSE; } @@ -731,13 +740,14 @@ int wxCmdLineParser::Parse(bool showUsage) else { errorMsg << wxString::Format(_("'%s' is not a correct numeric value for option '%s'."), - value.c_str(), name.c_str()) << "\n"; + value.c_str(), name.c_str()) << wxT("\n"); ok = FALSE; } } break; +#if wxUSE_DATETIME case wxCMD_LINE_VAL_DATE: { wxDateTime dt; @@ -745,7 +755,7 @@ int wxCmdLineParser::Parse(bool showUsage) if ( !res || *res ) { errorMsg << wxString::Format(_("Option '%s': '%s' cannot be converted to a date."), - name.c_str(), value.c_str()) << "\n"; + name.c_str(), value.c_str()) << wxT("\n"); ok = FALSE; } @@ -755,6 +765,7 @@ int wxCmdLineParser::Parse(bool showUsage) } } break; +#endif // wxUSE_DATETIME } } } @@ -785,7 +796,7 @@ int wxCmdLineParser::Parse(bool showUsage) } else { - errorMsg << wxString::Format(_("Unexpected parameter '%s'"), arg.c_str()) << "\n"; + errorMsg << wxString::Format(_("Unexpected parameter '%s'"), arg.c_str()) << wxT("\n"); ok = FALSE; } @@ -822,7 +833,7 @@ int wxCmdLineParser::Parse(bool showUsage) } errorMsg << wxString::Format(_("The value for the option '%s' must be specified."), - optName.c_str()) << "\n"; + optName.c_str()) << wxT("\n"); ok = FALSE; } @@ -843,7 +854,7 @@ int wxCmdLineParser::Parse(bool showUsage) if ( !(param.flags & wxCMD_LINE_PARAM_OPTIONAL) ) { errorMsg << wxString::Format(_("The required parameter '%s' was not specified."), - param.description.c_str()) << "\n"; + param.description.c_str()) << wxT("\n"); ok = FALSE; }