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


C++ wxString::BeforeLast方法代码示例

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


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

示例1: ShowHelpDialog

void HelpSystem::ShowHelpDialog(wxWindow *parent,
                    const wxString &localFileName,
                    const wxString &remoteURL,
                    bool bModal)
{
   AudacityProject * pProj = GetActiveProject();
   wxString HelpMode = wxT("Local");

   if( pProj )
   {
      HelpMode = pProj->mHelpPref;
      // these next lines are for legacy cfg files (pre 2.0) where we had different modes
      if( (HelpMode == wxT("Standard")) || (HelpMode == wxT("InBrowser")) )
      {
         HelpMode = wxT("Local");
         pProj->mHelpPref = HelpMode;
         gPrefs->Write(wxT("/GUI/Help"), HelpMode);
         gPrefs->Flush();
      }
   }

   // Anchors (URLs with a '#' in them) are not supported by many OSs for local file names
   // See, for example, https://groups.google.com/forum/#!topic/wx-users/pC0uOZJalRQ
   // Problems have been reported on Win, Mac and some versions of Linux.
   // So we set HelpMode to use the internet if an anchor is found.
   if (localFileName.Find('#', true) != wxNOT_FOUND)
      HelpMode = wxT("FromInternet");
   // Until a solution is found for this, the next few lines are irrelevant.

   // Obtain the local file system file name, without the anchor if present.
   wxString localfile;
   if (localFileName.Find('#', true) != wxNOT_FOUND)
      localfile = localFileName.BeforeLast('#');
   else
      localfile = localFileName;

   if( (HelpMode == wxT("FromInternet")) && !remoteURL.IsEmpty() )
   {
      // Always go to remote URL.  Use External browser.
      OpenInDefaultBrowser( remoteURL );
   }
   else if( !wxFileExists( localfile ))
   {
      // If you give an empty remote URL, you should have already ensured
      // that the file exists!
      wxASSERT( !remoteURL.IsEmpty() );
      // I can't find it'.
      // Use Built-in browser to suggest you use the remote url.
      wxString Text = HelpText( wxT("remotehelp") );
      Text.Replace( wxT("*URL*"), remoteURL );
      ShowHtmlText( parent, _("Help on the Internet"), Text, false, bModal );
   }
   else if( HelpMode == wxT("Local") )
   {
      // Local file, External browser
      OpenInDefaultBrowser( wxString(wxT("file:"))+localFileName );
   }
   else
   {
      // Local file, Built-in browser
      ShowHtmlText( parent, wxT(""), localFileName, true, bModal );
   }
}
开发者ID:Avi2011class,项目名称:audacity,代码行数:63,代码来源:HelpSystem.cpp

示例2: RemoveGershaim

void VcImporter::RemoveGershaim(wxString& str)
{
    TrimString(str);
    str = str.AfterFirst(wxT('"'));
    str = str.BeforeLast(wxT('"'));
}
开发者ID:Slasher006,项目名称:codelite,代码行数:6,代码来源:vcimporter.cpp

示例3: installService

