当前位置: 首页>>代码示例>>C++>>正文


C++ Accessor::LineStart方法代码示例

本文整理汇总了C++中Accessor::LineStart方法的典型用法代码示例。如果您正苦于以下问题:C++ Accessor::LineStart方法的具体用法?C++ Accessor::LineStart怎么用?C++ Accessor::LineStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Accessor的用法示例。


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

示例1: IsCommentLine

static bool IsCommentLine(int line, Accessor &styler) {
	int pos = styler.LineStart(line);
	int eol_pos = styler.LineStart(line + 1) - 1;
	for (int i = pos; i < eol_pos; i++) {
		char ch = styler[i];
		if (ch == '#')
			return true;
		else if (ch != ' ' && ch != '\t')
			return false;
	}
	return false;
}
开发者ID:MatiasNAmendola,项目名称:sqliteman,代码行数:12,代码来源:LexBash.cpp

示例2: IsCommentLine

static bool IsCommentLine(Sci_Position line, Accessor &styler) {
	Sci_Position pos = styler.LineStart(line);
	Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
	for (Sci_Position i = pos; i < eol_pos; i++) {
		char ch = styler[i];
		if (ch == '#')
			return true;
		else if (ch != ' ' && ch != '\t')
			return false;
	}
	return false;
}
开发者ID:OFFIS-Automation,项目名称:Framework,代码行数:12,代码来源:LexBash.cpp

示例3: GetStyleFirstWord

//
// Routine to find first none space on the current line and return its Style
// needed for comment lines not starting on pos 1
static int GetStyleFirstWord(Sci_PositionU szLine, Accessor &styler)
{
	Sci_Position nsPos = styler.LineStart(szLine);
	Sci_Position nePos = styler.LineStart(szLine+1) - 1;
	while (isspacechar(styler.SafeGetCharAt(nsPos)) && nsPos < nePos)
	{
		nsPos++; // skip to next char

	} // End While
	return styler.StyleAt(nsPos);

} // GetStyleFirstWord()
开发者ID:OFFIS-Automation,项目名称:Framework,代码行数:15,代码来源:LexAU3.cpp

示例4: IsCommentBlockStart

static bool IsCommentBlockStart(int line, Accessor &styler)
{
    int pos = styler.LineStart(line);
	int eol_pos = styler.LineStart(line + 1) - 1;
	for (int i = pos; i < eol_pos; i++) {
		char ch = styler[i];
		char chNext = styler[i+1];
        char style = styler.StyleAt(i);
		if ((style == SCE_VHDL_BLOCK_COMMENT) && (ch == '/') && (chNext == '*'))
			return true;
	}
	return false;
}
开发者ID:6VV,项目名称:NewTeachingBox,代码行数:13,代码来源:LexVHDL.cpp

示例5: GetStyleFirstWord

// Routine to find first none space on the current line and return its Style
// needed for comment lines not starting on pos 1
static int GetStyleFirstWord(int szLine, Accessor &styler)
{
	int startPos = styler.LineStart(szLine);
	int endPos = styler.LineStart(szLine + 1) - 1;
	char ch = styler.SafeGetCharAt(startPos);

	while (ch > 0 && isspacechar(ch) && startPos < endPos)
	{
		startPos++; // skip to next char
		ch = styler.SafeGetCharAt(startPos);
	}
	return styler.StyleAt(startPos);
}
开发者ID:JowC9V,项目名称:CLL-Synergie,代码行数:15,代码来源:LexPowerPro.cpp

示例6: IsCommentLine

static bool IsCommentLine(int line, Accessor &styler) {
	int pos = styler.LineStart(line);
	int eolPos = styler.LineStart(line + 1) - 1;
	for (int i = pos; i < eolPos; i++) {
		char ch = styler[i];
		char chNext = styler.SafeGetCharAt(i + 1);
		int style = styler.StyleAt(i);
		if (ch == '/' && chNext == '/' && style == SCE_PAS_COMMENTLINE) {
			return true;
		} else if (!IsASpaceOrTab(ch)) {
			return false;
		}
	}
	return false;
}
开发者ID:MatiasNAmendola,项目名称:sqliteman,代码行数:15,代码来源:LexPascal.cpp

