当前位置: 首页>>代码示例>>C++>>正文


C++ wxCmdLineParser类代码示例

本文整理汇总了C++中wxCmdLineParser的典型用法代码示例。如果您正苦于以下问题:C++ wxCmdLineParser类的具体用法?C++ wxCmdLineParser怎么用?C++ wxCmdLineParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了wxCmdLineParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DoImport

static bool DoImport(const wxCmdLineParser& parser)
{
	wxString sFileName;
	if (!parser.Found(_T("f"), &sFileName))
	{
		ReportError(_T("A filename must be specified with -f"));
		return false;
	}

#if SVGDEBUG
	wxString sDebugTraceLevel;
	if (parser.Found(_T("T"), &sDebugTraceLevel))
	{
		sDebugTraceLevel.ToLong(&iDebugTraceLevel);
		fprintf(stderr, "debug trace level %ld enabled\n", iDebugTraceLevel);
	}
#endif

	// Ask the library to create a Xar Exporter object
	CXarExport* pExporter = XarLibrary::CreateExporter();
	bool bRetVal = true;

	// Call StartExport passing stdout as where to write to
	if (pExporter->StartExport())
	{
		// Call DoImportInternal to actually do the work
		if (!DoImportInternal(pExporter, sFileName))
		{
			bRetVal = false;
		}
	}
	else
	{
		ReportError(_T("StartExport failed"));
		bRetVal = false;
	}

	// Delete the exporter object to clean up
	delete pExporter;

	return bRetVal;
}
开发者ID:UIKit0,项目名称:xara-xtreme,代码行数:42,代码来源:svgfilter.cpp

示例2: OnCmdLineParsed

bool mazeDlgApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
    if(parser.GetParamCount()<2) {
     cout << "Call Format: ./maze <maze file> <brain file>" << endl;
     exit(0);
    }

    // to get at your unnamed parameters use
    for (int i = 0; i < parser.GetParamCount(); i++)
    {
            files.Add(parser.GetParam(i));
	    cout << files[i].mb_str() << endl;
    }
 
    // and other command line parameters
 
    // then do what you need with them.
 
    return true;
}
开发者ID:djudjuu,项目名称:mazerobot-python,代码行数:20,代码来源:mazeApp.cpp

示例3: expandFilesList

/**
 * Loads the list(s) of files, delete the file that contains the list if the
 * <CODE>deleteTempLists</CODE> switch is activated.
 *
 * @param  parser  Command line parser.
 */
void CmdLineOptions::expandFilesList(const wxCmdLineParser& parser)
{
  wxString lists;
  if (!parser.Found(wxT("fl"), &lists))
    // No file.
    return;
  
  wxStringTokenizer tkzLists(lists, wxT("|"), wxTOKEN_STRTOK);
  while (tkzLists.HasMoreTokens())
  {
    wxString fileName = tkzLists.GetNextToken();
    if (!fileName.empty())
    {
      wxLogNull logNo;   // No log
      bool read = false; // the file has been opened and read ?

      {  // open a block to destroy the wxFileInputStream before erasing the file
        wxFileInputStream input(fileName);
        if (input.Ok())
        {
          // Reads the lines
          wxTextInputStream text(input);
          wxString line;

          line = text.ReadLine();
          while (!input.Eof())
          {
            line.Strip(wxString::both);
            if (!line.empty())
              files.Add(line);
            line = text.ReadLine();
          }
          read = true;
        }
      }

      if (read && deleteTempLists)
      {
        // Checks if the read file has the extension of the temp file.
        wxString ext;
        wxFileName::SplitPath(fileName, NULL, NULL, NULL, &ext);
        wxString tmpExts = wxConfig::Get()->Read(_T("Files/TempExts"), _T("tmp temp"));
        wxStringTokenizer tkz(tmpExts, wxT(" \t\r\n"), wxTOKEN_STRTOK);
        bool found = false;
        while (!found && tkz.HasMoreTokens())
          if (::compareFileName(tkz.GetNextToken(), ext) == 0)
            found = true;
          
        if (found)
          ::wxRemoveFile(fileName);
      }
    }
  }
}
开发者ID:gullinbursti,项目名称:as3gullinburstilibs,代码行数:60,代码来源:cmdlnopt.cpp

示例4: OnCmdLineParsed

