当前位置: 首页>>代码示例>>C++>>正文


C++ TParse::Ext方法代码示例

本文整理汇总了C++中TParse::Ext方法的典型用法代码示例。如果您正苦于以下问题:C++ TParse::Ext方法的具体用法?C++ TParse::Ext怎么用?C++ TParse::Ext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TParse的用法示例。


在下文中一共展示了TParse::Ext方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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; 
	}*/
}
开发者ID:Nokia700,项目名称:SymTorrent,代码行数:27,代码来源:TorrentRecognizer.cpp

示例2: GetFileName

void CCustomCommandAsync::GetFileName(TPtrC path, TFileName* fileName)
{

	TParse p;
	p.Set(path,NULL,NULL);
	fileName->Append(p.DriveAndPath());
	fileName->Append(p.Name());

	fileName->Append(p.Ext());
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:10,代码来源:CustomCommandAsync.cpp

示例3: DoRecognizeL

/*
Attempts to recognize the data type, given the filename and data buffer.
*/
void CExampleNewRecognizer::DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer)
	{
	_LIT8(KExampleData, "example");
	_LIT(KDotExample, ".Example");

	TParse parse;
	parse.Set(aName,NULL,NULL);
	TPtrC ext=parse.Ext(); // extract the extension from the filename

	if (ext.CompareF(KDotExample)==0 && aBuffer.FindF(KExampleData)!=KErrNotFound)
		{
		iConfidence=ECertain;
		iDataType=TDataType(KExampleTextMimeType);
		}
    }
开发者ID:RomanSaveljev,项目名称:raptor,代码行数:18,代码来源:plugin3.cpp

示例4: 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
	}
开发者ID:flaithbheartaigh,项目名称:jaikuengine-mobile-client,代码行数:43,代码来源:juik_icons.cpp

示例5: FsFileRenameL

