本文整理汇总了C++中wxString::Contains方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::Contains方法的具体用法?C++ wxString::Contains怎么用?C++ wxString::Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::Contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AppendMessage
void InstConsoleWindow::AppendMessage(const wxString& msg, MessageType msgT)
{
// Prevent some red spam
if (msg.Contains("[STDOUT]") || msg.Contains("[ForgeModLoader]"))
msgT = MSGT_STDOUT;
switch (msgT)
{
case MSGT_SYSTEM:
consoleTextCtrl->SetDefaultStyle(
wxTextAttr(settings->GetConsoleSysMsgColor()));
break;
case MSGT_STDOUT:
consoleTextCtrl->SetDefaultStyle(
wxTextAttr(settings->GetConsoleStdoutColor()));
break;
case MSGT_STDERR:
consoleTextCtrl->SetDefaultStyle(
wxTextAttr(settings->GetConsoleStderrColor()));
break;
}
(*consoleTextCtrl) << msg << "\n";
consoleTextCtrl->SetDefaultStyle(wxTextAttr(
wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT)));
}
示例2: OnPaperSizeChoice
void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
{
int idx = m_paperSizeComboBox->GetSelection();
if( idx < 0 )
idx = 0;
const wxString paperType = m_pageFmt[idx];
if( paperType.Contains( PAGE_INFO::Custom ) )
{
m_orientationComboBox->Enable( false );
m_TextUserSizeX->Enable( true );
m_TextUserSizeY->Enable( true );
m_customFmt = true;
}
else
{
m_orientationComboBox->Enable( true );
if( paperType.Contains( wxT( "A4" ) ) && IsGOST() )
{
m_orientationComboBox->SetStringSelection( _( "Portrait" ) );
m_orientationComboBox->Enable( false );
}
m_TextUserSizeX->Enable( false );
m_TextUserSizeY->Enable( false );
m_customFmt = false;
}
GetPageLayoutInfoFromDialog();
UpdatePageLayoutExample();
}
示例3: TextInString
bool TextInString(const wxString& str, const wxString& text, bool wholeWords)
{
int index = str.Find(text);
if (index >= 0)
{
if (wholeWords)
{
size_t textLen = text.Length();
bool result = true;
if (index >0)
result = result && SEPARATORS.Contains(str[index-1]);
if (index+textLen < str.Length())
result = result && SEPARATORS.Contains(str[index+textLen]);
return result;
}
else
{
return true;
}
}
else
{
return false;
}
}
示例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: stringToKeyModifier
KeynameConverter::ModifierList KeynameConverter::stringToKeyModifier(const wxString &keyModifier)
{
ModifierList modifiers;
// this search must be case-insensitive
const wxString str = keyModifier.Upper();
if (str.Contains(wxT("ALT+")))
{
modifiers.insert( ALT );
}
if (str.Contains(wxT("CTRL+")))
{
modifiers.insert( CTRL );
}
if (str.Contains(wxT("SHIFT+")))
{
modifiers.insert( SHIFT );
}
if (str.Contains(wxT("ANY+")))
{
modifiers.insert( ANY );
}
if (str.Contains(wxT("META+")))
{
modifiers.insert( META );
}
return modifiers;
}
示例6: existID
bool BaseDialog::existID( wxWindow* dlg, iONode list, iONode props, wxString id ) {
if( StrOp.equals( wItem.getid(props), id.mb_str(wxConvUTF8) ) ) {
return false;
}
if( id.Len() == 0 ) {
wxMessageDialog( dlg, wxGetApp().getMsg("invalidid"), _T("Rocrail"), wxOK | wxICON_ERROR ).ShowModal();
return true;
}
if( id.Contains(wxT(",")) || id.Contains(wxT(";")) || id.Contains(wxT(":")) ) {
wxMessageDialog( dlg, wxGetApp().getMsg("invalidchars"), _T("Rocrail"), wxOK | wxICON_ERROR ).ShowModal();
return true;
}
if( list != NULL ) {
int cnt = NodeOp.getChildCnt( list );
for( int i = 0; i < cnt; i++ ) {
iONode child = NodeOp.getChild( list, i );
if( StrOp.equals( wItem.getid(child), id.mb_str(wxConvUTF8) )) {
wxMessageDialog( dlg,
wxString::Format(wxGetApp().getMsg("existingid"), wItem.getx(child), wItem.gety(child)) + _T("\n") + wxString(wItem.getdesc(child),wxConvUTF8),
_T("Rocrail"), wxOK | wxICON_ERROR ).ShowModal();
return true;
}
}
}
return false;
}
示例7: if
TMotion::TMotion(const wxString& type, const wxString& length)
{
// In case of an error, default to linear growth across one second.
duration = 1000;
this->type = Linear;
if (type == "" || type == "linear")
this->type = Linear;
else if (type == "exponential")
this->type = Exponential;
else if (type == "logarthmic")
this->type = Logarithmic;
else
wxGetApp().Errorf("Unrecognized motion type '%s'.\n", type.c_str());
if (length == "") {
wxGetApp().Errorf("Motion length not specified.\n");
} else if (length.Contains("ms")) { // milliseconds
if (!length.SubString(0, length.Length() - 3).ToULong((unsigned long*) &duration))
wxGetApp().Errorf("Invalid number: '%s'.\n", length.c_str());
} else if (length.Contains("s")) { // seconds
if (!length.SubString(0, length.Length() - 2).ToULong((unsigned long*) &duration))
wxGetApp().Errorf("Invalid number: '%s'.\n", length.c_str());
else
duration *= 1000;
} else if (length.Contains("min")) { // minutes
if (!length.SubString(0, length.Length() - 4).ToULong((unsigned long*) &duration))
wxGetApp().Errorf("Invalid number: '%s'.\n", length.c_str());
else
duration *= 1000 * 60;
} else {
wxGetApp().Errorf("Motion length must be end in one of : {s, ms, min}.\n");
}
}
示例8: FindFirst
/**
* Doku see wxFileSystemHandler
*/
wxString wxChmFSHandler::FindFirst(const wxString& spec, int flags)
{
wxString right = GetRightLocation(spec);
wxString left = GetLeftLocation(spec);
wxString nativename = wxFileSystem::URLToFileName(left).GetFullPath();
if ( GetProtocol(left) != _T("file") )
{
wxLogError(_("CHM handler currently supports only local files!"));
return wxEmptyString;
}
m_chm = new wxChmTools(wxFileName(nativename));
m_pattern = right.AfterLast(_T('/'));
wxString m_found = m_chm->Find(m_pattern);
// now fake around hhp-files which are not existing in projects...
if (m_found.empty() &&
m_pattern.Contains(_T(".hhp")) &&
!m_pattern.Contains(_T(".hhp.cached")))
{
m_found.Printf(_T("%s#chm:%s.hhp"),
left.c_str(), m_pattern.BeforeLast(_T('.')).c_str());
}
return m_found;
}
示例9: FilterMessage
bool DbgGdb::FilterMessage( const wxString &msg )
{
wxString tmpmsg ( msg );
StripString( tmpmsg );
tmpmsg.Trim().Trim( false );
if ( tmpmsg.Contains( wxT( "Variable object not found" ) ) || msg.Contains( wxT( "Variable object not found" ) ) ) {
return true;
}
if ( tmpmsg.Contains( wxT( "mi_cmd_var_create: unable to create variable object" ) )||msg.Contains( wxT( "mi_cmd_var_create: unable to create variable object" ) ) ) {
return true;
}
if ( tmpmsg.Contains( wxT( "Variable object not found" ) )|| msg.Contains( wxT( "Variable object not found" ) ) ) {
return true;
}
if ( tmpmsg.Contains( wxT( "No symbol \"this\" in current context" ) )||msg.Contains( wxT( "No symbol \"this\" in current context" ) ) ) {
return true;
}
if ( tmpmsg.Contains( wxT( "*running,thread-id" ) ) ) {
return true;
}
if ( tmpmsg.StartsWith( wxT( ">" ) )||msg.StartsWith( wxT( ">" ) ) ) {
// shell line
return true;
}
return false;
}
示例10: fromDMM
double fromDMM( wxString sdms )
{
wchar_t buf[64];
char narrowbuf[64];
int i, len, top = 0;
double stk[32], sign = 1;
//First round of string modifications to accomodate some known strange formats
wxString replhelper;
replhelper = wxString::FromUTF8( "´·" ); //UKHO PDFs
sdms.Replace( replhelper, _T(".") );
replhelper = wxString::FromUTF8( "\"·" ); //Don't know if used, but to make sure
sdms.Replace( replhelper, _T(".") );
replhelper = wxString::FromUTF8( "·" );
sdms.Replace( replhelper, _T(".") );
replhelper = wxString::FromUTF8( "s. š." ); //Another example: cs.wikipedia.org (someone was too active translating...)
sdms.Replace( replhelper, _T("N") );
replhelper = wxString::FromUTF8( "j. š." );
sdms.Replace( replhelper, _T("S") );
sdms.Replace( _T("v. d."), _T("E") );
sdms.Replace( _T("z. d."), _T("W") );
//If the string contains hemisphere specified by a letter, then '-' is for sure a separator...
sdms.UpperCase();
if( sdms.Contains( _T("N") ) || sdms.Contains( _T("S") ) || sdms.Contains( _T("E") )
|| sdms.Contains( _T("W") ) ) sdms.Replace( _T("-"), _T(" ") );
wcsncpy( buf, sdms.wc_str( wxConvUTF8 ), 64 );
len = wcslen( buf );
for( i = 0; i < len; i++ ) {
wchar_t c = buf[i];
if( ( c >= '0' && c <= '9' ) || c == '-' || c == '.' || c == '+' ) {
narrowbuf[i] = c;
continue; /* Digit characters are cool as is */
}
if( c == ',' ) {
narrowbuf[i] = '.'; /* convert to decimal dot */
continue;
}
if( ( c | 32 ) == 'w' || ( c | 32 ) == 's' ) sign = -1; /* These mean "negate" (note case insensitivity) */
narrowbuf[i] = 0; /* Replace everything else with nuls */
}
/* Build a stack of doubles */
stk[0] = stk[1] = stk[2] = 0;
for( i = 0; i < len; i++ ) {
while( i < len && narrowbuf[i] == 0 )
i++;
if( i != len ) {
stk[top++] = atof( narrowbuf + i );
i += strlen( narrowbuf + i );
}
}
return sign * ( stk[0] + ( stk[1] + stk[2] / 60 ) / 60 );
}
示例11: wxIsPlatform64Bit
bool wxIsPlatform64Bit()
{
const wxString machine = wxGetCommandOutput(wxT("uname -m"));
// the test for "64" is obviously not 100% reliable but seems to work fine
// in practice
return machine.Contains(wxT("64")) ||
machine.Contains(wxT("alpha"));
}
示例12: GetArch
wxArchitecture wxPlatformInfo::GetArch(const wxString &arch)
{
if ( arch.Contains(wxT("32")) )
return wxARCH_32;
if ( arch.Contains(wxT("64")) )
return wxARCH_64;
return wxARCH_INVALID;
}
示例13: GetValue
int AudioDialog::GetValue(const wxString& type){
if (type.Contains(ZERO_MARGIN_KEY))
return zeroMarginCtl->GetValue();
if (type.Contains(SILENCE_CUTOFF_KEY))
return zeroCutOff->GetValue();
if (type.Contains(SPEECH_LENGTH_KEY))
return speechMargin->GetValue();
return debugChk->IsChecked();
}
示例14: SetValueAsString
void wxSVGLength::SetValueAsString(const wxString& n)
{
m_valueInSpecifiedUnits = 0;
m_unitType = wxSVG_LENGTHTYPE_NUMBER;
wxString value = n.Strip(wxString::both);
wxString unit;
if (value.length()>=2)
{
const wxString s_numeric = wxT("0123456789");
const wxString s_numericFirst = wxT("+-.Ee") + s_numeric;
if (!s_numeric.Contains(value.Right(1)))
{
if (s_numericFirst.Contains(value.Mid(value.Length()-2,1)))
{
unit = value.Right(1);
value = value.Left(value.Length()-1);
}
else
{
unit = value.Right(2);
value = value.Left(value.Length()-2);
}
}
}
double d;
if (!value.ToDouble(&d))
return;
m_valueInSpecifiedUnits = d;
if (unit.length() == 0);
else if (unit == wxT("px"))
m_unitType = wxSVG_LENGTHTYPE_PX;
else if (unit.Right(1) == wxT("%"))
m_unitType = wxSVG_LENGTHTYPE_PERCENTAGE;
else if (unit == wxT("em"))
m_unitType = wxSVG_LENGTHTYPE_EMS;
else if (unit == wxT("ex"))
m_unitType = wxSVG_LENGTHTYPE_EXS;
else if (unit == wxT("cm"))
m_unitType = wxSVG_LENGTHTYPE_CM;
else if (unit == wxT("mm"))
m_unitType = wxSVG_LENGTHTYPE_MM;
else if (unit == wxT("in"))
m_unitType = wxSVG_LENGTHTYPE_IN;
else if (unit == wxT("pt"))
m_unitType = wxSVG_LENGTHTYPE_PT;
else if (unit == wxT("pc"))
m_unitType = wxSVG_LENGTHTYPE_PC;
SetValueInSpecifiedUnits(m_valueInSpecifiedUnits);
}
示例15: conv_class
wxString conv_class(wxString input)//input contains class classname:$/nprivate:$/nvariable ...$/n
{
wxString output,classname,temporary;
output.Empty();
classname = input.BeforeFirst('$');//contains Class classname:
classname = classname.AfterFirst(' ');
classname = classname.BeforeFirst(':');
input = input.AfterFirst('$');//contains \n\tprivate:$\n.....
output << "class " <<classname;
temporary = input.BeforeFirst('$');//contains \n\tprivate:
output<<"\n{"<<temporary<<"\n";//has private:\n
input= input.AfterFirst('$'); //list of data members - either variables or functions and then $\n\tpublic:$\n
while(input.Contains(wxT("public:")))//input has /nint ....$/n...$/npublic:$/n
{
temporary = input.BeforeFirst('$');//contains variable or function or public;
if(temporary.Contains(wxT("public:"))) break;
else if(temporary.Contains(wxT("Variable")))
{
temporary.Replace("\t ","");
output<<"\t "<< conv_variable(temporary)<<"\n";
}
else if(temporary.Contains(wxT("Function")))
{
temporary.Replace("\t ","");
output<<"\t " << conv_g_func(temporary)<<"\n";
}
input = input.AfterFirst('$');
}//input contains \n\tpublic:$\n ... \nEnd Class$\n
temporary = input.BeforeFirst('$');//contains \n\tpublic:
output<<temporary<<"\n";//output has public:\n
input = input.AfterFirst('$');//input has list of datamembers and then has endclass$\n
while(input.Contains(wxT("End")))//input has /nint ....$/n...$/npublic:$/n
{
temporary = input.BeforeFirst('$');//contains variable or function or public;
if(temporary.Contains(wxT("End"))) break;
else if(temporary.Contains(wxT("Variable")))
{
temporary.Replace("\t ","");
output<<"\t "<< conv_variable(temporary)<<"\n";
}
else if(temporary.Contains(wxT("Function")))
{
temporary.Replace("\t ","");
output<<"\t " << conv_g_func(temporary)<<"\n";
}
input = input.AfterFirst('$');
}
output<<"\n};";
return output;
}