示例7: IsTeXCommentLine

static bool IsTeXCommentLine(int line, Accessor &styler) {
	int pos = styler.LineStart(line);
	int eol_pos = styler.LineStart(line + 1) - 1;
	
	int startpos = pos;

	while (startpos<eol_pos){
		char ch = styler[startpos];
		if (ch!='%' && ch!=' ') return false;
		else if (ch=='%') return true;
		startpos++;
	}		

	return false;
}
开发者ID:MatiasNAmendola,项目名称:sqliteman,代码行数:15,代码来源:LexTeX.cpp

示例8: FoldSolDoc

static void FoldSolDoc(unsigned int startPos, int length, int initStyle,
						   WordList *[], Accessor &styler)
 {
	int lengthDoc = startPos + length;

	int lineCurrent = styler.GetLine(startPos);
	if (startPos > 0)
        {
          if (lineCurrent > 0)
          {
               lineCurrent--;
               startPos = styler.LineStart(lineCurrent);
               if (startPos == 0)
                    initStyle = SCE_SCRIPTOL_DEFAULT;
               else
                    initStyle = styler.StyleAt(startPos-1);
           }
	}
	int state = initStyle & 31;
	int spaceFlags = 0;
        int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsSolComment);
        if ((state == SCE_SCRIPTOL_TRIPLE))
             indentCurrent |= SC_FOLDLEVELWHITEFLAG;
	char chNext = styler[startPos];
	for (int i = startPos; i < lengthDoc; i++)
         {
		char ch = chNext;
		chNext = styler.SafeGetCharAt(i + 1);
		int style = styler.StyleAt(i) & 31;

		if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc))
                {
                   int lev = indentCurrent;
                   int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsSolComment);
                   if (style == SCE_SCRIPTOL_TRIPLE)
                        indentNext |= SC_FOLDLEVELWHITEFLAG;
                   if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG))
                    {
                        // Only non whitespace lines can be headers
                        if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
                        {
                              lev |= SC_FOLDLEVELHEADERFLAG;
                        }
                        else if (indentNext & SC_FOLDLEVELWHITEFLAG)
                        {
                             // Line after is blank so check the next - maybe should continue further?
                             int spaceFlags2 = 0;
                             int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsSolComment);
                             if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK))
                             {
                                   lev |= SC_FOLDLEVELHEADERFLAG;
                              }
                        }
                    }
                   indentCurrent = indentNext;
                   styler.SetLevel(lineCurrent, lev);
                   lineCurrent++;
		}
	}
}
开发者ID:JowC9V,项目名称:CLL-Synergie,代码行数:60,代码来源:LexScriptol.cpp

示例9: IsContinuationLine

static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
{
	int startPos = styler.LineStart(szLine);
	int endPos = styler.LineStart(szLine + 1) - 2;
	while (startPos < endPos)
	{
		char stylech = styler.StyleAt(startPos);
		if (!(stylech == SCE_POWERPRO_COMMENTBLOCK)) {
			char ch = styler.SafeGetCharAt(endPos);
			char chPrev = styler.SafeGetCharAt(endPos - 1);
			char chPrevPrev = styler.SafeGetCharAt(endPos - 2);
			if (ch > 0 && chPrev > 0 && chPrevPrev > 0 && !isspacechar(ch) && !isspacechar(chPrev) && !isspacechar(chPrevPrev) )
				return (chPrevPrev == ';' && chPrev == ';' && ch == '+');
			}
		endPos--; // skip to next char
	}
	return false;
}
开发者ID:JowC9V,项目名称:CLL-Synergie,代码行数:18,代码来源:LexPowerPro.cpp

示例10: LineEnd

