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


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

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


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

示例1: GetAllFilenamesL

// -----------------------------------------------------------------------------
// CUpnpSecurityDbConnection::GetAllFilenamesL
// Get all filenames. 
// -----------------------------------------------------------------------------
//
void CUpnpSecurityDbConnection::GetAllFilenamesL(
    RPointerArray<HBufC>& aFilenameArray )
    {
    TInt err;
    RSqlStatement statement;
    User::LeaveIfError( statement.Prepare( iDatabase, KUpnpSecSqlSelectAllFiles ) );
    CleanupClosePushL( statement );

    TInt columnIndex = statement.ColumnIndex( KUpnpSecSqlFilename );

    while ( (err = statement.Next()) == KSqlAtRow )
        {
        TPtrC data = statement.ColumnTextL( columnIndex );
        HBufC* filename = data.AllocLC();
        aFilenameArray.AppendL( filename );
        CleanupStack::Pop( filename );
        }

    if ( err != KSqlAtEnd )
        {
        User::LeaveIfError( err );
        }

    CleanupStack::PopAndDestroy( &statement );
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:30,代码来源:upnpsecuritydbconnection.cpp

示例2: TextFieldL

/** 
Retrieve the field text for the given field type and contact item ID.

The behaviour differs when a specific field type is not given i.e. when
aFieldType is KUidContactFieldMatchAll:

- First tries to find an email for the given contact item ID.
- If there is no email then it retrieves the first entry in Fast Access fields
for the given contact item ID.
- If there is no Fast Access fields then it retrieves the first entry in the
text fields blob for the given contact item ID.

Text for all other field types are retrieved from the text fields blob.

The caller must determine that the given contact item ID exists before calling
this method.
*/
void CCntPplViewSession::TextFieldL(RSqlStatement& aSqlStatement, const CCntSqlStatement& aCntSqlStmt, const CContactTemplate& aSystemTemplate, TFieldType aFieldType, TDes& aText)
	{
	TPtrC8 textHeader;
	aSqlStatement.ColumnBinary(aCntSqlStmt.ParameterIndex(KContactTextFieldHeader()), textHeader);
	RDesReadStream textHeaderStream(textHeader);
	CleanupClosePushL(textHeaderStream);	
    CEmbeddedStore* textHeaderStore = CEmbeddedStore::FromLC(textHeaderStream);
    
	RStoreReadStream textHeaderStoreStream;
   	textHeaderStoreStream.OpenLC(*textHeaderStore,textHeaderStore->Root());

	TPtrC textFieldPtrC = aSqlStatement.ColumnTextL(aCntSqlStmt.ParameterIndex(KContactTextFields()));
	HBufC* textFieldsBuf = textFieldPtrC.AllocLC();
	
	if(aFieldType == KUidContactFieldMatchAll)
		{
		if (TCntPersistenceUtility::FindTxtFieldInTextBlobL(textHeaderStoreStream, textFieldsBuf, aSystemTemplate, aFieldType, aText) == EFalse)
			{
			CContactDatabase::TTextFieldMinimal	fastAccessText;
			if (HasTxtFieldInFastAccessFieldsL(aSqlStatement, aCntSqlStmt, fastAccessText))
				{
				aText.Copy(fastAccessText);		
				}
			}
		} 
	else
		{
		if (SpecificTxtFieldInFastAccessFieldsL(aSqlStatement, aCntSqlStmt, aFieldType, aText) == EFalse)
			{
			TCntPersistenceUtility::FindTxtFieldInTextBlobL(textHeaderStoreStream, textFieldsBuf, aSystemTemplate, aFieldType, aText);
			}
		}
		
	CleanupStack::PopAndDestroy(4, &textHeaderStream); //textHeaderStore, textHeaderStream, textHeaderStoreStream, textFieldsBuf
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:52,代码来源:cntpplviewsession.cpp

示例3: ReadFilesLC

HBufC8* CValidateTest::ReadFilesLC(CDesCArray& aServerCerts)
	{
	TInt count = aServerCerts.MdcaCount();
	TInt totalSize = 0;
	TInt i;

	for (i = 0; i < count; i++)
		{
		TPtrC filename = aServerCerts.MdcaPoint(i);
		RFile file;
		TRAPD(err, file.Open(iFs, filename, EFileRead));
		if(err != KErrNone)
			{
			HBufC *failedToLoad = filename.AllocLC();
			SetScriptError(EFileNotFound, failedToLoad->Des());
			CleanupStack::PopAndDestroy(2);//fsclose, fileClose	
			return(NULL);
			};
		CleanupClosePushL(file);
		TInt size;
		file.Size(size);
		CleanupStack::PopAndDestroy(1);	//	fileClose
		totalSize += size;
		}

	HBufC8* res = HBufC8::NewLC(totalSize);
	TPtr8 pRes = res->Des();
	for (i = 0; i < count; i++)
		{
		HBufC8* cert = ReadFileLC(aServerCerts.MdcaPoint(i));
		pRes.Append(cert->Des());
		CleanupStack::PopAndDestroy();//cert
		}
	return res;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:35,代码来源:ValidateTest.cpp

示例4: ReadTextBlobL

/**
Utility method used to read text blob fields from contacts database. Provides a mechanism to
fill a contact item with informations stored in text blobs within contact database.
A reference to the contact item to be fill has to be provided. A template has to be provided
if the contact item is based on a template. Template can be NULL. Also a view definition can
be provided to filter which fields are read from blob fields.

@param 		aTextHeader reference to a read stream from which header values will be read
@param 		aTextValues reference to a descriptor from which text values will be read
@param		aItem Contact item to be filled with information from text blob field.
@param		aView View definition specifying what item fields should be read from text blob field
@param		aTemplate Contact item representing a template based on which aItem should be read. Can be NULL
@leave		KErrNotFound if the specified contact item does not exist any more in contact database
*/	
void TCntPersistenceUtility::ReadTextBlobL(CEmbeddedStore& aTextHeaderStore, TPtrC& aTextValues, CContactItem& aItem, const CContactItemViewDef& aView, const CContactItem* aTemplate)
	{
	HBufC* textFieldsBuf = aTextValues.AllocLC();
	
	if (aTemplate) 
		{
		// If a system template is provided, we create a new CContactItemFieldSet object
		// and restore it based on provided template (CContactItemField objects composing
		// template). CContactItem object will be set with the newly created CContactItemFieldSet.
		CContactItemFieldSet* original = CContactItemFieldSet::NewLC();
		RestoreTextL(*original, aTextHeaderStore, aTextHeaderStore.Root(), textFieldsBuf, aView, aTemplate);
		
		for(TInt loop = 0;loop < original->Count();loop++)
			{
			CContactItemField* additionalField = CContactItemField::NewLC((*original)[loop]);
			aItem.CardFields().AddL(*additionalField);
			CleanupStack::Pop(additionalField);
			}
		CleanupStack::PopAndDestroy(original);
		}
	else
		{
		// If there is no template provided, we will fill the CContactItemField set provided
		// in the curent CContactItem object
		RestoreTextL(aItem.CardFields(), aTextHeaderStore, aTextHeaderStore.Root(), textFieldsBuf, aView, NULL);
		}
	
	CleanupStack::PopAndDestroy(textFieldsBuf); 
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:43,代码来源:cntpersistenceutility.cpp

示例5: CheckStartListDoesNotContainL

// ---------------------------------------------------------------------------
// CTestStartupListUpdater::CheckStartListDoesNotContainL()
// ---------------------------------------------------------------------------
//
TInt CTestStartupListUpdater::CheckStartListDoesNotContainL( CStifItemParser& aItem )
    {
    _LIT( KTestName, "NotInStartList" );
    Print( 0, KTestStartFormat, &KTestName );
    TInt testResult = KErrNone;

    RPointerArray<HBufC> startupList;
    CleanupResetAndDestroyPushL( startupList );
    GetStartupListL( startupList );

    TIdentityRelation<HBufC> compareFileNames( FileNamesEqual );

    TPtrC param;
    while( aItem.GetNextString ( param ) == KErrNone )
        {
        HBufC* buf = param.AllocLC();
        if( startupList.Find( buf, compareFileNames ) >= 0 )
            {
            testResult = KErrAlreadyExists;
            }
        CleanupStack::PopAndDestroy( buf );
        Print( 1, KTestParamFormatArg, &KTestName, &param, testResult );
        }

    CleanupStack::PopAndDestroy( &startupList );

    Print( 0, KTestDoneFormat, &KTestName );
    return testResult;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:33,代码来源:mt_startuplistupdaterblocks.cpp

示例6: BuildStringListL

void CExtensionTest::BuildStringListL(RPointerArray<HBufC>& aStrings, const TDesC& aBuf, const TDesC& aTag)
	{
	TInt pos = 0;
	TInt err = 0;	
	do
		{			
		// Find next value for the specified tag and add it to the string array
		// if it exists.
		TPtrC str = Input::ParseElement(aBuf, aTag, pos, err);
		if (err >= 0)
			{
			HBufC* string = str.AllocLC();			
			aStrings.AppendL(string);
			CleanupStack::Pop(string);
			}								
		}
	while (err >= 0);	
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:18,代码来源:extensiontest.cpp

示例7: RunTestL

void CMtfTestActionVerifyBodyText::RunTestL()
	{
	
	CMsvEntry* paramEntry = ObtainParameterReferenceL<CMsvEntry>(TestCase(),
									ActionParameters().Parameter(0));
									
	CMtfConfigurationType::TMtfConfigurationType paramConfigurationType = ObtainValueParameterL<CMtfConfigurationType::TMtfConfigurationType>(TestCase(),
												ActionParameters().Parameter(1));
	
	TInt paramIndex = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(2));


	TPtrC fileName = TestCase().GetConfigurationFileL(paramConfigurationType,paramIndex);
	
	// Call the utils function to verify the body text contents
	User::LeaveIfError(CMtfTestActionUtilsMessage::	VerifyBodyTextContentsL(*paramEntry,fileName.AllocLC()));

	CleanupStack::PopAndDestroy();
	
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:20,代码来源:CMtfTestActionVerifyBodyText.cpp

示例8: SetRecipientsL

void CCreateSmsMessageTestStep::SetRecipientsL(CSmsHeader& aHeader)
	{
	INFO_PRINTF1(_L("--Setting single recipient\n"));
	_LIT(KRecipient, "SentToAddress");
	
	TPtrC rcptTag;
	if ( !GetStringFromConfig(ConfigSection(),KRecipient,rcptTag))
		{
		ERR_PRINTF1(_L("No Input for FileName in CreateSmsMessage"));
		User::Leave(KErrNotReady);
		}
	
	HBufC* recipientAdd = rcptTag.AllocLC();
		
	CSmsNumber* rcpt = CSmsNumber::NewL();
	CleanupStack::PushL(rcpt);
	
	rcpt->SetAddressL(*recipientAdd);
	aHeader.Recipients().AppendL(rcpt);
	CleanupStack::Pop(rcpt);
	
	CleanupStack::PopAndDestroy(recipientAdd);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:23,代码来源:CCreateSmsMessageTestStep.cpp

示例9: FillViewItemL

/**
Filling content for the given view contact object.

@param aViewContact reference to the view contact object to be filled
@param aSqlStmt the sql statement which contains the retrieved content for the view object. 
*/
void CCntPplViewSession::FillViewItemL(CViewContact& aViewContact, RSqlStatement& aSqlStmt, const TContactViewPreferences& aViewPrefs)
	{
	if(iIsFastAccessFieldsOnly)
		{
		//The view gets fields only from fast access columns	
		const TInt KTextDefCount = iTextDef->Count();
		for(TInt index = 0; index < KTextDefCount; ++index)
			{
			const TDesC& KColumnName = TCntPersistenceUtility::GetFastAccessColumnNameById(iTextDef->At(index).iFieldType.iUid);
			ASSERT(KColumnName.Length() > 0);
			
			TPtrC fieldPtrC = aSqlStmt.ColumnTextL(iCntSqlStatement->ParameterIndex(KColumnName));
   			AddFieldInViewContactL(aViewContact, fieldPtrC, aViewPrefs);
			} //for
		}
	else
		{
		TBool searchFastAccessFields = EFalse;
		
		// iTextDef contains the fields that should be included in the view.
		// The array of all the field objects in a contact item is returned from
		// the Contacts table.  
		RPointerArray<CContactItemField> fields;
		CleanupStack::PushL(TCleanupItem(TCntPersistenceUtility::ResetAndDestroyRPointerArray, &fields));
		
		TPtrC8 textHeader;
		aSqlStmt.ColumnBinary(iCntSqlStatement->ParameterIndex(KContactTextFieldHeader()), textHeader);
		RDesReadStream textHeaderStream(textHeader);
		CleanupClosePushL(textHeaderStream);
        CEmbeddedStore* textHeaderStore = CEmbeddedStore::FromLC(textHeaderStream);
        
    	RStoreReadStream textHeaderStoreStream;
    	textHeaderStoreStream.OpenLC(*textHeaderStore,textHeaderStore->Root());
        
		TPtrC textFieldPtrC = aSqlStmt.ColumnTextL(iCntSqlStatement->ParameterIndex(KContactTextFields()));
		HBufC* textFieldsBuf = textFieldPtrC.AllocLC();
			
		TCntPersistenceUtility::ReadTextBlobL(textHeaderStoreStream, textFieldsBuf, *iTextDef, iContactProperties.SystemTemplateL(), fields, searchFastAccessFields);
		CleanupStack::PopAndDestroy(4, &textHeaderStream); //textHeaderStore, textHeaderStream, textHeaderStoreStream, textFieldsBuf
		
		// Loop through fields, checking for fields from fast access fields, and add 
		// the fields to the view contact object.
		const TInt KFieldsNumMax = fields.Count();
		for(TInt fieldsIndex = 0; fieldsIndex < KFieldsNumMax; ++fieldsIndex)
			{
			// this doesn't own the instance stored in fields array.
			CContactItemField* itemField = fields[fieldsIndex];

			if(itemField == NULL)
				{
				aViewContact.AddFieldL(KNullDesC);
				continue;
				}

			// The array of fields retrieved from the text fields blob does not
			// contain the text data Fast Access fields. If the searchFastAccessFields 
			// flags have been set then get the data from Fast Access columns
			// before adding the data to the view.
			TPtrC fieldText;
			if(searchFastAccessFields && itemField->ContentType().FieldTypeCount() > 0)
				{
				//Check the field name of the first field type(key field type) 
				//in the field's field types array
    			const TDesC& KColumnName = TCntPersistenceUtility::GetFastAccessColumnNameById(itemField->ContentType().FieldType(0).iUid);
				if(KColumnName.Length() > 0)
					{
					//this is a fast access field.
					fieldText.Set(aSqlStmt.ColumnTextL(iCntSqlStatement->ParameterIndex(KColumnName)));
					}
				else
					{
					fieldText.Set(itemField->TextStorage()->Text());
					}					
				}
			else
				{
				fieldText.Set(itemField->TextStorage()->Text());
				}
			
			AddFieldInViewContactL(aViewContact, fieldText, aViewPrefs);
			}
		
		CleanupStack::PopAndDestroy(&fields);
		}
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:91,代码来源:cntpplviewsession.cpp

示例10: doTestStepL

TVerdict CCreateSmsMessageTestStep::doTestStepL()
	{

	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
	CActiveScheduler::Install(scheduler);
	CleanupStack::PushL(scheduler);

	CSessionObserver* sessionObserver = new (ELeave) CSessionObserver;
	CleanupStack::PushL(sessionObserver);
	CMsvSession* session = CMsvSession::OpenSyncL(*sessionObserver);
	CleanupStack::PushL(session);
	
	_LIT(KFileName,"FileName");
	TPtrC tag;
	if ( !GetStringFromConfig(ConfigSection(),KFileName,tag))
		{
		ERR_PRINTF1(_L("No Input for FileName in CreateSmsMessage"));
		User::Leave(KErrNotReady);
		}
	
	HBufC* fileName = tag.AllocLC();
	

	// Create a Rich Text object
	CPlainText::TTextOrganisation ttOrg = {CPlainText::EOrganiseByLine};

	CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
	CleanupStack::PushL(paraFormatLayer);
	CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
	CleanupStack::PushL(charFormatLayer);
	CRichText* bodyRichText = CRichText::NewL(paraFormatLayer, charFormatLayer);
	CleanupStack::PushL(bodyRichText);
	
	// Store the file contents into the CRichText object
	bodyRichText->ImportTextFileL(0, fileName->Des(), ttOrg);
	
	
	// Create the SMS header object...
	CSmsHeader* header = CSmsHeader::NewL(CSmsPDU::ESmsSubmit, *bodyRichText);
	CleanupStack::PushL(header);
	
	// Set the body text...
	CSmsSettings* smsSettings = CSmsSettings::NewL();
	CleanupStack::PushL(smsSettings);

	CSmsAccount* account = CSmsAccount::NewLC();
	account->LoadSettingsL(*smsSettings);
	// Copy the message settings...
	header->SetSmsSettingsL(*smsSettings); 
	
	// Set the service centre
	TInt defaultIndex = smsSettings->DefaultServiceCenter();
	header->SetServiceCenterAddressL(smsSettings->GetServiceCenter(defaultIndex).Address());

	// Set recipient - ask derived class
	SetRecipientsL(*header);
	CArrayPtrFlat<CSmsNumber>& recipient = header->Recipients();

	INFO_PRINTF1(_L("Creating message..."));
	
	TMsvEntry entry;
	entry.SetVisible(ETrue); 
	entry.SetInPreparation(ETrue);
	TMsvId srvcId=0;
	TSmsUtilities::ServiceIdL(*session, srvcId);
	entry.iServiceId = srvcId;
	entry.iType = KUidMsvMessageEntry; 
	entry.iMtm = KUidMsgTypeSMS; 
	entry.iDate.UniversalTime();
	entry.iSize = 0; 
	entry.iDescription.Set(KNullDesC); 
	entry.iDetails.Set(KNullDesC); 
	entry.SetSendingState(KMsvSendStateWaiting);

	// Update entry description and details...
	entry.iDetails.Set(recipient[0]->Address());
	entry.iDescription.Set(recipient[0]->Address());
	entry.SetInPreparation(EFalse);

	//TPtrC tag;
	_LIT(KParent,"Parent");
	TPtrC parentTag;
	if ( !GetStringFromConfig(ConfigSection(),KParent,parentTag))
		{
		ERR_PRINTF1(_L("No Input for Outbox"));
		User::Leave(KErrNotReady);
		}
	// Create the entry - set context to the global outbox.
	TMsvId paramParentId =	MsgingUtils::GetLocalFolderId(parentTag);//KMsvGlobalOutBoxIndexEntryId;

	CMsvEntry* newEntry = CMsvEntry::NewL(*session,paramParentId,TMsvSelectionOrdering());
	CleanupStack::PushL(newEntry);
	newEntry->SetEntryL(paramParentId);
	
	newEntry->CreateL(entry);

	// Create new store and save header information
	newEntry->SetEntryL(entry.Id());
	CMsvStore* store = newEntry->EditStoreL();
	CleanupStack::PushL(store);
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:101,代码来源:CCreateSmsMessageTestStep.cpp

示例11: DoBuildL

void CHuiRasterizedTextMesh::DoBuildL(TInt aRasterizeFlags)
    {
    if(iUsingPreRasterizedMesh)
        {
        return;
        }

    TSize extents(0, 0);
    
    HUI_DEBUG(_L("CHuiRasterizedTextMesh::BuildL() - Updating rasterized text."));

    // This is never NULL during BuildL().
    const TDesC& text = *Text();
    
    // Retrieve the text style used when rasterizing this text mesh.
    THuiTextStyle* textStyle = CHuiStatic::Env().TextStyleManager().TextStyle(iTextStyleId);

    // Retrieve the CFont object used when rasterizing this text mesh.
    CFont* font = textStyle->Font().NearestFontL(iTextMeshScale);

    // Maximum width of a text line in pixels.
    TInt maxWidth = MaxLineWidth();

    TInt startIndex = 0;
    TInt index = 0;
    TInt lineCount = 0;

    CArrayFixFlat<TPtrC>* linePtrs = new (ELeave) CArrayFixFlat<TPtrC>(KLineArrayGranularity);
    CleanupStack::PushL(linePtrs);

    while(startIndex < text.Length())
        {
        /// @todo What is the Symbian way to determine line break chars?
#define HUI_IS_LINE_BREAK(aChar) (aChar == '\n')

        // Find the next logical line.
        while(index < text.Length() && !HUI_IS_LINE_BREAK(text[index]))
            {
            index++;
            }

        TPtrC logicalLine = text.Mid(startIndex, index - startIndex);
        ++index; // Skip the line break.
        startIndex = index;

        switch(LineMode())
            {
            case ELineModeTruncate:
                {
                ++lineCount; // there's always one line created per logical line
                HBufC* buf = logicalLine.AllocLC();
                TPtr ptr = buf->Des();
                // truncate line
                CHuiStatic::ConvertToVisualAndClipL(ptr, *font, maxWidth, maxWidth);
                // create the line entry if not already existing
                
                if (aRasterizeFlags != ERasterizeNone)
                	{
                    if (iLines.Count() < lineCount)
                        {
                        SRasterizedLine line;
                        line.iTexture = NULL;
                        line.iGap = 0;
                        iLines.AppendL(line);
                        
                        if (iPictographInterface)
                            {
                            SRasterizedLine pictographline;
                            pictographline.iTexture = NULL;
                            pictographline.iGap = 0;
                            iPictographLines.AppendL(pictographline);                                
                            }
                        }                	
                        
                	TInt currentLine = lineCount-1;
    	            if (aRasterizeFlags & ERasterizeText)
    	                {
    	                // rasterize a single line (updates texture in iLines[0].iTexture)
        	            RasterizeLineL(ptr, iLines[currentLine]);	                    
    	                }

    	            if (aRasterizeFlags & ERasterizePictographs && iPictographInterface)
    	                {
                        // Rasterize pictographs if needed
        	            RasterizePictographLineL(ptr, font, iPictographLines[currentLine]);
    	                }

    	            // Get extents from the texture we just created
                    CHuiTexture* tex = iLines[currentLine].iTexture;
                    extents.iHeight += iLines[currentLine].iGap;
                    if(tex)
                        {
                        extents.iWidth = Max(extents.iWidth, tex->Size().iWidth);
                        extents.iHeight += tex->Size().iHeight;
                        }	                
                	}
                else
                    {
                    // Don't rasterise or create textures, just get the extents of this text.
                    TSize lineExtents = textStyle->LineExtentsL(ptr);
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:101,代码来源:HuiRasterizedTextMesh.cpp

示例12: SetDatabasesToSearchL

// -----------------------------------------------------------------------------
// CPosLmMultiDbSearch::SetDatabasesToSearchL
//
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
EXPORT_C void CPosLmMultiDbSearch::SetDatabasesToSearchL(
    const CDesCArray& aDatabaseList)
{
    __ASSERT_ALWAYS(!iMultiSearchOperation, User::Leave(KErrInUse));
    __ASSERT_ALWAYS(aDatabaseList.Count() != 0, User::Leave(KErrArgument));

    CloseDbsNotToSearch(aDatabaseList);

    // Create search items for new uri, re-sort for existing uri
    for (TInt j = 0; j < aDatabaseList.Count(); j++)
    {
        TPtrC dbListUri = aDatabaseList.MdcaPoint(j);

        // Does uri exist in search items?
        TBool foundUri = EFalse;
        TInt i;
        for (i = j; i < iSearchItems.Count() && !foundUri; i++)
        {
            HBufC* searchItemUri = iSearchItems[i]->iDbUriPtr;
            if (dbListUri == *searchItemUri)
            {
                foundUri = ETrue;
                break;
            }
        }

        if (foundUri)
        {
            if (i != j)
            {
                // Re-sort item
                CPosLmMultiDbSearchItem* item = iSearchItems[i];
                iSearchItems.Remove(i);
                CleanupStack::PushL(item);
                iSearchItems.InsertL(item, j);
                CleanupStack::Pop(item);
            }
        }
        else
        {
            HBufC* uriPtr = dbListUri.AllocLC();
            CPosLmMultiDbSearchItem* item =
                new (ELeave) CPosLmMultiDbSearchItem(uriPtr);
            CleanupStack::Pop(uriPtr);
            CleanupStack::PushL(item);

            iSearchItems.InsertL(item, j);
            CleanupStack::Pop(item);
        }
    }

    // Remove any remaining double uri:s
    for (TInt i = aDatabaseList.Count(); i < iSearchItems.Count(); )
    {
        CPosLmMultiDbSearchItem* item = iSearchItems[i];
        iSearchItems.Remove(i);
        delete item;
    }

    // Reset all search errors as their db indexes might be invalid now.
    iSearchErrors.Reset();
    iNoOfSearchErrors = 0;
}
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:69,代码来源:EPos_CPosLmMultiDbSearch.cpp


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