X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2b5f62a0b2db198609b45dec622a018dae37008e..86351e4a9d12822b31f2052fe299fc6be6d5f44d:/src/common/cmdline.cpp diff --git a/src/common/cmdline.cpp b/src/common/cmdline.cpp index 6a21925fe7..dc3a857e66 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 /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -17,7 +17,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "cmdline.h" #endif @@ -114,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; } @@ -140,7 +144,9 @@ private: long m_longVal; wxString m_strVal; +#if wxUSE_DATETIME wxDateTime m_dateVal; +#endif // wxUSE_DATETIME }; struct wxCmdLineParam @@ -210,19 +216,19 @@ wxCmdLineParserData::wxCmdLineParserData() void wxCmdLineParserData::SetArguments(int argc, wxChar **argv) { - m_arguments.Empty(); + m_arguments.clear(); for ( int n = 0; n < argc; n++ ) { - m_arguments.Add(argv[n]); + m_arguments.push_back(argv[n]); } } void wxCmdLineParserData::SetArguments(const wxString& cmdLine) { - m_arguments.Empty(); + m_arguments.clear(); - m_arguments.Add(wxTheApp->GetAppName()); + m_arguments.push_back(wxTheApp->GetAppName()); wxArrayString args = wxCmdLineParser::ConvertStringToArgs(cmdLine); @@ -459,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); @@ -477,10 +484,11 @@ bool wxCmdLineParser::Found(const wxString& name, wxDateTime *value) const return TRUE; } +#endif // wxUSE_DATETIME size_t wxCmdLineParser::GetParamCount() const { - return m_data->m_parameters.GetCount(); + return m_data->m_parameters.size(); } wxString wxCmdLineParser::GetParam(size_t n) const @@ -521,7 +529,7 @@ int wxCmdLineParser::Parse(bool showUsage) // parse everything wxString arg; - size_t count = m_data->m_arguments.GetCount(); + size_t count = m_data->m_arguments.size(); for ( size_t n = 1; ok && (n < count); n++ ) // 0 is program name { arg = m_data->m_arguments[n]; @@ -624,7 +632,8 @@ int wxCmdLineParser::Parse(bool showUsage) wxString arg2 = arg[0u]; arg2 += arg.Mid(len + 1); // +1 for leading '-' - m_data->m_arguments.Insert(arg2, n + 1); + m_data->m_arguments.insert + (m_data->m_arguments.begin() + n + 1, arg2); count++; } //else: it's our value, we'll deal with it below @@ -739,6 +748,7 @@ int wxCmdLineParser::Parse(bool showUsage) } break; +#if wxUSE_DATETIME case wxCMD_LINE_VAL_DATE: { wxDateTime dt; @@ -756,6 +766,7 @@ int wxCmdLineParser::Parse(bool showUsage) } } break; +#endif // wxUSE_DATETIME } } } @@ -769,7 +780,7 @@ int wxCmdLineParser::Parse(bool showUsage) // TODO check the param type - m_data->m_parameters.Add(arg); + m_data->m_parameters.push_back(arg); if ( !(param.flags & wxCMD_LINE_PARAM_MULTIPLE) ) { @@ -895,7 +906,7 @@ wxString wxCmdLineParser::GetUsageString() wxString appname = wxTheApp->GetAppName(); if ( !appname ) { - wxCHECK_MSG( !m_data->m_arguments.IsEmpty(), wxEmptyString, + wxCHECK_MSG( m_data->m_arguments.size() != 0, wxEmptyString, _T("no program name") ); appname = wxFileNameFromPath(m_data->m_arguments[0]); @@ -979,8 +990,8 @@ wxString wxCmdLineParser::GetUsageString() usage << _T(']'); } - namesOptions.Add(option); - descOptions.Add(opt.description); + namesOptions.push_back(option); + descOptions.push_back(opt.description); } count = m_data->m_paramDesc.GetCount(); @@ -1011,7 +1022,7 @@ wxString wxCmdLineParser::GetUsageString() // now construct the detailed help message size_t len, lenMax = 0; - count = namesOptions.GetCount(); + count = namesOptions.size(); for ( n = 0; n < count; n++ ) { len = namesOptions[n].length(); @@ -1226,7 +1237,7 @@ wxArrayString wxCmdLineParser::ConvertStringToArgs(const wxChar *p) } } - args.Add(arg); + args.push_back(arg); } return args;