本文整理汇总了C++中TParse类的典型用法代码示例。如果您正苦于以下问题:C++ TParse类的具体用法?C++ TParse怎么用?C++ TParse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TParse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoRecognizeL
void CTorrentRecognizer::DoRecognizeL(const TDesC &aName, const TDesC8 &/*aBuffer*/)
{
iConfidence = ECertain;
TParse parse;
parse.Set(aName, NULL, NULL);
TPtrC ext = parse.Ext();
if (ext.CompareF(KTorrentExtension) == 0)
{
iConfidence = ECertain;
iDataType = TDataType(KTorrentType);
}
else
{
iConfidence = ENotRecognized;
iDataType = TDataType();
}
/*TFileName name=aName;
name.LowerCase();
if (name.Right(KTorrentExtension().Length()) == KTorrentExtension)
{
iDataType = TDataType(KTorrentType);
return;
}*/
}
示例2: defined
EXPORT_C
#if defined (_DEBUG)
/**
Function to create log file
@param aFileName The descriptor that holds the name of the log file to be created.
@param aShowDate If set to 1, the date of creation of the log file is recorded.
@param aShowTime If set to 1, the time of creation of the log file is recorded.
*/
void THttpLogger::CreateFlogger(const TDesC& aFileName, TInt aShowDate, TInt aShowTime)
//
// Create log file in directory KLogsdir\KWapLogsDirName - Note: ingore Drive and Path of aFilename
{
if(!iLogger)
{
iLogger = new RFileLogger;
}
if(iLogger)
{
TInt error = iLogger->Connect();
if(error == KErrNone)
{
TParse p;
p.Set(aFileName, NULL, NULL);
iLogger->CreateLog(KHttpLogsDirName, p.NameAndExt(), EFileLoggingModeOverwrite);
iLogger->SetDateAndTime(aShowDate, aShowTime);
iLogger->Write(KTestHeader);
}
else
User::InfoPrint(_L("Flogger connect failed"));
}
else
User::InfoPrint(_L("Flogger create failed"));
}
示例3: _LIT
TInt CTestUtils::AppendMainLogL()
{
_LIT(KDisplayLogFile,"Log File %S\n");
TParse loglocation;
TFileName logfile;
TInt err=ResolveLogFile(KNullDesC, loglocation);
if(err!=KErrNone)
{
iFs.MkDirAll(KMsvTestFileDefaultOutputBase);
err=ResolveLogFile(KNullDesC, loglocation);
}
User::LeaveIfError(err);
logfile.Copy(loglocation.FullName());
logfile.Delete(logfile.Length()-1,1);
AppendVariantName(logfile);
iRTest.Printf(KDisplayLogFile, &logfile);
iFs.MkDirAll(logfile);
iLogBuf=HBufC::NewL(KMaxLogLineLength);
iLogBuf8=HBufC8::NewL(KMaxLogLineLength);
TInt pos=0;
TInt ret=KErrNone;
ret=iFile.Open(iFs,logfile,EFileWrite|EFileShareAny);
if (ret==KErrNotFound)
ret=iFile.Create(iFs,logfile,EFileWrite|EFileShareAny);
if (ret==KErrNone)
return(iFile.Seek(ESeekEnd,pos));
else
return(ret);
}
示例4: requested
EXPORT_C void CPrintSetup::AddPrinterDriverDirL(const TDesC& aDriverDir)
/** Adds a search path for printer drivers.
This function must be called before a model name list can be created. It can
be called repeatedly to add a number of paths to the search list.
When a printer model name list is requested (using ModelNameListL()), the
directories specified in each of the search paths are scanned on all non-remote
drives for .pdr files, indicating the models supported. If any path contains
a drive, that drive alone is searched.
@param aDriverDir Path which specifies a directory in which to search for
printer drivers. Any filename in the path is ignored. If the path is already
in the list, it is not added again.
@leave KErrNoMemory There is insufficient memory to perform the operation. */
{
TParse parser;
parser.Set(aDriverDir,NULL,NULL);
for (TInt i=iDriverDirList->Count()-1 ; i>=0 ; i--)
{
if ( (*iDriverDirList)[i].CompareF(parser.DriveAndPath())==0 )
return; // its already on the list, so dont add it again
}
iDriverDirList->AppendL(parser.DriveAndPath());
}
示例5: CreateandOpenL
// -----------------------------------------------------------------------------
// CWPInternetAPDB::CreateandOpenL
// -----------------------------------------------------------------------------
//
void CSCOMOAdapterDb::CreateandOpenL(TParse& name)
{
TInt err;
#ifdef SYMBIAN_SECURE_DBMS
iDatabase.Create(iRdbSession, name.FullName(), KDBMSSecureID);
#else
if( SysUtil::FFSSpaceBelowCriticalLevelL( &iFsSession, KEmptyDbSizeEstimate ) )
{
User::Leave( KErrDiskFull );
}
iDatabase.Create(iFsSession, name.FullName());
#endif
CreateTableL(iDatabase);
iDatabase.Close();
#ifdef SYMBIAN_SECURE_DBMS
err = iDatabase.Open(iRdbSession, name.FullName(), KDBMSSecureID);
#else
err = iDatabase.Open(iFsSession, DBFileName);
#endif
//Debug
if (err != KErrNone)
{
User::LeaveIfError(err);
}
}
示例6: _LIT
// -----------------------------------------------------------------------------
// CbsUtils::FindAndOpenDefaultResourceFileLC
// Searches and opens the DLL default resource file.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CbsUtils::FindAndOpenDefaultResourceFileLC(
RFs& aFs,
RResourceFile& aResFile )
{
// default resource file path
_LIT(KDirAndFile,"z:CbsServer.rsc");
TParse* fp = new(ELeave) TParse();
fp->Set(KDirAndFile, &KDC_RESOURCE_FILES_DIR, NULL);
static const TInt KDefResFileSignature = 4;
// Find the resource file
TFileName fileName( fp->FullName() );
BaflUtils::NearestLanguageFile( aFs, fileName );
// Open the resource file
aResFile.OpenL( aFs, fileName );
// Push close operation in tbe cleanup stack
CleanupClosePushL( aResFile );
aResFile.ConfirmSignatureL( KDefResFileSignature );
delete fp;
}
示例7: MainL
LOCAL_C void MainL()
/**
* Main implementation
*/
{
CActiveScheduler* sched=NULL;
sched=new(ELeave) CActiveScheduler;
CActiveScheduler::Install(sched);
CTeIpUpsSuite* server = NULL;
CCommandLineArguments* args = CCommandLineArguments::NewLC();
TPtrC exeName = args->Arg(0);
TParse fullName;
fullName.Set(exeName, NULL, NULL);
CleanupStack::PopAndDestroy(args);
// Create the CTestServer derived server
TRAPD(err,server = CTeIpUpsSuite::NewL(fullName.Name()));
if(!err)
{
// Sync with the client and enter the active scheduler
RProcess::Rendezvous(KErrNone);
sched->Start();
}
delete server;
delete sched;
}
示例8: CleanupClosePushL
void CQualityProfileApi_ProfileReadStep::InitializeQualityProfileInfoL()
{
RFs fs;
User::LeaveIfError(fs.Connect());
CleanupClosePushL(fs);
TBuf<32> privatePath;
User::LeaveIfError(fs.PrivatePath(privatePath));
TParse parse;
parse.Set(privatePath, NULL, NULL);
parse.AddDir(KLbsDir);
RArray<TQualityProfile> qualityArray;
CleanupClosePushL(qualityArray);
qualityArray.Reserve(5);
// Only want to use the first file that is found.
// The way TFindFile::FindByDir works, it will search
// C: and D: before Z:, which is what we want.
TFindFile findFile(fs);
TInt err = findFile.FindByDir(KQualityProfileIniName, parse.Path());
if (err == KErrNone)
{
GetQualityProfileInfoL(fs, qualityArray, findFile.File());
}
// Publish the quality profile info
LbsQualityProfile::InitializeL(qualityArray);
CleanupStack::PopAndDestroy(&qualityArray);
CleanupStack::PopAndDestroy(&fs);
}
示例9: TRAPD
HBufC* CScriptFile::ReadFileLC(const TDesC& aScript) const
{
HBufC8* file = NULL;
TRAPD(err, file = ReadFileL(aScript));
if (err)
{
TParse fileOut;
err = iTestUtils.ResolveFile(*iComponent, aScript, fileOut);
if (err)
{
iTestUtils.Test().Printf(_L("Cannot read file %S. Error=%d"), &aScript, err);
User::Leave(err);
}
file = ReadFileL(fileOut.FullName());
}
CleanupStack::PushL(file);
HBufC* buf = HBufC::NewL(file->Length());
buf->Des().Copy(*file);
CleanupStack::PopAndDestroy(file);
CleanupStack::PushL(buf);
return buf;
}
示例10: CreateHiddenProfilesL
void CNSmlDSSettings::CreateHiddenProfilesL()
{
TFileName fileName;
Dll::FileName( fileName );
TParse parse;
parse.Set( KNSmlDSProfilesRsc, &fileName, NULL );
fileName = parse.FullName();
RResourceFile resourceFile;
BaflUtils::NearestLanguageFile( iFsSession, fileName );
TRAPD(leavecode,resourceFile.OpenL( iFsSession,fileName));
if(leavecode != 0)
{
return;
}
CleanupClosePushL(resourceFile);
HBufC8* profileRes = resourceFile.AllocReadLC( NSML_DS_PROFILES );
TResourceReader reader;
reader.SetBuffer( profileRes );
CNSmlDSResourceProfiles* profileResReader = CNSmlDSResourceProfiles::NewLC( reader, this );
profileResReader->SaveProfilesL(iResourceProfileArray);
CleanupStack::PopAndDestroy(3); // profileResReader, profileRes, resourceFile
}
示例11: DataFileL
// -----------------------------------------------------------------------------
// DataFileL
// return data filename as a TParse
// -----------------------------------------------------------------------------
//
LOCAL_C TParse DataFileL(RFs& aFs)
{
TBuf<256> path;
TParse p;
User::LeaveIfError(aFs.PrivatePath(path));
#ifndef RD_MULTIPLE_DRIVE
p.Set(KHelperServerDataStorage,&path,NULL);
#else //RD_MULTIPLE_DRIVE
TInt driveNumber( -1 );
TChar driveLetter;
DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, driveNumber );
aFs.DriveToChar( driveNumber, driveLetter );
TFileName helperServerDataStorage;
helperServerDataStorage.Format(
KHelperServerDataStorage, (TUint)driveLetter );
p.Set( helperServerDataStorage, &path, NULL );
#endif
return p;
}
示例12: TestOOML
/**
Test CDictionaryFileStore construction, forcing a leave error at each
possible stage of the process.
@SYMTestCaseID SYSLIB-STORE-CT-1190
@SYMTestCaseDesc Tests for CDictionaryFileStore construction under low memory conditions.
@SYMTestPriority High
@SYMTestActions Attempt for construction under low memory conditions.
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
LOCAL_C void TestOOML()
{
test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1190 Construction under low memory conditions "));
TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive()));
TParse dicFilePath;
dicFilePath.Set(drive.Name(), &KDicFilePath, NULL);
TheFs.Delete(dicFilePath.FullName()); // delete the file
TInt failRate=0;
for (failRate=1;;failRate++)
{
__UHEAP_SETFAIL(RHeap::EDeterministic,failRate);
__UHEAP_MARK;
TRAPD(ret, AddEntryL());
__UHEAP_MARKEND;
if (ret==KErrNone)
break;
test (ret==KErrNoMemory);
__UHEAP_RESET;
test (!CheckEntryL());
}
__UHEAP_RESET;
test (CheckEntryL());
test.Printf(_L(" #allocs for update: %d\n"),failRate-1);
//
// tidy up
}
示例13: CleanupClosePushL
// ---------------------------------------------------------
// CNSmlDsProvisioningAdapter::GetTitleL
// ---------------------------------------------------------
void CNSmlDsProvisioningAdapter::GetTitleL()
{
if( iTitle == 0 )
{
RFs fs;
User::LeaveIfError( fs.Connect() );
CleanupClosePushL( fs );
TFileName fileName;
TParse parse;
parse.Set( KNSmlDsPovisioningDirAndResource, &KDC_RESOURCE_FILES_DIR, NULL );
fileName = parse.FullName();
RResourceFile resourceFile;
BaflUtils::NearestLanguageFile( fs, fileName );
resourceFile.OpenL( fs, fileName );
CleanupClosePushL( resourceFile );
HBufC8* dataBuffer = resourceFile.AllocReadLC( R_SYNC_PROVISIONING_TITLE );
TResourceReader reader;
reader.SetBuffer( dataBuffer );
iTitle = reader.ReadHBufC16L();
CleanupStack::PopAndDestroy( 3 ); //fs, resourcefile, databuffer
}
}
示例14: __LOGSTR_TOFILE
void CSupLoginServiceProvider::ConstructL()
{
__LOGSTR_TOFILE("CSupLoginServiceProvider::ConstructL() begins");
// Form full path to credentials settings file
RFs &fs = CCoeEnv::Static()->FsSession();
TFileName privatePath;
fs.PrivatePath(privatePath);
TParse parser;
TFileName processFileName(RProcess().FileName());
User::LeaveIfError(parser.Set(KLoginProviderSettingsFilename, &privatePath, &processFileName));
iSettingsFile = parser.FullName();
// Read credentials from settings file
ReadDataFromFileL();
if (iMemberID && iUsername && iPassword)
iLogged = ETrue;
// Discover and retrieve description of the web service
CSenXmlServiceDescription* serviceDesc = CSenXmlServiceDescription::NewLC( KServiceEndpointMemberId, KNullDesC8 );
serviceDesc->SetFrameworkIdL(KDefaultBasicWebServicesFrameworkID);
// Create connection to web service
iConnection = CSenServiceConnection::NewL(*this, *serviceDesc);
CleanupStack::PopAndDestroy(); // serviceDesc
__LOGSTR_TOFILE("CSupLoginServiceProvider::ConstructL() ends");
}
示例15: TestAddBifL
void CSmsSendRecvTest::TestAddBifL(const TDesC& aBifName)
{
iSmsTest.Printf(_L("\tAdd BIF: %S\n"), &aBifName);
RFs& fs = iSmsTest.FileSession();
TInt err = fs.MkDir(KBifDir);
if (err != KErrAlreadyExists)
User::LeaveIfError(err);
TParse fileOut;
err = iSmsTest.ResolveFile(KSmsComponent, aBifName, fileOut);
if (err)
{
iSmsTest.Printf(_L("Test BIF %S not found! Continuing without this test\n"), &aBifName);
return;
}
CFileMan* fileMan = CFileMan::NewL(fs);
CleanupStack::PushL(fileMan);
err = fileMan->Copy(fileOut.FullName(), KBifDir);
if (err != KErrAlreadyExists)
User::LeaveIfError(err);
CleanupStack::PopAndDestroy(fileMan);
User::After(KBifWait);
}