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

C++ NextChar函数代码示例

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

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



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

示例1: ASSERT

void TFunctionScanner::SkipString(const TChar*& text)
{
	TChar	terminator = *text;
	ASSERT(terminator == '\'' || terminator == '\"');
	NextChar(text);
	
	TChar previous = 0;
	TChar previous2 = 0;
	
	while (1)
	{
		TChar ch = *text;
		
		if (ch == terminator && (previous != '\\' || previous2 == '\\'))
		{
			NextChar(text);
			break;
		}
	
		previous2 = previous;
		previous = ch;
		NextChar(text);
	}
}
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:24,代码来源:TFunctionScanner.cpp


示例2: NextChar

bool wxTextInputStream::EatEOL(const wxChar &c)
{
    if (c == wxT('\n')) return true; // eat on UNIX

    if (c == wxT('\r')) // eat on both Mac and DOS
    {
        wxChar c2 = NextChar();
        if(c2 == wxEOT) return true; // end of stream reached, had enough :-)

        if (c2 != wxT('\n')) UngetLast(); // Don't eat on Mac
        return true;
    }

    return false;
}
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:15,代码来源:txtstrm.cpp


示例3: NextChar

// Read string up to terminating quote, ignoring embedded double quotes
void Lexer::ScanString(int stringStart)
{
	char ch;
	do
	{
		ch = NextChar();
		if (!ch)
		{
			CompileError(TEXTRANGE(stringStart, CharPosition()), LErrStringNotClosed);
		}
		else
		{
			if (ch == STRINGDELIM)
			{
				// Possible termination or double quotes
				if (PeekAtChar() == STRINGDELIM)
					ch = NextChar();
				else
					break;
			}
			*tp++ = ch;
		}
	} while (ch);
}
开发者ID:brunobuzzi,项目名称:DolphinVM,代码行数:25,代码来源:lexer.cpp


示例4: NextName

bool FarXMLScanner::ParseAttribute (FarXMLNode *node)
{
    FarString attrName = NextName();
  if (attrName.IsEmpty())
    return false;
    SkipWhitespace();
  if (!NextExpectedChar ('='))
    return false;
  SkipWhitespace();

  char valueDelimiter = NextChar();
  if (valueDelimiter != '\'' && valueDelimiter != '\"')
  {
    ReportError ("\" or \'");
    return false;
  }

  FarString attrValue;
  while (1)
  {
    char c = NextChar();
    if (c == valueDelimiter)
      break;
    else if (c == '&')
    {
      int entityValue = ParseEntity();
      if (entityValue == -1)
        return false;
      attrValue += (char) entityValue;
    }
    else
            attrValue += c;
  }
  node->AddAttr (attrName, attrValue);
  return true;
}
开发者ID:Maximus5,项目名称:evil-programmers,代码行数:36,代码来源:FARXml.cpp


示例5: malloc

