• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetLineCount函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetLineCount函数的典型用法代码示例。如果您正苦于以下问题:C++ GetLineCount函数的具体用法?C++ GetLineCount怎么用?C++ GetLineCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetLineCount函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetLineCount

int CxEdit::DeleteLine(int nLine, BOOL bScroll, int nCount /*= 1*/)
{
   if (nCount >= 1)
   {
      const int linecount = GetLineCount();
      const BOOL bFirstLine = (nLine == 0);
      const BOOL bLastLine  = (nLine == (linecount - 1));
      
//TRACE("%i,%i,%i\n", LineIndex(nLine - 1), LineLength(nLine - 1), LineIndex(nLine));

      const int nStartChar = (bLastLine && (!bFirstLine)) 
         ? (LineIndex(nLine - 1) + LineLength(nLine - 1) + 0) 
         : LineIndex(nLine);
      const int nEndChar   = ((nLine + nCount) >= linecount) 
         ? (LineIndex(linecount - 1) + LineLength(linecount - 1) + 0)
         : LineIndex(nLine + nCount);
      const BOOL bReadOnly = IsStyleReadOnly();

      if (bReadOnly)
      {
         SetReadOnly(FALSE);
      }
      SetSel(nStartChar, nEndChar, !bScroll); // end of edit text
      Clear();        // ..then delete
      GotoEnd(bScroll);
      if (bReadOnly)
      {
         SetReadOnly(TRUE);
      }
   }
   return GetLineCount();
}
开发者ID:burzumishi,项目名称:arnold,代码行数:32,代码来源:edit.cpp


示例2: GetFirstVisibleLine