////////////////////////////////////////////////////////////
// installation and removal
bool installService(const wxString &serviceName, const wxString &executable,  const wxString &args, const wxString &displayname, const wxString &user, const wxString &password)
{
	DWORD dwData;
	bool done = false;

	SC_HANDLE manager = OpenSCManager(0, 0, SC_MANAGER_ALL_ACCESS);
	if (manager)
	{
		wxString cmd = executable + wxT(" ") + args;

		wxString quser;
		if (!user.Contains(wxT("\\")))
			quser = wxT(".\\") + user;
		else
			quser = user;

		SC_HANDLE service = CreateService(manager, serviceName.c_str(), displayname.c_str(), SERVICE_ALL_ACCESS,
		                                  SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL,
		                                  cmd.c_str(), 0, 0, 0, quser.c_str(), password.c_str());

		if (service)
		{
			done = true;
			CloseServiceHandle(service);
		}
		else
		{
			LPVOID lpMsgBuf;
			DWORD dw = GetLastError();

			FormatMessage(
			    FORMAT_MESSAGE_ALLOCATE_BUFFER |
			    FORMAT_MESSAGE_FROM_SYSTEM,
			    NULL,
			    dw,
			    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
			    (LPTSTR) &lpMsgBuf,
			    0, NULL
			);
			wxString error;
			error.Printf(wxT("%s"), lpMsgBuf);
			LogMessage(error, LOG_ERROR);
		}

		CloseServiceHandle(manager);
	}

	// Setup the event message DLL
	wxRegKey *msgKey = new wxRegKey(wxT("HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\") + serviceName);
	if(!msgKey->Exists())
	{
		if (!msgKey->Create())
			LogMessage(_("Could not open the message source registry key."), LOG_WARNING);
	}

	wxString path = executable.BeforeLast('\\') + wxT("\\pgaevent.dll");

	if (!msgKey->SetValue(wxT("EventMessageFile"), path))
		LogMessage(_("Could not set the event message file registry value."), LOG_WARNING);

	dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;

	if (!msgKey->SetValue(wxT("TypesSupported"), dwData))
		LogMessage(_("Could not set the supported types."), LOG_WARNING);;

	return done;
}
开发者ID:,项目名称:,代码行数:69,代码来源:

示例4: wxGetRichTextStyle

static wxString wxGetRichTextStyle(const wxString& style)
{
    return style.BeforeLast(wxT('|'));
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:4,代码来源:richtextstyles.cpp

示例5: LoadLayoutFromFile

bool SjVirtKeybdLayout::LoadLayoutFromFile(const wxString& file__, wxArrayString* allNames)
{
	// split index from file name
	wxString file;
	long currIndex = -1, wantedIndex = 0;
	if( file__.Find(wxT(','), TRUE) <= file__.Find(wxT('.'), TRUE) )
	{
		file = file__;
	}
	else
	{
		if( !file__.AfterLast(wxT(',')).ToLong(&wantedIndex, 10) ) { wantedIndex = 0; }
		file = file__.BeforeLast(wxT(','));
	}

	// init
	m_keys.Clear();
	m_file = file;
	m_name = file;
	m_lineCount = 1;
	m_totalRelWidth = 0;

	if( allNames )
	{
		allNames->Clear();
	}

	// read file content
	wxFileSystem fs;
	wxFSFile* fsFile = fs.OpenFile(file);
	if( fsFile == NULL )
	{
		return FALSE;
	}

	wxString fileContent = SjTools::GetFileContent(fsFile->GetStream(), &wxConvISO8859_1);
	delete fsFile;

	// parse file
	fileContent.Replace(wxT(";"), wxT("\n"));

	SjLineTokenizer tkz(fileContent);
	wxChar*         linePtr;
	wxString        line, lineType, lineValue;
	SjVirtKeybdKey* currKey = NULL;
	while( (linePtr=tkz.GetNextLine()) != NULL )
	{
		line = linePtr;

		// get key'n'value pair (currLine is already trimmed aleft and aright)
		if( line.Find('=') != -1 )
		{
			lineType = line.BeforeFirst('=').Trim().Lower();
			lineValue = line.AfterFirst('=').Trim(FALSE);
		}
		else
		{
			lineType = line.Lower();
			lineValue.Empty();
		}

		if( lineType == wxT("layout") )
		{
			if( allNames )
			{
				allNames->Add(lineValue);
			}

			currIndex++;
			if( currIndex == wantedIndex )
			{
				m_name = lineValue;
			}
		}
		else if( currIndex != wantedIndex )
		{
			;
		}
		else if( lineType == wxT("key") )
		{
			currKey = new SjVirtKeybdKey(lineValue);
			m_keys.Add(currKey);
		}
		else if( lineType == wxT("spacer") || lineType == wxT("nextline") )
		{
			currKey = new SjVirtKeybdKey(lineType);
			m_keys.Add(currKey);
		}
		else if( currKey )
		{
			if( lineType == wxT("width") )
			{
				currKey->SetRelWidth(lineValue);
			}
			else
			{
				currKey->SetKey(lineType, lineValue);
			}
		}
	}
//.........这里部分代码省略.........
开发者ID:boh1996,项目名称:silverjuke,代码行数:101,代码来源:virtkeybd.cpp

示例6:

std::unique_ptr<Vamp::Plugin> VampEffectsModule::FindPlugin(const wxString & path,
                                      int & output,
                                      bool & hasParameters)
{
   PluginLoader::PluginKey key = path.BeforeLast(wxT('/')).ToUTF8().data();

   std::unique_ptr<Plugin> vp{ PluginLoader::getInstance()->loadPlugin(key, 48000) }; // rate doesn't matter here
   if (!vp)
   {
      return nullptr;
   }

   // We limit the listed plugin outputs to those whose results can
   // readily be displayed in an Audacity label track.
   //
   // - Any output whose features have no values (time instants only),
   //   with or without duration, is fine
   //
   // - Any output whose features have more than one value, or an
   //   unknown or variable number of values, is right out
   //
   // - Any output whose features have exactly one value, with
   //   variable sample rate or with duration, should be OK --
   //   this implies a sparse feature, of which the time and/or
   //   duration are significant aspects worth displaying
   //
   // - An output whose features have exactly one value, with
   //   fixed sample rate and no duration, cannot be usefully
   //   displayed -- the value is the only significant piece of
   //   data there and we have no good value plot

   Plugin::OutputList outputs = vp->getOutputDescriptors();

   output = 0;

   hasParameters = !vp->getParameterDescriptors().empty();

   for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); ++j)
   {
      if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
            j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||
            !j->hasFixedBinCount ||
            (j->hasFixedBinCount && j->binCount > 1))
      {
         // All of these qualities disqualify (see notes above)

         ++output;
         continue;
      }

      wxString name = wxString::FromUTF8(vp->getName().c_str());

      if (outputs.size() > 1)
      {
         // This is not the plugin's only output.
         // Use "plugin name: output name" as the effect name,
         // unless the output name is the same as the plugin name
         wxString outputName = wxString::FromUTF8(j->name.c_str());
         if (outputName != name)
         {
            name = wxString::Format(wxT("%s: %s"),
                                    name, outputName);
         }
      }

      if (wxString::FromUTF8(key.c_str()) + wxT("/") + name == path)
      {
         return vp;
      }

      ++output;
   }

   return {};
}
开发者ID:RaphaelMarinier,项目名称:audacity,代码行数:75,代码来源:LoadVamp.cpp


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