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


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

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


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

示例1: SkipSpacesUntilNextLineBreak

// ---------------------------------------------------------------------------
// SdpUtil::SkipSpacesUntilNextLineBreak
// Skips spaces until next line break, if the line break can be found.
// Examples: "   \r\n" -> "\r\n", "abc def\r\n" -> "abc def\r\n"
// ---------------------------------------------------------------------------
//       
TBool SdpUtil::SkipSpacesUntilNextLineBreak( TLex8& aLexer )
    {
    TBool found = EFalse;
    if ( aLexer.Peek() == KSPChar )
        {
        TInt spaceCount = 0;
        while ( aLexer.Peek() == KSPChar )
            {
            spaceCount++;
            aLexer.Get();
            }
        if ( aLexer.Peek() != KCRChar && aLexer.Peek() != KLFChar )
            {
            for ( TInt i=0; i < spaceCount; i++ )
                {
                aLexer.UnGet();
                }
            }
        else
            {
            found = ETrue;
            }
        }
    return found;
    }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:31,代码来源:sdputil.cpp

示例2: GetTextString

// -----------------------------------------------------------------------------
// CWPPushMessage::GetTextString
// -----------------------------------------------------------------------------
//
TPtrC8 CWPPushMessage::GetTextString( TLex8& aPointer ) const
    {
    // Text-string can be quoted.
    if( aPointer.Peek() == KQuotedTextStringStart )
        {
        aPointer.Inc();
        }
    aPointer.Mark();

    while( aPointer.Get() != EKeyNull )
        {
        // Nothing
        }

    // We don't want to have NULL in the resulting descriptor, so
    // back that out.
    aPointer.UnGet();
    TPtrC8 result( aPointer.MarkedToken() );
    aPointer.Inc();
    return result;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:25,代码来源:CWPPushMessage.cpp

示例3: 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


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