// ---------------------------------------------------------------------------- // Copies elements from one array of descriptors to another // ---------------------------------------------------------------------------- // EXPORT_C void MPXUser::CopyArrayL(const MDesCArray& aSrc, CDesCArray& aDest) { aDest.Reset(); for (TInt i=0; i < aSrc.MdcaCount(); ++i) { aDest.AppendL(aSrc.MdcaPoint(i)); } }
// ---------------------------------------------------------------------------- // Add array items in aSrc into sorted array aDest if the item is not in // the aDest yet // ---------------------------------------------------------------------------- // EXPORT_C void MPXUser::MergeArray(const MDesCArray& aSrc, CDesCArray& aDest) { for (TInt i=aSrc.MdcaCount(); --i>=0 ;) { ////ignore leave when insert the same item TRAP_IGNORE(aDest.InsertIsqL(aSrc.MdcaPoint(i))); } }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void CPixelMetricsMapperViewContainer::ShowL( const TDesC& aString, TBool& aLast, const TBool& aFileOutput ) { MDesCArray* itemList = iListbox->Model()->ItemTextArray(); CDesCArray* itemArray = ( CDesCArray* ) itemList; itemArray->AppendL( aString ); iListbox->HandleItemAdditionL(); iListbox->SetCurrentItemIndex( iCount ); iCount++; if ( aLast ) { if (aFileOutput) { RFile file; RFs& fs = CEikonEnv::Static()->FsSession(); TFileName fileName =_L("Layout_"); TRect screenRect; AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow, screenRect ); // Add screen dimensions TInt height = screenRect.Height(); TInt width = screenRect.Width(); fileName.AppendNum(height); fileName.Append('_'); fileName.AppendNum(width); fileName.Append(_L(".txt")); TInt err=file.Open(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny); if (err==KErrNotFound) // file does not exist - create it err=file.Create(fs,fileName,EFileStreamText|EFileWrite|EFileShareAny); else file.SetSize(0); //sweep the file TFileText textFile; textFile.Set(file); err = textFile.Seek(ESeekStart); if (err) User::InfoPrint(_L("File corrupted")); // Finally loop through all the entries: TInt idx = 0; for(;idx!=itemList->MdcaCount();idx++) { err = textFile.Write(itemList->MdcaPoint(idx)); if (err) User::InfoPrint(_L("File corrupted")); } file.Close(); } DrawNow(); } }
/** Searches all contact items in the view for fields that contain the search strings specified. @capability ReadUserData @param aFindWords A descriptor array containing one or more search strings @param aMatchedContacts On return, an array of matching contact items @param find behaviour configuration uid to be passed to the server. */ void RContactRemoteView::ContactsMatchingCriteriaL(const MDesCArray& aFindWords, RPointerArray<CViewContact>& aMatchedContacts, TBool aPrefixSearch,TUid aUid) { if(aUid != KNullUid) { TIpcArgs args(aUid.iUid); User::LeaveIfError(SendReceive(ECntSendPluginUidToServer,args)); } CBufBase* buffer = CBufFlat::NewL(32); CleanupStack::PushL(buffer); RBufWriteStream writeStream(*buffer); CleanupClosePushL(writeStream); writeStream.WriteUint32L(aPrefixSearch); const TInt count = aFindWords.MdcaCount(); writeStream.WriteUint32L(count); for (TInt i=0; i<count; ++i) { TPtrC ptr = aFindWords.MdcaPoint(i); writeStream.WriteUint32L(ptr.Length()); writeStream << ptr; } writeStream.CommitL(); CleanupStack::PopAndDestroy(&writeStream); //writeStream.Close() TPtr8 ptr(buffer->Ptr(0)); const TInt bufferSize = buffer->Size(); TPckg<TInt> size(bufferSize); TPckgBuf<TInt> pckg; TIpcArgs args(&pckg,&size,&ptr); User::LeaveIfError(SendReceive(ECntContactMatchingCriteriaExternalizedSize,args)); CleanupStack::PopAndDestroy(buffer); //Internalize Contacts HBufC8* buf=HBufC8::NewLC(pckg()); TPtr8 contactsbufPtr(buf->Des()); TIpcArgs args2(&contactsbufPtr); User::LeaveIfError(SendReceive(ECntGetContactMatchingCriteria,args2)); RDesReadStream readStream(contactsbufPtr); CleanupClosePushL(readStream); const TInt findCount = readStream.ReadUint32L(); for (TInt zz=0;zz<findCount;++zz) { CViewContact* thisContact = CViewContact::NewLC(KNullContactId); readStream >> *thisContact; aMatchedContacts.AppendL(thisContact); CleanupStack::Pop(thisContact); } CleanupStack::PopAndDestroy(2, buf); }
/* ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- */ void CZipCompressor::ConstructL(const TDesC& aZipFileName,const MDesCArray& aFilesArray) { // _LIT(KRecFilename ,"C:\\ZipCompress.txt"); // iFs.Delete(KRecFilename); // User::LeaveIfError(iDebugFile.Create(iFs,KRecFilename,EFileWrite|EFileShareAny)); iFilesArray = new(ELeave)CDesCArrayFlat(10); for (TInt i=0; i < aFilesArray.MdcaCount(); i++) { iFilesArray->AppendL(aFilesArray.MdcaPoint(i)); } if(iDebugFile.SubSessionHandle()) { iDebugFile.Write(_L8("start, ")); } CActiveScheduler::Add(this); BeginL(aZipFileName); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // EXPORT_C void CSymbianUnitTestRunner::ExecuteTestsL( const MDesCArray& aTestDllNames, TBool aMemoryAllocationFailureSimulation, const TDesC& aOutputFileName, const TDesC& aOutputFormat, const CDesCArray& aTestCaseNames, TInt aTimeout ) { //init logger TBuf<50> version; version.Format(KLogVersion, SUT_MAJOR_VERSION, SUT_MINOR_VERSION, SUT_BUILD_VERSION); SUT_LOG_START(version); iTestCount = 0; MSymbianUnitTestInterface::TFailureSimulation failureSimulation = MSymbianUnitTestInterface::ENoFailureSimulation; if ( aMemoryAllocationFailureSimulation ) { failureSimulation = MSymbianUnitTestInterface::EMemAllocFailureSimulation; } for ( TInt i = 0; i < aTestDllNames.MdcaCount(); i++ ) { TPtrC16 testDllName( aTestDllNames.MdcaPoint( i ) ); RLibrary library; TInt ret; ret = library.Load( testDllName ); if ( ret != KErrNone ) { iUiCallBack.InfoMsg( KFailedToFindDll, testDllName ); SUT_LOG_FORMAT(KFailedToFindDll, &testDllName); //User::Leave( KErrNotFound ); User::Leave( ret ); } CleanupClosePushL( library ); // The second UID of the dll to be used must be compatible if ( library.Type()[ 1 ] != KSymbianUnitTestDllUid ) { iUiCallBack.InfoMsg( KNonCompatibleUIDs ); User::Leave( KErrNotFound ); } TLibraryFunction entryFunction = library.Lookup( 1 ); if ( !entryFunction ) { iUiCallBack.InfoMsg( KExportFuncNotFound ); User::Leave( KErrNotFound ); } MSymbianUnitTestInterface* test = reinterpret_cast< MSymbianUnitTestInterface* >( entryFunction() ); TCleanupItem cleanupItem( DeleteTest, test ); CleanupStack::PushL( cleanupItem ); iTestCount += test->TestCaseCount(); test->ExecuteL( *this, *iResult, failureSimulation, aTestCaseNames, aTimeout); CleanupStack::PopAndDestroy(); // cleanupItem CleanupStack::PopAndDestroy( &library ); } CSymbianUnitTestOutputFormatter* outputFormatter = SymbianUnitTestOutputFactory::CreateOutputLC( aOutputFileName, aOutputFormat ); outputFormatter->PrintL( *iResult ); CleanupStack::PopAndDestroy( outputFormatter ); SUT_LOG_INFO(KLogFinish); }