added cmd line parsing support to wxApp and --theme option to wxUniv

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10952 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-07-10 17:28:19 +00:00
parent a5bb60ce35
commit bf188f1add
5 changed files with 307 additions and 77 deletions

View File

@@ -64,6 +64,9 @@ struct wxCmdLineOption
wxCmdLineParamType typ,
int fl)
{
wxASSERT_MSG( !shrt.empty() || !lng.empty(),
_T("option should have at least one name") );
kind = k;
shortName = shrt;
@@ -240,13 +243,16 @@ void wxCmdLineParserData::SetArguments(const wxString& cmdLine)
int wxCmdLineParserData::FindOption(const wxString& name)
{
size_t count = m_options.GetCount();
for ( size_t n = 0; n < count; n++ )
if ( !name.empty() )
{
if ( m_options[n].shortName == name )
size_t count = m_options.GetCount();
for ( size_t n = 0; n < count; n++ )
{
// found
return n;
if ( m_options[n].shortName == name )
{
// found
return n;
}
}
}
@@ -410,6 +416,9 @@ void wxCmdLineParser::AddParam(const wxString& desc,
bool wxCmdLineParser::Found(const wxString& name) const
{
int i = m_data->FindOption(name);
if ( i == wxNOT_FOUND )
i = m_data->FindOptionByLongName(name);
wxCHECK_MSG( i != wxNOT_FOUND, FALSE, _T("unknown switch") );
wxCmdLineOption& opt = m_data->m_options[(size_t)i];
@@ -422,6 +431,9 @@ bool wxCmdLineParser::Found(const wxString& name) const
bool wxCmdLineParser::Found(const wxString& name, wxString *value) const
{
int i = m_data->FindOption(name);
if ( i == wxNOT_FOUND )
i = m_data->FindOptionByLongName(name);
wxCHECK_MSG( i != wxNOT_FOUND, FALSE, _T("unknown option") );
wxCmdLineOption& opt = m_data->m_options[(size_t)i];
@@ -438,6 +450,9 @@ bool wxCmdLineParser::Found(const wxString& name, wxString *value) const
bool wxCmdLineParser::Found(const wxString& name, long *value) const
{
int i = m_data->FindOption(name);
if ( i == wxNOT_FOUND )
i = m_data->FindOptionByLongName(name);
wxCHECK_MSG( i != wxNOT_FOUND, FALSE, _T("unknown option") );
wxCmdLineOption& opt = m_data->m_options[(size_t)i];
@@ -454,6 +469,9 @@ bool wxCmdLineParser::Found(const wxString& name, long *value) const
bool wxCmdLineParser::Found(const wxString& name, wxDateTime *value) const
{
int i = m_data->FindOption(name);
if ( i == wxNOT_FOUND )
i = m_data->FindOptionByLongName(name);
wxCHECK_MSG( i != wxNOT_FOUND, FALSE, _T("unknown option") );
wxCmdLineOption& opt = m_data->m_options[(size_t)i];