本文整理汇总了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;
}
示例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;
}
示例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));
}
}