本文整理匯總了C++中Cut函數的典型用法代碼示例。如果您正苦於以下問題:C++ Cut函數的具體用法?C++ Cut怎麽用?C++ Cut使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Cut函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: Clear
char* PathBuffer::Set( const char* path )
{
Clear();
if ( !currentFsParam ) { return p.data(); }
if ( currentFsParam->server[0] )
{
if ( currentFsParam->user[0] )
{
Cut( const_cast<char*>( currentFsParam->user ) );
Cut( "@" );
}
Cut( const_cast<char*>( currentFsParam->server ) );
Cut( "/" );
}
if ( path )
{
if ( path[0] == '/' ) { path++; }
Cut( path );
}
return p.data();
}
示例2: v1
void TectonicPlateSimulation::randomCut(int n = 1) {
for(int i = 0; i < n; i++) {
if(drand48() < 0.5) {
b2Vec2 v1(-20, drand48() * 40);
b2Vec2 v2(20, drand48() * 40);
Cut(v1, v2);
} else {
b2Vec2 v1(drand48() * 40 - 20, 0);
b2Vec2 v2(drand48() * 40 - 20, 40);
Cut(v1, v2);
}
}
}
示例3: main
int main()
{
int n, m, op;
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", K + i);
for (int i = 0; i < n; i++) Link(&T[i], &T[min(i + K[i], n)]);
scanf("%d", &m);
while (m--)
{
scanf("%d", &op);
if (op == 1)
{
int x;
scanf("%d", &x);
makeRoot(&T[n]);
access(&T[x]), splay(&T[x]);
printf("%d\n", T[x].ch[0] ? T[x].ch[0]->sz : 0);
}
if (op == 2)
{
int x, y;
scanf("%d%d", &x, &y);
Cut(&T[x], &T[min(x + K[x], n)]);
K[x] = y;
Link(&T[x], &T[min(x + K[x], n)]);
}
}
return 0;
}
示例4: TFile
void SkimFlatCat::Loop()
{
if (fChain == 0) return;
TFile *skimfile = new TFile("Skim.root","recreate");
fChain->LoadTree(0);
TTree *newtree = fChain->CloneTree(0);
Long64_t nentries = fChain->GetEntriesFast();
Int_t nselected = 0;
Long64_t nbytes = 0, nb = 0;
for (Long64_t jentry=0; jentry<nentries;jentry++) {
if(!(jentry%10000)) std::cout << jentry << " : "<< fChain->GetEntries() << std::endl;
Long64_t ientry = LoadTree(jentry);
if (ientry < 0) break;
nb = fChain->GetEntry(jentry); nbytes += nb;
if (Cut(ientry) < 0) continue;
nselected++;
newtree->Fill();
}
std::cout << "Selected " << nselected << " out of " << fChain->GetEntries() << std::endl;
newtree->Write();
skimfile->Close();
}
示例5: switch
void wxTextCtrl::OnKeyDown(wxKeyEvent& event)
{
if ( event.GetModifiers() == wxMOD_CONTROL )
{
switch( event.GetKeyCode() )
{
case 'A':
SelectAll();
return;
case 'C':
if ( CanCopy() )
Copy() ;
return;
case 'V':
if ( CanPaste() )
Paste() ;
return;
case 'X':
if ( CanCut() )
Cut() ;
return;
default:
break;
}
}
// no, we didn't process it
event.Skip();
}
示例6: cut_input
void cut_input (char *DICT_PATH, char *HMM_PATH, char *USER_DICT) {
char *s;
Jieba handle = NewJieba (DICT_PATH, HMM_PATH, USER_DICT);
setlocale (LC_ALL, "");
printf ("Chinese word segmentation\n=========================\n\n");
while (s = getstr ()) {
if (strcmp (s, "EOF") == 0) {
free (s);
printf ("bye\n");
break;
} else {
size_t len = strlen (s);
CJiebaWord* words = Cut (handle, s, len);
CJiebaWord* x;
for (x = words; x && x->word; x++) {
/* printf ("%*.*s/", x->len, x->len, x->word); */
printf ("%d ", x->len / CJIEBA_WCHAR_SIZE);
}
printf ("\n");
free (s);
FreeWords (words);
}
}
FreeJieba (handle);
}
示例7: Cut
void Cut(const string& sentence,
vector<string>& words,
size_t max_word_len) const {
vector<Word> tmp;
Cut(sentence, tmp, max_word_len);
GetStringsFromWords(tmp, words);
}
示例8: switch
void CColorEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
switch (nChar)
{
case 0x01:// Ctrl-A => handle SELECT_ALL
SetSel(0, -1);
return;
case 0x03:// Ctrl-C => handle WM_COPY
Copy();
return;
case 0x16:// Ctrl-V => handle WM_PASTE
Paste();
return;
case 0x18:// Ctrl-X => handle WM_CUT
Cut();
return;
case 0x1A:// Ctrl-Z => handle ID_EDIT_UNDO (EM_UNDO)
if(CanUndo())
Undo();
return;
}
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
示例9: Cut
bool Track::SyncLockAdjust(double oldT1, double newT1)
{
if (newT1 > oldT1) {
// Insert space within the track
if (oldT1 > GetEndTime())
return true;
Track *tmp;
bool ret;
ret = Cut(oldT1, GetEndTime(), &tmp);
if (!ret) return false;
ret = Paste(newT1, tmp);
wxASSERT(ret);
delete tmp;
return ret;
}
else if (newT1 < oldT1) {
// Remove from the track
return Clear(newT1, oldT1);
}
// fall-through: no change
return true;
}
示例10: dfs
static void
dfs(Agraph_t * g, Agnode_t * u, bcstate * stp, Agnode_t * parent)
{
Agnode_t *v;
Agedge_t *e;
Agedge_t *ep;
Agraph_t *sg;
stp->count++;
Low(u) = N(u) = stp->count;
for (e = agfstedge(g, u); e; e = agnxtedge(g, e, u)) {
if ((v = aghead(e)) == u)
v = agtail(e);
if (v == u)
continue;
if (N(v) == 0) {
push(&stp->stk, e);
dfs(g, v, stp, u);
Low(u) = min(Low(u), Low(v));
if (Low(v) >= N(u)) { /* u is an articulation point */
Cut(u) = 1;
sg = mkBlock(g, stp);
do {
ep = pop(&stp->stk);
agsubnode(sg, aghead(ep), 1);
agsubnode(sg, agtail(ep), 1);
} while (ep != e);
}
} else if (parent != v) {
Low(u) = min(Low(u), N(v));
if (N(v) < N(u))
push(&stp->stk, e);
}
}
}
示例11: OpenDocument
STDMETHODIMP CECR::MoveCash(BSTR FirmID, LONG Money, LONG DirectionIn, LONG* ErrorCode)
{
DWORD dwDocType;
DirectionIn ? dwDocType = CashInDocument : dwDocType = CashOutDocument;
// открыть документ
OpenDocument(FirmID, DEP_NO, ErrorCode, dwDocType);
if (*ErrorCode == E_SUCCESS)
{
PrintBuffer(FirmID, ErrorCode);
if (*ErrorCode == E_SUCCESS)
{
InitCmd();
// команда
to_numeric(214, m_Cmd, 3, m_Len); //SETTENDER
// пароль
to_char(OPERATOR_PASSWD, m_Cmd + m_Len, 4, m_Len);
// тип оплаты
to_numeric(0, m_Cmd + m_Len, 2, m_Len);
// сумма
to_smoney(Money, m_Cmd + m_Len, 10, m_Len);
m_RspLen = 11;
m_ECRList.PassCmd(FirmID, m_Cmd, m_Len, m_Rsp, m_RspLen, ErrorCode);
if (*ErrorCode == E_SUCCESS)
Cut(FirmID, 1, ErrorCode);
}
}
return S_OK;
}
示例12: switch
BOOL CMyComboBox::PreTranslateMessage(MSG* pMsg)
{
bool ctrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
if ( pMsg->message == WM_KEYDOWN){
switch( pMsg->wParam ){
case 'C':
if ( ctrl ){
Copy();
return TRUE;
}
break;
case 'X':
if ( ctrl ) {
Cut();
return TRUE;
}
break;
case 'V':
if ( ctrl ) {
Paste();
return TRUE;
}
break;
case VK_DOWN:
if ( GetDroppedState() == FALSE ){
ShowDropDown( TRUE );
}
break;
}
}
return CComboBox::PreTranslateMessage(pMsg);
}
示例13: GetCharCountAlongLine
void CPlainTextEditor::CutLine(CChars* pszDest)
{
int iCount;
int iStart;
int iEnd;
if (!IsSelected())
{
iCount = GetCharCountAlongLine(miEditPos);
iStart = FindStartOfLine(miEditPos);
iEnd = FindEndOfLine(miEditPos);
if (CanGoRight(iEnd))
{
iEnd++;
}
pszDest->AppendSubString(mszText, iStart, iEnd);
mszText.Remove(iStart, iEnd);
ResetUpDown();
miEditPos = FindPositionAlongLine(iStart, iCount);
}
else
{
Cut(pszDest);
}
}
示例14: GetSelectedRows
void CSimpleReport::RowDownMulti()
{
CXTPReportSelectedRows* pRows = GetSelectedRows();
if (!pRows)
return;
int total = GetRows()->GetCount() - 1;
int cnt = pRows->GetCount();
CXTPReportRow* pRow = pRows->GetAt(cnt-1); // 선택 영역의 마지막 row
if (!pRow)
return;
int n = pRow->GetIndex();
if (n >= total) // 더이상 내려갈 수 없음
return;
// 마지막 row 뒤에 paste하기 위해 m_bAdd를 true로 만듬.
// 그럼 cut후 add가 됨
if (n+1 >= total)
m_bAdd = true;
// focus는 cut된 시점에서 첫번째로 잡음.
pRow = pRows->GetAt(0);
n = pRow->GetIndex();
Cut(); // 컷하면 선택된 갯수는 제거되므로 total-cnt가
RowSetFocused(n+1);
Paste();
SetFocus();
}
示例15: Cut
void fbtTextFile::cutEvent(wxCommandEvent& evt)
{
if (GetReadOnly() || GetSelectionEnd() - GetSelectionStart() <= 0)
return;
Cut();
}