本文整理汇总了C++中TParse::SetNoWild方法的典型用法代码示例。如果您正苦于以下问题:C++ TParse::SetNoWild方法的具体用法?C++ TParse::SetNoWild怎么用?C++ TParse::SetNoWild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TParse
的用法示例。
在下文中一共展示了TParse::SetNoWild方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: SetFolderL
void CAknFileSettingPage::SetFolderL(const TDesC& aFolder)
{
TParse parse;
TFileName file;
TDesC* pos=NULL;
parse.SetNoWild(iFileValue,NULL,NULL);
if(aFolder.CompareF(KFolderUp)==0)
{
if(iFileValue.Length())
{
if(parse.PopDir()==KErrNone)
{
TParse parse2;
parse2.SetNoWild(iFileValue,NULL,NULL);
TPtrC ptr=parse2.DriveAndPath();
file=ptr.Left(ptr.Length()-1);
parse2.SetNoWild(file,NULL,NULL);
file=parse2.NameAndExt();
pos=&file;
iFileValue=parse.DriveAndPath();
}
else
iFileValue.Zero();
}
}
else
{
iFileValue=parse.DriveAndPath();
iFileValue.Append(aFolder);
iFileValue.Append('\\');
}
ReadFilesL(pos);
}
示例3: CheckDiskSpace
// ---------------------------------------------------------
// CCookieManagerServer::CheckDiskSpace
// ---------------------------------------------------------
//
TBool CCookieManagerServer::CheckDiskSpace( RFs& aFileSystem,
const TDesC& aFileName ) const
{
TInt err;
TParse parse;
err = parse.SetNoWild( aFileName, NULL, NULL );
if ( err == KErrNone )
{
// This is in the form : drive-letter: (letter + semi-colon)
TBuf<2> driveBuf( parse.Drive() );
TCharF driveLetter( driveBuf[0] );
TCharF driveALetter( 'A' );
TDriveNumber driveNum = (TDriveNumber)( (TUint)(driveLetter) -
(TUint)(driveALetter) );
TBool noSpace = EFalse;
TRAP( err, noSpace = SysUtil::DiskSpaceBelowCriticalLevelL
( &aFileSystem, KCookieMaxFileLength, driveNum ) );
if ( err == KErrNone && noSpace )
{
err = KErrDiskFull;
}
}
return ( err == KErrNone ? ETrue : EFalse );
}
示例4: 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);
}
示例5: ReadFilesL
void CAknFileSettingPage::ReadFilesL(const TDesC* aPos)
{
TInt pos=-1;
iFiles->Reset();
FileControl()->Reset();
TFileName buffer;
if(iFileValue.Length())
{
buffer.Copy(KFolderIcon);
buffer.Append(KFolderUp);
iFiles->AppendL(buffer);
TParse parse;
parse.SetNoWild(iFileValue,NULL,NULL);
CDir* list;
User::LeaveIfError(iFs.GetDir(parse.DriveAndPath(),KEntryAttMaskSupported,ESortByName|EDirsFirst,list));
CleanupStack::PushL(list);
for(TInt i=0; i<list->Count(); i++)
{
const TDesC& name=(*list)[i].iName;
if((*list)[i].IsDir())
{
buffer.Copy(KFolderIcon);
}
else
{
if(name.MatchF(KMelodyMask1)<0&&name.MatchF(KMelodyMask2)<0&&name.MatchF(KMelodyMask3)<0&&name.MatchF(KMelodyMask4)<0) continue;
buffer.Copy(KMelodyIcon);
}
buffer.Append(name);
if(aPos&&name.MatchF(*aPos)>=0) pos=iFiles->Count();
iFiles->AppendL(buffer);
}
CleanupStack::PopAndDestroy(); //list
}
else
{
TDriveList drives;
User::LeaveIfError(iFs.DriveList(drives));
for(TInt drive=EDriveA; drive<=EDriveZ; drive++)
{
if(drives[drive])
{
buffer.Copy(KFolderIcon);
buffer.Append(drive+'a');
buffer.Append(':');
iFiles->AppendL(buffer);
}
}
}
FileControl()->HandleItemAdditionL();
if(pos!=-1) FileControl()->SetCurrentItemIndexAndDraw(pos);
UpdateFileL();
}
示例6: UpdateFileL
void CAknFileSettingPage::UpdateFileL(void)
{
if(iFileValue.Length())
{
TPtrC item=(*iFiles)[FileControl()->CurrentItemIndex()],name=item.Mid(2);
TParse parse;
parse.SetNoWild(iFileValue,NULL,NULL);
iFileValue=parse.DriveAndPath();
iFileValue.Append(name);
}
CheckAndSetDataValidity();
UpdateCbaL();
}
示例7: RemoveDirectoryTreeL
void RemoveDirectoryTreeL(RFs& aFs, const TDesC& aFileName)
{
TParse directory;
User::LeaveIfError(directory.SetNoWild(aFileName, NULL, NULL));
while(!directory.IsRoot())
{
// try to remove this directory
TInt err = aFs.RmDir(directory.DriveAndPath());
if(err == KErrInUse || err == KErrAccessDenied)
{
break;
}
VerifyDeletionErrorL(err);
// move to deleted directory's parent
User::LeaveIfError(directory.PopDir());
}
}
示例8: FindAppInListL
RApaApplication* CApaProcess::FindAppInListL(const TDesC& aAppFileName, TUid aUid) const
// returns pointer to a matching app, or NULL if not in list
//
{
__ASSERT_DEBUG(iAppList, Panic(EPanicNullPointer));
TInt index = iAppList->Count();
if (aUid!=KNullUid)
{// search by UID
while(--index >= 0)
{
__ASSERT_DEBUG((*iAppList)[index], Panic(EDPanicNoAppHolder));
if ((*iAppList)[index]->AppFileUid() == aUid)
{
(*iAppList)[index]->ScheduleForAsyncDeletion(EFalse);
return (*iAppList)[index]; // match found
}
}
}
else
{// search by name as no UID has been supplied
TParse app;
TParse suspect;
User::LeaveIfError(app.Set(aAppFileName,NULL,NULL));
while (--index>=0)
{
__ASSERT_DEBUG((*iAppList)[index], Panic(EDPanicNoAppHolder));
suspect.SetNoWild((*iAppList)[index]->AppFileName(), NULL, NULL);
if (!app.Name().CompareF(suspect.Name()))
{
(*iAppList)[index]->ScheduleForAsyncDeletion(EFalse);
return (*iAppList)[index]; // match found
}
}
}
return NULL; // no match found
}
示例9: GetFullFile
GLDEF_C TInt GetFullFile(TFileName& aName, const TText16* upath, RFs& aSession)
// Use GetFullPath to establish the pathname, then add the filename onto the end
{
TParse path;
TInt err = GetFullPath(path,upath,aSession,&aName);
if (err!=KErrNone)
return err;
// Wildcard drive letter for searching across drives
if (upath[0]==L'?' && upath[1]==L':')
{
TFindFile search(aSession);
err=search.FindByDir(aName,path.Path());
if (!err)
{
aName=search.File();
return KErrNone;
}
}
err = path.SetNoWild(path.DriveAndPath(),NULL,&aName);
if (!err)
aName = path.FullName();
return err;
}
示例10: WavRecord
LOCAL_C TInt WavRecord()
{
// Parse the commandline and get a filename to use
TLex l(CommandLine);
TParse destinationName;
if (destinationName.SetNoWild(l.NextToken(),0,0)!=KErrNone)
{
Test.Printf(_L("No arg, skipping\r\n"));
return(KErrArgument);
}
Test.Next(_L("Record Wav file"));
// Open the file for writing
TInt r;
RFile destination;
r = destination.Replace(Fs,destinationName.FullName(),EFileWrite);
if (r!=KErrNone)
{
Test.Printf(_L("Open file for write failed(%d)\n"), r);
return(r);
}
Test.Printf(_L("File opened for write\r\n"));
Test.Next(_L("Preparing to record"));
// Get the rate
TLex cl(l.NextToken());
TUint32 tmpRate;
TSoundRate rate;
r = cl.Val(tmpRate,EDecimal);
if (r == KErrNone && (r=SamplesPerSecondToRate(tmpRate,rate))==KErrNone)
{
Test.Printf(_L("Parsed rate: %d\r\n"), tmpRate);
RecordFormatBuf().iRate = rate;
}
else
{
Test.Printf(_L("Parse rate failed(%d)\r\n"),r);
RecordFormatBuf().iRate = ESoundRate32000Hz;
}
// Get number of channels
TLex cl_chan(l.NextToken());
TUint32 tmpChannels;
r = cl_chan.Val(tmpChannels,EDecimal);
if (r == KErrNone)
{
Test.Printf(_L("Parsed %d channels\r\n"),tmpChannels);
RecordFormatBuf().iChannels = tmpChannels;
}
else
{
Test.Printf(_L("Parse channels failed(%d)\r\n"), r);
RecordFormatBuf().iChannels = 2;
}
RecordFormatBuf().iEncoding = ESoundEncoding16BitPCM;
// Set the record buffer configuration.
RChunk chunk;
TTestSharedChunkBufConfig bufferConfig;
bufferConfig.iNumBuffers=4;
bufferConfig.iBufferSizeInBytes=RecordBufferSizeInBytes(RecordFormatBuf());
if (RecordCapsBuf().iRequestMinSize)
bufferConfig.iBufferSizeInBytes&=~(RecordCapsBuf().iRequestMinSize-1); // Keep the buffer length valid for the driver.
bufferConfig.iFlags=0;
PrintBufferConf(bufferConfig,Test);
TPckg<TTestSharedChunkBufConfig> bufferConfigBuf(bufferConfig);
r=RxSoundDevice.SetBufferChunkCreate(bufferConfigBuf,chunk);
if (r!=KErrNone)
{
Test.Printf(_L("Buffer configuration not supported(%d)\r\n"),r);
return(r);
}
// Set the audio record configuration.
RxSoundDevice.SetVolume(KSoundMaxVolume);
PrintConfig(RecordFormatBuf(),Test);
r=RxSoundDevice.SetAudioFormat(RecordFormatBuf);
if (r!=KErrNone)
{
Test.Printf(_L("Format not supported\r\n"));
return(r);
}
// Get length in seconds
TLex cl_seconds(l.NextToken());
TUint32 tmpSeconds;
r = cl_seconds.Val(tmpSeconds,EDecimal);
if (r == KErrNone)
{
Test.Printf(_L("Parsed %d seconds\r\n"),tmpSeconds);
}
else
{
Test.Printf(_L("Parse seconds failed(%d)\r\n"),r);
tmpSeconds=10;
}
TInt bytesToRecord = BytesPerSecond(RecordFormatBuf())*tmpSeconds;
//.........这里部分代码省略.........
示例11: ParseCommandLine
TInt ParseCommandLine()
{
TBuf<256> c;
User::CommandLine(c);
// Get exe name
TLex l(c);
if(SourceName.SetNoWild(l.NextToken(),0,&KDefaultSourcePath)!=KErrNone)
return KErrArgument;
// Get capability
TLex cl(l.NextToken());
if(cl.Val((TInt64&)Capability,EHex)!=KErrNone)
return KErrArgument;
// Mask out unsupported capabilities
TCapabilitySet all;
all.SetAllSupported();
((TCapabilitySet&)Capability).Intersection(all);
// We always update capabilities in the headers
CapabilitySet = ETrue;
// Get options
SecureIdSet = EFalse;
VendorIdSet = EFalse;
TPtrC nextToken;
for (;;)
{
nextToken.Set(l.NextToken());
if (nextToken == KSIDOption)
{
// SID specified
nextToken.Set(l.NextToken());
if (nextToken == KNullDesC)
return KErrArgument;
TLex sl(nextToken);
if(sl.Val(SecureId.iId,EHex)!=KErrNone)
return KErrArgument;
SecureIdSet = ETrue;
}
else if (nextToken == KVIDOption)
{
// VID specified
nextToken.Set(l.NextToken());
if (nextToken == KNullDesC)
return KErrArgument;
TLex sl(nextToken);
if(sl.Val(VendorId.iId,EHex)!=KErrNone)
return KErrArgument;
VendorIdSet = ETrue;
}
else
break;
}
// Get target path
TPtrC s(SourceName.NameAndExt());
TBuf<sizeof(KDefaultDestinationPath)> defaultDestinationPath(KDefaultDestinationPath);
defaultDestinationPath[0] = (TUint8) RFs::GetSystemDriveChar();
if(DestinationName.SetNoWild(nextToken,&s,&defaultDestinationPath)!=KErrNone)
return KErrArgument;
// Check we used all the arguments
if (l.NextToken() != KNullDesC)
return KErrArgument;
return KErrNone;
}
示例12: ConstructL
// Second-phase constructor
void CPuttyAppUi::ConstructL() {
#ifdef PUTTY_S60V3
#ifdef PUTTY_SYM3
BaseConstructL(CAknAppUi::EAknEnableSkin | EAknTouchCompatible | EAknSingleClickCompatible);
#else
BaseConstructL(CAknAppUi::EAknEnableSkin);
#endif
#else
BaseConstructL();
#endif
// Determine profile, data and font directories based on the executable
// installation location. The files are on the same drive as the
// executable, except if the exe is in ROM (z:), in which case profiles and
// data use c:.
TFileName name;
name = RProcess().FileName();
TParse parsa;
parsa.SetNoWild(name, NULL, NULL);
TUint drive = parsa.Drive()[0];
// Font directory -- "<drv>:\resource\puttyfonts\"
iFontDirectory.Format(KFontDirFormat, drive);
// Fix drive for profiles and data
if ( (drive == 'z') || (drive == 'Z') ) {
drive = 'c';
}
// Data directory -- "<drv>:\private\<SID>\data\"
// If the data directory doesn't exist, create it and attempt to migrate
// host keys from a previous installation
iDataDirectory.Format(KDataDirFormat, drive, RProcess().SecureId().iId);
RFs &fs = CEikonEnv::Static()->FsSession();
if ( !BaflUtils::FolderExists(fs, iDataDirectory) ) {
BaflUtils::EnsurePathExistsL(fs, iDataDirectory);
if ( BaflUtils::FileExists(fs, KOldHostKeysFile) ) {
name = iDataDirectory;
name.Append(KNewHostKeysFile);
BaflUtils::CopyFile(fs, KOldHostKeysFile, name);
}
}
// Profile directory -- "<drv>:\private\<SID>\profiles\"
// If the profile directory doesn't exist, create it and attempt to migrate
// default settings from a previous installation
iProfileDirectory.Format(KProfileDirFormat, drive,
RProcess().SecureId().iId);
if ( !BaflUtils::FolderExists(fs, iProfileDirectory) ) {
BaflUtils::EnsurePathExistsL(fs, iProfileDirectory);
if ( BaflUtils::FileExists(fs, KOldSettingsFile) ) {
name = iProfileDirectory;
name.Append(KNewDefaultProfileFile);
BaflUtils::CopyFile(fs, KOldSettingsFile, name);
}
}
// Create navi pane
iNaviPane = (CAknNavigationControlContainer*)
(StatusPane()->ControlL(TUid::Uid(EEikStatusPaneUidNavi)));
// Build a list of available fonts
iFonts = new CDesC16ArrayFlat(8);
CDir *dir;
User::LeaveIfError(
CEikonEnv::Static()->FsSession().GetDir(iFontDirectory,
KEntryAttNormal,
ESortByName, dir));
CleanupStack::PushL(dir);
for ( TInt i = 0; i < dir->Count(); i++ ) {
parsa.SetNoWild((*dir)[i].iName, NULL, NULL);
iFonts->AppendL(parsa.Name());
}
CleanupStack::PopAndDestroy(); //dir
// Build views
iProfileListView = CProfileListView::NewL();
AddViewL(iProfileListView);
iProfileEditView = CProfileEditView::NewL();
AddViewL(iProfileEditView);
iTerminalView = CTerminalView::NewL();
AddViewL(iTerminalView);
// Start from the profile list view.
SetDefaultViewL(*iProfileListView);
}