本文整理汇总了C++中TLex::Inc方法的典型用法代码示例。如果您正苦于以下问题:C++ TLex::Inc方法的具体用法?C++ TLex::Inc怎么用?C++ TLex::Inc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLex
的用法示例。
在下文中一共展示了TLex::Inc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GotoEndOfLine
/*
-------------------------------------------------------------------------------
Class: CStifSectionParser
Method: GotoEndOfLine
Description: Goes end of the line.
Parameters: TLex& lex: inout: Parsed line.
Return Values: TInt: Last item's end position.
Errors/Exceptions: None
Status: Proposal
-------------------------------------------------------------------------------
*/
TInt CStifSectionParser::GotoEndOfLine( TLex& lex )
{
// End position of the last token(Initialized with current position)
TInt lastItemPosition( lex.Offset() );
// LINE BREAK NOTE:
// Line break in SOS, WIN: '\r\n'
// Line break in UNIX: '\n'
do
{
// Peek next character(10 or '\n' in UNIX style )
if( lex.Peek() == 0x0A )
{
lex.Inc();
break;
}
// Peek next character(13 or '\r' in Symbian OS)
if ( lex.Peek() == 0x0D )
{
// Increment the lex position
lex.Inc();
// Peek next character(10 or '\n' in Symbian OS)
if ( lex.Peek() == 0x0A )
{
// End of the section is found and increment the lex position
lex.Inc();
break;
}
// 0x0A not found, decrement position
lex.UnGet();
}
// Peek for tabulator(0x09) and space(0x20)
else if ( lex.Peek() == 0x09 || lex.Peek() == 0x20 )
{
// Increment the lex position
lex.Inc();
continue;
}
// If white spaces not found take next token
lex.NextToken();
lastItemPosition = lex.Offset();
} while ( !lex.Eos() );
return lastItemPosition;
}
示例2: result
// ----------------------------------------------------
// CheckIPv4AddressPart()
// 1*3DIGIT
// ----------------------------------------------------
//
LOCAL_C TBool CheckIPv4AddressPart( TLex& aLex )
{
TBool result( aLex.Peek().IsDigit() );
aLex.Inc();
if( aLex.Peek().IsDigit() )
{
aLex.Inc();
if( aLex.Peek().IsDigit() )
{
aLex.Inc();
}
}
return result;
}
示例3: ParseUrlL
/**
Parses URL from a token. Is used by SearchUrlL method and if a URL
was found it's appended to item array. Note that parsing for generic URIs
is done with SearchGenericUriL -method.
@param aType a Type of URL to seach, i.e.
www.
wap.
IP e.g.127.0.0.1
@param aTokenPtr Pointer to token that will be parsed
@param aTextOffset Offset of the token (start position in the whole text)
@leave KErrNone, if successful; otherwise one of the other system-wide error codes.
@return ETrue if the parameter for phone number is valid, else returns EFalse
*/
TBool CTulAddressStringTokenizer::ParseUrlL(const TDesC& aType, const TPtrC& aTokenPtr, TInt aTextOffset)
{
TBool wasValidUrl = EFalse;
TLex url;
TInt position = aTokenPtr.FindF( aType );
if ( position != KErrNotFound )
{ // address start found
url = aTokenPtr.Right( aTokenPtr.Length() - position );
url.Inc( aType.Length() );
while( IsValidUrlChar( url.Peek() ) && !(url.Eos()) )
{
if( url.Peek() == ':' )
{
url.Inc();
if ( !url.Peek().IsDigit() )
{
url.UnGet();
break;
}
}
else
url.Inc();
}
// If a period or question mark was followed by a whitespace remove it
if ( url.Eos() ) // Can't be followed by white space if it's
{ // the last character at token
url.UnGet();
if ( url.Peek() != '.' && url.Peek() != '?' && url.Peek() != ',' ) // If it wasn't a period or question mark
url.Inc();
}
url.Mark();
wasValidUrl = ETrue;
}
if ( wasValidUrl && ( url.MarkedOffset() > aType.Length() ) )
{
AddItemL( aTextOffset - aTokenPtr.Length() + position, url.MarkedOffset(), EFindItemSearchURLBin );
return ETrue;
}
return EFalse;
}
示例4: SkipToEnd
TInt SkipToEnd(TLex& aLex, const TDesC& aDes)
{
TInt ret = aLex.Remainder().Find(aDes);
if (ret >= 0)
{
aLex.Inc(ret + aDes.Length());
return KErrNone;
}
return KErrNotFound;
}
示例5: GetNextWord
EXPORT_C TInt CScriptFile::GetNextWord(TLex& aInput, TChar aDelimiter, TPtrC& aOutput)
{
//Get to the start of the descriptor
while (!aInput.Peek().IsAlphaDigit() && aInput.Peek() != '+' && !aInput.Eos() && aInput.Peek() != aDelimiter)
aInput.Inc();
if (aInput.Eos())
return KErrNotFound;
aInput.Mark();
while (aInput.Peek() != aDelimiter && !aInput.Eos())
aInput.Inc();
aOutput.Set(aInput.MarkedToken());
if (!aInput.Eos())
aInput.SkipAndMark(1);
return KErrNone;
}
示例6: 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);
}
}
示例7: GetNextVersionPart
/**
* Used for extracting the latter components of a TVersion from a string of the
* form 1.2.3
* Before reading checks that the end of the string has not yet been reached,
* then steps past the first character (assumed to be '.' and attempts to read
* an integer from the following character(s).
* Any error in version length or missing components (e.g. if the version is "1")
* reports 0 for thet missing part(s).
*/
TInt CTe_LbsIniFileReader::GetNextVersionPart(TLex& aLex) const
{
TInt number = 0;
if(!aLex.Eos())
{
aLex.Inc();
if(!aLex.Eos())
{
aLex.Val(number);
}
}
return(number);
}
示例8: hexDigits
// ----------------------------------------------------
// CheckIPv6Hex4()
// hex4 = 1*4HEXDIG
// ----------------------------------------------------
//
LOCAL_C TBool CheckIPv6Hex4( TLex& aLex )
{
_LIT( KHexDigits, "0123456789ABCDEF" );
TPtrC hexDigits( KHexDigits );
TBool foundOne( EFalse );
while( hexDigits.LocateF( aLex.Peek() ) != KErrNotFound )
{
foundOne = ETrue;
aLex.Inc();
}
return foundOne;
}
示例9: NextCommand
TPtrC NextCommand(TLex& aLex)
{
TPtrC command;
if (SkipToNextCommand(aLex) == KErrNone)
{
SkipToEnd(aLex, KPartialCommandStart);
aLex.Mark();
aLex.SkipCharacters();
command.Set(aLex.MarkedToken());
}
else
{
aLex.Inc(aLex.Remainder().Length());
}
return command;
}
示例10: hexSeq
// ----------------------------------------------------
// CheckIPv6HexPart()
// hexpart = hexseq | hexseq "::" [ hexseq ] | "::" [ hexseq ]
// ----------------------------------------------------
//
LOCAL_C TBool CheckIPv6HexPart( TLex& aLex )
{
TBool hexSeq( DoOrReverse( CheckIPv6HexSeq, aLex ) );
TBool doubleSemiColon( EFalse );
if( aLex.Peek() == ':' )
{
aLex.Inc();
if( aLex.Get() == ':' )
{
doubleSemiColon = ETrue;
DoOrReverse( CheckIPv6HexSeq, aLex );
}
}
return hexSeq || doubleSemiColon;
}
示例11: GetDigits
// -----------------------------------------------------------------------------
// CAknKeyRotatorImpl::SkipSpaces
// Goes over digits and returns that sequence.
// -----------------------------------------------------------------------------
//
TPtrC CAknKeyRotatorImpl::GetDigits( TLex& aLex )
{
// Mark current place and go over digits.
aLex.Mark();
while ( !aLex.Eos() && !IsEndOfLine( aLex.Peek() ) )
{
if ( aLex.Peek().IsDigit() )
{
aLex.Inc();
}
else
{
break;
}
}
return aLex.MarkedToken();
}
示例12: ReadDurationL
// -----------------------------------------------------------------------------
// CStartupAdaptationStubModel::ReadDurationL
//
// -----------------------------------------------------------------------------
//
TInt CStartupAdaptationStubModel::ReadDurationL( TLex& aLexer )
{
RDEBUG( _L( "CStartupAdaptationStubModel::ReadDurationL." ) );
TInt val = KDefaultDuration;
if ( aLexer.Peek() == '[' ) // Duration value is written to file
{
aLexer.Inc();
User::LeaveIfError( aLexer.Val( val ) );
if ( aLexer.Get() != ']' )
{
User::Leave( KErrCorrupt );
}
}
RDEBUG_1( _L( "CStartupAdaptationStubModel::ReadDurationL finished with %d." ), val );
return val;
}
示例13: SkipSpaces
// -----------------------------------------------------------------------------
// CAknKeyRotatorImpl::SkipSpaces
// Skips over spaces.
// -----------------------------------------------------------------------------
//
TInt CAknKeyRotatorImpl::SkipSpaces( TLex& aLex )
{
TInt flags = 0;
// Skip spaces, but stop at end of line.
while ( !aLex.Eos() && !IsEndOfLine( aLex.Peek() ) )
{
if ( aLex.Peek().IsSpace() )
{
// There was a space, so ok for now.
flags |= EAknWasSpace;
aLex.Inc();
}
else
{
flags |= EAknWasCharacter;
break;
}
}
return flags;
}
示例14: TextToNextCommand
TPtrC TextToNextCommand(TLex& aLex)
{
aLex.Mark();
if (SkipToNextCommand(aLex) != KErrNone)
{
aLex.Inc(aLex.Remainder().Length());
}
TLex lex(aLex.MarkedToken());
// Strip leading white space.
while (!lex.Eos())
{
if (lex.Peek().IsSpace())
{
lex.Get();
}
else
{
break;
}
}
lex.Mark();
TInt startOffset = lex.Offset();
// Remove trailing white space.
lex.Inc(lex.Remainder().Length());
while (lex.Offset() > startOffset)
{
lex.UnGet();
if (!lex.Peek().IsSpace())
{
lex.Get();
break;
}
}
return lex.MarkedToken();
}
示例15: SearchGenericUriL
/**
Search algorithm for searching generic URIs
@param aText Text that will be parsed
@return ETrue if any generic URI is found else returns EFalse
@leave KErrNone, if successful; otherwise one of the other system-wide error codes.
*/
TBool CTulAddressStringTokenizer::SearchGenericUriL( const TDesC& aText )
{
// Detect generic URI within the token
const TDesC& schemeStartArray = KURISchemeStartCharacters;
const TDesC& schemeBodyArray = KURISchemeBodyCharacters;
const TDesC& schemeTerminatorArray = KURISchemeTerminator;
const TDesC& URIArray = KURICharacters;
TBool wasValidUri = EFalse;
TLex text = aText;
while ( !text.Eos() )
{
// Discard characters until URI scheme terminator is found
while( !(text.Eos()) && schemeTerminatorArray.Locate(text.Peek()) == KErrNotFound )
text.Inc();
// if at end of the text, no legit URI found
if ( !text.Eos() )
{
// Store the schema end offset (+1 to skip ':')
TInt schemeEndOffset = text.Offset() + 1;
// Scheme must be at least 1 character long at the beginning of the text to be valid
if ( text.Offset() > 0 )
{
// Un-get last scheme character to begin examination
text.UnGet();
// Rewind until beginning of the URI
while ( text.Offset() > 0 && schemeBodyArray.Locate(text.Peek().GetLowerCase()) != KErrNotFound )
text.UnGet();
// Now text pointer is at first character of the URI
// Do go back through the scheme until a legal beginning character for URI
// is found or back to the (schemeEndOffset - 1) i.e. URI scheme terminator
while ( schemeStartArray.Locate(text.Peek().GetLowerCase()) == KErrNotFound && (text.Offset() + 1) < schemeEndOffset )
text.Inc();
// check if terminated because a valid start character was found when
// scheme terminator was reached.
if ( schemeStartArray.Locate(text.Peek().GetLowerCase()) != KErrNotFound )
{
// First character is a valid URI char, so the scheme is valid ->
// marks the beginning of the array
text.Mark();
// fast forward to the end of the scheme
while( text.Offset() < schemeEndOffset )
text.Inc();
// Get characters until end of schema
while( !(text.Eos()) && URIArray.Locate( text.Peek().GetLowerCase() ) != KErrNotFound )
text.Inc();
// remove certain punctuation from end of the URI, as it is likely
// to be part of the surrounding text.
text.UnGet();
//special processing for bracket
//only remove the end bracket if there is no open bracket in the uri
//not counting bracket pairs for efficiency
if (text.Peek()!=')' || text.MarkedToken().Locate(TChar('('))!=-1)
text.Inc();
text.UnGet();
if ( text.Peek() != '.' && text.Peek() != '?' && text.Peek() != ',')
text.Inc();
// URI cannot contain only scheme, so check that pointer was increased
// by at least one character
if ( schemeEndOffset != text.Offset() )
{
// Append found text to item array (it is now known to be
// syntactically valid URI as it contains characters after the scheme)
AddItemL( text.MarkedOffset(), text.Offset() - text.MarkedOffset(), EFindItemSearchScheme );
wasValidUri = ETrue;
}
}
else // First character of scheme is not legit, fast forward to end of the
// scheme anyway to continue search
{
while( text.Offset() < schemeEndOffset )
text.Inc();
}
}
else
text.Inc();
}
}
return wasValidUri;
}