本文整理汇总了C++中TLex::TokenLength方法的典型用法代码示例。如果您正苦于以下问题:C++ TLex::TokenLength方法的具体用法?C++ TLex::TokenLength怎么用?C++ TLex::TokenLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLex
的用法示例。
在下文中一共展示了TLex::TokenLength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
//.........这里部分代码省略.........