本文整理汇总了C++中wxString::StartsWith方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::StartsWith方法的具体用法?C++ wxString::StartsWith怎么用?C++ wxString::StartsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::StartsWith方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: invoke
bool CBasicCommandInvoker::invoke(const wxString& text)
{
if (text.StartsWith(CBasicCommandInvoker::JOIN)) {
wxString channle = text;
wxString argument = channle.Remove(0,
CBasicCommandInvoker::JOIN.size());
m_service->joinChannel(argument);
return true;
} else if (text.StartsWith(CBasicCommandInvoker::TOPIC)) {
wxString channle = text;
wxString argument = channle.Remove(0,
CBasicCommandInvoker::TOPIC.size());
m_service->onChangeTopic(argument);
return true;
} else if (text.StartsWith(CBasicCommandInvoker::NICK)) {
wxString channle = text;
wxString argument = channle.Remove(0,
CBasicCommandInvoker::NICK.size());
m_service->onNickChange(argument);
return true;
} else if (text.StartsWith(CBasicCommandInvoker::PART)) {
wxString argument = m_service->getCurrentChannel();
m_service->partChannel(argument);
return true;
}
return false;
}
示例2: Add_Skin_Icon
void CamuleDlg::Add_Skin_Icon(
const wxString &iconName,
const wxBitmap &stdIcon,
bool useSkins)
{
wxImage new_image;
if (useSkins) {
wxFFileInputStream in(m_skinFileName.GetFullPath());
wxZipInputStream zip(in);
ZipCatalog::iterator it = cat.find(wxZipEntry::GetInternalName(iconName + wxT(".png")));
if ( it != cat.end() ) {
zip.OpenEntry(*it->second);
if ( !new_image.LoadFile(zip,wxBITMAP_TYPE_PNG) ) {
AddLogLineN(wxT("Warning: Error loading icon for ") +
iconName);
useSkins = false;
}
}else {
AddLogLineN(wxT("Warning: Can't load icon for ") +
iconName);
useSkins = false;
}
}
wxBitmap bmp(useSkins ? new_image : stdIcon);
if (iconName.StartsWith(wxT("Client_"))) {
m_imagelist.Add(bmp);
} else if (iconName.StartsWith(wxT("Toolbar_"))) {
m_tblist.Add(bmp);
}
}
示例3: Init
bool SjKaraokeMaster::Init(const wxString& musicFile, const wxString& artist, const wxString& title)
{
wxFSFile* fsFile;
// exit old stuff
Exit();
if( musicFile.StartsWith(wxT("http:")) // this may be a steam - in this case (or in others) we get into an endless loop
|| musicFile.StartsWith(wxT("https:"))
|| musicFile.StartsWith(wxT("ftp:")) )
return false;
// try to create CDG (try musicFile.cdg and musicFile.mp3.cdg)
if( (fsFile=CheckFile(musicFile, wxT("cdg"))) )
{
m_reader = new SjCdgReader(fsFile); // SjCdgReader takes ownership of fsFile!
return true; // success
}
// try to create LRC (Simple Lyrics)
if( (fsFile=CheckFile(musicFile, wxT("lrc"))) )
{
m_reader = new SjSyncTxtReader(fsFile, SJ_SYNCTXT_LRC, artist, title); // SjSyncTxtReader takes ownership of fsFile!
return true; // success
}
// no karaoke file available
return false;
}
示例4: OnBeforeLoad
void HtmlOutputPane::OnBeforeLoad(IHtmlWndBeforeLoadEvent& event) {
const wxString url = event.GetURL();
if (url == wxT("about:blank")) return;
if (url.StartsWith(wxT("txmt://open"))) {
m_opener.OpenTxmtUrl(url);
// Don't try to open it in browser
event.Cancel(true);
return;
}
if (url.StartsWith(wxT("tm-file://"))) {
wxString path = url.substr(10);
#ifdef __WXMSW__
path = eDocumentPath::CygwinPathToWin(path); // path may be in unix format, so we have to convert it
#endif
DecodePath(path); // Spaces transformed to %20 in paths confuses ie
m_browser->LoadUrl(path);
// Don't try to open it in browser
event.Cancel(true);
return;
}
}
示例5: findRepeater
bool IRCDDBApp::findRepeater(const wxString& rptrCall)
{
if (rptrCall.StartsWith(wxT("XRF")) || rptrCall.StartsWith(wxT("REF")))
{
findReflector(rptrCall, d);
return true;
}
wxString arearp_cs = rptrCall;
arearp_cs.Replace(wxT(" "), wxT("_"));
wxString zonerp_cs;
wxMutexLocker lock(d->rptrMapMutex);
wxString s = wxT("NONE");
if (d->rptrMap.count(arearp_cs) == 1)
{
IRCDDBAppRptrObject o = d->rptrMap[arearp_cs];
zonerp_cs = o.zonerp_cs;
zonerp_cs.Replace(wxT("_"), wxT(" "));
zonerp_cs.SetChar(7, wxT('G'));
s = o.zonerp_cs;
}
IRCMessage * m2 = new IRCMessage(wxT("IDRT_REPEATER"));
m2->addParam(rptrCall);
m2->addParam(zonerp_cs);
m2->addParam(getIPAddress(s));
d->replyQ.putMessage(m2);
return true;
}
示例6: getPathAttachment
/*
This function transforms mnemonic pathes to real one
For example %USERPROFILE%\MyBudget will be transformed to C:\Users\James\MyBudget
*/
const wxString mmex::getPathAttachment(const wxString &attachmentsFolder)
{
if (attachmentsFolder == wxEmptyString)
return wxEmptyString;
wxString AttachmentsFolder = attachmentsFolder;
const wxString sep = wxFileName::GetPathSeparator();
const wxString LastDBPath = Model_Setting::instance().getLastDbPath();
const wxString& LastDBFolder = wxFileName::FileName(LastDBPath).GetPath() + sep;
const wxString& UserFolder = mmex::GetUserDir(false).GetPath() + sep;
if (attachmentsFolder.StartsWith(ATTACHMENTS_FOLDER_USERPROFILE, &AttachmentsFolder))
AttachmentsFolder.Prepend(wxGetHomeDir() + sep);
else if (attachmentsFolder.StartsWith(ATTACHMENTS_FOLDER_DOCUMENTS, &AttachmentsFolder))
AttachmentsFolder.Prepend(wxStandardPaths::Get().GetDocumentsDir() + sep);
else if (attachmentsFolder.StartsWith(ATTACHMENTS_FOLDER_DATABASE, &AttachmentsFolder))
AttachmentsFolder.Prepend(LastDBFolder);
else if (attachmentsFolder.StartsWith(ATTACHMENTS_FOLDER_APPDATA, &AttachmentsFolder))
AttachmentsFolder.Prepend(UserFolder);
if (AttachmentsFolder.Last() != sep)
AttachmentsFolder.Append(sep);
if (Model_Infotable::instance().GetBoolInfo("ATTACHMENTSSUBFOLDER", true))
AttachmentsFolder += wxString::Format("MMEX_%s_Attachments%s", wxFileName::FileName(LastDBPath).GetName(), sep);
return AttachmentsFolder;
}
示例7: StrToBool
bool StrToBool(const wxString &value)
{
if (value.StartsWith(wxT("t")))
{
return true;
}
else if (value.StartsWith(wxT("T")))
{
return true;
}
else if (value.StartsWith(wxT("1")))
{
return true;
}
else if (value.StartsWith(wxT("Y")))
{
return true;
}
else if (value.StartsWith(wxT("y")))
{
return true;
}
else if (value == wxT("on"))
return true;
return false;
}
示例8: CheckCommentSyntax
wxExTextFile::wxExCommentType wxExTextFile::CheckCommentSyntax(
const wxString& syntax_begin,
const wxString& syntax_end,
const wxString& text) const
{
if (syntax_begin == text)
{
return (syntax_end == text) ? COMMENT_BOTH: COMMENT_BEGIN;
}
else
{
if (syntax_end == text ||
(syntax_end.empty() && text.empty()))
{
return COMMENT_END;
}
}
if ( syntax_begin.StartsWith(text) ||
(!syntax_end.empty() && syntax_end.StartsWith(text)))
{
return COMMENT_INCOMPLETE;
}
return COMMENT_NONE;
}
示例9: _T
// constructor parses out the url for the get
// and limits size to 750 chars (darn line length limit!)
Request::Request(wxString & get, unsigned int ip) {
wxString line = _T("");
wxString url = _T("");
unsigned int linestartpos = 0, lineendpos = 0;
//Fill in the url by parsing the get
// find end of line
while (get.Len() > lineendpos && get[lineendpos] != '\n')
lineendpos++;
//if not multiline or (does not start with "GET " or "POST" or "HEAD")
if(lineendpos >= get.Len() || lineendpos - linestartpos <= 14 //enough room for "GET / HTTP/1.1"
|| (!get.StartsWith(_T("GET")) && !get.StartsWith(_T("POST"))
&& !get.StartsWith(_T("HEAD"))) )
throw _T("Incomplete Get");
//get GET
int start = 4;
if (get[linestartpos] != 'G')
start = 5;
for (unsigned int i = linestartpos + start; get[i] != ' ' && i < lineendpos; i++) // until we hit a space
line.append(1,get[i]);
//next line
lineendpos++;
linestartpos = lineendpos;
// continue to find host. look at each line
while (true) {
// find end of line
while (get.Len() > lineendpos && get[lineendpos] != '\n')
lineendpos++;
if (lineendpos >= get.Len() || lineendpos - linestartpos < 3)
break; // end of get
// get host
if (lineendpos - linestartpos > 7 //enough room for "Host: \r"
&& get[linestartpos] == 'H' && get[linestartpos+1] == 'o'
&& get[linestartpos+2] == 's' && get[linestartpos+3] == 't'
&& get[linestartpos+4] == ':' && get[linestartpos+5] == ' ') {
for (unsigned int i = linestartpos + 6; get[i] != '\r' && i < lineendpos; i++)
url.append(1,get[i]);
}
// move to next line
lineendpos++;
linestartpos = lineendpos;
if (get.length() <= lineendpos || url.Len() > 0) // end of given string or host found
break;
}// end each line
url.append(line); // append /ig/stuff to host
if (url.Len() > 748) // truncate long lines
url.Remove(749);
url.append(_T("\n"));
// set data members
this->URL = url;
this->HTTP = get;
this->IP = ip;
}
示例10: GetProtocolFromURL
/* static */
wxCurlProtocol wxCurlBaseThread::GetProtocolFromURL(const wxString &url)
{
// I'm sure this check could be done in a better way...
if (url.StartsWith(wxS("http:")) || url.StartsWith(wxS("https:")))
return wxCP_HTTP;
if (url.StartsWith(wxS("ftp:")) || url.StartsWith(wxS("ftps:")))
return wxCP_FTP;
return wxCP_INVALID;
}
示例11: StripBuildMarkders
static void StripBuildMarkders(wxString &s)
{
s.StartsWith(WARNING_MARKER, &s);
s.StartsWith(ERROR_MARKER, &s);
s.StartsWith(SUMMARY_MARKER, &s);
s.StartsWith(SUMMARY_MARKER_ERROR, &s);
s.StartsWith(SUMMARY_MARKER_SUCCESS, &s);
s.StartsWith(SUMMARY_MARKER_WARNING, &s);
}
示例12: extract_progress_from_stderr
void progress_dialog::extract_progress_from_stderr( const wxString& stdout_string )
{
// If it is a progress string (matches this mask using * and ?)...
if ( stdout_string.Matches( "*collected, * to do*" ) ) {
wxString value_string;
wxString range_string;
long value_long;
long range_long;
wxString searchable_string = stdout_string;
// The string starts like this: "---- 1 collected, 9 to do ----"
searchable_string.Replace( "---- ", "" );
// The string now looks like this "1 collected, 9 still to do---\n"
searchable_string.Replace( " collected, ", "R" );
// The string now looks like this: "1R9 still to do---\n"
value_string = searchable_string.BeforeFirst( 'R' );
// The value string is now "1".
range_string = searchable_string.AfterFirst( 'R' );
// The range string is now "9 still to ----\n"
range_string = range_string.BeforeFirst( ' ' );
// The range string is now "9"
// Try to convert these strings to longs (returns false if conversion failed)..
if ( value_string.ToLong( &value_long ) ) {
if ( range_string.ToLong( &range_long ) ) {
// Note that range_long is current still the number remaining.
// Add it to value to get a proper range.
range_long = range_long + value_long;
// ...If successfully got two longs, cast to ints, and send to
// our channel gaugue function
set_current_channel_gauge( (int)value_long, (int)range_long );
}
}
// If it was a "converting the retrieved files" message...
} else if ( stdout_string.StartsWith( "Convert" ) ) {
// ...Update the static text with a message
XMLCTRL( *this, "progress_dialog_current_channel_value_statictext", wxStaticText )
->SetLabel( _( "Converting retrieved files...." ) );
// If it was a "writing the files into pdb" message...
} else if ( stdout_string.StartsWith( "Wrote " ) ) {
// ...Update the static text with a message
XMLCTRL( *this, "progress_dialog_current_channel_value_statictext", wxStaticText )
->SetLabel( _( "Conversion complete. Writing output file..." ) );
// It was a "retrieval of files is complete" message:
} else if ( stdout_string.StartsWith( "---- all" ) ) {
// ...Set the progress bar to max (range is always plkrFIXED_PERCENTAGE_GAUGE_RANGE
// to stop flicker, see notes in plucker_defines.h
XMLCTRL( *this, "progress_dialog_current_channel_gauge", wxGauge )
->SetValue( plkrFIXED_PERCENTAGE_GAUGE_RANGE );
// ...Update the static text with a message
XMLCTRL( *this, "progress_dialog_current_channel_value_statictext", wxStaticText )
->SetLabel( _( "All pages retrieved and parsed. Starting conversion..." ) );
}
}
示例13: pxParseAssignmentString
// returns TRUE if the parse is valid, or FALSE if it's a comment.
bool pxParseAssignmentString( const wxString& src, wxString& ldest, wxString& rdest )
{
if( src.StartsWith(L"--") || src.StartsWith( L"//" ) || src.StartsWith( L";" ) )
return false;
ldest = src.BeforeFirst(L'=').Trim(true).Trim(false);
rdest = src.AfterFirst(L'=').Trim(true).Trim(false);
return true;
}
示例14: GetEndianness
wxEndianness wxPlatformInfo::GetEndianness(const wxString& end)
{
const wxString endl(end.Lower());
if ( endl.StartsWith(wxT("little")) )
return wxENDIAN_LITTLE;
if ( endl.StartsWith(wxT("big")) )
return wxENDIAN_BIG;
return wxENDIAN_INVALID;
}
示例15: Move
bool wxExEx::Move(
const wxString& begin_address,
const wxString& end_address,
const wxString& destination)
{
if (m_STC->GetReadOnly())
{
return false;
}
const int dest_line = ToLineNumber(destination);
if (dest_line == 0)
{
return false;
}
if (!SetSelection(begin_address, end_address))
{
return false;
}
if (begin_address.StartsWith("'"))
{
if (begin_address.size() > 1)
{
MarkerDelete(begin_address.GetChar(1));
}
}
if (end_address.StartsWith("'"))
{
if (end_address.size() > 1)
{
MarkerDelete(end_address.GetChar(1));
}
}
m_STC->BeginUndoAction();
m_STC->Cut();
m_STC->GotoLine(dest_line - 1);
m_STC->Paste();
m_STC->EndUndoAction();
const int lines = wxExGetNumberOfLines(m_STC->GetSelectedText());
if (lines >= 2)
{
m_Frame->ShowExMessage(wxString::Format(_("%d lines moved"), lines));
}
return true;
}