本文整理汇总了C++中TLex::NextToken方法的典型用法代码示例。如果您正苦于以下问题:C++ TLex::NextToken方法的具体用法?C++ TLex::NextToken怎么用?C++ TLex::NextToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLex
的用法示例。
在下文中一共展示了TLex::NextToken方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OkToExitL
TBool CEmTubeVideoUploadDialog::OkToExitL(TInt aButtonId)
{
if (aButtonId == EAknSoftkeyDone)
{
SaveFormDataL();
if( iQueueEntry->Title().Length() == 0 )
{
HBufC* message = StringLoader::LoadLC( R_DIALOG_TITLE_AND_DESCRIPTION_NEEDED_TXT );
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
informationNote->ExecuteLD( *message );
CleanupStack::PopAndDestroy( message );
return EFalse;
}
if( iQueueEntry->Description().Length() == 0 )
{
HBufC* message = StringLoader::LoadLC( R_DIALOG_TITLE_AND_DESCRIPTION_NEEDED_TXT );
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
informationNote->ExecuteLD( *message );
CleanupStack::PopAndDestroy( message );
return EFalse;
}
TBool res = ETrue;
if( iQueueEntry->Tags().Length() == 0 )
res = EFalse;
TLex lex = TLex( iQueueEntry->Tags() );
TPtrC16 ptr( lex.NextToken() );
TInt tokenCount = 0;
while( ptr.Length() && (tokenCount < 2) )
{
tokenCount++;
ptr.Set( lex.NextToken() );
}
if( tokenCount < 2 )
res = EFalse;
if( !res )
{
HBufC* message = StringLoader::LoadLC( R_DIALOG_TWO_TAGS_NEEDED_TXT );
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
informationNote->ExecuteLD( *message );
CleanupStack::PopAndDestroy( message );
return EFalse;
}
return ETrue;
}
else
{
return CAknForm::OkToExitL(aButtonId);
}
}
示例2: 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;
}
示例3: 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) ;
}
}