static int LineEnd(int line, Accessor &styler)
{
    const int docLines = styler.GetLine(styler.Length() - 1);  // Available last line
    int eol_pos ;
    // if the line is the last line, the eol_pos is styler.Length()
    // eol will contain a new line, or a virtual new line
    if ( docLines == line )
        eol_pos = styler.Length() ;
    else
        eol_pos = styler.LineStart(line + 1) - 1;
    return eol_pos ;
}
开发者ID:6qat,项目名称:robomongo,代码行数:12,代码来源:LexAbaqus.cpp

示例11: IsContinuationLine

//
// Routine to check the last "none comment" character on a line to see if its a continuation
//
static bool IsContinuationLine(Sci_PositionU szLine, Accessor &styler)
{
	Sci_Position nsPos = styler.LineStart(szLine);
	Sci_Position nePos = styler.LineStart(szLine+1) - 2;
	//int stylech = styler.StyleAt(nsPos);
	while (nsPos < nePos)
	{
		//stylech = styler.StyleAt(nePos);
		int stylech = styler.StyleAt(nsPos);
		if (!(stylech == SCE_AU3_COMMENT)) {
			char ch = styler.SafeGetCharAt(nePos);
			if (!isspacechar(ch)) {
				if (ch == '_')
					return true;
				else
					return false;
			}
		}
		nePos--; // skip to next char
	} // End While
	return false;
} // IsContinuationLine()
开发者ID:OFFIS-Automation,项目名称:Framework,代码行数:25,代码来源:LexAU3.cpp

示例12: ColouriseMAXScriptDoc


//.........这里部分代码省略.........
			{
				if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\')
				{
					sc.Forward();
				}
			}
			else if (sc.ch == '\"')
			{
				sc.ForwardSetState(SCE_MAXSCRIPT_DEFAULT);
			}
			else if (sc.atLineEnd)
			{
				sc.ChangeState(SCE_MAXSCRIPT_STRINGEOL);
				sc.ForwardSetState(SCE_MAXSCRIPT_DEFAULT);
			}
		}

		// Determine if a new state should be entered.
		if (sc.state == SCE_MAXSCRIPT_DEFAULT)
		{
			// 数字(小数)
			if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)))
			{
				sc.SetState(SCE_MAXSCRIPT_NUMBER);
			}
			else if (IsAWordStart(sc.ch))
			{
				//单词的开始:标识符
				sc.SetState(SCE_MAXSCRIPT_IDENTIFIER);
			}
			// 注释行
			else if (sc.Match('-', '-'))
			{
				// 注释
				if (sc.Match("--!"))  // Nice to have a different comment style
					sc.SetState(SCE_MAXSCRIPT_COMMENTLINEBANG);
				else
					sc.SetState(SCE_MAXSCRIPT_COMMENT);
			}
            else if( sc.Match('/', '/') )
			{
				if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!"))
					sc.SetState(SCE_MAXSCRIPT_COMMENTLINEBANG);
				else
					sc.SetState(SCE_MAXSCRIPT_COMMENT);
			}
			else if (sc.Match('/', '*'))
			{
				if (sc.Match("/**") || sc.Match("/*!"))
				{
					sc.SetState(SCE_MAXSCRIPT_COMMENTLINEBANG);
				}
				else
				{
					sc.SetState(SCE_MAXSCRIPT_COMMENT);
				}
				sc.Forward();	// Eat the * so it isn't used for the end of the comment
			}
			else if (sc.ch == '\"')
			{
				sc.SetState(SCE_MAXSCRIPT_STRING);
			}
			else if (sc.Match('@', '\"'))
			{
				sc.SetState(SCE_MAXSCRIPT_STRING);
				sc.Forward();
			}
			else if (isoperator(static_cast<char>(sc.ch))) 
			{
				sc.SetState(SCE_MAXSCRIPT_OPERATOR);
			}
		}
	}
	sc.Complete();
}

