本文整理汇总了C++中TLex::Eos方法的典型用法代码示例。如果您正苦于以下问题:C++ TLex::Eos方法的具体用法?C++ TLex::Eos怎么用?C++ TLex::Eos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLex
的用法示例。
在下文中一共展示了TLex::Eos方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadStructuredListL
// -----------------------------------------------------------------------------
// CStartupAdaptationStubModel::ReadStructuredListL
//
// -----------------------------------------------------------------------------
//
void CStartupAdaptationStubModel::ReadStructuredListL(
const TInt aNumParts,
TLex& aLexer,
CStructuredList& aList )
{
RDEBUG( _L( "CStartupAdaptationStubModel::ReadStructuredListL." ) );
while ( !aLexer.Eos() )
{
aList.AppendL( ReadDurationL( aLexer ) );
TUint val( 0 );
User::LeaveIfError( aLexer.Val( val, EHex ) );
aList.AppendL( val );
for ( TInt i = 0; i < aNumParts - 1; i++ )
{
if ( aLexer.Get() != ',' ) User::Leave( KErrCorrupt );
User::LeaveIfError( aLexer.Val( val, EHex ) );
aList.AppendL( val );
}
if ( !aLexer.Eos() && aLexer.Get() != ';' ) User::Leave( KErrCorrupt );
}
if ( aList.Count() == 0 ) User::Leave( KErrCorrupt );
RDEBUG_1( _L( "CStartupAdaptationStubModel::ReadStructuredListL finished. List length: %d" ), aList.Count() );
}
示例2: 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);
}
示例3: GetEnumValuesL
void GetEnumValuesL(TLex& aLex, RBuf& aValues, RBuf& aDescriptions)
{
aValues.CreateL(0x100);
aDescriptions.CreateL(0x100);
while (!aLex.Eos())
{
TLexMark mark;
aLex.Mark(mark);
TPtrC command(NextCommand(aLex));
if (command == KCmndEnumValue)
{
TPtrC value(NextWord(aLex));
TPtrC description(TextToNextCommand(aLex));
if (value.Length() == 0)
{
User::Leave(KErrArgument);
}
AppendL(aValues, value, EFalse);
if (description.Length() > 0)
{
AppendL(aDescriptions, description, ETrue);
}
}
else
{
aLex.UnGetToMark(mark);
break;
}
}
}
示例4: LeaveIfEmptyFieldsL
//fix for DEF017686: EMail notification parser leaves when field data is empty
void CEmailNotificationParser::LeaveIfEmptyFieldsL(const TDesC& aFieldName,
const TLex& aTokenLex)
{
/*
The following checks for an empty field value.
The only fields allowed to be empty are the subject and extension fields.
Hence, the check is done when aFieldName is not a subject field and an extension field.
However, it is not possible to explicitly check for an extension field as we don't
know which strings to compare. Therefore, a comparison with all the known field names
must be performed instead. The risk is fairly small as the change is localised and it can
be easily tested.
*/
if ((aFieldName.CompareF(KHeaderFrom)==KErrNone) ||
(aFieldName.CompareF(KHeaderSize)==KErrNone) ||
(aFieldName.CompareF(KHeaderUidImap)==KErrNone) ||
(aFieldName.CompareF(KHeaderUidPop)==KErrNone) ||
(aFieldName.CompareF(KHeaderServerId)==KErrNone) ||
(aFieldName.CompareF(KHeaderAttachments)==KErrNone) ||
(aFieldName.CompareF(KHeaderTo)==KErrNone) ||
(aFieldName.CompareF(KHeaderCc)==KErrNone) ||
(aFieldName.CompareF(KHeaderDate)==KErrNone) ||
(aFieldName.CompareF(KHeaderFolder)==KErrNone) ||
(aFieldName.CompareF(KHeaderSender)==KErrNone) ||
(aFieldName.CompareF(KHeaderReplyTo)==KErrNone) ||
(aFieldName.CompareF(KHeaderUidValidity)==KErrNone) //not sure if this actually exists*/
)
if (aTokenLex.Eos())
User::Leave(KBspSmartMessageInvalidToken);
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: result
// ----------------------------------------------------
// CheckIPv6Address()
// IPv6address = hexpart [ ":" IPv4address ]
// ----------------------------------------------------
//
LOCAL_C TBool CheckIPv6Address( TLex& aLex )
{
TBool result( CheckIPv6HexPart( aLex ) );
if( aLex.Peek() == '.' )
{
while( aLex.Peek() != ':' && aLex.Offset() > 0 )
{
aLex.UnGet();
}
aLex.Inc();
result = CheckIPv4Address( aLex );
}
return result && aLex.Eos();
}
示例9: ValF
TInt TfrLex::ValF( TLex& aLex, const TDesC& aTerm )
{
TLex term( aTerm );
TLexMark mark;
aLex.Mark( mark );
while ( !term.Eos() )
{
if ( aLex.Eos() || User::Fold(term.Get()) != User::Fold(aLex.Get()) )
{
aLex.UnGetToMark( mark );
return KErrNotFound;
}
}
return KErrNone;
}
示例10: ParseVersionComponent
TInt CSwisExpressionEnvironment::ParseVersionComponent(const TDesC& aComponentString)
{
/**
* Convert the string into a TInt representation and check that
* the string is a valid decimal value
*/
TLex componentLex = aComponentString;
TInt componentValue = 0;
if(componentLex.Val(componentValue) == KErrNone && componentLex.Eos())
{
return componentValue;
}
// Return an error if the TInt value is not parsed correctly
return KErrNotFound;
}
示例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: 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;
}
示例13: CreateCfgDataFromFileL
/**
* Read the Cfg File data into a heap buffer
* And populate the arrays of selective test case IDs and
* Ranges to be used by the state machine
* NOTE: we do not support nested cfgs...
*/
LOCAL_C void CreateCfgDataFromFileL(TPtrC& aCfgFilePath,RArray<TRange>& aSelectiveCaseRange, TDesC*& aSelTestCfgFileData)
{
RFs fS;
User::LeaveIfError(fS.Connect());
CleanupClosePushL(fS);
RFile cfgFile;
User::LeaveIfError(cfgFile.Open(fS,aCfgFilePath,EFileRead | EFileShareAny));
CleanupClosePushL(cfgFile);
TInt fileSize;
User::LeaveIfError(cfgFile.Size(fileSize));
// Create a 16bit heap buffer
HBufC* cfgData = HBufC::NewL(fileSize);
CleanupStack::PushL(cfgData);
HBufC8* narrowData = HBufC8::NewL(fileSize);
CleanupStack::PushL(narrowData);
TPtr8 narrowPtr=narrowData->Des();
// Read the file into an 8bit heap buffer
User::LeaveIfError(cfgFile.Read(narrowPtr));
TPtr widePtr(cfgData->Des());
// Copy it to the 16bit buffer
widePtr.Copy(narrowData->Des());
CleanupStack::PopAndDestroy(narrowData);
CleanupStack::Pop(cfgData);
CleanupStack::Pop(2);
cfgFile.Close();
fS.Close();
// Set up the instance token parser
TLex cfgLex = cfgData->Des();
aSelTestCfgFileData = cfgData; // to preserve the pointer of cfgdata and transfer the ownership to aSelTestCfgFileData
cfgData = NULL; // relinquish the ownership
while(!cfgLex.Eos())
{
DistinguishElement(cfgLex.NextToken(),aSelectiveCaseRange) ;
}
}
示例14: SaveSettingsL
TBool CSettingView::SaveSettingsL()
{
// Save settings to the member variables
StoreSettingsL();
// Validate input
TLex lex;
TInt maxPacketCount;
lex.Assign( iMaxPacketCount );
if ( lex.Val( maxPacketCount ) != KErrNone )
{
CEikonEnv::Static()->InfoMsg(_L("Packet count must be numeric"));
return EFalse;
}
TInt packetDataSize;
lex.Assign( iPacketDataSize );
if ( lex.Val( packetDataSize ) != KErrNone )
{
CEikonEnv::Static()->InfoMsg(_L("Packet size must be numeric"));
return EFalse;
}
TInt waitTime;
lex.Assign( iWaitTime );
if ( lex.Val( waitTime ) != KErrNone )
{
CEikonEnv::Static()->InfoMsg(_L("Wait time must be numeric"));
return EFalse;
}
TInt lastWaitTime;
lex.Assign( iLastWaitTime );
if ( lex.Val( lastWaitTime ) != KErrNone )
{
CEikonEnv::Static()->InfoMsg(_L("Last wait time must be numeric"));
return EFalse;
}
lex.Assign( iPattern );
while (!lex.Eos())
{
if (!lex.Get().IsHexDigit())
{
CEikonEnv::Static()->InfoMsg(_L("Pattern must be hexadecimal"));
return EFalse;
}
}
// Validation OK, so save settings to the model
iPingModel->iPackLimit = iLimitPacketCount;
iPingModel->iTotalPackets = maxPacketCount;
iPingModel->iPacketDataSize = packetDataSize;
iPingModel->iSecWait = waitTime;
iPingModel->iLastSecWait = lastWaitTime;
iPingModel->iPattern.Copy(iPattern);
iPingModel->iQuiet = iQuiet;
iPingModel->iVerbose = iVerbose;
iPingModel->iDebug = iDebug;
#ifdef IAPSETTING
TInt iap;
lex.Assign( iIAP );
lex.Val( iap );
iPingModel->iIAP = iap;
#endif
return ETrue;
}
示例15: ParseMessageL
//
// ParseMessageL()
//
// Simple Notification:
// Looks for number of messages and "From:" field
// writes numMsg into the parsed field array, sets
// entry.iDetails to the "From:"
// Complicated Notification:
// does the above and writes everything else into
// the array....
//
void CEmailNotificationParser::ParseMessageL()
{
TBool isSimpleNotification = EFalse;
TLex tokenLex;
TPtrC fieldName;
TPtrC fieldValue;
// reset parsedfield array
for(TInt i = iParsedFieldArray->Count();--i>=0;)
(*iParsedFieldArray)[i]->SetFieldValueL(_L(""));
// Set extraction mark at first character
iSms.SkipSpaceAndMark();
if(iSms.Peek() == KCharSlash)
{
// Check first line is <header>
iSms.SkipCharacters();
if (iSms.MarkedToken() != KEmailHeader)
{
User::Leave(KBspInvalidMessage);
}
// Get <new-amount> from second line and check for terminating linefeed
iSms.SkipSpaceAndMark();
}
// Val() seeks forward from next char position, looking for valid
// digits and incrementing next char as it goes.
if (!(iSms.Val(iMessageCount) == KErrNone && iMessageCount >= 0)) // If marked token is not a valid positive integer
{
iMessageCount = 0;
User::Leave(KBspInvalidMessage);
}
else
{
fieldValue.Set(iSms.MarkedToken()); // The message count..
AddParsedFieldL(KHeaderNumberMessages, fieldValue, ETrue);
}
// Next character may now be at newline or space after integer.
// If at space, advance to newline.
while (iSms.Peek() != KCharLineFeed && !iSms.Eos())
iSms.Inc();
iSms.SkipSpaceAndMark();
// Now parse the rest of the fields, if any.
while (!iSms.Eos())
{
while (iSms.Peek() != KCharLineFeed && !iSms.Eos())
iSms.Inc(); // Skip to next delimiter
if (iSms.Eos())
break; // we've finished break out of the function
if (iSms.TokenLength() == 0)
User::Leave(KBspSmartMessageInvalidToken);
// Parsing....
tokenLex.Assign(iSms.MarkedToken()); // Assign token to a new TLex
while (tokenLex.Peek() != KCharColon && !tokenLex.Eos())
tokenLex.Inc(); // Advance to a ':'
if (tokenLex.Eos() || tokenLex.TokenLength() == 0)
User::Leave(KBspSmartMessageInvalidToken);
fieldName.Set(tokenLex.MarkedToken()); // Store (pointer to) field name
tokenLex.Inc();
//fix for DEF017686
LeaveIfEmptyFieldsL(fieldName,tokenLex);
tokenLex.SkipSpaceAndMark(); // Step past optional spaces
//fix for DEF017686
LeaveIfEmptyFieldsL(fieldName,tokenLex);
// if it's the server id field try to extract the id value
// and match to an existing email service
if(fieldName.CompareF(KHeaderServerId)==KErrNone)
{
TInt valErr = tokenLex.Val(iServerId);
if(valErr != KErrNone)
iServerId = 0;
else
GetEmailServicesL();
//.........这里部分代码省略.........