wxCmdLineParamType typ,
int fl)
{
+ wxASSERT_MSG( !shrt.empty() || !lng.empty(),
+ _T("option should have at least one name") );
+
kind = k;
shortName = shrt;
// methods
wxCmdLineParserData();
- void SetArguments(int argc, char **argv);
+ void SetArguments(int argc, wxChar **argv);
void SetArguments(const wxString& cmdline);
int FindOption(const wxString& name);
#endif
}
-void wxCmdLineParserData::SetArguments(int argc, char **argv)
+void wxCmdLineParserData::SetArguments(int argc, wxChar **argv)
{
m_arguments.Empty();
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;
+ }
}
}
m_data = new wxCmdLineParserData;
}
-void wxCmdLineParser::SetCmdLine(int argc, char **argv)
+void wxCmdLineParser::SetCmdLine(int argc, wxChar **argv)
{
m_data->SetArguments(argc, argv);
}
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];
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];
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];
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];