本文整理汇总了C++中wxString::BeforeFirst方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::BeforeFirst方法的具体用法?C++ wxString::BeforeFirst怎么用?C++ wxString::BeforeFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::BeforeFirst方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
hoxChesscapePlayer::_HandleCmd_Logout( const wxString& cmdStr )
{
const wxString sPlayerId = cmdStr.BeforeFirst( 0x10 );
m_site->OnPlayerLoggedOut( sPlayerId );
}
示例2: wxLogDebug
bool
hoxChesscapePlayer::_ParseIncomingCommand( const wxMemoryBuffer& data,
wxString& command,
wxString& paramsStr ) const
{
/* TODO: Force to convert the buffer to a string. */
const wxString contentStr =
wxString::FromUTF8( (const char*) data.GetData(), data.GetDataLen() );
if ( data.GetDataLen() > 0 && contentStr.empty() ) // failed?
{
wxLogDebug("%s: *WARN* Fail to convert [%d] data to string.",
__FUNCTION__, data.GetDataLen());
return false;
}
/* CHECK: The first character must be 0x10 */
if ( contentStr.empty() || contentStr[0] != 0x10 )
{
wxLogDebug("%s: *WARN* Invalid command = [%s].", __FUNCTION__, contentStr.c_str());
return false;
}
/* Chop off the 1st character */
const wxString actualContent = contentStr.Mid(1);
/* Extract the command and its parameters-string */
command = actualContent.BeforeFirst( '=' );
paramsStr = actualContent.AfterFirst('=');
return true; // success
}
示例3: ExtractKeyName
wxRegKey::StdKey wxRegKey::ExtractKeyName(wxString& strKey)
{
wxString strRoot = strKey.BeforeFirst(REG_SEPARATOR);
size_t ui;
for ( ui = 0; ui < nStdKeys; ui++ ) {
if ( strRoot.CmpNoCase(aStdKeys[ui].szName) == 0 ||
strRoot.CmpNoCase(aStdKeys[ui].szShortName) == 0 ) {
break;
}
}
if ( ui == nStdKeys ) {
wxFAIL_MSG(wxT("invalid key prefix in wxRegKey::ExtractKeyName."));
ui = HKCR;
}
else {
strKey = strKey.After(REG_SEPARATOR);
if ( !strKey.empty() && strKey.Last() == REG_SEPARATOR )
strKey.Truncate(strKey.Len() - 1);
}
return (StdKey)ui;
}
示例4: GetVarType
int mxVarWindow::GetVarType (int &line, wxString var_name) {
if (var_name.Contains("[")) var_name=var_name.BeforeFirst('[');
var_name.MakeUpper();
wxTreeItemIdValue cookie;
wxTreeItemId it = tree->GetFirstChild(tree->GetRootItem(),cookie);
while (it.IsOk()) {
range *r=(range*)tree->GetItemData(it);
if (/*r && */line>=r->from && line<=r->to) {
line = r->from;
break;
}
it = tree->GetNextSibling(it);
}
if (!it.IsOk()) return -1;
it = tree->GetFirstChild(it,cookie);
while (it.IsOk()) {
wxString it_text = tree->GetItemText(it);
if (it_text.Contains("[")) {
if (it_text.BeforeFirst('[').Upper()==var_name)
return GetVarType(it);
} else {
if (it_text.Upper()==var_name)
return GetVarType(it);
}
it = tree->GetNextSibling(it);
}
return -1;
}
示例5: ExecuteSayCommand
bool User::ExecuteSayCommand( const wxString& cmd ) const
{
if ( cmd.BeforeFirst(' ').Lower() == _T("/me") ) {
GetServer().DoActionPrivate( m_nick, cmd.AfterFirst(' ') );
return true;
} else return false;
}
示例6: SetParameters
void wxSheetCellFloatRendererRefData::SetParameters(const wxString& params)
{
if ( params.IsEmpty() )
{
// reset to defaults
SetWidth(-1);
SetPrecision(-1);
}
else
{
wxString tmp( params.BeforeFirst(_T(',')) );
if ( !tmp.IsEmpty() )
{
long width;
if ( tmp.ToLong(&width) )
SetWidth((int)width);
else
wxLogDebug(_T("Invalid wxSheetCellFloatRenderer width parameter string '%s ignored"), params.c_str());
}
tmp = params.AfterFirst(_T(','));
if ( !tmp.IsEmpty() )
{
long precision;
if ( tmp.ToLong(&precision) )
SetPrecision((int)precision);
else
wxLogDebug(_T("Invalid wxSheetCellFloatRenderer precision parameter string '%s ignored"), params.c_str());
}
}
}
示例7: conv_g_func
wxString conv_g_func(wxString input)//input = Function func_name parameters: int var1,char * var2,int var3 returns char*
{
wxString output,fname,rtype,params;
input = input.AfterFirst(' '); //input contains "func_name parameters: int var1,char * var2,int var3 returns char*"
fname = input.BeforeFirst(' ');
input = input.AfterFirst(' ');//input contains "parameters: int var1,char * var2,int var3 returns char*"
input = input.AfterFirst(' ');//input contains "int var1,char * var2,int var3 returns char*"
input.Replace("returns","%returns");//input contains "int var1,char * var2,int var3 %returns char*"
params = input.BeforeFirst('%');
if(params.Contains(wxT("none"))) params.Empty();
input = input.AfterFirst('%');
rtype = input.AfterFirst(' ');
output.Empty();
output<< rtype <<" " << fname << "(" << params <<");"; //output = char* func_name(int var1,char * var2,int var3);
return output;
}
示例8: if
void
hoxChesscapePlayer::_HandleTableCmd( const wxString& cmdStr )
{
const wxString tCmd = cmdStr.BeforeFirst(0x10);
wxString subCmdStr = cmdStr.AfterFirst(0x10);
if (!subCmdStr.empty() && subCmdStr[subCmdStr.size()-1] == 0x10)
subCmdStr = subCmdStr.substr(0, subCmdStr.size()-1);
wxLogDebug("%s: Processing tCmd = [%s]...", __FUNCTION__, tCmd.c_str());
if ( tCmd == "Settings" ) _HandleTableCmd_Settings( subCmdStr );
else if ( tCmd == "Invite" ) _HandleTableCmd_Invite( subCmdStr );
else
{
/* NOTE: The Chesscape server only support 1 table for now. */
hoxTable_SPtr pTable = _GetMyTable();
if ( ! pTable )
{
wxLogDebug("%s: *WARN* This player [%s] not yet joined any table.",
__FUNCTION__, this->GetId().c_str());
return;
}
if ( tCmd == "MvPts" ) _HandleTableCmd_PastMoves( pTable, subCmdStr );
else if ( tCmd == "Move" ) _HandleTableCmd_Move( pTable, subCmdStr );
else if ( tCmd == "GameOver" ) _HandleTableCmd_GameOver( pTable, subCmdStr );
else if ( tCmd == "OfferDraw" ) _HandleTableCmd_OfferDraw( pTable );
else if ( tCmd == "Clients" ) _HandleTableCmd_Clients( pTable, subCmdStr );
else if ( tCmd == "Unjoin" ) _HandleTableCmd_Unjoin( pTable, subCmdStr );
else
{
wxLogDebug("%s: *** Ignore this Table-command = [%s].", __FUNCTION__, tCmd.c_str());
}
}
}
示例9: AppendExtension
wxString wxFileDialogBase::AppendExtension(const wxString &filePath,
const wxString &extensionList)
{
// strip off path, to avoid problems with "path.bar/foo"
wxString fileName = filePath.AfterLast(wxFILE_SEP_PATH);
// if fileName is of form "foo.bar" it's ok, return it
int idx_dot = fileName.Find(wxT('.'), true);
if ((idx_dot != wxNOT_FOUND) && (idx_dot < (int)fileName.length() - 1))
return filePath;
// get the first extension from extensionList, or all of it
wxString ext = extensionList.BeforeFirst(wxT(';'));
// if ext == "foo" or "foo." there's no extension
int idx_ext_dot = ext.Find(wxT('.'), true);
if ((idx_ext_dot == wxNOT_FOUND) || (idx_ext_dot == (int)ext.length() - 1))
return filePath;
else
ext = ext.AfterLast(wxT('.'));
// if ext == "*" or "bar*" or "b?r" or " " then its not valid
if ((ext.Find(wxT('*')) != wxNOT_FOUND) ||
(ext.Find(wxT('?')) != wxNOT_FOUND) ||
(ext.Strip(wxString::both).empty()))
return filePath;
// if fileName doesn't have a '.' then add one
if (filePath.Last() != wxT('.'))
ext = wxT(".") + ext;
return filePath + ext;
}
示例10: UpdateClassInfo
void ClassListDialog::UpdateClassInfo(const wxString &itemName)
{
wxString classname = itemName.BeforeFirst(' ');
wxCheckBox *cb = static_cast<wxCheckBox*>(FindWindow(ID_SHOW_PROPERTIES_RECURSIVELY));
m_pTextCtrl->SetValue(
DumpClassInfo(wxClassInfo::FindClass(classname), cb->IsChecked()));
}
示例11: IsInPath
bool ArchiveTestSuite::IsInPath(const wxString& cmd)
{
wxString c = cmd.BeforeFirst(_T(' '));
#ifdef __WXMSW__
c += _T(".exe");
#endif
return !m_path.FindValidPath(c).empty();
}
示例12: BeforeAndAfter
void StringTestCase::BeforeAndAfter()
{
// Construct a string with 2 equal signs in it by concatenating its three
// parts: before the first "=", in between the two "="s and after the last
// one. This allows to avoid duplicating the string contents (which has to
// be different for Unicode and ANSI builds) in the tests below.
#if wxUSE_UNICODE
#define FIRST_PART L"letter"
#define MIDDLE_PART L"\xe9;\xe7a"
#define LAST_PART L"l\xe0"
#else // !wxUSE_UNICODE
#define FIRST_PART "letter"
#define MIDDLE_PART "e;ca"
#define LAST_PART "la"
#endif // wxUSE_UNICODE/!wxUSE_UNICODE
const wxString s(FIRST_PART wxT("=") MIDDLE_PART wxT("=") LAST_PART);
wxString r;
CPPUNIT_ASSERT_EQUAL( FIRST_PART, s.BeforeFirst('=', &r) );
CPPUNIT_ASSERT_EQUAL( MIDDLE_PART wxT("=") LAST_PART, r );
CPPUNIT_ASSERT_EQUAL( s, s.BeforeFirst('!', &r) );
CPPUNIT_ASSERT_EQUAL( "", r );
CPPUNIT_ASSERT_EQUAL( FIRST_PART wxT("=") MIDDLE_PART, s.BeforeLast('=', &r) );
CPPUNIT_ASSERT_EQUAL( LAST_PART, r );
CPPUNIT_ASSERT_EQUAL( "", s.BeforeLast('!', &r) );
CPPUNIT_ASSERT_EQUAL( s, r );
CPPUNIT_ASSERT_EQUAL( MIDDLE_PART wxT("=") LAST_PART, s.AfterFirst('=') );
CPPUNIT_ASSERT_EQUAL( "", s.AfterFirst('!') );
CPPUNIT_ASSERT_EQUAL( LAST_PART, s.AfterLast('=') );
CPPUNIT_ASSERT_EQUAL( s, s.AfterLast('!') );
#undef LAST_PART
#undef MIDDLE_PART
#undef FIRST_PART
}
示例13: AddMultiPathsToPathList
// static
void AudacityApp::AddMultiPathsToPathList(wxString multiPathString,
wxArrayString &pathList)
{
while (multiPathString != wxT("")) {
wxString onePath = multiPathString.BeforeFirst(wxPATH_SEP[0]);
multiPathString = multiPathString.AfterFirst(wxPATH_SEP[0]);
AddUniquePathToPathList(onePath, pathList);
}
}
示例14: AddDefinition
void CxxPreProcessor::AddDefinition(const wxString& def)
{
wxString macroName = def.BeforeFirst('=');
wxString macroValue = def.AfterFirst('=');
CxxPreProcessorToken token;
token.name = macroName;
token.value = macroValue;
m_tokens.insert(std::make_pair(macroName, token));
}
示例15: nomFromPlantePlusId0
wxString nomFromPlantePlusId0(wxString nom, int &idx, wxArrayInt *comboItems) { // specifique !!!
wxUniChar sep0 = '[';
wxUniChar sep1 = ']';
wxString beg0, rest0, beg1, rest1;
beg0 = nom.BeforeFirst(sep0, &rest0);
beg1 = rest0.BeforeFirst(sep1, &rest1);
idx = atoi(beg1);
comboItems->Add(atoi(beg1));
return rest1;
}