當前位置: 首頁>>代碼示例>>C++>>正文


C++ Cut函數代碼示例

本文整理匯總了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();
}
開發者ID:Serguei666,項目名稱:WalCommander,代碼行數:27,代碼來源:vfs-smb.cpp

示例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);
        }
    }
}
開發者ID:bernhardfritz,項目名稱:Bachelorarbeit,代碼行數:13,代碼來源:TectonicPlateSimulation.cpp

示例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;
}
開發者ID:crazymonkeylyc,項目名稱:my_solutions,代碼行數:29,代碼來源:2002.cpp

示例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();
}
開發者ID:jalmond,項目名稱:LQanalyzer,代碼行數:31,代碼來源:SkimFlatCat.C

示例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();
}
開發者ID:CustomCardsOnline,項目名稱:wxWidgets,代碼行數:28,代碼來源:textctrl_osx.cpp

示例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);
}
開發者ID:kanglmf,項目名稱:emacs-chinese-word-segmentation,代碼行數:27,代碼來源:chinese-word-segmentation.c

示例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);
 }
開發者ID:C-sjia,項目名稱:cppjieba,代碼行數:7,代碼來源:MPSegment.hpp

示例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);
}
開發者ID:KurzedMetal,項目名稱:Jaangle,代碼行數:25,代碼來源:ColorEdit.cpp

示例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;
}
開發者ID:ScorpioJonesy,項目名稱:audacity,代碼行數:28,代碼來源:Track.cpp

示例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);
	}
    }
}
開發者ID:AhmedAMohamed,項目名稱:graphviz,代碼行數:35,代碼來源:bcomps.c

示例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;
}
開發者ID:Dennis-Petrov,項目名稱:Cash,代碼行數:31,代碼來源:ECR.cpp

示例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);
}
開發者ID:beketa,項目名稱:jot-for-X01SC,代碼行數:33,代碼來源:MyComboBox.cpp

示例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);
	}
}
開發者ID:andrewpaterson,項目名稱:Codaphela.Library,代碼行數:28,代碼來源:PlainTextEditor.cpp

示例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();
}
開發者ID:tlogger,項目名稱:TMon,代碼行數:31,代碼來源:SimpleReport.cpp

示例15: Cut

void fbtTextFile::cutEvent(wxCommandEvent& evt)
{
	if (GetReadOnly()  || GetSelectionEnd() - GetSelectionStart() <= 0)
		return;
	Cut();

}
開發者ID:Ali-il,項目名稱:gamekit,代碼行數:7,代碼來源:fbtTextFile.cpp


注:本文中的Cut函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。