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


C++ GetNextChar函数代码示例

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


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

示例1: GetNextChar

//------------------------------------------------------------------------------
// Parse a NEXUS-style comment
bool Tokeniser::ParseComment ()
{
	bool echo = false;
	comment = "";

	curChar = GetNextChar ();
	echo = (curChar == '!');
	if (echo)
		curChar =  GetNextChar ();

	while ((curChar != '\0') && (curChar != ']'))
	{
		comment += curChar;
		curChar = GetNextChar();
	}

	if (echo)
#if defined __BORLANDC__ && (__BORLANDC__ < 0x0550)
		cout << comment;
#else
		std::cout << comment;
#endif

	return true;
}
开发者ID:bomeara,项目名称:omearatenure,代码行数:27,代码来源:tokeniser.cpp

示例2: GetNextChar

void CToken::GetTTString()
{
	int nsLen;

	m_eNextTokenType = ttString;
	m_sNextTokenType = "String";

	nsLen = m_sNextToken.GetLength();
	m_sNextToken.Insert(nsLen, m_cNextChar);

	GetNextChar();
	char cPrevChar='x';
	bool bHasRemnString;
	do
	{
		bHasRemnString = false;

		while(m_cNextChar != '\"')
		{
			nsLen = m_sNextToken.GetLength();
			m_sNextToken.Insert(nsLen, m_cNextChar);
			cPrevChar = m_cNextChar;
			GetNextChar();
		}

		nsLen = m_sNextToken.GetLength();
		m_sNextToken.Insert(nsLen, m_cNextChar);

		if(cPrevChar == '\\')
			bHasRemnString = true;

		GetNextChar();
	}while(bHasRemnString == true);
}
开发者ID:asakpke,项目名称:MakeTokenGUI-Compiler-Construction,代码行数:34,代码来源:Token.cpp

示例3: T

struct Node_t * T(void)
{
  struct Node_t * ret_node;

  if (last == '(')
  {
    last = GetNextChar();
    ret_node = E();
    last = GetNextChar(); /* preskocit ')' */
    return ret_node;
  }
  free_node->oper = last;
  last = GetNextChar(); /* preskocit terminator */
  return free_node++;
}
开发者ID:jermenkoo,项目名称:spoj.pl_solutions,代码行数:15,代码来源:CMEXPR.c

示例4: MHERROR

// Parse a string argument.  ASN1 strings can include nulls as valid characters.
void MHParseBinary::ParseString(int endStr, MHOctetString &str)
{
    // TODO: Don't deal with indefinite length at the moment.
    if (endStr == INDEFINITE_LENGTH)
    {
        MHERROR("Indefinite length strings are not implemented");
    }

    int nLength = endStr - m_p;
    unsigned char *stringValue = (unsigned char *)malloc(nLength + 1);
    if (stringValue == NULL)
    {
        MHERROR("Out of memory");
    }

    unsigned char *p = stringValue;

    while (m_p < endStr)
    {
        *p++ = GetNextChar();
    }

    str.Copy(MHOctetString((const char *)stringValue, nLength));
    free(stringValue);
}
开发者ID:DaveDaCoda,项目名称:mythtv,代码行数:26,代码来源:ParseBinary.cpp

示例5: token

/*----------------------------------------------------------------------------------------------------------------------
|	Reads rest of parenthetical token (starting '(' already input) up to and including the matching ')' character.  All
|	nested parenthetical phrases will be included.
*/
void NxsToken::GetParentheticalToken()
	{
	// Set level to 1 initially.  Every ')' encountered reduces
	// level by one, so that we know we can stop when level becomes 0.
	//
	int level = 1;

	char ch;
	for(;;)
		{
		ch = GetNextChar();
		if (atEOF)
			break;

		if (ch == ')')
			level--;
		else if (ch == '(')
			level++;

		AppendToToken(ch);

		if (level == 0)
			break;
		}
	}
开发者ID:rforge,项目名称:phylobase,代码行数:29,代码来源:nxstoken.cpp

示例6: word

