本文整理汇总了C++中wxString::Find方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::Find方法的具体用法?C++ wxString::Find怎么用?C++ wxString::Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::Find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExtractImagesInfo
// -------------------------------------------------------------------------------- //
int guGoogleCoverFetcher::ExtractImagesInfo( wxString &content, int count )
{
int ImageIndex = 0;
while( !m_MainThread->TestDestroy() )
{
//guLogMessage( wxT( "%s\n" ), content.c_str() );
int FindPos = content.Find( wxT( "{\"GsearchResultClass\":" ) );
if( FindPos == wxNOT_FOUND )
{
break;
}
content = content.Mid( FindPos );
FindPos = content.Find( wxT( "}," ) );
if( FindPos == wxNOT_FOUND )
break;
ExtractImageInfo( content.Mid( 0, FindPos + 1 ) );
ImageIndex++;
if( ImageIndex > count )
break;
content = content.Mid( FindPos + 1 );
if( content.IsEmpty() )
break;
}
return ( ImageIndex == GOOGLE_COVERS_PER_PAGE ) ? ImageIndex : 0;
}
示例2:
inline bool
SbModel::comparePermission(const wxString &ps, SbEntry::Permission p) const
{
return ((ps.Find(wxT("r")) != wxNOT_FOUND) && (p == SbEntry::READ)) ||
((ps.Find(wxT("w")) != wxNOT_FOUND) && (p == SbEntry::WRITE)) ||
((ps.Find(wxT("x")) != wxNOT_FOUND) && (p == SbEntry::EXECUTE));
}
示例3: reportError
bool frmMain::reportError(const wxString &error, const wxString &msgToIdentify, const wxString &hint)
{
bool identified=false;
wxString translated=wxGetTranslation(msgToIdentify);
if (translated != msgToIdentify)
{
identified = (error.Find(translated) >= 0);
}
if (!identified)
{
if (msgToIdentify.Left(20) == wxT("Translator attention"))
identified = (error.Find(msgToIdentify.Mid(msgToIdentify.Find('!')+1)) >= 0);
else
identified = (error.Find(msgToIdentify) >= 0);
}
if (identified)
{
if (frmHint::WantHint(hint))
frmHint::ShowHint(this, hint, error);
}
return identified;
}
示例4: checkBlock
wxString modeltest::checkBlock(wxString block)
{
int lsetPos, semiPos;
wxString fblock;
if(block.Contains("Lset") || block.Contains("lset") || block.Contains("LSET"))
{
int pB = wxMessageBox("LSET command found on your PAUP block.\nDo you want to comment it?", "Paup Block", wxYES | wxNO);
if(pB == wxYES)
{
lsetPos = block.Find("LSET");
block.Replace("LSET", "[LSET", false);
if(lsetPos == -1)
{
lsetPos = block.Find("Lset");
block.Replace("Lset", "[Lset", false);
}
if(lsetPos == -1)
{
lsetPos = block.Find("lset");
block.Replace("lset", "[lset", false);
}
if(lsetPos == 0)
{
semiPos = block.First(";");
block.Replace(";", ";]", false);
}
}
}
return block;
}
示例5: AnalyseLine
/** This function determines the caracteristics of a given line (code line, comment line etc...).
* It is called by the "CountLines" function.
* @see CountLines
*/
void CodeStatExecDlg::AnalyseLine(LanguageDef &language, wxString line, bool &comment, bool &code, bool &multi_line_comment)
{
int first_single_line_comment, first_multi_line_comment_begin, first_multi_line_comment_end;
// Delete first and trailing spaces
line = line.Trim(true);
line = line.Trim(false);
if (line.IsEmpty())
return;
// Searching for single and multi-lines comment signs
if (language.single_line_comment.Length() > 0)
first_single_line_comment = line.Find(language.single_line_comment);
else first_single_line_comment = -1;
if (language.multiple_line_comment[0].Length() > 0)
first_multi_line_comment_begin = line.Find(language.multiple_line_comment[0]);
else first_multi_line_comment_begin = -1;
if (language.multiple_line_comment[1].Length() > 0)
first_multi_line_comment_end = line.Find(language.multiple_line_comment[1]);
else first_multi_line_comment_end = -1;
// We are in a multiple line comment => finding the "end of multiple line comment" sign
if (multi_line_comment)
{
comment = true;
if (first_multi_line_comment_end > -1)
{
multi_line_comment = false;
if (first_multi_line_comment_end+language.multiple_line_comment[1].Length() < line.Length())
AnalyseLine(language, line.Mid(first_multi_line_comment_end+language.multiple_line_comment[1].Length()), comment, code, multi_line_comment);
}
}
// We are not in a multiple line comment
else if (!multi_line_comment)
{
// First comment sign found is a single line comment sign
if ( (first_single_line_comment>-1)
&&((first_multi_line_comment_begin==-1)||((first_multi_line_comment_begin>-1)&&(first_single_line_comment<first_multi_line_comment_begin))) )
{
comment = true;
if (first_single_line_comment > 0)
code = true;
}
// First comment sign found is a multi-line comment begin sign
else if (first_multi_line_comment_begin>-1)
{
multi_line_comment = true;
comment = true;
if (first_multi_line_comment_begin > 0)
code = true;
if (first_multi_line_comment_begin+language.multiple_line_comment[0].Length() < line.Length())
AnalyseLine(language, line.Mid(first_multi_line_comment_begin+language.multiple_line_comment[0].Length()), comment, code, multi_line_comment);
}
else
{
code = true;
}
}
}
示例6: GetAppClassName
wxString wxWidgetsGUI::GetAppClassName(const wxString& Source,wxsCodingLang Lang)
{
switch ( Lang )
{
case wxsCPP:
{
// Doing some trick - searching for IMPLEMENT_APP macro followed
// by '(' and class name - here we can fetch name of application class
int Pos = Source.Find(_T("IMPLEMENT_APP"));
if ( Pos<0 ) return wxEmptyString;
Pos += 13;// strlen("IMPLEMENT_APP")
while ( IsWhite(Source,Pos) ) Pos++;
if ( Pos >= (int)Source.Length() ) return wxEmptyString;
if ( Source[Pos++] != _T('(') ) return wxEmptyString;
while ( IsWhite(Source,Pos) ) Pos++;
wxString ClassName;
static const wxString AllowedChars(_T("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"));
while ( (Pos < (int)Source.Length()) && (AllowedChars.Find(Source[Pos])>=0) )
{
ClassName += Source[Pos];
Pos++;
}
while ( IsWhite(Source,Pos) ) Pos++;
if ( Pos >= (int)Source.Length() ) return wxEmptyString;
if ( Source[Pos] != _T(')') ) return wxEmptyString;
return ClassName;
}
default:
;
}
return wxEmptyString;
}
示例7: QuoteStringIfNeeded
void QuoteStringIfNeeded(wxString& str)
{
bool hasSpace = str.Find(_T(' ')) != -1;
bool hasParen = !platform::windows && (str.Find(_T('(')) != -1 || str.Find(_T(')')) != -1);
if (!str.IsEmpty() && str.GetChar(0) != _T('"') && (hasSpace || hasParen))
str = wxString(_T("\"")) + str + _T("\"");
}
示例8: GetLocaleFile
static wxString GetLocaleFile(const wxString& localesDir, wxString name)
{
if (wxFileName::FileExists(localesDir + name + _T("/filezilla.mo")))
return name;
if (wxFileName::FileExists(localesDir + name + _T("/LC_MESSAGES/filezilla.mo")))
return name + _T("/LC_MESSAGES");
size_t pos = name.Find('@');
if (pos > 0)
{
name = name.Left(pos);
if (wxFileName::FileExists(localesDir + name + _T("/filezilla.mo")))
return name;
if (wxFileName::FileExists(localesDir + name + _T("/LC_MESSAGES/filezilla.mo")))
return name + _T("/LC_MESSAGES");
}
pos = name.Find('_');
if (pos > 0)
{
name = name.Left(pos);
if (wxFileName::FileExists(localesDir + name + _T("/filezilla.mo")))
return name;
if (wxFileName::FileExists(localesDir + name + _T("/LC_MESSAGES/filezilla.mo")))
return name + _T("/LC_MESSAGES");
}
return _T("");
}
示例9: _Get_DataSource
//---------------------------------------------------------
bool CActive_Attributes_Control::_Get_DataSource(wxString &Source)
{
if( Source.Find("PGSQL:" ) == 0
|| Source.Find("ftp://" ) == 0
|| Source.Find("http://" ) == 0
|| Source.Find("https://") == 0
|| Source.Find("file://" ) == 0
|| wxFileExists(Source) )
{
return( true );
}
if( g_pActive->Get_Active_Data_Item() && g_pActive->Get_Active_Data_Item()->Get_Object()->Get_File_Name(false) )
{
wxFileName fn(Source), dir(g_pActive->Get_Active_Data_Item()->Get_Object()->Get_File_Name(false));
if( fn.MakeAbsolute(dir.GetPath()) && fn.Exists() )
{
Source = fn.GetFullPath();
return( true );
}
}
return( false );
}
示例10: ObtenerPolinomioDesComa
wxString interprete::ObtenerPolinomioDesComa(wxString DespuesComa, usi it)
{
wxString obpa="error";
usi DondeComa=DespuesComa.Find(',');
usi DondeP=DespuesComa.Find(')');
DondeComa++;
DondeP--;
obpa=DespuesComa.Mid(DondeComa,DondeP);
return obpa;
}
示例11: DisplayFile
void frmHbaConfig::DisplayFile(const wxString &str)
{
lines.Empty();
filetype = wxTextFileType_Unix;
wxStringTokenizer strtok;
if (str.Find('\r') >= 0)
{
if (str.Find(wxT("\n\r")) >= 0 || str.Find(wxT("\r\n")))
filetype = wxTextFileType_Dos;
else
filetype = wxTextFileType_Mac;
strtok.SetString(wxTextBuffer::Translate(str, wxTextFileType_Unix), wxT("\n"), wxTOKEN_RET_EMPTY);
}
else
strtok.SetString(str, wxT("\n"), wxTOKEN_RET_EMPTY);
while (strtok.HasMoreTokens())
{
pgHbaConfigLine *line = new pgHbaConfigLine(strtok.GetNextToken());
lines.Add(line);
}
listEdit->DeleteAllItems();
size_t i = lines.GetCount();
// make sure the last line is empty
for (i = 0 ; i < lines.GetCount() ; i++)
{
pgHbaConfigLine &line = lines.Item(i);
const wxChar *connTypeStr = line.GetConnectType();
if ((line.isValid || (!line.isValid && !line.isComment)) && !line.GetText().IsEmpty())
{
int imgIndex = 0;
if (!line.isComment)
imgIndex = 1;
long pos = listEdit->AppendItem(imgIndex, connTypeStr, line.database, line.user);
listEdit->SetItem(pos, 3, line.ipaddress);
listEdit->SetItem(pos, 4, line.GetMethod());
listEdit->SetItem(pos, 5, line.option);
line.item = pos;
}
}
if (!i || !lines.Item(i - 1).text.IsEmpty())
{
pgHbaConfigLine *line = new pgHbaConfigLine();
lines.Add(line);
line->item = listEdit->AppendItem(0, wxString(wxEmptyString));
}
}
示例12: wxT
bool
wxPdfBarCodeCreator::I25(double xpos, double ypos, const wxString& code, double basewidth, double height)
{
// wide/narrow codes for the digits
wxString locCode = code;
double wide = basewidth;
double narrow = basewidth / 3 ;
double lineWidth;
if ((locCode.Length() > 0 && !wxIsdigit(locCode[0])) || !locCode.IsNumber())
{
return false;
}
// add leading zero if code-length is odd
if (locCode.Length() % 2 != 0)
{
locCode = wxT("0") + locCode;
}
m_document->SetFont(wxT("Helvetica"), wxT(""), 10);
m_document->Text(xpos, ypos + height + 4, locCode);
m_document->SetFillColour(0);
// add start and stop codes
locCode = wxT("AA") + locCode + wxT("ZA");
size_t i;
for (i = 0; i < locCode.Length(); i += 2)
{
// choose next pair of digits
int digitBar = i25_chars.Find(locCode[i]);
int digitSpace = i25_chars.Find(locCode[i+1]);
// create a wide/narrow-sequence (first digit=bars, second digit=spaces)
wxString seq = wxT("");
size_t j;
for (j = 0; j < i25_barChar[digitBar].Length(); j++)
{
seq += wxString(i25_barChar[digitBar][j]) + wxString(i25_barChar[digitSpace][j]);
}
for (j = 0; j < seq.Length(); j++)
{
// set lineWidth depending on value
lineWidth = (seq[j] == wxT('n')) ? narrow : wide;
// draw every second value, because the second digit of the pair is represented by the spaces
if (j % 2 == 0)
{
m_document->Rect(xpos, ypos, lineWidth, height, wxPDF_STYLE_FILL);
}
xpos += lineWidth;
}
}
return true;
}
示例13: GetNearestParent
wxTreeItemId CLocalTreeView::GetNearestParent(wxString& localDir)
{
const wxString separator = wxFileName::GetPathSeparator();
#ifdef __WXMSW__
int pos = localDir.Find(separator);
if (pos == -1)
return wxTreeItemId();
wxString drive = localDir.Left(pos);
localDir = localDir.Mid(pos + 1);
wxTreeItemIdValue value;
wxTreeItemId root = GetFirstChild(m_drives, value);
while (root)
{
if (!GetItemText(root).Left(drive.Length()).CmpNoCase(drive))
break;
root = GetNextSibling(root);
}
if (!root)
{
if (drive[1] == ':')
return AddDrive(drive[0]);
return wxTreeItemId();
}
#else
if (localDir[0] == '/')
localDir = localDir.Mid(1);
wxTreeItemId root = GetRootItem();
#endif
while (localDir != _T(""))
{
wxString subDir;
int pos = localDir.Find(separator);
if (pos == -1)
subDir = localDir;
else
subDir = localDir.Left(pos);
wxTreeItemId child = GetSubdir(root, subDir);
if (!child)
return root;
if (!pos)
return child;
root = child;
localDir = localDir.Mid(pos + 1);
}
return root;
}
示例14: stripZeros
void SPICE_VALUE::stripZeros( wxString& aString )
{
if ( aString.Find( ',' ) >= 0 || aString.Find( '.' ) >= 0 )
{
while( aString.EndsWith( '0' ) )
aString.RemoveLast();
if( aString.EndsWith( '.' ) || aString.EndsWith( ',' ) )
aString.RemoveLast();
}
}
示例15: AddSegment
void CLocalPath::AddSegment(const wxString& segment)
{
wxASSERT(!m_path.empty());
wxASSERT(segment.Find(_T("/")) == -1);
#ifdef __WXMSW__
wxASSERT(segment.Find(_T("\\")) == -1);
#endif
m_path += segment;
m_path += path_separator;
}