當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。