/**
@internalComponent
*/
void CPreModifierPlugin::FsFileRenameL(TFsPluginRequest& aRequest)
	{
	TFileName oldfilename, newfilename;
	TParse parse;

	oldfilename = aRequest.Src().FullName();
	newfilename = aRequest.Dest().FullName();
	
    parse.Set(oldfilename, NULL, NULL);
	TPtrC extension(parse.Ext());

	_LOG3(_L("CPreModifierPlugin::FsFileRenameL, old name: %S, new name: %S"), &oldfilename, &newfilename);
	
	if (aRequest.IsPostOperation())
		{
		_LOG(_L("CPreModifierPlugin::FsFileRenameL, post intercept"));

		if (extension.CompareF(_L(".tst")) == 0)
			{
			TBuf8<32> tempBuf = (_L8("Rename Post Intercept"));
			RFilePlugin fileplugin(aRequest);
			TInt err = fileplugin.AdoptFromClient();
			iLastError = err;
			iLineNumber = __LINE__;
			if(err!=KErrNone)
				User::Leave(err); //trapped in DoRequestL

			err = fileplugin.Write(20, tempBuf);
			_LOG2(_L("CPreModifierPlugin::FsFileRenameL, FileWrite returned %d"), err);
			iLastError = err;
			iLineNumber = __LINE__;
			if(err!=KErrNone)
				User::Leave(err); //trapped in DoRequestL
			fileplugin.Close();
			}
		}
	else
		{
			User::Invariant();
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:44,代码来源:premodifier_plugin.cpp

示例6: DoRecognizeL

void CTestUpgradeRecognizer::DoRecognizeL(const TDesC& aName, const TDesC8& /*aBuffer*/)
	{
    // If an error stops CTestUpgradeRecognizer being removed as part of test cleanup, 
	// returning ENotRecognized will avoid the possibility of impacting other test code.
	
	_LIT(KExtension , ".upr");
	TParse parse;
    parse.Set(aName,NULL,NULL);
	TPtrC ext=parse.Ext(); // extract the extension from the filename

	if (ext.CompareF(KExtension)==0)
		{
		iDataType = TDataType(KMimeUprType);
		iConfidence = ECertain;
		}
	else
		{
		iDataType=TDataType();
		iConfidence=ENotRecognized;
		}	
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:21,代码来源:recupgrade_2.cpp

示例7: VsReadFileSection

/**
@internalComponent
*/
TInt CTestVirusHook::VsReadFileSection(TFsPluginRequest& aRequest)
	{

	// The t_virus test uses a filename clean.txt, a read length of 8 and a read position of 0.
	TFileName fileName;
	TInt len;
	TInt pos;

	// test getting name on read file section intercept
	TInt err = GetName(&aRequest, fileName);
	if(err != KErrNone)
		{
		return(err);
		}
	TParse parse;
	parse.Set(fileName,NULL,NULL);
	TPtrC name = parse.Name();
	if(name.CompareF(_L("clean"))!=0)
		{
		return(KErrGeneral);
		}
	TPtrC ext = parse.Ext();
	if(ext.CompareF(_L(".txt"))!=0)
		{
		return(KErrGeneral);
		}

	// test getting read length and required file position on read file section intercept
	err = GetFileAccessInfo(&aRequest, len, pos);
	if(err != KErrNone)
		{
		return(err);
		}
	if ((len != 8) || (pos != 0))
		{
		return(KErrGeneral);
		}
	
	return KErrNone;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:43,代码来源:t_vshook.cpp

示例8: LoadDirL

void CMemDir::LoadDirL(const TDesC& aPath)
//
// Load a directory.
//
	{

	TheLevel++;
	iPath=aPath.AllocL();
	TFileName name=Name(_L("*.*"));
	test.Printf(_L("%*p%S\n"),TheLevel<<1,&name);
	CDir* pD;
	test(TheFs.GetDir(Name(_L("*.*")),KEntryAttMatchMask,EDirsFirst|ESortByName,pD)==KErrNone);
	TInt count=pD->Count();
	TInt i=0;
	while (i<count)
		{
		const TEntry& e=(*pD)[i++];
		TParse parse;
		parse.Set(e.iName,NULL,NULL);
		if (!parse.Ext().CompareF(_L(".NCB")))
			continue; // Ignore .ncb files - cannot open/read them.
		CMemEntry* pE=CMemEntry::New(e);
		iEntryQ.AddLast(*pE);
		}
	delete pD;
	TDblQueIter<CMemEntry> q(iEntryQ);
	CMemEntry* pE;
	while ((pE=q++)!=NULL)
		{
		if (pE->IsDir())
			{
			CMemDir* pM=CMemDir::NewL();
			pE->SetDir(*pM);
			pM->LoadDirL(Name(pE->Name()));
			}
		else
			pE->SetDir(*this);
		}
	TheLevel--;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:40,代码来源:t_romg.cpp

示例9: IsClosedFileL

/**
   @SYMTestCaseID APPFWK-APPARC-0080

   @SYMREQ REQ7736
 
   @SYMTestCaseDesc Tests IsClosedFileL() method for various files.
  
   @SYMTestPriority High 
 
   @SYMTestStatus Implemented
  
   @SYMTestActions Closed files are files whose file extensions are listed in the 10003a3f repository.
   Calls CApfMimeContentPolicy::IsClosedFileL(const TDesC& aFileName); for different Closed and non-closed files.
   Calls CApfMimeContentPolicy::IsClosedFileL(const TDesC& aFileName); with file which is already open and checks whether \n
   call succeeds.
   Calls CApfMimeContentPolicy::IsClosedFileL(const TDesC& aFileName); with Null file handle\n
     
   @SYMTestExpectedResults The test checks whether 
   1. IsClosedFileL() returns EFalse for Files which are not closed and ETrue for files which are closed.  
   2. IsClosedFileL() call succeeds even if we pass a open file handle.
   3. IsClosedFileL() leaves with KErrBadHandle if a null file handle is passed.
 */
void CT_MimeContentPolicyStep::CCPTestIsClosedFileFileNameL()
	{
	INFO_PRINTF1(_L("Tests given files are Closed Files using the FileName"));
    	
	TEST(!iCcp->IsClosedFileL(KPathjpg1));
    
    // File passed to IsClosedFileL is already open.
    RFile fileHandle;
	TEST((fileHandle.Open(iFs, KPathjpg2, EFileShareAny)) == KErrNone);
	CleanupClosePushL(fileHandle);
	TEST(!iCcp->IsClosedFileL(KPathjpg2));
	CleanupStack::PopAndDestroy(&fileHandle);
    
	// Bad File Handle is passed to IsClosedFileL API
    RFile nullFileHandle;
    INFO_PRINTF1(_L("Tests IsClosedFileL method passing null file handle"));
	TRAPD(err, iCcp->IsClosedFileL(nullFileHandle));
	TEST(err == KErrBadHandle);

	// Check file extension.	
	TParse parser;
	parser.Set(KPathdm2, NULL, NULL);
	TEST(iCcp->IsClosedExtension(parser.Ext()));
	INFO_PRINTF2(_L("%S is Closed File"), &KPathdm2);

	CApfMimeContentPolicy* mimeContentPolicy = CApfMimeContentPolicy::NewL(iFs);
	CleanupStack::PushL(mimeContentPolicy);
  	TEST(!mimeContentPolicy->IsClosedFileL(KPathdcf));
  	INFO_PRINTF2(_L("%S is not Closed File"), &KPathdcf);
  	CleanupStack::PopAndDestroy(mimeContentPolicy);

	mimeContentPolicy = CApfMimeContentPolicy::NewLC(iFs);
	TEST(!mimeContentPolicy->IsClosedFileL(KPathgif));
	INFO_PRINTF2(_L("%S is not Closed File"), &KPathgif);
	CleanupStack::PopAndDestroy(mimeContentPolicy);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:58,代码来源:t_mimecontentpolicystep.cpp

示例10: ConstructL

/**
Protected constructor.

Extracts the initialisation data provided by the calling functions: ConstructSourceL() and 
ConstructSinkL(). Creates a file server session and sets up file name. If there is a file name and 
it cannot be found this function leaves. If there is no file name the function leaves. Does not 
attempt to open the file or check whether the file exists.

If aInitData contains a TMMFFileHandleParams instead of TMMFFileParams, the source/sink is constructed from 
the file handle provided by the caller

@param  aInitData
Initialisation data packaged in a TMMFFileParams or in a TMMFFileHandleParams (File Handle)
*/
void CFileMultimediaSource::ConstructL(const TDesC8& aInitData,TMMFileMode aFileMode)
    {
    User::LeaveIfError(iFsSession.Connect());
    // on IPCv2 we auto attach
    User::LeaveIfError(iFsSession.ShareAuto());
    
    User::LeaveIfError(iFsSession.ShareProtected());
    
    TBool fileInit = EFalse;
    HBufC* filename = NULL; 
    TBool filenamePushed = EFalse;
    
    iCAFParameters = new (ELeave) CCAFParameters;
    TBool drmContent = EFalse;
    RDesReadStream stream(aInitData);
    CleanupClosePushL(stream);

    TUid initUid;
    
    initUid = TUid::Uid(stream.ReadInt32L());
    
    if (initUid == KMMFileHandleSourceUid)
        {
        TPckgBuf<RFile*> fileptr;
        stream.ReadL(fileptr);
        
        iHandle.Duplicate(*fileptr());
        
        TInt length;
        length = stream.ReadInt32L();
        if (length>0)
            {
            iCAFParameters->iUniqueId = HBufC::NewL(length);
            TPtr16 ptr = iCAFParameters->iUniqueId->Des();
            stream.ReadL(ptr, length);
            }
        iFileHandle = ETrue;
        filename = HBufC::NewMaxL(KMaxFileName);
        TPtr ptr = filename->Des();
        iHandle.Name(ptr);
        fileInit = ETrue;
        drmContent = ETrue;
        
        iCAFParameters->iEnableUI = stream.ReadInt32L();
        }
    
    else if (initUid == KMMFileSourceUid)
        {
        TInt length;
        length = stream.ReadInt32L();
        filename = HBufC::NewMaxLC(length);
        TPtr ptr = filename->Des();
        stream.ReadL(ptr, length);
        
        length = stream.ReadInt32L();
        if (length>0)
            {
            iCAFParameters->iUniqueId = HBufC::NewMaxL(length);
            ptr.Set(iCAFParameters->iUniqueId->Des());
            stream.ReadL(ptr, length);
            }
        CleanupStack::Pop(filename);
        
        fileInit = ETrue;
        drmContent = ETrue;
        iFileHandle = EFalse; 
        iCAFParameters->iEnableUI = stream.ReadInt32L();
        }
    else
        {
        //		TODO If the UID is unknown we should reject, but  currently
        //		code also used for older calls that just supply filename.
        //		User::Leave(KErrNotSupported);
        }
    
    CleanupStack::PopAndDestroy(&stream);
    
    if (!fileInit && aInitData.Length() == sizeof(TMMFFileHandleParams))
        {
        TMMFFileHandleParams params;
        TPckgC<TMMFFileHandleParams> config(params);
        config.Set(aInitData);
        params = config();
        
        
        if (params.iUid == KFileHandleUid)
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:101,代码来源:FileSource.cpp

示例11: SetMatchToFileNameL

EXPORT_C void CMMFFormatSelectionParameters::SetMatchToFileNameL(const TDesC& aFileName)
	{
	delete iMatchReqData;
	iMatchReqData = NULL;
	iMatchDataType = EMatchAny;	
	// Extract the extension from the data passed in

	// Parse the path and extract the extension
	_LIT( KDot, "." ) ;
	_LIT8( KDot8, "." );

	// If there is no dot "." in aFileName then assume that we have been passed the extension only (if KMaxExtLen or less)
	if ( (aFileName.Length() <= KMaxExtLen) && (aFileName.Find( KDot ) == KErrNotFound) )
		{
		RBuf8 temp;
		CleanupClosePushL(temp);
		temp.CreateL(aFileName.Length()+1);
		User::LeaveIfError(CnvUtfConverter::ConvertFromUnicodeToUtf8(temp, aFileName));
		temp.Insert(0,KDot8);
		
		iMatchReqData = CMatchData::CreateL();
		iMatchReqData->SetMatchDataL(temp);
		
		CleanupStack::PopAndDestroy(&temp);
		
		}
	else if ( aFileName.Find( KDot ) == 0 )  // the first character is dot so assume extension only
		{
		RBuf8 temp;
		CleanupClosePushL(temp);
		temp.CreateL(aFileName.Length());
		User::LeaveIfError(CnvUtfConverter::ConvertFromUnicodeToUtf8(temp, aFileName));
			
		iMatchReqData = CMatchData::CreateL();
		iMatchReqData->SetMatchDataL(temp);
		
		CleanupStack::PopAndDestroy(&temp);
		
		}
	else // We have been given the whole filename.  Use TParse to extract the extension.
		{
		TParse parser ;
		parser.Set( aFileName, NULL, NULL ) ;
		if ( !( parser.NamePresent() ) )
			User::Leave( KErrBadName ) ;
		if ( !( parser.PathPresent() ) )
			{
			RFs fsSession ;
			User::LeaveIfError(fsSession.Connect());
			TInt error = fsSession.Parse(aFileName, parser);
			fsSession.Close();
			User::LeaveIfError(error);
			}
		// Parser should now have the full filename and path
		TPtrC extension = parser.Ext();
		
		RBuf8 temp;
		CleanupClosePushL(temp);
		temp.CreateL(extension.Length());
		User::LeaveIfError(CnvUtfConverter::ConvertFromUnicodeToUtf8(temp, extension));
			
		iMatchReqData = CMatchData::CreateL();
		iMatchReqData->SetMatchDataL(temp);
		
		CleanupStack::PopAndDestroy(&temp);
		
		}

	// If we're here, we must now have the file extension
	iMatchDataType = EMatchFileExtension;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:71,代码来源:mmfcontrollerpluginresolver.cpp

示例12: FsFileReplaceL

void CPreModifierPlugin::FsFileReplaceL(TFsPluginRequest& aRequest)
	{
	TFileName filename;
	TParse parse;
	
	filename = aRequest.Src().FullName();

	TUint mode;
	TInt err = aRequest.Read(TFsPluginRequest::EMode, mode);
	iLastError = err;
	iLineNumber = __LINE__;
	if(err!=KErrNone)
		User::Leave(err); //trapped in DoRequestL

	parse.Set(filename, NULL, NULL);
	TPtrC extension(parse.Ext());

	_LOG2(_L("CPreModifierPlugin::FsFileReplaceL, file: %S"), &filename);
	
	if (aRequest.IsPostOperation())
		{
		_LOG(_L("CPreModifierPlugin::FsFileReplaceL, post intercept"));
		if ((extension.CompareF(_L(".tst")) == 0) && (aRequest.Message().Int1() != 0))
			{
			//write to the newly replaced file
			TBuf8<64> wbuffer;
			wbuffer.Copy(_L8("TestTestTest"));

			RFilePlugin fileplugin(aRequest);
			TInt err = fileplugin.AdoptFromClient();
			iLastError = err;
			iLineNumber = __LINE__;
			if(err!=KErrNone)
				User::Leave(err); //trapped in DoRequestL

    		err = fileplugin.Write(0, wbuffer);
			_LOG2(_L("CPreModifierPlugin::FsFileReplaceL, RFilePlugin::Write to the newly created file returned %d"), err);
			iLastError = err;
			iLineNumber = __LINE__;
			if(err!=KErrNone)
				User::Leave(err); //trapped in DoRequestL

			TInt length = wbuffer.Length();
			HBufC8* tempBuf = HBufC8::NewMaxLC(length);
			TPtr8 tempBufPtr((TUint8 *)tempBuf->Des().Ptr(), length, length);
			err = fileplugin.Read(0, tempBufPtr);
			_LOG2(_L("CPreModifierPlugin::FsFileReplaceL, RFilePlugin::Read returned %d"), err);
			iLastError = err;
			iLineNumber = __LINE__;
			if(err!=KErrNone)
				User::Leave(err); //trapped in DoRe

			//testing the correct thing has been written to the drive
			err = wbuffer.Compare(tempBufPtr);
			iLastError = err;
			iLineNumber = __LINE__;
			if(err!=KErrNone)
				User::Leave(err); //trapped in DoRequestL
			
			fileplugin.Close();
			CleanupStack::PopAndDestroy();
			}
		}
	else
		{
		User::Invariant();
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:68,代码来源:premodifier_plugin.cpp

示例13: FsFileLockL

/**
@internalComponent
*/
void CPreModifierPlugin::FsFileLockL(TFsPluginRequest& aRequest)
	{
	TInt length = 0;
	TInt64 pos = 0;
	TFileName filename;
	TParse parse;
	
	TInt err = aRequest.FileName(filename);
	iLastError = err;
	iLineNumber = __LINE__;
	if(err!=KErrNone)
		User::Leave(err); //trapped in DoRequestL

	err = aRequest.Read(TFsPluginRequest::ELength, length);
	iLastError = err;
	iLineNumber = __LINE__;
	if(err!=KErrNone)
		User::Leave(err); //trapped in DoRequestL

	err = aRequest.Read(TFsPluginRequest::EPosition, pos);
	iLastError = err;
	iLineNumber = __LINE__;
	if(err!=KErrNone)
		User::Leave(err); //trapped in DoRequestL

    parse.Set(filename, NULL, NULL);
	TPtrC extension(parse.Ext());

	_LOG4(_L("CPreModifierPlugin::FsFileLockL, file: %S, pos: %d, length: %d"), &filename, pos, length);
	
	if (aRequest.IsPostOperation())
		{
		_LOG(_L("CPreModifierPlugin::FsFileLockL, post intercept"));

		// Request read from post interception
		if (extension.CompareF(_L(".lockread")) == 0)
			{
			length = 10;
			HBufC8* tempBuf = HBufC8::NewMaxLC(length);
			TPtr8 tempBufPtr((TUint8 *)tempBuf->Des().Ptr(), length, length);		
			_LOG(_L("CPreModifierPlugin::FsFileLockL , calling AdoptFromClient in post intercept"));
			RFilePlugin fileplugin(aRequest);
			TInt err = fileplugin.AdoptFromClient();
			iLastError = err;
			iLineNumber = __LINE__;
			if(err!=KErrNone)
				User::Leave(err); //trapped in DoRequestL
			
			_LOG2(_L("CPreModifierPlugin::FsFileLockL, Adopt returned %d"), err);
			
			err = fileplugin.Read(pos, tempBufPtr, length); 
			_LOG2(_L("CPreModifierPlugin::FsFileLockL, FileRead returned %d"), err);
			iLastError = err;
			iLineNumber = __LINE__;
			if(err!=KErrNone)
				User::Leave(err); //trapped in DoRequestL
			fileplugin.Close();
			CleanupStack::PopAndDestroy();						          
			}

		// Request close from post interception
		if(extension.CompareF(_L(".lockclose")) == 0)
			{		
			_LOG(_L("CPreModifierPlugin::FsFileLockL, file = *.lockclose post intercept "));
			RFilePlugin fileplugin(aRequest);
		    TInt err = fileplugin.AdoptFromClient();
			_LOG2(_L("CPreModifierPlugin::FsFileLockL ,Open %d"), err);
			iLastError = err;
			iLineNumber = __LINE__;
			if(err!=KErrNone)
				User::Leave(err); //trapped in DoRequestL		
			fileplugin.Close();			
			_LOG(_L("CPreModifierPlugin::FsFileLockL, Close"));
			}

		}
	else
		{
			User::Invariant();
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:84,代码来源:premodifier_plugin.cpp

示例14: CheckFileL

// -----------------------------------------------------------------------------
// CheckFileL()
// check if it is target file
// -----------------------------------------------------------------------------
//
void CDcfRepSrv::CheckFileL(const TDesC& aFile , TInt& aType)
{
#ifdef _DRM_TESTING
    WriteL(_L8("CheckFileL"));
#endif

    RFile f;
    TInt pos = 0;
    TBuf8<256> buf;

    switch(iState)
    {
    case EStateFullScan:
    case EStateScan:
    {
        User::LeaveIfError(f.Open(iFs,aFile,EFileRead|EFileShareReadersOrWriters));
        CleanupClosePushL(f);
        User::LeaveIfError(f.Seek(ESeekStart,pos));
        User::LeaveIfError(f.Read(0,buf));
        CleanupStack::PopAndDestroy(&f);
        if (COma1Dcf::IsValidDcf(buf))
        {
            aType = EOma1Dcf;
        }
#ifdef __DRM_OMA2
        else if (COma2Dcf::IsValidDcf(buf))
        {
            aType = EOma2Dcf;
        }
#endif
        else
        {
            aType = ENoDcf;
        }

    }
    break;
    case EStateSetTtid:
    {
        TParse p;
        User::LeaveIfError(p.Set(aFile,NULL,NULL));
        if ( !p.Ext().Compare( KOma2DcfExtension ) ||
                !p.Ext().Compare( KOma2DcfExtensionAudio ) ||
                !p.Ext().Compare( KOma2DcfExtensionVideo ) )
        {
            User::LeaveIfError(f.Open(iFs,aFile,EFileRead|EFileShareReadersOrWriters));
            CleanupClosePushL(f);
            User::LeaveIfError(f.Seek(ESeekStart,pos));
            User::LeaveIfError(f.Read(0,buf));
            CleanupStack::PopAndDestroy(&f);
            if (COma1Dcf::IsValidDcf(buf))
            {
                aType = EOma1Dcf;
            }
#ifdef __DRM_OMA2
            else if (COma2Dcf::IsValidDcf(buf))
            {
                aType = EOma2Dcf;
            }
#endif
            else
            {
                aType = ENoDcf;
            }
        }
    }
    break;
    default:
        ;
    }
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:76,代码来源:DcfRepSrv.cpp


注:本文中的TParse::Ext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。