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


C++ TPtrC::FindF方法代码示例

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


在下文中一共展示了TPtrC::FindF方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FieldStart

// ---------------------------------------------------------
// CMailToHandler::FieldStart()
// ---------------------------------------------------------
//
TInt CMailToHandler::FieldStart(const TDesC& aHeader)
	{
	CLOG_ENTERFN( "CMailToHandler::FieldStart()" );

	TPtrC path = iParsedUrl->Des();
	TInt retVal = path.Length();

	/* find the starting position of the specific filed */
	if( IsHeader( aHeader ) )
		{
		retVal = path.FindF( aHeader ) + aHeader.Length();
		}

	CLOG_LEAVEFN( "CMailToHandler::FieldStart()" );

	return retVal;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:21,代码来源:MailToHandler.cpp

示例2: DoSearch

/**
Search for a node by directory path, start from children of aNodeToStart but do not include aNodeToStart.

@param	aPath			the path as the key to search in the tree
@param	aNodeToStart	the node whose children to start with 
@param	aNodeFound		in return, the node found 
@param	aDirPos			the location of the directory
@return	KErrNone 		if a node found
		KErrNotFound 	if no node is found
*/
TInt CLeafDirTree::DoSearch(const TDesC& aPath, CLeafDirTreeNode* aNodeToStart, CLeafDirTreeNode*& aNodeFound, TLeafDirData& aLeafDirData)
	{
	RPointerArray<CLeafDirTreeNode> currentLevel = aNodeToStart->Children();
	TInt currentPos = currentLevel.Count() - 1;
	// Current path in search
	TPtrC currentPath;
	currentPath.Set(aPath);
	while (currentLevel.Count() > 0 && currentPos >= 0)
		{
		CLeafDirTreeNode* currentNode = currentLevel[currentPos];
		TPtrC currentNodePath;
		currentNodePath.Set(currentNode->Path());
		TInt foundPos = currentPath.FindF(currentNodePath);
		// If current child's path is part of the searching path, 
		// 	go to next level
		// 	E.g.: current child's path = "1\2\3\", searching path = "1\2\3\5\".
		if (foundPos == 0 && currentNodePath.Length() < currentPath.Length())
			{
			currentPath.Set(currentPath.Mid(currentNodePath.Length()));
			currentLevel = currentNode->Children();
			currentPos = currentLevel.Count() - 1;
			continue;
			}
		// If current child's path matches current searching path,
		// 	check the node type.
		else if (foundPos == 0 && currentNodePath.Length() == currentPath.Length())
			{
			if (currentNode->IsPureIntermediary())
			// If found is 'pure intermediary', it is not cached. 
				{
				return KErrNotFound;
				}
			// Otherwise, we have got a cache hit!
			MakeMostRecentlyUsed(currentNode);
			aNodeFound = currentNode;
			aLeafDirData = currentNode->LeafDirData();
			return KErrNone;
			}
		// else, go through current level
		currentPos--;
		}
	// If there is no child or we have not found any matching node,
	//	return KErrNotFound
	return KErrNotFound;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:55,代码来源:sl_leafdir_cache.cpp

示例3: IsHeader

// ---------------------------------------------------------
// CMailToHandler::IsHeader()
// ---------------------------------------------------------
//
TBool CMailToHandler::IsHeader(const TDesC& aHeader)
	{
	CLOG_ENTERFN( "CMailToHandler::IsHeader()" );

	TBool retVal = EFalse;

	TPtrC path = iParsedUrl->Des();

	/* is the field in the mailto sheme */
	if( KErrNotFound != path.FindF( aHeader ) )
		{
		retVal = ETrue;
		}

	CLOG_LEAVEFN( "CMailToHandler::IsHeader()" );

	return retVal;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:22,代码来源:MailToHandler.cpp

示例4: StepToNextBlock

TInt CIniData::StepToNextBlock()
/**
Locates the next available block of data within a section

@return ETrue if successful or EFalse
*/
	{
	if (BlockState != E_UNKNOWN)
		{
		// get unscanned portion of the section
		TPtrC temp = section.Mid(scanStart);

		// find the start of the next block
		if (BlockState == E_SET)
			{
			blockStart = temp.FindF(TPtrC(BEGIN_SET));
			blockEnd = temp.FindF(TPtrC(END_SET));
			}
		else if (BlockState == E_TEMPLATE)
			{
			blockStart = temp.FindF(TPtrC(BEGIN_TEMPLATE));
			blockEnd = temp.FindF(TPtrC(END_TEMPLATE));
			}
		else if (BlockState == E_ADD)
			{
			blockStart = temp.FindF(TPtrC(BEGIN_ADD));
			blockEnd = temp.FindF(TPtrC(END_ADD));
			}

		if (blockStart != KErrNotFound && blockEnd != KErrNotFound)
			{
			// set the start point for the next block search
			scanStart += blockEnd;
			scanStart++;

			// set the actual block to work with
			blockEnd -= blockStart;
			TPtrC tempBlock = temp.Mid(blockStart,blockEnd);
			block.Set((unsigned short *)tempBlock.Ptr(), tempBlock.Length(), tempBlock.Size());
			return ETrue;
			}
		}

	return EFalse;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:45,代码来源:CIniFile.cpp

示例5: GetBackupListFunctionalTest

/**
@SYMTestCaseID          PDS-SQL-UT-4224
@SYMTestCaseDesc        CSqlServer::GetBackUpListL() functional test
@SYMTestPriority        High
@SYMTestActions         Calls CSqlServer::GetBackUpListL() and tests the output, when the drive is read-only,
                        when there is a sub-directory which name is matching the search pattern.
@SYMTestExpectedResults Test must not fail
*/  
void GetBackupListFunctionalTest()
	{
    CSqlServer* server = NULL;
    TRAPD(err, server = CreateSqlServerL());
    TEST2(err, KErrNone);
    //Case 1: database with specified uid bellow do exist (on drive C). There will be one subdirectory matching the search pattern. 
    const TDriveNumber KTestDrvNum1 = EDriveC;
    const TUid KDbUid = {0x98765432};
	TDriveUnit testDrive(KTestDrvNum1);
	TDriveName testDriveName = testDrive.Name();
	testDriveName.LowerCase(); 
	//One test directory will be created, which name will be matching the search pattern.
	//The directory name should not be included in the list with the file names.
    TFileName testFileName;
    err = server->Fs().PrivatePath(testFileName);
    TEST2(err, KErrNone);
    testFileName.Append(KDbUid.Name());
    _LIT(KTestPath, "t_startup\\");
    testFileName.Append(KTestPath);
    testFileName.Append(_L("t_startup.db"));
    TParse parse;
    err = parse.Set(testFileName, &testDriveName, 0);
    TEST2(err, KErrNone);
    err = server->Fs().MkDirAll(parse.FullName());
    TEST(err == KErrNone || err == KErrAlreadyExists);
    //
    RArray<HBufC*> files;
    TRAP(err, server->GetBackUpListL(KDbUid, KTestDrvNum1, files));
    TEST2(err, KErrNone);
    TInt fileCnt = files.Count();
    for(TInt i=0;i<fileCnt;++i)
    	{
		TPtrC fname = files[i]->Des();
		TheTest.Printf(_L("Db: %S\r\n"), &fname);
		TEST(fname.FindF(KTestPath) < 0);
		//The name should include the full path + the drive
		err = parse.Set(fname, 0, 0);
		TEST2(err, KErrNone);
		TEST(parse.DrivePresent());
		TEST(parse.PathPresent());
		TDriveName driveName(parse.Drive());
		driveName.LowerCase(); 
		delete files[i];
		TEST(driveName == testDriveName);		
    	}
    files.Close();
    //Case 2: drive Z:. No files should be returned.
    const TDriveNumber KTestDrvNum2 = EDriveZ;
    TRAP(err, server->GetBackUpListL(KDbUid, KTestDrvNum2, files));
    TEST2(err, KErrNone);
    fileCnt = files.Count();
    TEST2(fileCnt, 0);
    //Case 3: drive A:. The drive does not exist. No files should be returned.
    const TDriveNumber KTestDrvNum3 = EDriveA;
    TRAP(err, server->GetBackUpListL(KDbUid, KTestDrvNum3, files));
	TheTest.Printf(_L("Drive %d, err=%d\r\n"), KTestDrvNum3, err);
    fileCnt = files.Count();
    TEST2(fileCnt, 0);
    //
    delete server;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:69,代码来源:t_sqlstartup.cpp

示例6: inputNum

// -----------------------------------------------------------------------------
// CLibxml2Tester::TestUseExternalDataL
// test deserialize from file, using external data
// (other items were commented in a header).
// -----------------------------------------------------------------------------
// 	
TInt CLibxml2Tester::TestUseExternalDataInfosetL(CStifItemParser& aItem)
	{
	TInt err;
    TPtrC pDeserializerType;
    aItem.GetNextString( pDeserializerType );
	
    TPtrC pInputFile;
    aItem.GetNextString( pInputFile );
	
	TPtrC pBinary;
	aItem.GetNextString( pBinary );
	
	TPtrC pFile;
	aItem.GetNextString(pFile);
	
    TPtrC pOutputFile;
    aItem.GetNextString( pOutputFile );
    
    TPtrC pDirtyReturn;
    aItem.GetNextString( pDirtyReturn );
    
    TLex inputNum (pDirtyReturn);
    TInt dirtyReturn;
     inputNum.Val(dirtyReturn);	
    
    TInt nContainers = 3;
    RFile fileHandle;
    RFs aRFs;
    aRFs.Connect();
    CleanupClosePushL( aRFs );
	
	SetupDocumentL();
	  
    HBufC8* binbuf = ReadFileToBufferL(pBinary);
	CleanupStack::PushL(binbuf);
    
	
	TBufC<100> chunkName(_L("ChunkContainer") );
    TInt size = 2000;
    TInt maxSize = 10000;
    TInt offset = 0;
    TInt binarySize = CID_2().Length();
//    TBool isReadOnly = EFalse;
    RChunk chunk;
    chunk.CreateGlobal(chunkName, size, maxSize);
    CleanupClosePushL(chunk);

	
	RFile fp;
	User::LeaveIfError( fp.Open(aRFs, pFile, EFileRead) );
	CleanupClosePushL(fp); 	
  
  
	
    TXmlEngBinaryContainer bincont = iDoc.CreateBinaryContainerL(CID_1(), binbuf->Des());
    TXmlEngChunkContainer chunkcont = iDoc.CreateChunkContainerL(CID_2(), chunk, offset, binarySize);
	TXmlEngFileContainer filecont = iDoc.CreateFileContainerL(CID_3(), fp);
		
	iDoc.DocumentElement().AppendChildL(bincont);
	iDoc.DocumentElement().AppendChildL(chunkcont);
	iDoc.DocumentElement().AppendChildL(filecont);
	
    User::LeaveIfError( fileHandle.Replace( aRFs, pOutputFile, EFileStream | EFileWrite | EFileShareExclusive));
    CleanupClosePushL( fileHandle );
	
    CTestHandler* testHandle = CTestHandler::NewLC( fileHandle );
    RArray<TXmlEngDataContainer> list;
	CleanupClosePushL(list);	////
	iDoc.GetDataContainerList(list); 
	CXmlEngDeserializer* des;
    if( pDeserializerType.FindF( XOP ) != KErrNotFound )     
        {
        des = CXmlEngDeserializer::NewL( *testHandle, EDeserializerXOP );
        CleanupStack::PushL( des );
        des->SetInputFileL( pInputFile );
        des->UseExternalDataL( list );
        TRAP(err,des->DeserializeL());
        
        }
    else if( pDeserializerType.FindF( INFOSET ) != KErrNotFound )     
        {
        des = CXmlEngDeserializer::NewL( *testHandle, EDeserializerXOPInfoset );
        CleanupStack::PushL( des );
        des->SetInputFileL( pInputFile );
        des->UseExternalDataL( list );
        TRAP(err,des->DeserializeL());
        }
    if(list.Count() != nContainers) User::Leave(KErrGeneral);

    CleanupStack::PopAndDestroy( 8 );
    if ( err == dirtyReturn ) return KErrNone;		
    else return err;

	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:100,代码来源:xmlengtesterblocksdesinfoset.cpp

示例7: DoInsertL

/**
Implementation of the insertion algorithm 

@param	aNodeToStart	the node whose children to start with
@param	aPath			the path of the new node to be inserted
@param	aDirPos 		the position of the new node to be inserted
@param	aNodeInserted 	in return, the node that has been successfully inserted
*/
void CLeafDirTree::DoInsertL(CLeafDirTreeNode* aNodeToStart, const TDesC& aPath, const TLeafDirData& aLeafDirData, CLeafDirTreeNode*& aNodeInserted)
	{
	CLeafDirTreeNode* currentParent = aNodeToStart;
	TInt foundPos = 0;
	RPointerArray<CLeafDirTreeNode> currentLevel = aNodeToStart->Children();
	TInt currentPos = currentLevel.Count() - 1;
	TPtrC currentPath;
	currentPath.Set(aPath);
	while (currentLevel.Count() > 0 && currentPos >= 0)
		{
		CLeafDirTreeNode* currentNode = currentLevel[currentPos];
		TPtrC currentNodePath;
		currentNodePath.Set(currentNode->Path());

		// If current node is contained by aPath.
		// 	E.g.: current node = "1\2\3\", currentPath = "1\2\3\5\"
		//	In this case, we need to go to next level,
		//	discard logged position (currentPos) in this level as we don't need to come back.
		foundPos = currentPath.FindF(currentNodePath);
		if (foundPos == 0 && currentNodePath.Length() < currentPath.Length())
			{
			currentParent = currentNode;
			currentLevel = currentNode->Children();
			currentPos = currentLevel.Count() - 1;
			currentPath.Set(currentPath.Mid(currentNodePath.Length()));
			continue;
			}

		// If current node's path contains aPath 
		// 	E.g.: current node = "1\2\3\4\", currentPath = "1\2\3\"
		//	We need to split current node to two nodes and return.
		foundPos = currentNodePath.FindF(currentPath);
		if (foundPos == 0 && currentNodePath.Length() > currentPath.Length())
			{
			CLeafDirTreeNode* newNode = CLeafDirTreeNode::NewL(this, currentPath, aLeafDirData, CLeafDirTreeNode::ELeafIntermediary);
			currentParent->MakeItChildL(newNode);
			
			TPtrC restPath;
			restPath.Set(currentNodePath.Mid(currentPath.Length()));
			currentNode->SetPathL(restPath);
			currentParent->RemoveChild(currentNode);
			
			newNode->MakeItChildL(currentNode);
			AddOntoLruL(newNode);
			aNodeInserted = newNode;
			return;
			}

		// If current node's path equals aPath,
		//	change the node type if it is necessary
		if (foundPos == 0 && currentNodePath.Length() == currentPath.Length())
			{
			// Check node type, if already cached, update Lru list and return.
			if (currentNode->IsLeaf() || currentNode->IsLeafIntermediary())
				{
				currentNode->SetLeafDirData(aLeafDirData);
				aNodeInserted = currentNode;
				MakeMostRecentlyUsed(currentNode);
				return;
				}
			// If it has not been cached yet, i.e., it is a 'pure intermediary' node,
			//	cache the node and put it onto Lru list
			else if(currentNode->IsPureIntermediary())
				{
				currentNode->SetLeafDirData(aLeafDirData);
				currentNode->SetType(CLeafDirTreeNode::ELeafIntermediary);
				AddOntoLruL(currentNode);
				aNodeInserted = currentNode;
				return;
				}
			}
		
		// If none of above is the case (i.e. haven't found exact match or paths 
		//	are not contained by each other), we need to find the first common part 
		//	between each child and aPath to share path data.
		foundPos = FindLongestCommonPath(currentNodePath, currentPath);
		// If a common part of path is found, we need to create a pure intermediary node to share
		//	the common part of path data, and create a new leaf node for the target path.
		if (foundPos > 0)
			{
			TPtrC commonPath;
			commonPath.Set(currentNodePath.Left(foundPos + 1));

			currentNodePath.Set(currentNodePath.Mid(foundPos + 1));
			TPtrC newLeafPath;
			newLeafPath.Set(currentPath.Mid(foundPos + 1));

			// Add new pureintermediary node, set it as child of current parent
			TLeafDirData dummyPos(0);
			CLeafDirTreeNode* newPureIntermediaryNode = CLeafDirTreeNode::NewL(this, commonPath, dummyPos, CLeafDirTreeNode::EPureIntermediary);
			currentParent->MakeItChildL(newPureIntermediaryNode);

//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:sl_leafdir_cache.cpp

示例8: doTestStepL

TVerdict CForceRemove::doTestStepL()
	{

#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
	// Wait up to 30 seconds to ensure both SWIS and the sisregistry server
	// have shut down
	_LIT(KSisRegistryServerName, "!SisRegistryServer");
	_LIT(KInstallServerName, "!InstallServer");
	TInt delaytime = 30; 

	while (delaytime-- > 0)
		{
		TFullName serverName;
		TFindServer find(KInstallServerName);
		if (KErrNotFound == find.Next(serverName))
			{
			find.Find(KSisRegistryServerName);
			if (KErrNotFound == find.Next(serverName))
				{
				break;
				}
			}
		User::After(1000000); // wait a second until the next test
		}
#endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
	
	TPtrC name;
	RTestUtilSessionSwi testutil;
	User::LeaveIfError(testutil.Connect());
	CleanupClosePushL(testutil);
	
	// If file deletion fails we'll try moving the file to a temp directory
	// for another process to clean up later.
	
	TTime currentTime;
	currentTime.UniversalTime();
	
	_LIT(KTempPathFormat, "\\temp\\%Lu");
	TDriveUnit sysDrive (RFs::GetSystemDrive());
	TBuf<128> tempPathFormat(sysDrive.Name());
	tempPathFormat.Append(KTempPathFormat);
	
	TFileName targetPath;
	targetPath.Format(tempPathFormat, currentTime.Int64());
	
	_LIT(KNumFiles, "numfiles");

#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
	RArray<TUint> removeUids;
	CleanupClosePushL(removeUids);
#endif

	TInt num(0);
	GetIntFromConfig(ConfigSection(), KNumFiles, num);

	// Get the file names and use testutil to remove them
	for (TInt i = 0; i < num; ++i)
		{
		_LIT(KFile, "file");
		TBuf<32> key(KFile);
		key.AppendNum(i);
		
		if (!GetStringFromConfig(ConfigSection(), key, name))
			continue;
			
		INFO_PRINTF2(_L("ForceRemove - trying to delete file %S"), &name);

		TInt err = testutil.Delete(name);
		if (err != KErrNone && err != KErrNotFound && err != KErrPathNotFound)
			{
			INFO_PRINTF3(_L("RTestUtilSessionSwi::Delete(%S) returned %d, attempting move instead."), &name, err);
			TFileName source(name);
			TParsePtr parse(source);
			TFileName dest(targetPath);
			dest.Append(parse.Path());
			if (parse.DrivePresent())
				{
				dest[0] = source[0];
				}
			testutil.MkDirAll(dest);
			dest.Append(parse.NameAndExt());

			err = testutil.Move(source, dest);
			
			if (err != KErrNone)
				{
				INFO_PRINTF4(_L("Attempt to move from %S to %S returned %d"),
							&source, &dest, err);
				}
			}
#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
		_LIT(KRegistryPath, "\\sys\\install\\sisregistry\\");
		if (name.FindF(KRegistryPath) == KErrNotFound)
			continue;

		// Extract the uid and add it to our list
		TInt slashPos = name.LocateReverse('\\');
		TPtrC ptrUid = name.Mid(slashPos + 1);
		if (ptrUid.Length() != 8)
			continue;
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:101,代码来源:forceremove.cpp

示例9: ParseScriptSectionsL

void CScriptFile::ParseScriptSectionsL(const TDesC& aScript, TInt aInsertIndex)
	{
	iLastSection = NULL;

	CScriptSection* section = NULL;
	CScriptSectionItem* currentItem = NULL;
	TInt currentItemStart = 0;
	CScriptSection* sectionAll = NULL;
	RArray<TInt> sectionIndexArray;
	CleanupClosePushL(sectionIndexArray);
	TInt indexIncrement = 0;		
	HBufC* scriptContents = ReadFileLC(aScript);

	TLex input(*scriptContents);

	while (!input.Eos())
		{
	    input.SkipSpaceAndMark();

		input.SkipCharacters();
		if ( input.TokenLength() == 0 )    // if valid potential token
			{
			break;
			}

		TPtrC token = input.MarkedToken();

		if (token.CompareF(_L("endscript")) == 0)
			{
			break;
			}
		else if (token.FindF(KScriptSectionStart) == 0 && token.Length() > 2)
			{
			ParseAndSetItemValueL(*scriptContents, input, currentItemStart, currentItem);

			TInt mid = 1;
			TInt len = token.Length() - 2;

			if (sectionAll)
				section = CScriptSection::NewLC(token.Mid(mid, len), *sectionAll);
			else
				section = CScriptSection::NewLC(token.Mid(mid, len));

			if (!sectionAll && section->SectionName().CompareF(_L("All")) == 0)
				sectionAll = section;
			
			// We have a Scripts section, store its index as we need to track where
			// it occured so that the scripts can be added in the same location
			// after the current file has parsed
			if (section->SectionName().CompareF(KScriptsSection) == 0)
				{
				if(aInsertIndex==KErrNotFound)
					{
					// Not an embedded script, simple store its index
					TInt currectSectionsCount = iSections->Count();
					sectionIndexArray.Append(currectSectionsCount);
					}
				else
					{
					// An embedded script, calculate the index it should be inserted at
					TInt currectSectionsCount = indexIncrement+aInsertIndex;
					sectionIndexArray.Append(currectSectionsCount);
					}
				}
			
			// Check if the section needs to be inserted at a particular location
			if(aInsertIndex==KErrNotFound)
				iSections->AppendL(section);
			else
				iSections->InsertL(aInsertIndex + indexIncrement++, section);
				
			CleanupStack::Pop(section);
			}
		else if (section)
			{
			TPtrC itemEnd(KScriptItemEnd);

			if (itemEnd.Length() < token.Length() && token.Right(itemEnd.Length()).CompareF(itemEnd) == 0)
				{
				FoundNewItemL(*scriptContents, input, currentItemStart, *section, currentItem);
				}
			}
		}

	ParseAndSetItemValueL(*scriptContents, input, currentItemStart, currentItem);
	CleanupStack::PopAndDestroy(scriptContents);
	
	// We have been tracking where the script sections have been inserted so we
	// want to load the sections from the embedded script file and insert them
	// at the same point. This must be done in reverse order so that the index
	// values of script sections before the current one is maintained.
	TInt scriptSectionsCount = sectionIndexArray.Count();
	for( TInt ii=scriptSectionsCount-1; ii>=0; --ii)
		{
		TInt indexOfScriptSection = sectionIndexArray[ii];
		ParseEmbeddedScriptsL(*(iSections->At(indexOfScriptSection)), indexOfScriptSection);
		}
	CleanupStack::PopAndDestroy(&sectionIndexArray);
	}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:99,代码来源:ScriptFile.cpp

示例10: error

// -----------------------------------------------------------------------------
// CLibxml2Tester::SerializeGZIPL
// test GZIP Serialize
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt CLibxml2Tester::SerializeGZIPL(CStifItemParser& aItem)
{
    TInt error(KErrGeneral);

    //get test controls, input&output paths
    TPtrC pControl;
    aItem.GetNextString( pControl );

    TPtrC pBinary;
    aItem.GetNextString( pBinary );

    TPtrC pXml;
    aItem.GetNextString( pXml );

    TPtrC pSerialized;
    aItem.GetNextString( pSerialized );

    TPtrC pGzipSerialized;
    aItem.GetNextString( pGzipSerialized );

    TPtrC pOptions;
    aItem.GetNextString( pOptions );

    // saves xml file with binary data added ( default serialize )
    RXmlEngDocument iDocument;
    CleanupClosePushL( iDocument );
    if( pControl.FindF( SINGLE ) != KErrNotFound )
    {
        error = SaveXmlWithBinaryDataL( iDocument, pOptions, pBinary, pXml, EMPTY_STRING() );
    }
    else if ( pControl.FindF( MULTI ) != KErrNotFound )
    {
        error = SaveXmlWithBinaryDataL( iDocument, pOptions,  pBinary, pXml, EMPTY_STRING(), TRUE );
    }
    else
    {
        User::Leave(KErrArgument);
    }

    if ( pControl.FindF( ONE_PARA ) != KErrNotFound )
    {
        User::LeaveIfError( TestSerialize1paraToFileL( iDocument, pGzipSerialized, pOptions, ESerializerGZip ) );
    }

    if ( pControl.FindF( THREE_PARA ) != KErrNotFound )
    {
        User::LeaveIfError ( TestSerialize3paraToFileL( iDocument, pGzipSerialized, pOptions, ESerializerGZip ) );
    }

    if ( pControl.FindF( TO_RFS ) != KErrNotFound )
    {
        User::LeaveIfError( TestSerializeRFsL( iDocument, pGzipSerialized, pOptions, ESerializerGZip ) );
    }

    if ( pControl.FindF( BUFFER ) != KErrNotFound )
    {
        User::LeaveIfError( TestSerializeToBufferL( iDocument, pGzipSerialized, pOptions, ESerializerGZip ) );
    }
    CleanupStack::PopAndDestroy( 1 );
    return error;
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:67,代码来源:xmlengtesterblockssergzip.cpp

示例11: inputNum

TInt CLibxml2Tester::TestDOMExternalDataL(CStifItemParser& aItem)
	{
 TInt err;
    TPtrC pDeserializerType;
    aItem.GetNextString( pDeserializerType );
	
    TPtrC pInputFile;
    aItem.GetNextString( pInputFile );
	
    TPtrC pBinary;
   TPtrC pFile;
   if( (pDeserializerType.FindF( INFOSET ) != KErrNotFound ) || (pDeserializerType.FindF( XOP ) != KErrNotFound )  )   
        {
        aItem.GetNextString( pBinary );
        aItem.GetNextString(pFile);	
        }
	
    TPtrC pOutputFile;
    aItem.GetNextString( pOutputFile );
    
    TPtrC pDirtyReturn;
    aItem.GetNextString( pDirtyReturn );
    
    TLex inputNum (pDirtyReturn);
    TInt dirtyReturn;
     inputNum.Val(dirtyReturn);	
        
    TInt nContainers = 3;
    RFile fileHandle;
    RFs aRFs;
    aRFs.Connect();
    CleanupClosePushL( aRFs );
    RArray<TXmlEngDataContainer> list;
    if( (pDeserializerType.FindF( INFOSET ) != KErrNotFound ) || (pDeserializerType.FindF( XOP ) != KErrNotFound ) )   
        {
        SetupDocumentL();	  
        HBufC8* binbuf = ReadFileToBufferL(pBinary);
        CleanupStack::PushL(binbuf);
        TBufC<100> chunkName(_L("ChunkContainer") );
        TInt size = 2000;
        TInt maxSize = 10000;
        TInt offset = 0;
        TInt binarySize = CID_2().Length();
//        TBool isReadOnly = EFalse;
        RChunk chunk;
        chunk.CreateGlobal(chunkName, size, maxSize);
        CleanupClosePushL(chunk);	
	RFile fp;
	User::LeaveIfError( fp.Open(aRFs, pFile, EFileRead) );
	CleanupClosePushL(fp); 	
        TXmlEngBinaryContainer bincont = iDoc.CreateBinaryContainerL(CID_1(), binbuf->Des());
        TXmlEngChunkContainer chunkcont = iDoc.CreateChunkContainerL(CID_2(), chunk, offset, binarySize);
        TXmlEngFileContainer filecont = iDoc.CreateFileContainerL(CID_3(), fp);
        iDoc.DocumentElement().AppendChildL(bincont);   
        iDoc.DocumentElement().AppendChildL(chunkcont);
        iDoc.DocumentElement().AppendChildL(filecont);
        CleanupClosePushL(list);	////
        iDoc.GetDataContainerList(list); 
        }	
	
    RXmlEngDocument doc;
    	
         CXmlEngDeserializerDOM* des = CXmlEngDeserializerDOM::NewL();
        CleanupStack::PushL( des );
        des->UseDOMImplementationL( DOM_impl);
    if( pDeserializerType.FindF( XOP ) != KErrNotFound )     
        {
        des->UseExternalDataL( list );
        des->SetInputFileL( pInputFile,EDeserializerXOP);
        TRAP(err,doc=des->DeserializeL());
        }
    else if( pDeserializerType.FindF( INFOSET ) != KErrNotFound )     
        {
        des->UseExternalDataL( list );
        des->SetInputFileL( pInputFile,EDeserializerXOPInfoset );
        TRAP(err,doc=des->DeserializeL());
        }    
          
    if(list.Count() != nContainers) User::Leave(KErrGeneral);
    
    RArray<TXmlEngDataContainer>* fromDeserializer = des->ExternalData();
    
    if(fromDeserializer->Count() != nContainers) User::Leave(KErrGeneral);	
    	for(TInt i = 0; i < nContainers; i++ )
		{
		if (fromDeserializer->operator[](i).NodeType() != list.operator[](i).NodeType() ) User::Leave( KErrGeneral );
		if (fromDeserializer->operator[](i).Size() != list.operator[](i).Size() ) User::Leave( KErrGeneral );
		}
//    fromDeserializer->Close();

    SaveDocumentL(doc,pOutputFile);
		
    CleanupStack::PopAndDestroy( 6 ); 
    if ( err == dirtyReturn ) return KErrNone;		
    else return err;

	}	
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:97,代码来源:xmlengtesterblocksdeserializedom.cpp

示例12: ReadFileL

TInt CLibxml2Tester::TestDOMSetInputBufferL(CStifItemParser& aItem)
        {
        TPtrC pType;
        aItem.GetNextString(pType);
	
        TPtrC pDoc;
        aItem.GetNextString(pDoc);
        
        TPtrC pBinary;
        TPtrC pFile;
        if( pType.FindF( INFOSET ) != KErrNotFound )   
            {
        aItem.GetNextString( pBinary );
        aItem.GetNextString(pFile);	
            }
        	
        TPtrC pOut;
        aItem.GetNextString(pOut);
	
        HBufC8* buf = ReadFileL(pDoc);
        CleanupStack::PushL(buf);
		
//             TInt nContainers = 3;
        RFile fileHandle;
        RFs aRFs;
        aRFs.Connect();
        CleanupClosePushL( aRFs );
	
        RArray<TXmlEngDataContainer> list;
        if( pType.FindF( INFOSET ) != KErrNotFound )   
        {
        SetupDocumentL();	  
        HBufC8* binbuf = ReadFileToBufferL(pBinary);
        CleanupStack::PushL(binbuf);
        TBufC<100> chunkName(_L("ChunkContainer") );
        TInt size = 2000;
        TInt maxSize = 10000;
        TInt offset = 0;
        TInt binarySize = CID_2().Length();
//        TBool isReadOnly = EFalse;
        RChunk chunk;
        chunk.CreateGlobal(chunkName, size, maxSize);
        CleanupClosePushL(chunk);	
	RFile fp;
	User::LeaveIfError( fp.Open(aRFs, pFile, EFileRead) );
	CleanupClosePushL(fp); 	
        TXmlEngBinaryContainer bincont = iDoc.CreateBinaryContainerL(CID_1(), binbuf->Des());
        TXmlEngChunkContainer chunkcont = iDoc.CreateChunkContainerL(CID_2(), chunk, offset, binarySize);
        TXmlEngFileContainer filecont = iDoc.CreateFileContainerL(CID_3(), fp);
        iDoc.DocumentElement().AppendChildL(bincont);   
        iDoc.DocumentElement().AppendChildL(chunkcont);
        iDoc.DocumentElement().AppendChildL(filecont);
        CleanupClosePushL(list);	////
        iDoc.GetDataContainerList(list); 
        }	
	

        RXmlEngDocument doc;
	
       CXmlEngDeserializerDOM* des = CXmlEngDeserializerDOM::NewL();
       CleanupStack::PushL( des );
       des->UseDOMImplementationL( DOM_impl);
               if( pType.FindF( INFOSET ) != KErrNotFound )   
            {
            des->UseExternalDataL( list );
            }
       des->SetInputBuffer(buf->Des(), RetDeserializerType(pType));
       doc=des->DeserializeL();
       SaveDocumentL(doc,pOut);
          if( pType.FindF( INFOSET ) != KErrNotFound )   
            {
            CleanupStack::PopAndDestroy( 7 );
            }
            else
            {
            CleanupStack::PopAndDestroy( 3 );    
            }
       return KErrNone;	
       }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:79,代码来源:xmlengtesterblocksdeserializedom.cpp

示例13: SearchL

TInt CIpsPlgMsgIterator::SearchL( 
    CMsvEntrySelection* aMessageEntries,
    const TDesC& aStartWith,
    TInt& aIndex )
    {
    FUNC_LOG;
    TInt result( KErrNotFound );
    TInt i;
    TInt findStatus;
    TInt offset;
    TFSMailSortField primaryKey = EFSMailDontCare;
    TPtrC subject;

    // Check whether the search is supported
    if ( iSortingCriteria.Count() > 0 )
        {
        primaryKey = iSortingCriteria[0].iField;
        }
    if ( !iSortingOn ||
         ( ( primaryKey != EFSMailSortBySender ) &&
           ( primaryKey != EFSMailSortBySubject ) ) )
        {
        result = KErrNotSupported;
        }
        
    // Actual search        
    i = 0;
    while ( ( result == KErrNotFound ) && ( i < aMessageEntries->Count() ) )
        {
        const TMsvEntry& entry( 
            iFolderEntry->ChildDataL( aMessageEntries->At(i) ) );

        findStatus = KErrNotFound;

        if ( primaryKey == EFSMailSortBySender )
            {
            findStatus = entry.iDetails.FindF( aStartWith );
            }
        if ( primaryKey == EFSMailSortBySubject )
            {
            // Strip the prefixes (Re:, Fwd: etc) from the subject before
            // matching
            offset = iMsgSortKey->FindSubjectStart( entry.iDescription );
            subject.Set( 
                entry.iDescription.Ptr() + offset, 
                entry.iDescription.Length() - offset );
            findStatus = subject.FindF( aStartWith );
            }
        
        // Checks whether a matching message has been found
        if ( findStatus == 0 ) 
            {
            result = KErrNone;
            aIndex = i;
            }

        i++;
        }
        
    return result;
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:61,代码来源:ipsplgmsgiterator.cpp

示例14: ConstructL

void CTestEngine::ConstructL()
	{
	OstTraceFunctionEntry1( CTESTENGINE_CONSTRUCTL_ENTRY, this );
	CActiveScheduler::Add(this);

	// Display information (construction text and OS build version number
	gtest.Title();
	gtest.Start(_L("Test Engine Initiation"));
	gtest.Printf(_L(">>\n"));
	OstTrace0(TRACE_NORMAL, CTESTENGINE_CONSTRUCTL, ">>\n");
	gtest.Printf(_L(">>   T E S T   R U N \n"));
	OstTrace0(TRACE_NORMAL, CTESTENGINE_CONSTRUCTL_DUP01, ">>   T E S T   R U N \n");
	gtest.Printf(_L(">>\n"));
	OstTrace0(TRACE_NORMAL, CTESTENGINE_CONSTRUCTL_DUP02, ">>\n");

	// Process the command line option for role
	TInt cmdLineLength(User::CommandLineLength());
	HBufC* cmdLine = HBufC::NewMax(cmdLineLength);
	CleanupStack::PushL(cmdLine);
	TPtr cmdLinePtr = cmdLine->Des();
	User::CommandLine(cmdLinePtr);
	
	// be careful, command line length is limited(248 characters)	
	gtest.Printf(_L("***cmdLine = %lS\n"), cmdLine);
	OstTraceExt1(TRACE_NORMAL, CTESTENGINE_CONSTRUCTL_DUP03, "***cmdLine = %lS\n", *cmdLine);
		
	TLex args(*cmdLine);
	args.SkipSpace();
	
	// Obtain the role of this test module
	TPtrC roleToken = args.NextToken(); // e.g. -role=host
	TBool hostFlag(ETrue);
	
	TInt pos(roleToken.FindF(KArgRole));
	if(pos != KErrNotFound)
		{
		pos = roleToken.FindF(_L("="));
		TPtrC role = roleToken.Right(roleToken.Length()-pos-1);
		if(role.Compare(KArgRoleHost) == 0)
			{
			hostFlag = ETrue;
			}
		else if(role.Compare(KArgRoleClient) == 0)
			{
			hostFlag = EFalse;
			}
		else
			{
			gtest.Printf(_L("Test configuration: could not find option -role\n"));
			OstTrace0(TRACE_NORMAL, CTESTENGINE_CONSTRUCTL_DUP04, "Test configuration: could not find option -role\n");
			gtest(EFalse);
			}
		}
	else
		{
		gtest.Printf(_L("Test configuration option not found: %S\n"),&KArgRole);
		OstTraceExt1(TRACE_NORMAL, CTESTENGINE_CONSTRUCTL_DUP05, "Test configuration option not found: %S\n",KArgRole);
		gtest(EFalse);
		}
		
	// Obtain the test cases to be run
	TPtrC casesToken = args.NextToken();
	
	pos = casesToken.FindF(KArgTestCases);
	if(pos != KErrNotFound)
		{
		pos = casesToken.FindF(_L("="));
		TPtrC testCases = casesToken.Right(casesToken.Length()-pos-1);
	
		// Remaining test cases
		TPtrC remCases(testCases);
		while(pos != KErrNotFound)
			{
			pos = remCases.FindF(_L(","));
			HBufC* tc = HBufC::NewLC(KTestCaseIdLength);
			TPtr tcPtr = tc->Des();
			tcPtr.Append(KTestStringPreamble);	
			
			if(pos == KErrNotFound)
				{
				// This is the last test case identity			
				tcPtr.Append(remCases);
				}
			else
				{ 			
				tcPtr.Append(remCases.Left(KTestIdSize));
				}									
							
			gtest.Printf(_L("Test case specified: %S\n"),tc);
			OstTraceExt1(TRACE_NORMAL, CTESTENGINE_CONSTRUCTL_DUP06, "Test case specified: %S\n",*tc);
			
						
			iTestCasesIdentities.Append(tc);
			CleanupStack::Pop(tc);
			remCases.Set(testCases.Right(remCases.Length()-pos-1));
			}
		}
	else
		{
		gtest.Printf(_L("Test configuration option not found: %S\n"),&KArgTestCases);
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:TestEngine.cpp


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