/*----------------------------------------------------------------------------------------------------------------------
|	Gets remainder of a quoted NEXUS word (the first single quote character was read in already by GetNextToken). This
|	function reads characters until the next single quote is encountered. An exception occurs if two single quotes occur
|	one after the other, in which case the function continues to gather characters until an isolated single quote is
|	found. The tandem quotes are stored as a single quote character in the token NxsString.
*/
void NxsToken::GetQuoted()
	{
	char ch;

	for(;;)
		{
		ch = GetNextChar();
		if (atEOF)
			break;

		if (ch == '\'' && saved == '\'')
			{
			// Paired single quotes, save as one single quote
			//
			AppendToToken(ch);
			saved = '\0';
			}
		else if (ch == '\'' && saved == '\0')
			{
			// Save the single quote to see if it is followed by another
			//
			saved = '\'';
			}
		else if (saved == '\'')
			{
			// Previously read character was single quote but this is something else, save current character so that it will
			// be the first character in the next token read
			//
			saved = ch;
			break;
			}
		else
			AppendToToken(ch);
		}
	}
开发者ID:rforge,项目名称:phylobase,代码行数:41,代码来源:nxstoken.cpp

示例7: Q3SocketDevice

void MainObject::ProcessCommands()
{
  char c;
  Q3SocketDevice *udp_command=new Q3SocketDevice(Q3SocketDevice::Datagram);
  char rml[RD_RML_MAX_LENGTH];
  unsigned ptr=0;
  bool active=false;

  while(!GetNextChar(&c)) {
    if(active) {
      if(c=='!') {
	rml[ptr++]=c;
	rml[ptr]=0;
	udp_command->writeBlock(rml,ptr,*dest_addr,dest_port);
	ptr=0;
	active=false;
      }
      else {
	rml[ptr++]=c;
      }
      if(ptr==RD_RML_MAX_LENGTH) {
	fprintf(stderr,"rmlsend: rml command too long\n");
	CloseStream();
	exit(256);
      }
    }
    else {
      if(isalpha(c)) {
	rml[ptr++]=c;
	active=true;
      }
    }
  }
}
开发者ID:WMFO,项目名称:rivendell,代码行数:34,代码来源:rmlsend.cpp

示例8: IsNextMoveValid

static int IsNextMoveValid(GAME_STATE *ptr, G_GHOST *pGhost)
{
char c;

	c = GetNextChar(ptr, pGhost);
	return Pac_IsOpenArea(c);
}
开发者ID:Alexandre251313,项目名称:pacman,代码行数:7,代码来源:ghosts.c

示例9: malloc

