本文整理汇总了C++中TParse::NameAndExt方法的典型用法代码示例。如果您正苦于以下问题:C++ TParse::NameAndExt方法的具体用法?C++ TParse::NameAndExt怎么用?C++ TParse::NameAndExt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TParse
的用法示例。
在下文中一共展示了TParse::NameAndExt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testBugL
/**
@SYMTestCaseID SYSLIB-STORE-CT-1131
@SYMTestCaseDesc Writing and reading back a long stream test
@SYMTestPriority High
@SYMTestActions Attempt to write long data to a stream and read back and test for the integrity of the data.
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
LOCAL_C void testBugL()
{
test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1131 Opening host file "));
TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive()));
TParse parse;
parse.Set(drive.Name(), &KFileLocationSpec, NULL);
CFileStore* file=CDirectFileStore::ReplaceLC(TheFs,parse.NameAndExt(),EFileRead|EFileWrite);
file->SetTypeL(file->Layout());
CSecureStore* secure=NULL;
secure=CSecureStore::NewLC(*file,*thePBEKey);
test.Next(_L("Writing long stream"));
RStoreWriteStream out;
TStreamId id=out.CreateLC(*secure);
TInt ii;
for (ii=0;ii<400;++ii)
out<<_L("a goodly length of data");
out.CommitL();
CleanupStack::PopAndDestroy();
file->SetRootL(out.CreateLC(*secure));
out<<_L("spam")<<id;
out.CommitL();
CleanupStack::PopAndDestroy(2, secure);
file->CommitL();
CleanupStack::PopAndDestroy();
//
test.Next(_L("Opening host file"));
file=CFileStore::OpenLC(TheFs,parse.NameAndExt(),EFileRead);
secure=CSecureStore::NewLC(*file,*thePBEKey);
//
TBuf<30> buf;
test.Next(_L("Reading"));
RStoreReadStream in;
in.OpenLC(*secure,file->Root());
in>>buf>>id;
CleanupStack::PopAndDestroy();
test(buf==_L("spam"));
in.OpenLC(*secure,id);
for (ii=0;ii<400;++ii)
{
in>>buf;
test (buf==_L("a goodly length of data"));
}
CleanupStack::PopAndDestroy(3);
}
示例2: ConstructL
void CAknFileSettingPage::ConstructL(void)
{
BaseConstructL();
//listbox icons
CAknIconArray* icons=new(ELeave)CAknIconArray(2);
CleanupStack::PushL(icons);
icons->ConstructFromResourceL(R_CLOCKAPP_EXTRA_SETTING_ICONS);
FileControl()->ItemDrawer()->ColumnData()->SetIconArray(icons);
CleanupStack::Pop(); //icons
//listbox items
iFiles=new(ELeave)CDesCArrayFlat(32);
CTextListBoxModel* model=FileControl()->Model();
model->SetItemTextArray(iFiles); //old text array deleted by owner
model->SetOwnershipType(ELbmOwnsItemArray); //transfer ownership
TParse parse;
parse.SetNoWild(iFileValue,NULL,NULL);
TPtrC name=parse.NameAndExt(),path=parse.DriveAndPath();
TDesC* pos=&name;
if(!BaflUtils::PathExists(iFs,path))
{
pos=NULL;
iFileValue.Zero();
}
ReadFilesL(pos);
}
示例3: StartL
void CAddObexAttachmentAsEntryState::StartL(TRequestStatus& aStatus)
{
// Add an attachment as a child entry
CBaseMtm& clientMtm = iClientTest.ObexTestUtils().GetCurrentObexClientMtm();
CMsvEntry& entry = clientMtm.Entry();
CMsvStore* store = entry.EditStoreL();
CleanupStack::PushL(store);
CAsyncWaiter* waiter = CAsyncWaiter::NewL();
CleanupStack::PushL(waiter);
CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
CleanupStack::PushL(attachment);
TParse fileNameParser;
User::LeaveIfError(fileNameParser.Set(iFileName, NULL, NULL));
attachment->SetAttachmentNameL(fileNameParser.NameAndExt());
store->AttachmentManagerL().AddAttachmentL(iFileName, attachment, waiter->iStatus);
CleanupStack::Pop(attachment);
waiter->StartAndWait();
User::LeaveIfError(waiter->Result());
CleanupStack::PopAndDestroy(waiter);
store->CommitL();
CleanupStack::PopAndDestroy(store);
TRequestStatus* status = &aStatus;
User::RequestComplete(status, KErrNone);
}
示例4: CreateFlogger
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"));
}
示例5: RunTestL
void CMtfTestActionAddAttachmentAsLink::RunTestL()
{
CMsvStore* paramStore = ObtainParameterReferenceL<CMsvStore>(TestCase(),ActionParameters().Parameter(0));
HBufC* paramFilePath = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(1));
HBufC8* paramMimeType = ObtainParameterReferenceL<HBufC8>(TestCase(),ActionParameters().Parameter(2));
CMtfAsyncWaiter* waiter = CMtfAsyncWaiter::NewL();
CleanupStack::PushL(waiter);
CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvLinkedFile);
CleanupStack::PushL(attachment);
attachment->SetMimeTypeL(*paramMimeType);
TParse fileNameParser;
User::LeaveIfError(fileNameParser.Set(*paramFilePath, NULL, NULL));
attachment->SetAttachmentNameL(fileNameParser.NameAndExt());
MMsvAttachmentManager& manager = paramStore->AttachmentManagerL();
manager.AddLinkedAttachmentL(*paramFilePath, attachment, waiter->iStatus);
CleanupStack::Pop(attachment); // ownership passed to manager
waiter->StartAndWait();
User::LeaveIfError(waiter->Result());
CleanupStack::PopAndDestroy(waiter);
TMsvAttachmentId attachmentId = attachment->Id();
paramStore->CommitL();
StoreParameterL<TMsvAttachmentId>(TestCase(),attachmentId,ActionParameters().Parameter(3));
}
示例6: testWriteL
/**
@SYMTestCaseID SYSLIB-STORE-CT-1128
@SYMTestCaseDesc Tests for writing to a store
@SYMTestPriority High
@SYMTestActions Attempt for writing to a root store and empty store.
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
LOCAL_C void testWriteL()
{
test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1128 Replacing host file "));
TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive()));
TParse parse;
parse.Set(drive.Name(), &KFileLocationSpec, NULL);
CFileStore* file=CPermanentFileStore::ReplaceLC(TheFs,parse.NameAndExt(),EFileWrite);
file->SetTypeL(file->Layout());
//
test.Next(_L("Writing root store"));
RStoreWriteStream stream;
TStreamId embed=stream.CreateL(*file);
CEmbeddedStore* store=CEmbeddedStore::NewLC(stream);
CSecureStore* secure=CSecureStore::NewLC(*store, *thePBEKey);
store->SetRootL(testWriteL(*secure));
CleanupStack::PopAndDestroy(secure);
store->CommitL();
CleanupStack::PopAndDestroy();
__UHEAP_MARK;
TStreamId root=stream.CreateLC(*file);
REncryptStream encrypt;
encrypt.AttachLC(stream,*thePBEKey);
encrypt<<_L8(" root")<<embed;
encrypt.CommitL();
CleanupStack::PopAndDestroy(2);
__UHEAP_MARKEND;
file->SetRootL(root);
//
test.Next(_L("Writing temp store"));
embed=stream.CreateL(*file);
store=CEmbeddedStore::NewLC(stream);
secure = CSecureStore::NewLC(*store, *thePBEKey);
store->SetRootL(testWriteL(*secure));
CleanupStack::PopAndDestroy(secure);
store->CommitL();
CleanupStack::PopAndDestroy();
__UHEAP_MARK;
TheTempId=stream.CreateLC(*file);
encrypt.OpenLC(stream,*thePBEKey);
encrypt<<_L8(" temp")<<embed;
encrypt.CommitL();
CleanupStack::PopAndDestroy();
stream.CommitL();
CleanupStack::PopAndDestroy();
__UHEAP_MARKEND;
//
file->CommitL();
CleanupStack::PopAndDestroy(file);
}
示例7: testWriteL
/**
@SYMTestCaseID SYSLIB-STORE-CT-1153
@SYMTestCaseDesc Tests for writing using a permanent file store
@SYMTestPriority High
@SYMTestActions Tests for memory and end of file error while creating the store.
Tests for writing to replaced,temporary,opened,created file.
Tests for creating an already existing file.
Tests for panic while deleting a file.
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
LOCAL_C void testWriteL()
{
test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1153 Creating and failing to open 'ghost' file "));
TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive()));
TParse parse;
parse.Set(drive.Name(), &KFileLocationSpec, NULL);
TheFs.Delete(parse.NameAndExt());
CFileStore* store=CPermanentFileStore::CreateLC(TheFs,parse.NameAndExt(),EFileWrite);
CleanupStack::PopAndDestroy();
store=NULL;
TRAPD(r,store=CPermanentFileStore::OpenL(TheFs,parse.NameAndExt(),EFileRead|EFileWrite));
test(store==NULL&&r==KErrEof);
//
test.Next(_L("Empty tests on replaced file"));
store=CPermanentFileStore::ReplaceLC(TheFs,parse.NameAndExt(),EFileWrite);
store->SetTypeL(TUidType(KPermanentFileStoreLayoutUid,KPermanentFileStoreLayoutUid));
testEmptyL(*store);
CleanupStack::PopAndDestroy();
//
test.Next(_L("Writing to temp file"));
store=CPermanentFileStore::TempLC(TheFs,parse.DriveAndPath(),TheTempFile,EFileWrite);
store->SetTypeL(TUidType(store->Layout(),KNullUid,KPermanentFileStoreLayoutUid));
testWriteL(*store);
store->CommitL();
CleanupStack::PopAndDestroy();
(void)TheFs.Delete(TheTempFile);
//
test.Next(_L("Writing to temp file - 2"));
store=CPermanentFileStore::TempL(TheFs,parse.DriveAndPath(),TheTempFile,EFileWrite);
CleanupStack::PushL(store);
store->SetTypeL(TUidType(store->Layout(),KNullUid,KPermanentFileStoreLayoutUid));
testWriteL(*store);
store->CommitL();
CleanupStack::PopAndDestroy();
//
test.Next(_L("Writing to opened file"));
store=CPermanentFileStore::OpenLC(TheFs,parse.NameAndExt(),EFileRead|EFileWrite);
testWriteL(*store);
store->CommitL();
CleanupStack::PopAndDestroy();
//
test.Next(_L("Failing to create existing file"));
store=NULL;
TRAP(r,store=CPermanentFileStore::CreateL(TheFs,TheTempFile,EFileWrite));
test(store==NULL&&r==KErrAlreadyExists);
if (TheFs.Delete(parse.NameAndExt())!=KErrNone)
test.Panic(_L("Deleting file"));
//
test.Next(_L("Writing to created file"));
RFile file;
test(file.Create(TheFs,parse.NameAndExt(),EFileWrite)==KErrNone);
store=CPermanentFileStore::NewLC(file);
store->SetTypeL(KPermanentFileStoreLayoutUid);
testWriteL(*store);
store->CommitL();
CleanupStack::PopAndDestroy();
}
示例8: WriteRootStreamL
/** Writes the application identifier (derived from the application object CApaApplication)
followed by the stream dictionary to the store and makes the stream dictionary the root stream of the
store.
Typically, the function is called by the application when it
implements a file create or file save type operation. It is called after all
model and UI data has been persisted. The IDs of the streams containing the
model and UI data should have been lodged in the stream dictionary.
In effect, the function finishes off the file save or file
create type operation, leaving the file containing the store in a valid state
with the standard interface.
@param aStore The store to which the root stream is to be written. Before
calling this function, a reference to the store must be saved by putting a
pointer onto the cleanup stack or by making it member data of a class. This
ensures that it is not orphaned in the event of this function leaving.
@param aStreamDic The stream dictionary containing the locations and associated
UIDs of other streams in the store.
@param aApp The application used to create the main document in the file
being written. The application identifier to be written is constructed from
this application object. */
EXPORT_C void CApaProcess::WriteRootStreamL(CPersistentStore& aStore,CStreamDictionary& aStreamDic,const CApaApplication& aApp)
{ // this is a static method
__SHOW_TRACE(_L("Starting CApaProcess::WriteRootStreamL(app)"));
// get the app dll name
TParse dllPath;
dllPath.SetNoWild(aApp.DllName(),NULL,NULL);
// set up an app identifier
TApaAppIdentifier appId(aApp.AppDllUid(),dllPath.NameAndExt());
// Write the root stream
WriteRootStreamL(aStore,aStreamDic,appId);
}
示例9: RequestRenameFile
void CFileEngine::RequestRenameFile(const TDesC& aFileName)
{
//ASSERT(NULL == iRenameFile);
CInputDialog* inputDialog = iControlFactory.CreateInputTextDialog(*this,iMainEngine.GetDesById(ETurkeyTextRes_ReName),KNullDesC,ECmdRenameFile);
TParse parse;
parse.Set(aFileName,NULL,NULL);
inputDialog->SetEdwinText(parse.NameAndExt());
delete iRenameFile;
iRenameFile = NULL;
iRenameFile = aFileName.AllocL();
// iInputEvent = ECmdRenameFile;
}
示例10: CreateFlogger
EXPORT_C
#if defined (_DEBUG)
void TInuLogger::CreateFlogger(const TDesC& aFileName, TInt aShowDate, TInt aShowTime)
//
// Create log file in directory KLogsdir\KWapLogsDirName - Note: ingore Drive and Path of aFilename
{
iLogger.Connect();
TParse p;
p.Set(aFileName, NULL, NULL);
iLogger.CreateLog(KInuLogsDirName, p.NameAndExt(), EFileLoggingModeOverwrite);
iLogger.SetDateAndTime(aShowDate, aShowTime);
iLogger.Write(KTestHeader);
}
示例11: RunTestL
void CMtfTestActionSmtpAddLinkedAttachment::RunTestL()
{
CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
TMsvId messageEntry = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
HBufC* paramFilePath = ObtainParameterReferenceL<HBufC>(TestCase(),ActionParameters().Parameter(2));
HBufC8* paramMimeType = ObtainParameterReferenceL<HBufC8>(TestCase(),ActionParameters().Parameter(3));
CMsvEntry* entry = paramSession->GetEntryL(messageEntry);
CleanupStack::PushL(entry);
CImEmailMessage* emailMsg = CImEmailMessage::NewL(*entry);
CleanupStack::PushL(emailMsg);
CMtfAsyncWaiter* waiter = CMtfAsyncWaiter::NewL();
CleanupStack::PushL(waiter);
CMsvAttachment* attachment = CMsvAttachment::NewL(CMsvAttachment::EMsvLinkedFile);
CleanupStack::PushL(attachment);
attachment->SetMimeTypeL(*paramMimeType);
TParse fileNameParser;
User::LeaveIfError(fileNameParser.Set(*paramFilePath, NULL, NULL));
attachment->SetAttachmentNameL(fileNameParser.NameAndExt());
TEntry fileEntry;
User::LeaveIfError(paramSession->FileSession().Entry( fileNameParser.FullName(), fileEntry));
attachment->SetSize(fileEntry.iSize);
MMsvAttachmentManager& manager = emailMsg->AttachmentManager();
manager.AddLinkedAttachmentL(*paramFilePath, attachment, waiter->iStatus);
CleanupStack::Pop(attachment); // ownership passed to manager
waiter->StartAndWait();
User::LeaveIfError(waiter->Result());
CleanupStack::PopAndDestroy(waiter);
attachment = NULL;
TInt attachmentCount = manager.AttachmentCount();
attachment = manager.GetAttachmentInfoL(attachmentCount - 1);
CleanupStack::PushL(attachment);
TMsvAttachmentId attachmentId = attachment->Id();
CleanupStack::PopAndDestroy(attachment);
CleanupStack::PopAndDestroy(2, entry); // emailMsg, entry
StoreParameterL<TMsvAttachmentId>(TestCase(),attachmentId,ActionParameters().Parameter(4));
}
示例12: WriteFileDataL
EXPORT_C void CMsvTestUtils::WriteFileDataL(TMsvId aId, const TFileName& aFileName, const TFileName& aLogFilepath, TBool aReplace)
{
TParse dirPath;
RFile attach;
dirPath.Set(aFileName, NULL, NULL);
TInt err = KErrNone;
if (attach.Open(iFs, dirPath.FullName(), KEntryAttNormal) != KErrNone)
return; // failed to find attachment
TFileName filename(aLogFilepath);
filename.Append(KFileNameFiles);
RFile file;
if (aReplace)
err = file.Replace(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);
else
err = file.Open(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);
if(err==KErrNotFound) // file does not exist - create it
err=file.Create(iFs, filename, EFileShareAny | EFileStreamText | EFileWrite);
TInt offset=0;
__ASSERT_ALWAYS(file.Seek(ESeekEnd, offset)==KErrNone, Panic(KErrGeneral));
TBuf<100> buf;
buf.Zero();
buf.AppendFormat(_L("\n*** %d *************** File Data ***************\n"), aId);
buf.AppendFormat(_L("Filename >>> "));
WriteToFileL(file, buf);
WriteToFileL(file, dirPath.NameAndExt());
WriteToFileL(file,_L("\n"));
HBufC8* buffer8 = HBufC8::NewLC(1024);
TPtr8 buf8 = buffer8->Des();
do {
attach.Read(buf8);
WriteToFileL(file, buf8);
} while (buf8.Length());
buf.Zero();
buf.AppendFormat(_L("\n********************* end of File ***********************\n"));
WriteToFileL(file, buf);
CleanupStack::PopAndDestroy(); // buffer8
attach.Close();
file.Close();
}
示例13: testReadL
/**
@SYMTestCaseID SYSLIB-STORE-CT-1129
@SYMTestCaseDesc Tests for reading from a store
@SYMTestPriority High
@SYMTestActions Attempt for reading from a root store and temporary store
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
LOCAL_C void testReadL()
{
test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1129 Opening host file "));
TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive()));
TParse parse;
parse.Set(drive.Name(), &KFileLocationSpec, NULL);
CFileStore* file=CFileStore::OpenLC(TheFs,parse.NameAndExt(),EFileRead);
//
test.Next(_L("Reading from root store"));
TStreamId root=file->Root();
RStoreReadStream stream;
stream.OpenLC(*file,root);
RDecryptStream decrypt;
decrypt.AttachLC(stream,*thePBEKey);
TStreamId embed;
TBuf8<5> b;
decrypt>>b>>embed;
test(b==_L8(" root"));
CleanupStack::PopAndDestroy(2);
stream.OpenL(*file,embed);
CEmbeddedStore* store=CEmbeddedStore::FromLC(stream);
CSecureStore* secure=NULL;
secure=CSecureStore::NewLC(*store,*thePBEKey);
testReadL(*secure,store->Root());
CleanupStack::PopAndDestroy(2);
//
test.Next(_L("Reading from temp store"));
stream.OpenLC(*file,TheTempId);
decrypt.OpenLC(stream,*thePBEKey);
decrypt>>b>>embed;
test(b==_L8(" temp"));
CleanupStack::PopAndDestroy(2);
stream.OpenL(*file,embed);
store=CEmbeddedStore::FromLC(stream);
secure=CSecureStore::NewLC(*store,*thePBEKey);
testReadL(*secure,store->Root());
//
CleanupStack::PopAndDestroy(3);
}
示例14: SaveAs
void CFileEngine::SaveAs()
{
ASSERT(iSaveAsSrcName);
ASSERT(iSaveAsDstPath);
TParse parse;
parse.Set(*iSaveAsSrcName,NULL,NULL);
const TDesC& nameAndExt = parse.NameAndExt();
HBufC* saveAsDstName = HBufC::NewLC(iSaveAsDstPath->Length() + nameAndExt.Length());
saveAsDstName->Des().Append(*iSaveAsDstPath);
saveAsDstName->Des().Append(nameAndExt);
//iFileActiveEngine.MoveFile(*iSaveAsSrcName,*saveAsDstName,this);
iFileActiveEngine.CopyFile(*iSaveAsSrcName,*saveAsDstName,this);
CleanupStack::PopAndDestroy(saveAsDstName);
delete iSaveAsSrcName;
iSaveAsSrcName = NULL;
delete iSaveAsDstPath;
iSaveAsDstPath = NULL;
}
示例15: FigureOutRealPathL
// class CIconFileHandle : public CBase, public MContextBase,
void FigureOutRealPathL(const TDesC& aFullPath, TDes& aRealPath, RFs& aFs)
{
CALLSTACKITEMSTATIC_N(_CL("JuikIcons"), _CL("FigureOutRealPathL"));
if ( aFullPath == AknIconUtils::AvkonIconFileName() )
{
aRealPath.Copy( aFullPath );
return;
}
#ifdef __S60V3__
// Change path to c:\\resource
TParse p; p.Set( aFullPath, 0, 0);
aRealPath=_L("c:\\resource\\");
aRealPath.Append(p.NameAndExt());
#else
// Just use given path
aRealPath=aFullPath;
#endif
#ifdef __WINS__
// in WINS, read always from Z
aRealPath.Replace(0, 1, _L("z"));
#else
// In device, if file doesn't exist, read from E
TBool try_mif=EFalse;
if (p.Ext().CompareF(_L(".mbm"))==0) try_mif=ETrue;
again:
if (! BaflUtils::FileExists(aFs, aRealPath)) {
aRealPath.Replace(0, 1, _L("e"));
if (! BaflUtils::FileExists(aFs, aRealPath)) {
if (try_mif) {
aRealPath=_L("c:\\resource\\");
aRealPath.Append(p.Name());
aRealPath.Append(_L(".mif"));
try_mif=EFalse;
goto again;
}
User::Leave(KErrNotFound);
}
}
#endif
}