本文整理汇总了C++中CStr::GetToken方法的典型用法代码示例。如果您正苦于以下问题:C++ CStr::GetToken方法的具体用法?C++ CStr::GetToken怎么用?C++ CStr::GetToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStr
的用法示例。
在下文中一共展示了CStr::GetToken方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxBoxSizer
CShowOneDescriptionDlg::CShowOneDescriptionDlg(wxWindow * parent, const char * title, const char * description)
:CResizableDlg( parent, wxString::FromUTF8(title), SZ_SECT_WND_DESCR_ONE)
{
wxBoxSizer * topsizer = new wxBoxSizer( wxVERTICAL );
wxButton * pBtnDone = new wxButton (this, wxID_CANCEL, wxT("Done") );
wxButton * pBtnSave = new wxButton (this, wxID_OK , wxT("Save as") );
//wxTextCtrl * pText = new wxTextCtrl(this, -1, description, wxDefaultPosition, wxDefaultSize,
// wxTE_MULTILINE | wxTE_READONLY | wxHSCROLL );
wxTextCtrl * pText = new wxTextCtrl(this, -1, wxT(""), wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxTE_READONLY | wxHSCROLL );
const char * p;
int count = 0;
CStr S;
topsizer->Add( pText ,
1, // make vertically stretchable
wxEXPAND );//| wxALL, // make horizontally stretchable // and make border all around
wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
button_sizer->Add( pBtnSave, 0, wxALL, 10 );
button_sizer->Add( pBtnDone, 0, wxALL, 10 );
topsizer->Add( button_sizer, 0, wxALIGN_CENTER );
SetAutoLayout( TRUE ); // tell dialog to use sizer
SetSizer( topsizer ); // actually set the sizer
topsizer->Fit( this ); // set size to minimum size as calculated by the sizer
topsizer->SetSizeHints( this ); // set size hints to honour mininum size}
pText->SetFocus();
pBtnDone ->SetDefault();
CResizableDlg::SetSize();
pText->SetValue(wxString::FromAscii(description));
pText->SetFont(*gpApp->m_Fonts[FONT_VIEW_DLG]);
m_descr = description;
p = description;
while (p && *p && count++ < 3)
{
p = S.GetToken(p, '(', TRIM_ALL);
p = S.GetToken(p, ')', TRIM_ALL);
if (gpApp->SelectLand(S.GetData()))
break;
}
}
示例2: OnLBSelect
void CShowDescriptionListDlg::OnLBSelect(wxCommandEvent & event)
{
CBaseObject * pObj;
CStr S;
const char * p;
pObj = (CBaseObject*)m_pItems->At((long)m_pList->GetClientData(m_pList->GetSelection()));
if (pObj)
{
p = pObj->Name.GetData();
while (p && *p)
{
p = S.GetToken(p, '(', TRIM_ALL);
p = S.GetToken(p, ')', TRIM_ALL);
if (gpApp->SelectLand(S.GetData()))
break;
}
}
}
示例3: wxT
CComboboxDlg::CComboboxDlg(wxWindow *parent, const char * szTitle, const char * szMessage, const char * szChoices)
:wxDialog(parent, -1, wxString::FromAscii(szTitle), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
{
wxBoxSizer * topsizer;
wxBoxSizer * sizer ;
CStr S;
wxButton * btnOk;
wxButton * btnCancel;
btnOk = new wxButton (this, wxID_OK , wxT("Ok") );
btnCancel = new wxButton (this, wxID_CANCEL, wxT("Cancel") );
m_cbChoices = new wxComboBox(this, -1, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN);
topsizer = new wxBoxSizer( wxVERTICAL );
topsizer->Add(new wxStaticText(this, -1, wxString::FromAscii(szMessage)), 0, wxALIGN_LEFT | wxALL, 5);
topsizer->Add(m_cbChoices , 0, wxALIGN_CENTER | wxALL | wxGROW, 5);
sizer = new wxBoxSizer( wxHORIZONTAL );
sizer->Add(btnOk , 0, wxALIGN_CENTER | wxALL, 5);
sizer->Add(btnCancel, 0, wxALIGN_CENTER | wxALL, 5);
topsizer->Add(sizer, 0, wxALIGN_CENTER | wxALL, 10);
while (szChoices && *szChoices)
{
szChoices = S.GetToken(szChoices, ',');
m_cbChoices->Append(wxString::FromAscii(S.GetData()));
}
SetAutoLayout( TRUE ); // tell dialog to use sizer
SetSizer( topsizer ); // actually set the sizer
topsizer->Fit( this ); // set size to minimum size as calculated by the sizer
topsizer->SetSizeHints( this ); // set size hints to honour mininum size}
m_cbChoices->SetFocus();
btnOk->SetDefault();
Centre( wxBOTH | wxCENTER_FRAME);
}
示例4: OnPopupMenuAddUnitToTracking
void CUnitPane::OnPopupMenuAddUnitToTracking (wxCommandEvent& WXUNUSED(event))
{
long idx = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
CUnit * pUnit = GetUnit(idx);
int sectidx;
CStr S;
const char * szName;
const char * szValue;
BOOL found = FALSE;
BOOL ManyUnits = (GetSelectedItemCount() > 1);
sectidx = gpApp->GetSectionFirst(SZ_SECT_UNIT_TRACKING, szName, szValue);
while (sectidx >= 0)
{
if (!S.IsEmpty())
S << ",";
S << szName;
sectidx = gpApp->GetSectionNext(sectidx, SZ_SECT_UNIT_TRACKING, szName, szValue);
}
if (S.IsEmpty())
S = "Default";
if (pUnit || ManyUnits)
{
CComboboxDlg dlg(this, "Add unit to a tracking group", "Select a group to add unit to.\nTo create a new group, just type in it's name.", S.GetData());
if (wxID_OK == dlg.ShowModal())
{
idx = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
while (idx>=0)
{
pUnit = GetUnit(idx);
found = FALSE;
szValue = gpApp->GetConfig(SZ_SECT_UNIT_TRACKING, dlg.m_Choice.GetData());
while (szValue && *szValue)
{
szValue = S.GetToken(szValue, ',');
if (atol(S.GetData()) == pUnit->Id)
{
found = TRUE;
break;
}
}
if (found)
wxMessageBox(wxT("The unit is already in the group."));
else
{
S = gpApp->GetConfig(SZ_SECT_UNIT_TRACKING, dlg.m_Choice.GetData());
S.TrimRight(TRIM_ALL);
if (!S.IsEmpty())
S << ",";
S << pUnit->Id;
gpApp->SetConfig(SZ_SECT_UNIT_TRACKING, dlg.m_Choice.GetData(), S.GetData());
}
idx = GetNextItem(idx, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
}
}
}
}