本文整理汇总了C++中TLex::SkipSpace方法的典型用法代码示例。如果您正苦于以下问题:C++ TLex::SkipSpace方法的具体用法?C++ TLex::SkipSpace怎么用?C++ TLex::SkipSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLex
的用法示例。
在下文中一共展示了TLex::SkipSpace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Eat
TBool TfrLex::Eat( TLex& aLex, const TChar aChar )
{
TLexMark unget;
if ( aChar.IsSpace() )
{
// A space character requires its own logic = go over
// the other space characters - x gets the next char.
TChar x;
aLex.Mark(unget);
while ( x = aLex.Get(), x.IsSpace() && x != aChar )
{};
if ( x == aChar )
return ETrue;
}
else
{
// For other, non-space, characters: skip spaces and
// get the next character x.
aLex.SkipSpace();
aLex.Mark(unget);
if ( aLex.Get() == aChar )
return ETrue;
}
// The character wasn't there, unget to the start point.
aLex.UnGetToMark(unget);
return EFalse;
}
示例2: EatF
TBool TfrLex::EatF( TLex& aLex, const TDesC& aTerm )
{
aLex.SkipSpace();
TLexMark unget;
aLex.Mark(unget);
if ( ValF(aLex,aTerm) == KErrNone ) return ETrue;
aLex.UnGetToMark(unget);
return EFalse;
}
示例3: GetL
TPtrC TfrLex::GetL( TLex& aLex, const TChar aChar )
{
// Skip spaces and mark the token's start point.
aLex.SkipSpace();
TLexMark mark;
aLex.Mark(mark);
if (aLex.Peek() == '"' )
{
// Skip the " and do find next " followed by eos, space or aChar.
aLex.Inc();
TChar x;
while ( x = aLex.Get(), !x.Eos() )
{
if ( x == '"' )
{
// Found a " character - but is it the end of the token?
x = aLex.Peek(); // peek the next character
if ( x.Eos() || x.IsSpace() || x == aChar )
// End of token: return token.
return aLex.MarkedToken(mark);
}
}
// Unget and L E A V E because did not find the end " of token.
aLex.UnGetToMark(mark);
User::Leave(KErrArgument);
return aLex.MarkedToken(mark); // never reached (l e a v e).
}
else
{
// Is not a "*" token: find eos or the next space or the aChar
// and return the token.
TChar x;
while ( x = aLex.Peek(), !x.Eos() && !x.IsSpace() && x != aChar )
aLex.Inc();
return aLex.MarkedToken(mark);
}
}
示例4: SearchPhoneNumberL
/**
Search algorithm for searching phone numbers
@param aText Text that will be parsed
@return ETrue if any Phone Number items were found else returns EFalse
@leave KErrNone, if successful; otherwise one of the other system-wide error codes.
@panic ETulPanicDescriptorLength in debug build if item's position
and/or length is out of the document's range.
*/
TBool CTulAddressStringTokenizer::SearchPhoneNumberL( const TDesC& aText )
{
TLexMark startMark; // Points to the start of the found phone number
TLexMark endMark; // Points to the end of the found phone number
TLexMark mark;
const TInt end = aText.Length();
TLex number = aText;
while ( !(number.Eos()) )
{
TInt numberCount = 0; // How many real numbers (1234567890)
TInt bracketsOpen = 0; // How many brackets are currently open
TInt brackets = 0; // How many brackets overall
TChar charac = number.Peek();
while( (!(IsValidPhoneNumberChar( charac ) || charac == '+'
|| charac == '(' ) || charac == '-' || charac == '.' || charac == '/')
&& !(number.Eos()) && number.Offset() < end )
{
number.Inc();
charac = number.Peek();
}
if ( number.Offset() >= end )
break;
if ( number.Peek() == '#' )
{
number.Inc();
if (number.Peek() == '.' )
continue;
number.UnGet();
}
if ( number.Peek() == '+' )
{ // '+' has to be followed by a number (not # or * ...)
number.Inc();
if ( !(number.Peek().IsDigit()) )
continue;
number.UnGet();
}
if ( number.Peek() == '(' )
{ // '(' has to be followed by valid phone number
// character (whitespaces are allowed before) or '+' is a next character
number.Inc();
if ( !(number.Peek() == '+') )
{
number.Mark(mark);
number.SkipSpace();
charac = number.Peek();
if ( !( IsValidPhoneNumberChar(charac) || charac == '+'
|| charac == '(' ) || charac == '-' || charac == '.' || charac == '/')
{
number.Inc();
continue;
}
else
{
number.UnGetToMark(mark);
number.UnGet();
number.Mark(startMark);
}
}
else
{
number.UnGet();
number.Mark(startMark);
number.Inc();
}
bracketsOpen++;
brackets++;
}
else
number.Mark(startMark);
if ( number.Peek().IsDigit() ) // If the character was a number
numberCount++;
else if ( bracketsOpen > 0 )
{
number.Inc();
TChar next = number.Peek();
TInt bracketsOpen2 = bracketsOpen;
while( (IsValidPhoneNumberChar( next ) || next.IsSpace()
|| next == '(' || next == ')' || next == 'p' || next == '+'
|| next == 'w' ) && !(number.Eos()) && number.Offset() < end)
//.........这里部分代码省略.........