/*
================
CSyntaxRichEditCtrl::GetVisibleRange
================
*/
CHARRANGE CSyntaxRichEditCtrl::GetVisibleRange(void) const
{
	RECT rectArea;
	int firstLine, lastLine;
	CHARRANGE range;

	firstLine = GetFirstVisibleLine();
	GetClientRect(&rectArea);
	lastLine = firstLine + (rectArea.bottom / (defaultCharFormat.yHeight / 20));

	if (lastLine >= GetLineCount()) {
		lastLine = GetLineCount() - 1;
	}

	range.cpMin = LineIndex(firstLine);

	if (range.cpMin < 0) {
		range.cpMin = 0;
	}

	range.cpMax = LineIndex(lastLine);

	if (range.cpMax == -1) {
		range.cpMax = range.cpMin + LineLength(range.cpMin);
	} else {
		range.cpMax += LineLength(range.cpMax);
	}

	if (range.cpMax >= GetTextLength()) {
		range.cpMax = GetTextLength() - 1;
	}

	return range;
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:39,代码来源:CSyntaxRichEditCtrl.cpp


示例3: BeginUndoAction

void ScintillaWrapper::forEachLine(PyObject* function)
{
	if (PyCallable_Check(function))
	{	
		BeginUndoAction();
		
		long lineCount = GetLineCount();
		for(int line = 0; line < lineCount;)
		{
			
			boost::python::object result = boost::python::call<boost::python::object>(function, GetLine(line), line, lineCount);
				
			if (result.is_none() || !PyInt_Check(result.ptr()))
			{
				++line;
			}
			else
			{
				line += PyInt_AsLong(result.ptr());
			}
			
			lineCount = GetLineCount();
		}

		EndUndoAction();
	}
}
开发者ID:juntalis,项目名称:PythonScript,代码行数:27,代码来源:ScintillaWrapper.cpp


示例4: GetLineCount

bool wxExTextFile::RunTool()
{
  if (!wxTextFile::Open(m_FileName.GetFullPath()))
  {
    return false;
  }

  m_Stats.m_Elements.Set(_("Files"), 1);

  if (m_Tool.IsCount())
  {
    m_Stats.m_Elements.Inc(_("Total Size"), m_FileName.GetStat().st_size);
    m_Stats.m_Elements.Inc(_("Lines"), GetLineCount());
  }

  if (GetLineCount() > 0)
  {
    if (!Parse())
    {
      Close();

      return false;
    }
  }

  if (m_Tool.IsStatisticsType())
  {
    if (m_Tool.GetId() == ID_TOOL_REPORT_KEYWORD)
    {
      if (!m_FileName.GetLexer().GetKeywordsString().empty())
      {
        IncActionsCompleted();
      }
    }

    ReportStatistics();
  }

  if (m_Modified && !m_FileName.GetStat().IsReadOnly())
  {
    if (!Write())
    {
      Close();

      return false;
    }
  }

  Close();

  return true;
}
开发者ID:hugofvw,项目名称:wxExtension,代码行数:52,代码来源:textfile.cpp


示例5: pIndexOf

    int pIndexOf(const wxString& sSearch,
                 bool bIncludeComments = false,
                 int iStart = 0)
    {
        wxString sTest = sSearch;
        sTest.MakeLower();
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
        for(size_t i = iStart; i < GetLineCount(); i++)
        {
            wxString sLine = GetLine(i);
            if(bIncludeComments || ! sLine.StartsWith(wxT("#")))
            {
                if(sLine.StartsWith(sTest))
                    return (int)i;
            }
        }
        return wxNOT_FOUND;
    }
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:26,代码来源:mimetype.cpp


示例6: GetFont

void ZToolTip::SetBounds(void)
{
	MFont* pFont = GetFont();

	char szName[MWIDGET_NAME_LENGTH];

	RemoveAnd(szName, m_bUseParentName==true?GetParent()->m_szName:m_szName);

	int nWidth = pFont->GetWidthWithoutAmpersand(szName);
	int nHeight = pFont->GetHeight();
	int x, y;
	
	GetPosAlignedWithParent(x, y, nWidth, nHeight);
	
	// 최소사이즈 16 size bitmap 일경우.. 32x32 규정?
	int w = max(nWidth+ZTOOLTIP_WIDTH_GAP*2,32);
	int h = max(nHeight+ZTOOLTIP_HEIGHT_GAP*2,32);

	if(w) {

//		int line = (w / (ZTOOLTIP_MAX_W-20))+1;
		int _max=0;
		int line = GetLineCount( szName , _max );
		int	_max_w = MAX_TOOLTIP_LINE_STRING*(pFont->GetWidth("b"));
		
		if(line) {
			w = _max_w;
			h = h + ((nHeight + ZTOOLTIP_LINE_GAP) * line);
		}
//		else w = min(w,_max_w);
	}

	MWidget::SetBounds(MRECT(x-ZTOOLTIP_WIDTH_GAP, y-ZTOOLTIP_HEIGHT_GAP,w,h));
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:34,代码来源:ZToolTip.cpp


示例7: DrawLines

	void CPlot::DrawLines(CDC *pDC)
	{
		// 遍历每一条曲线
		for(int i=0;i<GetLineCount();i++)
		{
			CLine* nLine = GetLineByIndex(i);
			//
			if(!nLine->IsShow || nLine->GetPointCount()<1){
				continue;
			}
			// 动态申请临时数组
			CPoint* nCPointArray = new CPoint[nLine->GetPointCount()];
			// 画笔
			CPen pen(nLine->LineType, nLine->LineWidth, nLine->LineColor);
			CPen *oldPen = pDC->SelectObject(&pen);
			// 坐标转化与处理
			for(int k=0;k<nLine->GetPointCount();k++)
			{
				// 将浮点数Point坐标数据转为整数
				int x = (int)(m_rectPlot.right-((m_axisX.GetRangeUpperLimit()-nLine->GetPointX(k))/(m_axisX.GetAxisRange())*m_rectPlot.Width()));
				int y = (int)(m_rectPlot.bottom - ((nLine->GetPointY(k)-m_axisY.GetRangeLowerLimit())/(m_axisY.GetAxisRange())*m_rectPlot.Height()));
				// 将转化后的值存入数组
				nCPointArray[k].x = x;
				nCPointArray[k].y = y;
			}
			// 绘制单条曲线
			DrawLine(pDC,&(this->m_rectPlot),nCPointArray,nLine->GetPointCount());
			// 释放数组空间
			if(nCPointArray){
				delete [] nCPointArray;
			}
			// 恢复画笔
			pDC->SelectObject(oldPen);
		}		
	}
开发者ID:Daice,项目名称:bmd101,代码行数:35,代码来源:Plot.cpp


示例8: GetSelection

void CCrystalEditView::OnEditDelete() 
{
	if (! QueryEditable() || m_pTextBuffer == NULL)
		return;

	CPoint ptSelStart, ptSelEnd;
	GetSelection(ptSelStart, ptSelEnd);
	if (ptSelStart == ptSelEnd)
	{
		if (ptSelEnd.x == GetLineLength(ptSelEnd.y))
		{
			if (ptSelEnd.y == GetLineCount() - 1)
				return;
			ptSelEnd.y ++;
			ptSelEnd.x = 0;
		}
		else
			ptSelEnd.x ++;
	}

	CPoint ptCursorPos = ptSelStart;
	ASSERT_VALIDTEXTPOS(ptCursorPos);
	SetAnchor(ptCursorPos);
	SetSelection(ptCursorPos, ptCursorPos);
	SetCursorPos(ptCursorPos);
	EnsureVisible(ptCursorPos);

	m_pTextBuffer->DeleteText(this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_DELETE); // [JRT]
}
开发者ID:open2cerp,项目名称:Open2C-ERP,代码行数:29,代码来源:CCrystalEditView.cpp


示例9: WriteHeader

void CLog::WriteHeader(const char *str )
{
	if (GetLineCount() == 0)
	{
		WriteLog(str);
	}
}
开发者ID:gnoses,项目名称:CNNObjectDetection,代码行数:7,代码来源:Common.cpp


示例10: Flush

void CLogEx::Flush()
{
	char str[10240] = {""};

	if (GetLineCount() == 0)
	{
		for (int i=0;i<(int)vecLogItem.size();i++)
		{
			strcat(str, vecLogItem[i].name);
			strcat(str, ",");
		}
		strcat(str, "\n");


		WriteHeader(str);
	}

	for (int i=0;i<(int)vecLogItem.size();i++)
	{			

		WriteLog("%s,", vecLogItem[i].str);	

	}
	WriteLog("\n");
}
开发者ID:gnoses,项目名称:CNNObjectDetection,代码行数:25,代码来源:Common.cpp


示例11: GetLineCount

bool wxSTEditorShell::SetMaxLines(int max_lines)
{
    m_max_lines = max_lines;
    if (m_max_lines < 0) return false;

    int total_lines = GetLineCount();
    total_lines     = wxMax(0, total_lines-1);

    // delete lines when more than m_max_lines, you'll eventually crash otherwise
    if (total_lines > m_max_lines)
    {
        BeginWriteable();

        int marker = MarkerGet(total_lines - m_max_lines);

        SetTargetStart(0);
        SetTargetEnd(PositionFromLine(total_lines - m_max_lines));
        ReplaceTarget(wxEmptyString);

        // wipe marker that has moved up if there shouldn't be a marker
        if ((marker & (1<<markerPrompt)) == 0)
            MarkerDelete(0, markerPrompt);

        EndWriteable();
        return true;
    }

    return false;
}
开发者ID:Aetherdyne,项目名称:glintercept,代码行数:29,代码来源:steshell.cpp


示例12: SetLimitText

void CEditLogB::Update () 
{
	//LOCK_BLOCK (_lock);

	if (!_init) {
		SetLimitText(_maxLine*1024);
		_init = true;
	}

	int lineCount = GetLineCount ();
	if (_maxLine < lineCount) {
		LockWindowUpdate();

		SetSel (0, LineIndex (lineCount - _maxLine*8/10));
		ReplaceSel ("");

		_textLength = GetWindowTextLength();
		LineScroll(_maxLine, 0);

		UnlockWindowUpdate();
	}

	for (int i=0, n=_logList.size (); i<n; ++i) {
		string &smsg = _logList[i];

		SetSel (_textLength, _textLength);
		ReplaceSel (smsg.c_str ());

		_textLength += smsg.length ();
	}
	_logList.clear ();
}
开发者ID:shuride,项目名称:macro-windows,代码行数:32,代码来源:EditLogB.cpp


示例13: GetLine

bool CodeEditor::GetStringRange(int cursor, int& b, int &e) const
{
	int cl = GetLine(cursor);
	cursor -= GetPos(cl);
	bool is_begin, is_end; //@@@@@@
	Vector<Point> list = GetLineString(GetWLine(cl), is_begin, is_end);
	int i = list.GetCount();
	while(--i >= 0 && (list[i].x > cursor || list[i].y < cursor))
		;
	if(i < 0)
		return false;
	int bl = cl, bp = list[i].x;
	int el = cl, ep = list[i].y;
	while(is_begin && bl > 0)
	{
		list = GetLineString(GetWLine(bl - 1), is_begin, is_end);
		if(list.IsEmpty() || !is_end)
			break;
		bl--;
		bp = list.Top().x;
	}
	while(el + 1 < GetLineCount() && ep >= GetLineLength(el))
	{
		list = GetLineString(GetWLine(el + 1), is_begin, is_end);
		if(list.IsEmpty() || !is_begin)
			break;
		el++;
		ep = list[0].y;
	}
	b = GetPos(bl, bp);
	e = GetPos(el, ep);
	return b < e;
}
开发者ID:ultimatepp,项目名称:mirror,代码行数:33,代码来源:Lang.cpp


示例14: GetLineCount

BOOL WINAPI duListCtrl::DeleteLine(int nIndex, BOOL fAdjust)
{
	int nLineCount = GetLineCount();
	if (nIndex < 0 || nIndex >= nLineCount)
		return FALSE;

	duPlugin *pDelete = m_vtLines[nIndex];
	if (pDelete == NULL)
		return FALSE;

	duRect rcDelete;
	pDelete->GetRect(&rcDelete);

	if (nIndex < m_nFirstLine)
		m_nFLTotalHeight -= rcDelete.Height();

	m_nViewCy -= rcDelete.Height();
	
	vector<duPlugin *>::iterator iterDelete = m_vtLines.begin() + nIndex;
	m_vtLines.erase(iterDelete);
	UpdateScroll();

	if (pDelete == m_pSel)
		m_pSel = NULL;

	if (pDelete == m_pHot)
		m_pHot = NULL;
	
	Plugin_Delete(pDelete);
	CompleteAdjustLine();

	return TRUE;
}
开发者ID:blueantst,项目名称:dulib,代码行数:33,代码来源:duListCtrl.cpp


示例15: GetLineCount

void Edit::OnGoto(wxCommandEvent &WXUNUSED(event)) {
  const wxString message = wxString::Format(_("Line number : 1 - %d"), GetLineCount());
  const long line_number = wxGetNumberFromUser(wxEmptyString, message, wxT("Go To Line"), 1, 1, 100, this);
  if (line_number > 0) {
    GotoLine(line_number - 1);
  }
}
开发者ID:8l,项目名称:objeck-lang,代码行数:7,代码来源:editor.cpp


示例16: SetMarginWidth

void IWnd_stc::UpdateMarginLineNumWidth(bool flag)
{
	BitFlags &flags(param.flags);

	if(!flags.get(FLAG_LINENUM))
	{
		if(m_nLineNumWidth==0)
		{
			return;
		}
		m_nLineNumWidth=0;
		SetMarginWidth(StcManager::LINE_NR_ID,0);
	}
	else
	{

		int _nWidth=3+(int)::log10(double(GetLineCount()));
		if(_nWidth<4) _nWidth=4;
		if(_nWidth>7) _nWidth=7;

		if(_nWidth==m_nLineNumWidth && !flag)
		{
			return;
		}
		m_nLineNumWidth=_nWidth;

		static const char* text="999999999999999";
		int wd=TextWidth (wxSTC_STYLE_LINENUMBER, wxString(text,m_nLineNumWidth));
		SetMarginWidth(StcManager::LINE_NR_ID,wd);
	}

}
开发者ID:xuanya4202,项目名称:ew_base,代码行数:32,代码来源:iwnd_stc.cpp


示例17: ClientToScreen

void CStatusCtrl::OnContextMenu(CWnd* pWnd, CPoint point)
{
    ClientToScreen(&point);

    CMenu menu;
    menu.LoadMenu(IDR_OUTPUTCONTEXT);

    CMenu* pPopup = menu.GetSubMenu(0);
    ASSERT(pPopup != NULL);
    CWnd* pWndPopupOwner = this;
    //while (pWndPopupOwner->GetStyle() & WS_CHILD)
    //	pWndPopupOwner = pWndPopupOwner->GetParent();

    if (!GetLineCount())
    {
        pPopup->EnableMenuItem(ID_OUTPUTCONTEXT_COPYTOCLIPBOARD,MF_GRAYED);
        pPopup->EnableMenuItem(ID_OUTPUTCONTEXT_CLEARALL,MF_GRAYED);
    }
    HCURSOR	hCursor;
    hCursor=AfxGetApp()->LoadStandardCursor( IDC_ARROW );
    m_doPopupCursor = TRUE;
    SetCursor(hCursor);

    pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y,
                           pWndPopupOwner);
}
开发者ID:sd-eblana,项目名称:bawx,代码行数:26,代码来源:StatusCtrl.cpp


示例18: GetClientRect

void CLineNumberEdit::UpdateTopAndBottom() 
/* ============================================================
	Function :		CLineNumberEdit::UpdateTopAndBottom
	Description :	Updates the top- and bottom line number 
					for the line number control.
 
	Return :		void
	Parameters :	none
	Usage :			Should be called as soon as the contents of 
					the control is changed.

   ============================================================*/
{

	CRect rect;
	GetClientRect( &rect );
	int maxline = GetLineCount() + m_LineDelta;

	// Height for individual lines
	int lineheight = m_zero.cy;

	// Calculate the number of lines to draw
	int topline = GetFirstVisibleLine() + m_LineDelta;
	if( ( topline + ( rect.Height() / lineheight ) ) < maxline )
		maxline = topline + ( rect.Height() / lineheight );

    if ( m_maxval > 0 && maxline > m_maxval + m_LineDelta )
        maxline = m_maxval + m_LineDelta;

	m_line.SetTopAndBottom( topline, maxline );

}
开发者ID:707wk,项目名称:Online-exercises,代码行数:32,代码来源:LineNumberEdit.cpp


示例19: trimWhitespace

/* TextEditor::trimWhitespace
 * Removes any unneeded whitespace from the ends of lines
 *******************************************************************/
void TextEditor::trimWhitespace()
{
	// Go through lines
	for (int a = 0; a < GetLineCount(); a++)
	{
		// Get line start and end positions
		int pos = GetLineEndPosition(a) - 1;
		int start = pos - GetLineLength(a);

		while (pos > start)
		{
			int chr = GetCharAt(pos);

			// Check for whitespace character
			if (chr == ' ' || chr == '\t')
			{
				// Remove character if whitespace
				Remove(pos, pos+1);
				pos--;
			}
			else
				break;	// Not whitespace, stop
		}
	}
}
开发者ID:macressler,项目名称:SLADE,代码行数:28,代码来源:TextEditor.cpp


示例20: fileTmp

bool wxTextFile::OnWrite(wxTextFileType typeNew, const wxMBConv& conv)
{
    wxFileName fn = m_strBufferName;

    // We do NOT want wxPATH_NORM_CASE here, or the case will not
    // be preserved.
    if ( !fn.IsAbsolute() )
        fn.Normalize(wxPATH_NORM_ENV_VARS | wxPATH_NORM_DOTS | wxPATH_NORM_TILDE |
                     wxPATH_NORM_ABSOLUTE | wxPATH_NORM_LONG);

    wxTempFile fileTmp(fn.GetFullPath());

    if ( !fileTmp.IsOpened() ) {
        wxLogError(_("can't write buffer '%s' to disk."), m_strBufferName.c_str());
        return false;
    }

    size_t nCount = GetLineCount();
    for ( size_t n = 0; n < nCount; n++ ) {
        fileTmp.Write(GetLine(n) +
                      GetEOL(typeNew == wxTextFileType_None ? GetLineType(n)
                                                            : typeNew),
                      conv);
    }

    // replace the old file with this one
    return fileTmp.Commit();
}
开发者ID:chromylei,项目名称:third_party,代码行数:28,代码来源:textfile.cpp



注:本文中的GetLineCount函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetLink函数代码示例发布时间:2022-05-30
下一篇:
C++ GetLine函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap