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


C++ TLex8::Eos方法代码示例

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


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

示例1: GetNextElement

TInt CTestConfig::GetNextElement(TLex8& aInput, TChar aDelimiter, TPtrC8& aOutput)
	{
	if (aInput.Eos())
		return KErrNotFound;

	//Get to the start of the descriptor
	while (!aInput.Eos() && aInput.Peek() != aDelimiter)
		aInput.Inc();

	aOutput.Set(aInput.MarkedToken());
	if (!aInput.Eos())
		aInput.SkipAndMark(1);

	return KErrNone;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:15,代码来源:testconfigfile.cpp

示例2: SkipToNextLine

void CTestConfig::SkipToNextLine(TLex8& aInput) const
	{
	const TChar cr('\n');

	while (!aInput.Eos() && aInput.Peek() != cr)
		{
		aInput.Inc();
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:9,代码来源:testconfigfile.cpp

示例3: GetTokenText

// -----------------------------------------------------------------------------
// CWPPushMessage::GetTokenText
// -----------------------------------------------------------------------------
//
TPtrC8 CWPPushMessage::GetTokenText( TLex8& aPointer ) const
    {
    // Token text is just characters with an end-of-string marker.
    aPointer.Mark();

    while( !aPointer.Eos() && aPointer.Get() != EKeyNull )
        {
        // Do nothing
        }
    
    return aPointer.MarkedToken();
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:16,代码来源:CWPPushMessage.cpp

示例4: GetNextTokenAndCheck

TInt CIniFileParser::GetNextTokenAndCheck(TLex8& lex, TPtr8& tempPtr)
/*
Gets next token and ensures the token is simply not the EOF or a linefeed.
lex is the lexical string to get the next token from.
tempPtr points to the next token
Returns KErrGeneral if token is bad or if we've already read past the end.
*/
	{
	TUint8 ch;
	TInt len;

	if (lex.Eos())
		{
		return KErrGeneral;
		}
	
	tempPtr = lex.NextToken();

	len = tempPtr.Length();
	if (len == 0)
		{
		// lex has figured out what is left is just the EOF
		return KErrGeneral;
		}

	// this next part may be superfluous but we've had so much strife with
	// the parser thus far that for now we're leaving it in

	ch = tempPtr[0];
	if (ch == KCarriageReturn || ch == KLineFeed)
		{
		return KErrGeneral;
		}

	if (tempPtr.Length() < 2)
		{
		return KErrNone;
		}
	ch = tempPtr[1];
	if (ch == KCarriageReturn || ch == KLineFeed)
		{
		return KErrGeneral;
		}

	return KErrNone;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:46,代码来源:comsdbgaux.cpp

示例5: IsIntegerValue

// -----------------------------------------------------------------------------
// CWPPushMessage::IsIntegerValue
// -----------------------------------------------------------------------------
//
TBool CWPPushMessage::IsIntegerValue( TLex8& aPointer ) const
    {
    // Integer values either are above KShortIntegerMask or
    // their first byte is <=KMaxLongIntegerLength.
    TBool result( EFalse );

    if( !aPointer.Eos() )
        {
        TUint first( aPointer.Peek() );

        if( first > KShortIntegerMask || first <= KMaxLongIntegerLength )
            {
            result = ETrue;
            }
        }

    return result;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:22,代码来源:CWPPushMessage.cpp

示例6: GetVersionValue

// -----------------------------------------------------------------------------
// CWPPushMessage::GetVersionValue
// -----------------------------------------------------------------------------
//
TUint CWPPushMessage::GetVersionValue( TLex8& aPointer ) const
    {
    // Version-value is a short integer or text. Handle that.
    TUint result( 0 );

    if( !aPointer.Eos() )
        {
        TUint first( aPointer.Peek() );
        
        if( first > KShortIntegerMask )
            {
            result = GetShortInteger( aPointer );
            }
        else
            {
            GetTextString( aPointer );
            }
        }

    return result;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:25,代码来源:CWPPushMessage.cpp

示例7: GetQValue

// -----------------------------------------------------------------------------
// CWPPushMessage::GetQValue
// -----------------------------------------------------------------------------
//
TUint CWPPushMessage::GetQValue( TLex8& aPointer ) const
    {
    // q-value is an integer. It is coded as 7 bits per byte.
    // The highest bit determines if the number continues.
    TUint result( 0 );
    TBool lastDigit( EFalse );

    while( !aPointer.Eos() && !lastDigit )
        {
        TInt one( aPointer.Get() );

        result = (result << 7) || (one & ~KQValueContinuation);

        if( (one & KQValueContinuation) == 0 )
            {
            lastDigit = ETrue;
            }
        }

    return result;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:25,代码来源:CWPPushMessage.cpp

示例8: GetIntegerValue

// -----------------------------------------------------------------------------
// CWPPushMessage::GetIntegerValue
// -----------------------------------------------------------------------------
//
TInt64 CWPPushMessage::GetIntegerValue( TLex8& aPointer ) const
    {
    // Integer value can be a short integer or a long integer.
    // Short integer is always >KShortIntegerMask.
    TInt64 result( 0 );

    if( !aPointer.Eos() )
        {
        TUint first( aPointer.Peek() );

        if( first > KShortIntegerMask )
            {
            result = GetShortInteger( aPointer );
            }
        else
            {
            result = GetLongInteger( aPointer );
            }
        }

    return result;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:26,代码来源:CWPPushMessage.cpp

示例9: GetFieldName

// -----------------------------------------------------------------------------
// CWPPushMessage::GetFieldName
// -----------------------------------------------------------------------------
//
TUint CWPPushMessage::GetFieldName( TLex8& aPointer ) const
    {
    // Field name can be a short integer or text.
    TUint result( 0 );

    if( !aPointer.Eos() )
        {
        TUint first( aPointer.Peek() );

        if( first > KShortIntegerMask )
            {
            result = GetShortInteger( aPointer );
            }
        else
            {
            // Only well-known fields are read
            GetTokenText( aPointer );
            }
        }

    return result;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:26,代码来源:CWPPushMessage.cpp

示例10: GetConstrainedEncoding

// -----------------------------------------------------------------------------
// CWPPushMessage::GetConstrainedEncoding
// -----------------------------------------------------------------------------
//
TUint CWPPushMessage::GetConstrainedEncoding( TLex8& aPointer ) const
    {
    // Constrained encoding can be extension media or short integer
    TUint result( 0 );

    if( !aPointer.Eos() )
        {
        TUint first( aPointer.Peek() );

        if( first > KShortIntegerMask )
            {
            result = GetShortInteger( aPointer );
            }
        else
            {
            // Just skip the text version
            GetTokenText( aPointer );
            }
        }

    return result;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:26,代码来源:CWPPushMessage.cpp

示例11: EncodeL

void CDomainNameCodec::EncodeL(TDomainNameArray& aNames, RBuf8& aBuf8)
	{
	TUint requiredLength = 0;
	TUint8 nameIdx = 0;
	
	for (nameIdx=0;nameIdx<aNames.Count();nameIdx++)
		{
		// The total length required for the labels that comprise an
		// individual domain name needs to take into the length octet
		// for the initial label and the null-termination character.
		// Hence the '+ 2' below.
		requiredLength += (aNames[nameIdx].Length() + 2);		
		
		// A further length check is performed on each domain name to
		// ensure it does not exceed the maximum length permitted according
		// to RFC 1035.
		if(aNames[nameIdx].Length() > KMaxDomainNameLength)
			{
			User::Leave(KErrArgument);
			}
		}		
	
	aBuf8.Zero();
	aBuf8.ReAllocL(requiredLength);
	
	TLex8 domainName;
	TPtrC8 currentLabel;
	
	for (nameIdx=0;nameIdx<aNames.Count();nameIdx++)
		{
		domainName.Assign(aNames[nameIdx]);		
		domainName.Mark();
		
		while (!domainName.Eos())
			{
			TChar ch;
			do
				{
				ch = domainName.Get();
				}
			while ( ch != TChar('.') && !domainName.Eos() );
			
			// if not the end of the string, unget the previous char to skip the trailing
			//  dot in our marked token
			//
			if( !domainName.Eos() )
				{
				domainName.UnGet();
				}
			
			currentLabel.Set(domainName.MarkedToken());
			
			// move past the dot again, or do nothing in particular at EOS
			//
			domainName.Get();
			
			User::LeaveIfError(currentLabel.Length() > KMaxDnsLabelLength ? 
				KErrArgument : KErrNone);
			
			aBuf8.Append(TChar(currentLabel.Length()));
			aBuf8.Append(currentLabel);
			
			domainName.Mark();
			}
		
		aBuf8.Append(TChar(0));
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:68,代码来源:DomainNameDecoder.cpp

示例12: ReadConfigFileL

// Function to read a line from a buffer
GLDEF_C void ReadConfigFileL(RFile& aConfigFile, TListeners& aListeners, RSocketServ& aSocketServ, RConnection& aConnect)
{
    TInt fileLen;
    User::LeaveIfError(aConfigFile.Size(fileLen));
    HBufC8* readBuffer = HBufC8::NewL(fileLen);
    CleanupStack::PushL(readBuffer);
    TPtr8 buff = readBuffer->Des();

    // Read File
    // Here, we read the whole file as we know it's small
    TRequestStatus status;
    aConfigFile.Read(buff, status);
    User::WaitForRequest(status);
    if(status.Int() != KErrNone && status.Int() != KErrEof)
    {
        User::LeaveIfError(status.Int());
    }

    HBufC8* tempBuffer = HBufC8::NewL(KLineSize);
    CleanupStack::PushL(tempBuffer);
    TPtr8 lineBuff = tempBuffer->Des();
    TLex8 lex;
    lex.Assign(buff);

    /* Parse whole stream in to split it in lines
    We discard commented line with #
     */
    TBool error = EFalse;
    while(!lex.Eos() && !error)
    {
        TBool comment = EFalse;
        if(lex.Peek() == '#')
        {
            // We've got a comment
            comment = ETrue;
        }

        TInt nbCharRead = 0;	// To count number of character per line. Used to avoid a buffer overflow
        while(!error && !lex.Eos() && lex.Peek() != '\r' && lex.Peek() != '\n')
        {
            // We look if we are allowed to append character. Otherwise we stop loopping.
            if(nbCharRead < KLineSize)
            {
                lineBuff.Append(lex.Get());
                nbCharRead++;
            }
            else
            {
                error = ETrue;
            }
        }
        if(!comment)
        {
            // We create a new listener
            TInt nbListeners = aListeners.Count();
            if(nbListeners < KNbListeners)
            {
                aListeners.Append(CListener::NewL(aSocketServ, aConnect, CListenerOptions::NewL(lineBuff)));
                aListeners[nbListeners]->AcceptL();
            }
        }
        lineBuff.Zero();
        if(lex.Peek() == '\r')
        {
            lex.Get();	// Get rid of \r
        }
        lex.Get();	// Get rid of \n
    }

    // Delete buffers
    CleanupStack::PopAndDestroy(tempBuffer);
    CleanupStack::PopAndDestroy(readBuffer);

    if(error)
    {
        // We have a bad line in our configuration file so we delete all listeners
        aListeners.ResetAndDestroy();
    }
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:80,代码来源:INETD.CPP

示例13: ParseContentType

// -----------------------------------------------------------------------------
// CWPPushMessage::ParseContentType
// -----------------------------------------------------------------------------
//
void CWPPushMessage::ParseContentType( TLex8& aPointer )
    {
    // Go through the whole content type header.
    while( !aPointer.Eos() )
        {
        // Each parameter might be well-known (integer) or unknown (text)
        if( IsIntegerValue( aPointer ) )
            {
            // For well-known parameters, the token is an integer value
            TUint paramToken( I64LOW( GetIntegerValue( aPointer ) ) );

            // These are filled with results from parsing.
            TInt resultInteger( 0 );
            TPtrC8 resultString;
            
            // Make sure paramToken fits into KParameterTypes table
            if( paramToken 
                < sizeof(KParameterTypes)/sizeof(TParameterCodingType))
                {
                // Get the coding and use it to determine how we should decode 
                // the next parameter value. We actually ignore all results 
                // except short integer (SEC) and text-value (MAC), but the 
                // rest of the parameters have to be parsed anyway.
                TParameterCodingType coding( KParameterTypes[paramToken] );

                switch( coding )
                    {
                    case EQValue:
                        GetQValue( aPointer );
                        break;

                    case EWellKnownCharset:
                        GetWellKnownCharset( aPointer );
                        break;

                    case EVersionValue:
                        GetVersionValue( aPointer );
                        break;

                    case EIntegerValue:
                        GetIntegerValue( aPointer );
                        break;

                    case ETextString:
                        GetTextString( aPointer );
                        break;

                    case EFieldName:
                        GetFieldName( aPointer );
                        break;

                    case EShortInteger:
                        resultInteger = GetShortInteger( aPointer );
                        break;

                    case EConstrainedEncoding:
                        GetConstrainedEncoding( aPointer );
                        break;

                    case EDeltaSecondsValue:
                        GetDeltaSecondsValue( aPointer );
                        break;

                    case ENoValue:
                        GetNoValue( aPointer );
                        break;

                    case ETextValue:
                        resultString.Set( GetTextValue( aPointer ) );
                        break;

                    case EDateValue:
                        GetDateValue( aPointer );
                        break;

                    default:
                        break;
                    }

                // We have a result. We're actually only interested in
                // SEC and MAC parameters, so we save them here.
                switch( paramToken )
                    {
                    case KWSPHeaderSEC:
                        iSEC = resultInteger;
                        break;

                    case KWSPHeaderMAC:
                        iMAC.Set( resultString );
                        break;

                    default:
                        break;
                    }
                }
            }
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:101,代码来源:CWPPushMessage.cpp


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