bool MyApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
    if ( !wxApp::OnCmdLineParsed(parser) )
        return false;

    if ( parser.GetParamCount() )
    {
        const wxString loc = parser.GetParam();
        const wxLanguageInfo * const lang = wxLocale::FindLanguageInfo(loc);
        if ( !lang )
        {
            wxLogError(_("Locale \"%s\" is unknown."), loc);
            return false;
        }

        m_lang = static_cast<wxLanguage>(lang->Language);
    }

    return true;
}
开发者ID:ExperimentationBox,项目名称:Edenite,代码行数:20,代码来源:internat.cpp

示例5: IsSingleInstance

bool CodeLiteApp::IsSingleInstance(const wxCmdLineParser& parser)
{
    // check for single instance
    if(clConfig::Get().Read(kConfigSingleInstance, false)) {
        wxString name = wxString::Format(wxT("CodeLite-%s"), wxGetUserId().c_str());
        
        wxString path;
#ifndef __WXMSW__
        path = "/tmp";
#endif
        m_singleInstance = new wxSingleInstanceChecker(name, path);
        if(m_singleInstance->IsAnotherRunning()) {
            // prepare commands file for the running instance
            wxArrayString files;
            for(size_t i = 0; i < parser.GetParamCount(); i++) {
                wxString argument = parser.GetParam(i);

                // convert to full path and open it
                wxFileName fn(argument);
                fn.MakeAbsolute();
                files.Add(fn.GetFullPath());
            }

            try {
                // Send the request
                clSocketClient client;
                bool dummy;
                client.ConnectRemote("127.0.0.1", SINGLE_INSTANCE_PORT, dummy);

                JSONRoot json(cJSON_Object);
                json.toElement().addProperty("args", files);
                client.WriteMessage(json.toElement().format());
                return false;

            } catch(clSocketException& e) {
                CL_ERROR("Failed to send single instance request: %s", e.what());
            }
        }
    }
    return true;
}
开发者ID:GaganJotSingh,项目名称:codelite,代码行数:41,代码来源:app.cpp

示例6: okcan

bool Pcsx2App::ParseOverrides( wxCmdLineParser& parser )
{
	wxString dest;

	if (parser.Found( L"cfgpath", &dest ) && !dest.IsEmpty())
	{
		Console.Warning( L"Config path override: " + dest );
		Overrides.SettingsFolder = dest;
	}

	if (parser.Found( L"cfg", &dest ) && !dest.IsEmpty())
	{
		Console.Warning( L"Config file override: " + dest );
		Overrides.VmSettingsFile = dest;
	}

	Overrides.DisableSpeedhacks = parser.Found(L"nohacks");

	if (parser.Found(L"gamefixes", &dest))
	{
		Overrides.ApplyCustomGamefixes = true;
		Overrides.Gamefixes.Set( dest, true );
	}

	if (parser.Found(L"fullscreen"))	Overrides.GsWindowMode = GsWinMode_Fullscreen;
	if (parser.Found(L"windowed"))		Overrides.GsWindowMode = GsWinMode_Windowed;

	const PluginInfo* pi = tbl_PluginInfo; do
	{
		if( !parser.Found( pi->GetShortname().Lower(), &dest ) ) continue;

		if( wxFileExists( dest ) )
			Console.Warning( pi->GetShortname() + L" override: " + dest );
		else
		{
			wxDialogWithHelpers okcan( NULL, AddAppName(_("Plugin Override Error - %s")) );

			okcan += okcan.Heading( wxsFormat(
				_("%s Plugin Override Error!  The following file does not exist or is not a valid %s plugin:\n\n"),
				pi->GetShortname().c_str(), pi->GetShortname().c_str()
			) );

			okcan += okcan.GetCharHeight();
			okcan += okcan.Text(dest);
			okcan += okcan.GetCharHeight();
			okcan += okcan.Heading(AddAppName(_("Press OK to use the default configured plugin, or Cancel to close %s.")));

			if( wxID_CANCEL == pxIssueConfirmation( okcan, MsgButtons().OKCancel() ) ) return false;
		}
		
		Overrides.Filenames.Plugins[pi->id] = dest;

	} while( ++pi, pi->shortname != NULL );
	
	return true;
}
开发者ID:juhalaukkanen,项目名称:pcsx2,代码行数:56,代码来源:AppInit.cpp

