本文整理汇总了C++中TLex::Assign方法的典型用法代码示例。如果您正苦于以下问题:C++ TLex::Assign方法的具体用法?C++ TLex::Assign怎么用?C++ TLex::Assign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLex
的用法示例。
在下文中一共展示了TLex::Assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CTap2MenuAppUi::ReadExceptions()
{
TInt err=KErrNone;
iExceptions.Reset();
if (BaflUtils::FileExists(CEikonEnv::Static()->FsSession(),KExceptionsPath)) //!!!!!!!!!!!!!!!!!!!!!!!!!!!
{
TBuf<255> val;
TLex conv;
TUint32 IntVal;
RFile filesave;
TBuf<255> t;
TFileText ft;
filesave.Open(CEikonEnv::Static()->FsSession(), KExceptionsPath, EFileRead);
ft.Set(filesave);
while (ft.Read(val)==KErrNone)
{
conv.Assign(val);
conv.Val(IntVal,EHex);
iExceptions.AppendL(TUid::Uid(IntVal));
}
filesave.Close();
}
else
{
TParse parse;
CEikonEnv::Static()->FsSession().Parse(KExceptionsPath,parse);
if (!BaflUtils::FolderExists(CEikonEnv::Static()->FsSession(),parse.DriveAndPath()))
{
CEikonEnv::Static()->FsSession().MkDirAll(parse.DriveAndPath());
}
}
}
示例2: ConstructL
void CSettings::ConstructL()
{
RFs fs;
RFile file;
TFileText text;
TLex lex;
TBuf<256> buf;
User::LeaveIfError(fs.Connect());
if(file.Open(fs,_L("C:\\System\\Apps\\vcall\\times"),EFileRead) != KErrNone)
{
User::Panic(_L("Config file not open"),KErrNotFound);
}
text.Set(file);
while(text.Read(buf) == KErrNone)
{
lex.Assign(buf);
TInt val;
lex.Val(val);//TODO: error handling
iTimes.Append(val);
}
file.Close();
//iTimes.SortSigned();//TODO: fix sort
iTimer = CVTimer::NewL();
iTimer->setTimes(iTimes);
}
示例3: GetIntValueL
TInt CTerminalControlServer::GetIntValueL( TInt aSCPCommandEnum )
{
TBuf<MAX_NUMBER_OF_DIGITS_IN_10BASE_INT64> valueStr;
TInt value;
TLex lex;
User::LeaveIfError( iSCPClient.GetParamValue( aSCPCommandEnum, valueStr ) );
lex.Assign( valueStr );
User::LeaveIfError( lex.Val( value ) );
return value;
}
示例4: GetLockMaxTimeoutL
// ----------------------------------------------------------------------------------------
// CTerminalControlServer::GetLockMaxTimeoutL
// ----------------------------------------------------------------------------------------
TInt CTerminalControlServer::GetLockMaxTimeoutL( )
{
RDEBUG("CTerminalControlServer::GetLockMaxTimeoutL");
TBuf<MAX_NUMBER_OF_DIGITS_IN_10BASE_INT64> valueStr;
TInt value;
TLex lex;
User::LeaveIfError( iSCPClient.GetParamValue(ESCPMaxAutolockPeriod/*RTerminalControl3rdPartySession::EMaxTimeout*/, valueStr) );
lex.Assign(valueStr);
User::LeaveIfError(lex.Val( value ));
return value;
}
示例5: Register
bool CMobileOfficeAppUi::Register()
{
TBuf <64> buff;
HBufC * propmtText = CEikonEnv::Static()->AllocReadResourceL( R_STR_INPUT_ACTIVATION_CODE );
CAknTextQueryDialog* dlg = new(ELeave) CAknTextQueryDialog( buff, CAknQueryDialog::ENoTone );
if (dlg->ExecuteLD(R_GNFIELDQUERY_BIGNUMBER_QUERY, *propmtText ))
{
int user_number = 0;
TLex lx;
lx.Assign( buff );
lx.Val( user_number );
licMan.SetUnlockCode( user_number );
// Dummy code
TBuf<64> aImei;
}
if( licMan.Is_dm_1() )
{
HBufC* errorText = StringLoader::LoadLC( R_MOBILESEARCH_ERROR );
HBufC* invalidCodeText = StringLoader::LoadLC( R_MOBILESEARCH_INVALIDCODE );
CEikonEnv::Static()->InfoWinL( *errorText, *invalidCodeText );
CleanupStack::PopAndDestroy( invalidCodeText );
CleanupStack::PopAndDestroy( errorText );
}
else
{
HBufC* correctCodeText = StringLoader::LoadLC( R_MOBILESEARCH_CORRECTCODE );
HBufC* thanksText = StringLoader::LoadLC( R_MOBILESEARCH_THANKS );
CEikonEnv::Static()->InfoWinL( *correctCodeText, *thanksText );
CleanupStack::PopAndDestroy( thanksText );
CleanupStack::PopAndDestroy( correctCodeText );
}
delete propmtText;
return true;
}
示例6: Work
LOCAL_C void Work()
{
__LOGSTR("Work");
RProcess proc;
TInt val;
TBuf<5> buf2;
TLex lex;
buf2.Copy(proc.FullName().Right(1));
lex.Assign(buf2);
lex.Val(val);
if(val > 1)
{
}else{
CPhoneReceiver* res = CPhoneReceiver::NewLC();
CActiveScheduler::Start();
_CPOPD(res);
}
}
示例7: Connect
// -----------------------------------------------------------------------------
// RsearchServerSession::Connect()
// Connects to the server and create a session.
// -----------------------------------------------------------------------------
EXPORT_C TInt RSearchServerSession::Connect()
{
//read the name and Uid of the search server
TInt err = KErrNotReady;
// get the watchdog repro
//TRAP_IGNORE is used to avoid the code scanner error
CRepository* wdrepo = NULL;
TRAP_IGNORE(wdrepo = CRepository::NewL( KWDrepoUidMenu ));
if ( wdrepo )
{
HBufC* servername = NULL;
TUid serveruid = {0};
TBuf<KCenrepUidLength> temp;
TInt64 value;
TLex uidvalue;
//read the searchserver UId
if ( KErrNone == wdrepo->Get( KSearchServerUIDKey, temp ))
{
uidvalue.Assign(temp);
if (KErrNone == uidvalue.Val( value,EHex ))
serveruid.iUid = value;
}
//read the search server name
if ( KErrNone == wdrepo->Get( KSearchServerNAMEKey, temp ))
{
//TRAP_IGNORE is used to avoid the code scanner error
TRAP_IGNORE(servername = HBufC::NewL( temp.Length() ));
TPtr ssname = servername->Des();
ssname.Copy( temp );
}
// make sure the server is started before creating connection
if ( servername )
err = StartServer( *servername , serveruid );
if ( KErrNone == err )
{
err = CreateSession(*servername, Version(), KDefaultMessageSlots);
}
delete servername;
}
delete wdrepo;
return err;
}
示例8: IsAllDigits
// -----------------------------------------------------------------------------
// CSTSPinConverter::IsAllDigits
// Checks, are all values in gived descriptor digits or not.
// Returns: ETrue: All was digits
// EFalse: At least one value was not digit
// -----------------------------------------------------------------------------
TBool CSTSPinConverter::IsAllDigits(const TDesC& aPinValue)
{
//if empty
if (aPinValue.Length() == 0)
{
return EFalse;
}
TLex lex;
lex.Assign(aPinValue);
while (lex.Peek() != 0)
{
if (!(lex.Get()).IsDigit())
{
//if was not digit
return EFalse;
}
}
return ETrue;
}
示例9: OnStartElementL
void CBLParser::OnStartElementL( const RTagInfo &aElement, const RAttributeArray &aAttributes, TInt aErrorCode )
{
(void)aErrorCode;
TBuf<KMaxFileName> name;
RAttribute attr;
TBuf<10> num;
TLex lex;
TInt err(KErrNone);
TUint32 scan(0);
name.Copy(aElement.LocalName().DesC());
if(aAttributes.Count())
{
attr = aAttributes[0];
num.Copy(attr.Value().DesC());
lex.Assign(num);
if(name == KBlacklist)
{
err = lex.Val(scan,EHex);
iObserver.AddToBlacklist(scan);
}
}
}
示例10: 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();
//.........这里部分代码省略.........
示例11: ParseTimeStrMilliL
void TAzenqosEngineUtils::ParseTimeStrMilliL(const TDesC& str,TTime &time)
{
TInt instrlen = str.Length();
if(str.Length() != KTimeStampMillisecStrLen )
User::Leave(KErrBadName);
TDateTime date;
TPtrC ptr(0,0);
TInt pos=0;
TLex lex;
TInt val;
//_LIT(KTimeStampMillisecFormat,"%02d%02d%02d_%02d:%02d:%02d.%03d");
///year
ptr.Set(str.Mid(pos,2));
pos+=2;
lex.Assign(ptr);
val=0;
User::LeaveIfError(lex.Val(val));
val+=2000;
User::LeaveIfError(date.SetYear(val));
//month
ptr.Set(str.Mid(pos,2));
pos+=2;
lex.Assign(ptr);
val=0;
User::LeaveIfError(lex.Val(val));
if(val<1 || val > 12)//month should be at least 1 so we can set as symbian format: month-1
User::Leave(KErrGeneral);
val--;//Symbian format EJanuary is 0
User::LeaveIfError(date.SetMonth((TMonth)val));
//day
ptr.Set(str.Mid(pos,2));
pos+=2;
lex.Assign(ptr);
val=0;
User::LeaveIfError(lex.Val(val));
if(val<1 || val > 31)//day limit
User::Leave(KErrGeneral);
val--;//Symbian format EJanuary is 0
User::LeaveIfError(date.SetDay(val));
//skip '_'
pos+=1;
//HH
ptr.Set(str.Mid(pos,2));
pos+=2;
lex.Assign(ptr);
val=0;
User::LeaveIfError(lex.Val(val));
if(val<0 || val > 23)//0 to 23 Hrs
User::Leave(KErrGeneral);
User::LeaveIfError(date.SetHour(val));
//skip ':'
pos+=1;
//MM
ptr.Set(str.Mid(pos,2));
pos+=2;
lex.Assign(ptr);
val=0;
User::LeaveIfError(lex.Val(val));
if(val<0 || val > 59)//0 to 59 mins
User::Leave(KErrGeneral);
User::LeaveIfError(date.SetMinute(val));
//skip ':'
pos+=1;
//SS
ptr.Set(str.Mid(pos,2));
pos+=2;
lex.Assign(ptr);
val=0;
User::LeaveIfError(lex.Val(val));
if(val<0 || val > 59)//0 to 59 Seconds
User::Leave(KErrGeneral);
User::LeaveIfError(date.SetSecond(val));
//skip '.'
pos+=1;
//SSS
ptr.Set(str.Mid(pos,3));
pos+=3;
lex.Assign(ptr);
val=0;
User::LeaveIfError(lex.Val(val));
if(val<0 || val > 999999)//0 to 999999 MicroSeconds
User::Leave(KErrGeneral);
User::LeaveIfError(date.SetMicroSecond(val));
time = date;
//.........这里部分代码省略.........
示例12: doTestStepPreambleL
/**
* Reads test configuration data from ini file
* Leaves if expected data not found
*/
TVerdict CWServTestStep::doTestStepPreambleL()
{
TVerdict ret=CTestStep::doTestStepPreambleL();
if (!GetIntFromConfig(KDefaultSectionName, KT_WservStressInit, iData.initPeriod)||
!GetIntFromConfig(KDefaultSectionName, KT_WservStressPeriod, iData.period)||
!GetIntFromConfig(KDefaultSectionName, KT_WservStressMaxRunCycles, iData.maxRunCycles))
{
INFO_PRINTF1(_L("Error reading ini file"));
User::Leave(KErrNotFound);
}
//random_seed is not a mandatory parameter
iData.randomSeed = -1;
TPtrC strSeed;
GetStringFromConfig(KDefaultSectionName, KT_WservStressRandomSeed, strSeed);
if (strSeed.Ptr())
{
TLex seed;
seed.Assign(strSeed);
seed.Val(iData.randomSeed);
}
iData.minNumWindows = 0; //unlimited
GetIntFromConfig(KDefaultSectionName, KT_WservStressMinNumWindows, iData.minNumWindows);
iData.windowWidth = 400;
GetIntFromConfig(KDefaultSectionName, KT_WservStressWindowWidth, iData.windowWidth);
iData.windowHeight = 400;
GetIntFromConfig(KDefaultSectionName, KT_WservStressWindowHeight, iData.windowHeight);
iData.compareBitmaps = ETrue;
GetBoolFromConfig(KDefaultSectionName, KT_WservStressCompareBitmaps, iData.compareBitmaps);
iData.saveOnlyDifferent = ETrue;
GetBoolFromConfig(KDefaultSectionName, KT_WservStressSaveOnlyDifferent, iData.saveOnlyDifferent);
iData.saveDifferenceBitmap = EFalse;
GetBoolFromConfig(KDefaultSectionName, KT_WservStressSaveDifferenceBitmap, iData.saveDifferenceBitmap);
iData.clearAllBackground = ETrue;
GetBoolFromConfig(KDefaultSectionName, KT_WservStressClearAllBackground, iData.clearAllBackground);
TPtrC path;
GetStringFromConfig(KDefaultSectionName, KT_WservStressLoggingPath, path);
RBuf loggingPath;
loggingPath.CleanupClosePushL();
loggingPath.CreateL(path.Length() + 16);
if (path.Length())
{
loggingPath.Copy(path);
if (path[path.Length()-1] != '\\')
{
loggingPath.Append('\\');
}
}
else
{
loggingPath = _L("C:\\StressLog\\");
}
iData.loggingPath = loggingPath;
CleanupStack::PopAndDestroy(&loggingPath);
return ret;
}
示例13: ReadConf
void CMyServer::ReadConf()
{
__LOGSTR("ReadConf");
if(iFile.Open(iFs,KFileConfig,EFileRead) != KErrNone)
{//file not exist
__LOGSTR("File not exist");
TInt err = iFs.MkDirAll(KFileConfigDir);
__LOGSTR1("Mkdir: %d",err);
iFile.Replace(iFs,KFileConfig,EFileRead|EFileWrite);
TFileText text;
iFile.Write(0,_L8("\xff\xfe"));//signature
text.Set(iFile);
text.Write(_L("140"));//iX
text.Write(_L("190"));//iY
text.Write(_L("120"));//iLandY
text.Write(_L("150"));//iLandX
text.Write(_L("15"));//iHeight
text.Write(_L("0xffffff"));//TRgb white
text.Write(_L("0x102750f0"));//default UID
iFile.Close();
ReadConf();
}else{
__LOGSTR("File exist");
//file exist
TFileText text;
TLex lex;
TBuf<32> buf;
text.Set(iFile);
text.Read(buf);
lex.Assign(buf);
lex.Val(iConfig.iX);
text.Read(buf);
lex.Assign(buf);
lex.Val(iConfig.iY);
text.Read(buf);
lex.Assign(buf);
lex.Val(iConfig.iLandY);
text.Read(buf);
lex.Assign(buf);
lex.Val(iConfig.iLandX);
text.Read(buf);
lex.Assign(buf);
lex.Val(iConfig.iHeight);
text.Read(buf);
if(buf.Left(2)==_L("0x"))
buf.Delete(0,2);
lex.Assign(buf);
TUint32 rgb;
lex.Val(rgb,EHex);
iConfig.iColor = rgb;
text.Read(buf);
buf.Delete(0,2); // delete 0x
lex.Assign(buf);
TUint tempuid;
lex.Val(tempuid,EHex);
iConfig.iUid.iUid = tempuid;
iFile.Close();
}
}
示例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: ReadIniFileL
void TSimpleSettings::ReadIniFileL( RFs& aFs )
{
// Set few values without reading them from ini file
CSimpleSettingFile* configFile = CSimpleSettingFile::NewL( aFs );
CleanupStack::PushL( configFile ); // *****
// Search current drive
TFileName path;
Dll::FileName( path );
TDriveName drive( TParsePtrC( path ).Drive( ) );
// In emulator we try to find from c drive
// in hardware we try to find from current drive and then from RAM.
#ifdef __WINS__
TFileName fileN( KSimpleIniFile);
#else
TFileName fileN( drive );
fileN.Append( KSimpleIniFile );
#endif
TInt err = 0;
// Open temporary config file
TRAP( err, configFile->OpenL( fileN ));
if ( err && drive.CompareF( _L("c:") ))
{
err = KErrNone;
fileN = _L("c:");
fileN.Append( KSimpleIniFile );
TRAP( err, configFile->OpenL( fileN ));
}
if ( err )
{
err = KErrNone;
TSimpleLogger::Log(_L("Config file not found ***"));
User::Leave( KErrNotFound );
}
else
{
TSimpleLogger::Log(_L("Config file found ***"));
}
TUint32 myUint = 0;
TPtrC8 myPtr;
TBuf<8> myBuffer;
// read expiry times
TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleExpiryPuhlish)));
if ( !err )
{
myBuffer.Copy( myPtr );
TLex lex;
lex.Assign( myBuffer );
lex.Val(myUint, EDecimal);
iExpiryPuhlish = (TInt) myUint;
}
TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleExpiryWatcher)));
if ( !err )
{
myBuffer.Copy( myPtr );
TLex lex;
lex.Assign( myBuffer );
lex.Val(myUint, EDecimal);
iExpiryWatcher = (TInt) myUint;
}
TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleExpiryWinfo)));
if ( !err )
{
myBuffer.Copy( myPtr );
TLex lex;
lex.Assign( myBuffer );
lex.Val(myUint, EDecimal);
iExpiryWinfo = (TInt) myUint;
}
TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleExpiryAPI)));
if ( !err )
{
myBuffer.Copy( myPtr );
TLex lex;
lex.Assign( myBuffer );
lex.Val(myUint, EDecimal);
iExpiryApi = (TInt) myUint;
}
TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleObjLimit)));
if ( !err )
{
myBuffer.Copy( myPtr );
TLex lex;
lex.Assign( myBuffer );
lex.Val(myUint, EDecimal);
iObjLimit = (TInt) myUint;
}
TRAP( err, myPtr.Set( configFile->KeyValueL(KSimpleThrottle)));
if ( !err )
{
myBuffer.Copy( myPtr );
//.........这里部分代码省略.........