//=============================================================================
// 是否是注释行:-- // /**/
static bool IsCommentLine(int line, Accessor &styler)
{
	int pos = styler.LineStart(line);
	int eol_pos = styler.LineStart(line + 1) - 1;	
	for (int i = pos; i < eol_pos; i++)
	{
		char ch = styler[i];
		char chNext = styler[i+1];
		if ((ch == '-') && (chNext == '-'))
			return true;
		else if((ch == '/') && (chNext == '/'))
			return true;
		else if((ch == '/') && (chNext == '*'))
		{
			// 这里是否是要判断一下最后是不是"*/"
			return true;
		}	
		else if (ch != ' ' && ch != '\t')
			return false;
	}
	return false;
}
开发者ID:jzsun,项目名称:MaxscriptEditor,代码行数:101,代码来源:LexMAXscript.cpp

示例13: Fold

void LexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle,
	  WordList *keywordlists[], Accessor &styler) const {
	if (fnFolder) {
		int lineCurrent = styler.GetLine(startPos);
		// Move back one line in case deletion wrecked current line fold state
		if (lineCurrent > 0) {
			lineCurrent--;
			int newStartPos = styler.LineStart(lineCurrent);
			lengthDoc += startPos - newStartPos;
			startPos = newStartPos;
			initStyle = 0;
			if (startPos > 0) {
				initStyle = styler.StyleAt(startPos - 1);
			}
		}
		fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler);
	}
}
开发者ID:Aahanbhatt,项目名称:robomongo,代码行数:18,代码来源:LexerModule.cpp

示例14: FoldMatlabOctaveDoc

static void FoldMatlabOctaveDoc(unsigned int startPos, int length, int,
                                WordList *[], Accessor &styler,
                                bool (*IsComment)(Accessor&, int, int)) {

	int endPos = startPos + length;

	// Backtrack to previous line in case need to fix its fold status
	int lineCurrent = styler.GetLine(startPos);
	if (startPos > 0) {
		if (lineCurrent > 0) {
			lineCurrent--;
			startPos = styler.LineStart(lineCurrent);
		}
	}
	int spaceFlags = 0;
	int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsComment);
	char chNext = styler[startPos];
	for (int i = startPos; i < endPos; i++) {
		char ch = chNext;
		chNext = styler.SafeGetCharAt(i + 1);

		if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) {
			int lev = indentCurrent;
			int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsComment);
			if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
				// Only non whitespace lines can be headers
				if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
					lev |= SC_FOLDLEVELHEADERFLAG;
				} else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
					// Line after is blank so check the next - maybe should continue further?
					int spaceFlags2 = 0;
					int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsComment);
					if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
						lev |= SC_FOLDLEVELHEADERFLAG;
					}
				}
			}
			indentCurrent = indentNext;
			styler.SetLevel(lineCurrent, lev);
			lineCurrent++;
		}
	}
}
开发者ID:Aahanbhatt,项目名称:robomongo,代码行数:43,代码来源:LexMatlab.cpp

示例15: FoldFlagShipDoc

static void FoldFlagShipDoc(unsigned int startPos, int length, int,
									WordList *[], Accessor &styler)
{

	int endPos = startPos + length;

	// Backtrack to previous line in case need to fix its fold status
	int lineCurrent = styler.GetLine(startPos);
	if (startPos > 0 && lineCurrent > 0) {
			lineCurrent--;
			startPos = styler.LineStart(lineCurrent);
	}
	int spaceFlags = 0;
	int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags);
	char chNext = styler[startPos];
	for (int i = startPos; i < endPos; i++) {
		char ch = chNext;
		chNext = styler.SafeGetCharAt(i + 1);

		if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos-1)) {
			int lev = indentCurrent;
			int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags);
			if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
				if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
					lev |= SC_FOLDLEVELHEADERFLAG;
				} else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
					int spaceFlags2 = 0;
					int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2);
					if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
						lev |= SC_FOLDLEVELHEADERFLAG;
					}
				}
			}
			indentCurrent = indentNext;
			styler.SetLevel(lineCurrent, lev);
			lineCurrent++;
		}
	}
}
开发者ID:6VV,项目名称:NewTeachingBox,代码行数:39,代码来源:LexFlagship.cpp


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