示例7: OnCmdLineParsed

bool CubicSDR::OnCmdLineParsed(wxCmdLineParser& parser) {
    wxString *confName = new wxString;
    if (parser.Found("c",confName)) {
        if (confName) {
            config.setConfigName(confName->ToStdString());
        }
    }
    
    config.load();

    return true;
}
开发者ID:hotelzululima,项目名称:CubicSDR,代码行数:12,代码来源:CubicSDR.cpp

示例8: OnInitCmdLine

void UpdaterApp::OnInitCmdLine(wxCmdLineParser& parser)
{
    #ifndef HAVE_WX29
        #define STR _T
    #else
        #define STR
    #endif

    wxCmdLineEntryDesc cmdLineDesc[] =
    {
		{ wxCMD_LINE_SWITCH, STR("h"), STR("help"), _("show this help message"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
		{ wxCMD_LINE_OPTION, STR("f"), STR("target-exe"),  _("the SpringLobby executeable to be updated"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_OPTION_MANDATORY | wxCMD_LINE_NEEDS_SEPARATOR },
		{ wxCMD_LINE_OPTION, STR("r"), STR("target-rev"),  _("the SpringLobby revision to update to"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_OPTION_MANDATORY | wxCMD_LINE_NEEDS_SEPARATOR },
		{ wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0 }//while this throws warnings, it is mandatory according to http://docs.wxwidgets.org/stable/wx_wxcmdlineparser.html
    };

    parser.SetDesc( cmdLineDesc );
    parser.SetSwitchChars (_T("-"));

    #undef STR
}
开发者ID:Mailaender,项目名称:springlobby,代码行数:21,代码来源:updaterapp.cpp

示例9: OnCmdLineParsed

bool MainApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
    mStartHidden = false;

    mBatchMode = parser.Found(wxT("b"));

    mEnableAppProfiles = parser.Found(wxT("a"));

    if (mBatchMode || mEnableAppProfiles)
    {
	mStartHidden = true;
    }

    if (!parser.Found(wxT("c"), &mColorTemp))
    {
	mColorTemp = 0;	
    }
    else
    {
	mStartHidden = true;
    }

    if (!parser.Found(wxT("i"), &mGPUIndex))
    {
	mGPUIndex = 0;
    }

    if (parser.GetParamCount() > 0)
    {
        mProfileName = parser.GetParam(0);
	mStartHidden = true;
    }

    return true;
}
开发者ID:3dfxmadscientist,项目名称:AMDOverdriveControlled,代码行数:35,代码来源:main.cpp

示例10: OnCmdLineParsed

bool MyApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
	s_bDoVerbose = parser.Found(_T("v"));

	if (!parser.Found(_T("f"), &m_sOutFile))
	{
		ReportError(_T("A filename must be specified with -f"));
		return false;
	}

	if (!parser.Found(_T("x"), &m_sXMLFile))
	{
		ReportError(_T("An XML filename must be specified with -x"));
		return false;
	}
	if (!parser.Found(_T("i")) && !parser.Found(_T("e")))
	{
		ReportError(_T("An action must be specified with -i or -e"));
		return false;
	}
	m_bDoExport = parser.Found(_T("e"));

	// Open the output file for writing
	wxFileOutputStream OutFile(m_sXMLFile);
	if (!OutFile.Ok())
	{
		ReportError(_T("Failed to open output XML file."));
		// Set an appropriate error here
		return false;
	}
	wxTextOutputStream OutText(OutFile);

	OutText << _T("<XPFilterConfig>\n");
	OutText << _T("<Private ");

	m_bCancelled = false;
	if (m_bDoExport) {
		SVGExportDialog *dlg = new SVGExportDialog(NULL);
		if (dlg->ShowModal() != wxID_OK) {
			// user cancelled export
			m_bCancelled = true;
		} else {
			// output exporter settings
			if (dlg->m_SVGVersionComboBox->GetSelection() == 0)
				OutText << _T("version=\"1.1\" ");
			else
				OutText << _T("version=\"1.2\" ");
			if (dlg->m_VerboseCheckBox->IsChecked())
				OutText << _T("verbose=\"1\" ");
			else
				OutText << _T("verbose=\"0\" ");
		}
		dlg->Destroy();
	}
	OutText << _T("/>\n");
	OutText << _T("</XPFilterConfig>\n");

    return true;
}
开发者ID:UIKit0,项目名称:xara-xtreme,代码行数:59,代码来源:svgfilterui.cpp

示例11: OnCmdLineParsed

bool wxAppConsoleBase::OnCmdLineParsed(wxCmdLineParser& parser)
{
#if wxUSE_LOG
    if ( parser.Found(OPTION_VERBOSE) )
    {
        wxLog::SetVerbose(true);
    }
#else
    wxUnusedVar(parser);
#endif // wxUSE_LOG

    return true;
}
开发者ID:jonntd,项目名称:dynamica,代码行数:13,代码来源:appbase.cpp

示例12: OnCmdLineParsed

bool CTimerControlApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
	if (!wxApp::OnCmdLineParsed(parser))
		return false;

	m_nolog = parser.Found(NOLOGGING_SWITCH);

	wxString logDir;
	bool found = parser.Found(LOGDIR_OPTION, &logDir);
	if (found)
		m_logDir = logDir;

	wxString confDir;
	found = parser.Found(CONFDIR_OPTION, &confDir);
	if (found)
		m_confDir = confDir;

	if (parser.GetParamCount() > 0U)
		m_name = parser.GetParam(0U);

	return true;
}
开发者ID:BackupTheBerlios,项目名称:opendv-svn,代码行数:22,代码来源:TimerControlApp.cpp

示例13: IsSingleInstance

bool CodeLiteApp::IsSingleInstance(const wxCmdLineParser &parser, const wxString &curdir)
{
    // check for single instance
    if ( clConfig::Get().Read("SingleInstance", false) ) {
        const wxString name = wxString::Format(wxT("CodeLite-%s"), wxGetUserId().c_str());

        m_singleInstance = new wxSingleInstanceChecker(name);
        if (m_singleInstance->IsAnotherRunning()) {
            // prepare commands file for the running instance
            wxString files;
            for (size_t i=0; i< parser.GetParamCount(); i++) {
                wxString argument = parser.GetParam(i);

                //convert to full path and open it
                wxFileName fn(argument);
                fn.MakeAbsolute(curdir);
                files << fn.GetFullPath() << wxT("\n");
            }

            if (files.IsEmpty() == false) {
                Mkdir(ManagerST::Get()->GetStarupDirectory() + wxT("/ipc"));

                wxString file_name, tmp_file;
                tmp_file 	<< ManagerST::Get()->GetStarupDirectory()
                            << wxT("/ipc/command.msg.tmp");

                file_name 	<< ManagerST::Get()->GetStarupDirectory()
                            << wxT("/ipc/command.msg");

                // write the content to a temporary file, once completed,
                // rename the file to the actual file name
                WriteFileUTF8(tmp_file, files);
                wxRenameFile(tmp_file, file_name);
            }
            return false;
        }
    }
    return true;
}
开发者ID:AndrianDTR,项目名称:codelite,代码行数:39,代码来源:app.cpp

示例14: OnInitCmdLine

void mainApp::OnInitCmdLine (wxCmdLineParser &parser) 
{
  static const wxCmdLineEntryDesc cmdLineDesc[] =
  {    
    { wxCMD_LINE_PARAM,  NULL, NULL, "input-file", 
      wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL },
    { wxCMD_LINE_OPTION,  "verbose" ,"verbose",NULL,
      wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
    { wxCMD_LINE_NONE }
  };
  parser.SetDesc(cmdLineDesc);
  return;
}
开发者ID:HelloWilliam,项目名称:osiris,代码行数:13,代码来源:mainApp.cpp

示例15: OnCmdLineParsed

bool CamulecmdApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
	m_HasCmdOnCmdLine = parser.Found(wxT("command"), &m_CmdString);
	if (m_CmdString.Lower().StartsWith(wxT("help")))
	{
		OnInitCommandSet();
		printf("%s %s\n", m_appname, (const char *)unicode2char(GetMuleVersion()));
		Parse_Command(m_CmdString);
		exit(0);
	}
	m_interactive = !m_HasCmdOnCmdLine;
	return CaMuleExternalConnector::OnCmdLineParsed(parser);
}
开发者ID:amule-project,项目名称:amule,代码行数:13,代码来源:TextClient.cpp


注:本文中的wxCmdLineParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。