// creates a new pathame string that is a dup of the input pathname, with the
// extension (if any) replaced by the given extension.
CHAR * NEAR CloneNameAddExt
(
    CHAR * szInputFile,
    CHAR * szExt
)
{
    CHAR * szFile;
    CHAR * pExt;
    CHAR * pch;

    // CONSIDER:
    // assumes the extension is no more than 3 bytes incl '.' (ie non-DBCS)
    // (This is true for the moment - can it ever change???)

    // alloc string with enough space for ".", extension, and null
    szFile = malloc(strlen(szInputFile)+1+3+1);
    strcpy(szFile, szInputFile); 	// start with input file name

    // find "." (if present) that occurs after last \ or /.
    pExt = NULL;
    for (pch = szFile; *pch; NextChar(pch))
	{
	    switch (*pch)
		{
#ifdef	MAC
		case ':':
		case ' ':       // start search over at a space
#else	//MAC
		case '\\':
		case '/':
#endif	//MAC
		    pExt = NULL;
		    break;
		case '.':
		    pExt = pch;
		    break;
		default:
		    ;
		}
	}
    if (pExt == NULL)	// if no extension after last '\', then
	pExt = pch;	// append an extension to the name.

    strcpy (pExt, szExt);	// replace extension (if present) with
				// desired extension

    return szFile;
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:50,代码来源:mktyplib.c


示例6: NextExpectedChar

 bool NextExpectedChar (char expected)
 {
   char c = NextChar();
   if (c != expected)
   {
     if (fErrorSink != NULL)
     {
       char buf [2];
       buf [0] = expected;
       buf [1] = '\0';
       fErrorSink->ReportError (fCurLine, GetCurColumn(), buf);
     }
     return false;
   }
   return true;
 }
开发者ID:Maximus5,项目名称:evil-programmers,代码行数:16,代码来源:FARXml.cpp


示例7: NextChar

bool Parser::ParseKeyword(Statement* statement)
{
	// ["?"]
	if (GetCurrentChar() == '?') {
		NextChar();
		statement->SetType(Statement::kQuery);
	}
	// Keyword
	BString* keyword = fScanner.ScanIdent();
	if (keyword == NULL) {
		Error("Identifier expected");
		return false;
	}
	statement->SetKeyword(keyword);
	return true;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:16,代码来源:Parser.cpp


示例8: SymName

void SymName (char* S)
/* Read a symbol from the input stream. The first character must have been
** checked before calling this function. The buffer is expected to be at
** least of size MAX_IDENTLEN+1.
*/
{
    unsigned Len = 0;
    do {
        if (Len < MAX_IDENTLEN) {
            ++Len;
            *S++ = CurC;
        }
        NextChar ();
    } while (IsIdent (CurC) || IsDigit (CurC));
    *S = '\0';
}
开发者ID:pmprog,项目名称:cc65,代码行数:16,代码来源:scanner.c


示例9: NextChar

Json* Json::Parser::ParsePrimary(){
	NextChar();
	Kind kind = KindPreview(ch);
	Json* json = NULL;
	switch(kind){
	case kString: { json = ParseString(); break;}
	case kNumber: { json = ParseNumber(); break;}
	case kFalse: { json = ParseFalse(); break; }
	case kTrue: { json = ParseTrue(); break; }
	case kArray: { json = ParseArray(); break; }
	case kObject: { json = ParseObject(); break; }
	case kNull: break;
	default: break;
	};
	return json;
}
开发者ID:JackWyj,项目名称:Json-Parser,代码行数:16,代码来源:Json.cpp


示例10: main

/***********************************************************************
Function  : main

Returns   : zero for successful execution
	    3    if an error is encountered

The main routine allocates buffers for the input and output buffer.
Characters are then read from the input buffer building the line buffer
that will be sent to the filter processor.  Lines are read and filtered
until the end of input is reached.
***********************************************************************/
int main( void )
{
   char c;
   unsigned long core;

   setmode(1,O_BINARY);               /* set output stream to binary mode */
   core = farcoreleft();
   if (core > 64000U)
      BufSize = 64000U;
   else BufSize = (unsigned)core;     /* get available memory */
                                      /* stay under 64K */
   if ((CurInPtr = malloc(BufSize)) == NULL) /* allocate buffer space */
      exit(3);
#if 0
   processor = NULL;                  /* set current processor to none */
#endif

   InBuffer = CurInPtr;               /* input buffer is first half of space */
   BufSize = BufSize/2;               /* output buffer is 2nd half */
   OutBuffer = InBuffer + BufSize;
   CurOutPtr = OutBuffer;             /* set buffer pointers */
   LinePtr = Line;
   CurBufLen = 0;
   Put(PipeId,PipeIdLen);             /* send ID string to message window */
   while ((c = NextChar()) != 0)      /* read characters */
   {
      if ((c == 13) || (c == 10))     /* build until line end */
      {
         *LinePtr = 0;
         ProcessLine(Line);           /* filter the line */
         LinePtr = Line;
      }
      /* characters are added to buffer up to 132 characters max */
      else if ((FP_OFF(LinePtr) - FP_OFF(&Line)) < 132)
      {
         *LinePtr = c;                /* add to line buffer */
         LinePtr++;
      }
   }
   *LinePtr = 0;
   ProcessLine(Line);                 /* filter last line */
   EndMark = MsgEoFile;
   Put(&EndMark,1);                   /* indicate end of input to
                                         the message window */
   flushOut((unsigned)(CurOutPtr-OutBuffer));     /* flush the buffer */
   return 0;                          /* return OK */
}
开发者ID:WiLLStenico,项目名称:TestesEOutrasBrincadeiras,代码行数:58,代码来源:rc2msg.c


示例11: NextChar

/*************************************************************************
Function  : NextChar
Parameters: none
Returns   : next character in input buffer or 0 on end of file

Input from the standard input stream is buffered in a global buffer InBuffer
which is allocated in function main.  The function will return
the next character in the buffer, reading from the input stream when the
buffer becomes empty.
**************************************************************************/
char NextChar(void)
{
  if (CurInPtr < InBuffer+CurBufLen)  /* if buffer is not empty */
  {
    return *(CurInPtr++);             /* return next character */
  }
  else
  {
    CurInPtr = InBuffer;              /* reset pointer to front of buffer */
    lseek(0,InOff,0);                 /* seek to the next section for read */
    InOff += BufSize;                 /* increment pointer to next block */
    if ((CurBufLen = read(0,InBuffer,BufSize)) !=0)
      return NextChar();              /* recursive call merely returns
                                         first character in buffer after read */
    return 0;                         /* return 0 on end of file */
  }
}
开发者ID:WiLLStenico,项目名称:TestesEOutrasBrincadeiras,代码行数:27,代码来源:rc2msg.c


示例12: while

// expect we are not in a C-string.
bool Tokenizer::SkipToOneOfChars(const wxChar* chars, bool supportNesting, bool skipPreprocessor, bool skipAngleBrace)
{
    while (NotEOF() && !CharInString(CurrentChar(), chars))
    {
        MoveToNextChar();

        while (SkipString() || SkipComment())
            ;

        // use 'while' here to cater for consecutive blocks to skip (e.g. sometemplate<foo>(bar)
        // must skip <foo> and immediately after (bar))
        // because if we don't, the next block won't be skipped ((bar) in the example) leading to weird
        // parsing results
        bool done = false;
        while (supportNesting && !done)
        {
            switch (CurrentChar())
            {
                case '#':
                    if (skipPreprocessor)
                        SkipToEOL(true);
                    else
                        done = true;
                    break;
                case '{': SkipBlock('{'); break;
                case '(': SkipBlock('('); break;
                case '[': SkipBlock('['); break;
                case '<': // don't skip if << operator
                    if (skipAngleBrace)
                    {
                        if (NextChar() == '<')
                            MoveToNextChar(2); // skip it and also the next '<' or the next '<' leads to a SkipBlock('<');
                        else
                            SkipBlock('<');
                        break;
                    }

                default: done = true; break;
            }
        }

    }

    return NotEOF();
}
开发者ID:stahta01,项目名称:EmBlocks,代码行数:46,代码来源:tokenizer.cpp


示例13: while

wxString wxTextInputStream::ReadLine()
{
    wxString line;

    while ( !m_input.Eof() )
    {
        wxChar c = NextChar();
        if(c == wxEOT)
            break;

        if (EatEOL(c))
            break;

        line += c;
    }

    return line;
}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:18,代码来源:txtstrm.cpp


示例14: CError

static void CError( void )
{
    size_t      len;
    bool        save;

    len = 0;
    while( CurrChar != '\n' && CurrChar != '\r' && CurrChar != EOF_CHAR ) {
        if( len != 0 || CurrChar != ' ' ) {
            Buffer[len++] = CurrChar;
        }
        NextChar();
    }
    Buffer[len] = '\0';
    /* Force #error output to be reported, even with preprocessor */
    save = CompFlags.cpp_output;
    CompFlags.cpp_output = FALSE;
    CErr2p( ERR_USER_ERROR_MSG, Buffer );
    CompFlags.cpp_output = save;
}
开发者ID:Graham-stott,项目名称:open-watcom-v2,代码行数:19,代码来源:cmac2.c


示例15: ReadIdent

static void ReadIdent (void)
/* Read an identifier from the current input position into Ident. Filling SVal
** starts at the current position with the next character in C. It is assumed
** that any characters already filled in are ok, and the character in C is
** checked.
*/
{
    /* Read the identifier */
    do {
        SB_AppendChar (&CurTok.SVal, C);
        NextChar ();
    } while (IsIdChar (C));
    SB_Terminate (&CurTok.SVal);

    /* If we should ignore case, convert the identifier to upper case */
    if (IgnoreCase) {
        UpcaseSVal ();
    }
}
开发者ID:pfusik,项目名称:cc65,代码行数:19,代码来源:scanner.c


示例16: SkipWhite

static int SkipWhite (void)
/* Skip white space in the input stream, reading and preprocessing new lines
** if necessary. Return 0 if end of file is reached, return 1 otherwise.
*/
{
    while (1) {
        while (CurC == '\0') {
            if (NextLine () == 0) {
                return 0;
            }
            Preprocess ();
        }
        if (IsSpace (CurC)) {
            NextChar ();
        } else {
            return 1;
        }
    }
}
开发者ID:pmprog,项目名称:cc65,代码行数:19,代码来源:scanner.c


示例17: CError

local void CError( void )
{
    int i;
    int save;

    i = 0;
    while( CurrChar != '\n' && CurrChar != '\r' && CurrChar != EOF_CHAR ) {
        if( i != 0 || CurrChar != ' ' ) {
            Buffer[ i ] = CurrChar;
            ++i;
        }
        NextChar();
    }
    Buffer[ i ] = '\0';
    /* Force #error output to be reported, even with preprocessor */
    save = CompFlags.cpp_output;
    CompFlags.cpp_output = 0;
    CErr2p( ERR_USER_ERROR_MSG, Buffer );
    CompFlags.cpp_output = save;
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:20,代码来源:cmac2.c


示例18: ReadLine

        // The folowing function was copied verbatim from wxTextStream::ReadLine()
        // The only change, is the addition of m_input.CanRead() in the while()
        wxString ReadLine()
        {
            wxString line;

            while ( m_input.CanRead() && !m_input.Eof() )
            {
                wxChar c = NextChar();
                if(m_input.LastRead() <= 0)
                    break;

                if ( !m_input )
                    break;

                if (EatEOL(c))
                    break;

                line += c;
            }
            return line;
        }
开发者ID:469306621,项目名称:Languages,代码行数:22,代码来源:pipedprocess.cpp


示例19: while

Json* Json::Parser::ParseNumber(){
	std::string snum = "";
	bool isDouble = false;
	while(isdigit(ch) || ch == '.'){
		if(ch == '.') {
			if(isDouble) JSON_ASSERT("unexpected char \".\" came out again");
			isDouble = true;
		}else
			snum += ch;
		NextChar();
	}
	BackCharIndex();	
	if(isDouble){
		double num = atof(snum.c_str());
		return new Json(num);
	}else{
		int num = atoi(snum.c_str());
		return new Json(num);
	}
}
开发者ID:JackWyj,项目名称:Json-Parser,代码行数:20,代码来源:Json.cpp


示例20: while

bool Scanner::ScanHexadecimalSubstring(BString* literal)
{
	int digit = 0;
	int value = 0;
	while(true) {
		NextChar();
		int ch = GetCurrentChar();
		
		if (ch == '>') {
			// end of hexadecimal substring reached
			return digit == 0;
		}
		
		if (ch == -1) {
			Error("Unexpected EOF in hexadecimal substring!");
			return false;
		}
		
		if (IsWhitespace(ch)) {
			// ignore white spaces
			continue;
		}
		
		int d = getHexadecimalDigit(ch);
		if (d == -1) {
			Error("Character is not a hexadecimal digit!");
			return false;
		}
		
		if (d == 0) {
			// first digit
			value = d << 8;
			d = 1;
		} else {
			// second digit
			value |= d;
			literal->Append((unsigned char)value, 1);
			d = 0;
		}
	}
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:41,代码来源:Scanner.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ NextDevicePathNode函数代码示例发布时间:2022-05-30
下一篇:
C++ NextCh函数代码示例发布时间: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