extern char *GetNextString( read_file *ch_info ) {

    char                *buffer;
    int                 x = 0;
    int                 current_max = BUFF_INC;
    int                 ch;

    buffer = malloc( BUFF_INC );

    do {
        if ( x >= current_max ) {
            current_max += BUFF_INC;
            buffer = realloc( buffer, current_max );
            if ( !buffer ) {
                puts("Out of memory");
                close( ch_info->file_handle );
                abort();
            }
        }
        ch = GetNextChar( ch_info );
        if ( ch == -1 ) {
            puts("File read error occured");
            close( ch_info->file_handle );
            free( buffer );
            abort();
        }
        buffer[ x ] = ch;
        x++;
    } while ( ch );
    return( buffer );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:31,代码来源:loadtype.c

示例10: ListSaveFile

// write the file (or pipe) to another file
static void _near ListSaveFile( void )
{
	int i, nFH, nMode;
	long lTemp;
	POPWINDOWPTR wn;
	TCHAR szBuffer[ MAXLISTLINE+1 ];
	
	// disable ^C / ^BREAK handling
	HoldSignals();
	
	wn = wOpen( 2, 1, 4, GetScrCols() - 2, nInverse, LIST_SAVE_TITLE, NULL );
	wn->nAttrib = nNormal;
	wClear();
	wWriteListStr( 0, 1, wn, LIST_QUERY_SAVE );
	egets( szBuffer, MAXFILENAME, EDIT_DATA | EDIT_BIOS_KEY );
	
	if ( szBuffer[0] ) {
		
		// save start position
		lTemp = LFile.lViewPtr;
		
		nMode = _O_BINARY;
		
		if (( nFH = _sopen( szBuffer, ( nMode | _O_WRONLY | _O_CREAT | _O_TRUNC ), _SH_DENYNO, _S_IWRITE | _S_IREAD )) >= 0 ) {
			
			// reset to beginning of file

				ListSetCurrent( 0L );
			
			do {
				
				for ( i = 0; ( i < MAXLISTLINE ); i++ ) {
					
					// don't call GetNextChar unless absolutely necessary
					if ( LFile.lpCurrent == LFile.lpEOF )
						break;

					szBuffer[i] = (TCHAR)GetNextChar();
				}

				szBuffer[i] = _TEXT('\0');
				
			} while (( i > 0 ) && ( wwrite( nFH, szBuffer, i ) > 0 ));
			
			_close( nFH );
			
			// restore start position
			LFile.lViewPtr = lTemp;
			ListSetCurrent( LFile.lViewPtr );
			
		} else
			honk();
	}
	
	wRemove( wn );
	
	// enable ^C / ^BREAK handling
	EnableSignals();
}
开发者ID:CivilPol,项目名称:sdcboot,代码行数:60,代码来源:listc.c

示例11: while

/* ¶ÁÈ¡×Ö·û´® */  
bool JsonString::ReadString()  
{  
	char c = 0;  
	while(current_ != end_)  
	{  
		c= GetNextChar();  
		if( c == '\\')  
		{  
			c = GetNextChar();  
		}  
		else if( c == '"')  
		{  
			break;  
		}  
	}  
	return (c == '"');  
}  
开发者ID:Strongc,项目名称:myLib,代码行数:18,代码来源:JsonString.cpp

示例12: while

int CPDF_Font::GetStringWidth(const FX_CHAR* pString, int size) {
  int offset = 0;
  int width = 0;
  while (offset < size) {
    uint32_t charcode = GetNextChar(pString, size, offset);
    width += GetCharWidthF(charcode);
  }
  return width;
}
开发者ID:documentcloud,项目名称:pdfium,代码行数:9,代码来源:cpdf_font.cpp

示例13: while

void CCSVParser::ParseToOpenQuote (void)

//	ParseToOpenQuote
//
//	Reads characters until we find an open quote.

	{
	while (GetCurChar() != '\"')
		GetNextChar();
	}
开发者ID:kronosaur,项目名称:Hexarc,代码行数:10,代码来源:CCSVParser.cpp

示例14: while

void CToken::Skip2EndOfLine()
{
	while(m_cNextChar != cEndOfLine && m_cNextChar != cEndOfFile) //10 = end of line
	{
		//s.Format("%c",m_cNextChar);
		//MessageBox(s);

		GetNextChar();
	}	
}
开发者ID:asakpke,项目名称:Parser-5-Compiler-Construction,代码行数:10,代码来源:Token.cpp

示例15: while

void CToken::GetTTComments()
{
	int nsLen;

	if(m_cNextChar == '/')
	{
		m_eNextTokenType = ttCPPComments;
		m_sNextTokenType = "CPP's Comments";				

		while(m_cNextChar != 10) // end of line
		{
			nsLen = m_sNextToken.GetLength();
			m_sNextToken.Insert(nsLen, m_cNextChar);
			GetNextChar();
		}				
	}
	else if(m_cNextChar == '*')
	{
		char cPrevChar='x';
		m_eNextTokenType = ttCComments;
		m_sNextTokenType = "C's Comments";				

		//store '*'
		nsLen = m_sNextToken.GetLength();
		m_sNextToken.Insert(nsLen, m_cNextChar);

		GetNextChar();
		while(cPrevChar != '*' && m_cNextChar != '/')
		{
			nsLen = m_sNextToken.GetLength();
			m_sNextToken.Insert(nsLen, m_cNextChar);

			cPrevChar = m_cNextChar;
			GetNextChar();
		}
		// store last '/'
		nsLen = m_sNextToken.GetLength();
		m_sNextToken.Insert(nsLen, m_cNextChar);

		GetNextChar();
	}
}
开发者ID:asakpke,项目名称:MakeTokenGUI-Compiler-Construction,代码行数:42,代码来源:Token.cpp


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