/** Utility method used to read binary fields from blob and fill item field set,Provides a mechanism to restore a contact item field set from binary blob field within contact database. Blob informations are stored based on contact item field. At restore, a reference to a contact item field set is provided. For every contact item field in the item field set, a text restore is made. @param aFieldSet Reference to CContactItemFieldSet. Item field set that has to be filled with informations from blob @param aHeaderStore Stream store containing the header informations @param aId Root id for the header stream store @param aValuesStore Read stream used to read text fields from binary blob @param aViewDef View definition indicating which fields have to be read from blob @param aTemplate Template indicating if current field set should be filled based on a template */ void TCntPersistenceUtility::RestoreBinaryL(CContactItemFieldSet& aFieldSet, CStreamStore& aHeaderStore, TStreamId aId, CStreamStore* aBlobStore, const CContactItemViewDef& aViewDef, const CContactItem* aTemplate) { const TBool KIncludeFields = aViewDef.Use() == CContactItemViewDef::EIncludeFields; if (KIncludeFields && aViewDef.Count() == 0) { // If view definition does not contain any field we don't do anything (don't read from // blob). We simply return from method without doing anything. // This is not an error condition return; } RStoreReadStream stream; stream.OpenLC(aHeaderStore,aId); TCardinality fieldCount; stream>>fieldCount; TStreamId nestedId; for (TInt ii = 0; ii < fieldCount; ++ii) { // Restore binary value for every CContactItemField in provided CContactItemFieldSet. CContactItemField* field = CContactItemField::NewLC(); if(aTemplate) { nestedId = field->RestoreFieldTypesL(stream, &(aTemplate->CardFields())); } else { nestedId = field->RestoreFieldTypesL(stream, NULL); } ASSERT(field->StorageType() != KStorageTypeText); TBool fieldDefined = ETrue; if(!aViewDef.MatchesAll()) { fieldDefined = (aViewDef.Find(field->ContentType()) != KErrNotFound); } if ((!((fieldDefined && KIncludeFields) || (!fieldDefined && !KIncludeFields))) || (field->IsHidden() && aViewDef.Mode() == CContactItemViewDef::EMaskHiddenFields)) { CleanupStack::PopAndDestroy(field); } else { RStoreReadStream readStream; readStream.OpenLC(*aBlobStore, nestedId); field->Storage()->RestoreL(*aBlobStore, readStream); CleanupStack::PopAndDestroy(&readStream); aFieldSet.AddL(*field); CleanupStack::Pop(field); } } CleanupStack::PopAndDestroy(&stream); }
/** @SYMTestCaseID SYSLIB-STORE-CT-1131 @SYMTestCaseDesc Writing and reading back a long stream test @SYMTestPriority High @SYMTestActions Attempt to write long data to a stream and read back and test for the integrity of the data. @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void testBugL() { test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1131 Opening host file ")); TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive())); TParse parse; parse.Set(drive.Name(), &KFileLocationSpec, NULL); CFileStore* file=CDirectFileStore::ReplaceLC(TheFs,parse.NameAndExt(),EFileRead|EFileWrite); file->SetTypeL(file->Layout()); CSecureStore* secure=NULL; secure=CSecureStore::NewLC(*file,*thePBEKey); test.Next(_L("Writing long stream")); RStoreWriteStream out; TStreamId id=out.CreateLC(*secure); TInt ii; for (ii=0;ii<400;++ii) out<<_L("a goodly length of data"); out.CommitL(); CleanupStack::PopAndDestroy(); file->SetRootL(out.CreateLC(*secure)); out<<_L("spam")<<id; out.CommitL(); CleanupStack::PopAndDestroy(2, secure); file->CommitL(); CleanupStack::PopAndDestroy(); // test.Next(_L("Opening host file")); file=CFileStore::OpenLC(TheFs,parse.NameAndExt(),EFileRead); secure=CSecureStore::NewLC(*file,*thePBEKey); // TBuf<30> buf; test.Next(_L("Reading")); RStoreReadStream in; in.OpenLC(*secure,file->Root()); in>>buf>>id; CleanupStack::PopAndDestroy(); test(buf==_L("spam")); in.OpenLC(*secure,id); for (ii=0;ii<400;++ii) { in>>buf; test (buf==_L("a goodly length of data")); } CleanupStack::PopAndDestroy(3); }
void THighscoreHolder::RestoreL(const CStreamStore& aStore, TStreamId aStreamId) { RStoreReadStream stream; stream.OpenLC(aStore, aStreamId); InternalizeL(stream); CleanupStack::PopAndDestroy(); }
void CMsvSendExe::RetrievePackagesL() { //open the filestore CFileStore* store = CDirectFileStore::FromLC(iTaskFile);//pushes store RStoreReadStream instream; instream.OpenLC(*store,store->Root());//pushes instream //get task count TInt taskCount = instream.ReadInt32L(); SCHSENDLOG(FLog(iFileName, _L("\tTask Count=%d"), taskCount)); for (TInt curTask = 0; curTask < taskCount; curTask++) { CScheduledTask* task = CScheduledTask::NewLC(instream); AddPackageL(*task); CleanupStack::PopAndDestroy(task); } CleanupStack::PopAndDestroy(2, store); }
/** 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 }
void CCompound::RestoreL() { RStoreReadStream stream; stream.OpenLC(iStore,iId); InternalizeL(stream); CleanupStack::PopAndDestroy(); }
void CVersitTest::StreamInL() //Convert the iVersit into stream format, save it as "ExpDelVersitIn" //and internalize it as a CVersitParser { RFile file; FileRegister->CreateTempFileLC(file, _L("ExpDelVersit2")); CDirectFileStore* store = CDirectFileStore::NewLC(file); store->SetTypeL(KDirectFileStoreLayoutUid); RStoreWriteStream outstream; TStreamId id = outstream.CreateLC(*store); TInt length=iVersit.Length(); for (TInt ii=0; ii<length; ii++) outstream.WriteInt8L(iVersit[ii]); outstream.CommitL(); CleanupStack::PopAndDestroy(); store->SetRootL(id); store->CommitL(); CleanupStack::PopAndDestroy(2); // store + file FileRegister->OpenTempFileLC(file, _L("ExpDelVersit2")); store = CDirectFileStore::NewLC(file); RStoreReadStream instream; instream.OpenLC(*store,store->Root()); iParser->InternalizeL(instream); CleanupStack::PopAndDestroy(3); //store + stream + file }
LOCAL_C void StoreRestoreTestL() { CStreamStore* blobstore=CBufStore::NewLC(3); CStreamStore* textstore=CBufStore::NewLC(3); CStreamStore* store=CBufStore::NewLC(3); RStoreWriteStream stream; TStreamId textId=stream.CreateLC(*textstore); // CContactItemFieldSet* fieldSet=CContactItemFieldSet::NewLC(); AddFieldL(fieldSet,KStorageTypeText,KUidContactFieldCompanyName,KUidContactFieldVCardMapORG); AddFieldL(fieldSet,KStorageTypeText,KUidContactFieldPhoneNumber,KUidContactFieldVCardMapTEL); AddFieldL(fieldSet,KStorageTypeDateTime,KUidContactFieldBirthday,KUidContactFieldVCardMapBDAY); // TStreamId streamId=fieldSet->StoreL(*store,stream,*blobstore); CleanupStack::PopAndDestroy(); // fieldSet // CContactItemFieldSet* fieldSet2=CContactItemFieldSet::NewLC(); CContactItemViewDef *viewDef=CContactItemViewDef::NewLC(CContactItemViewDef::EMaskFields,CContactItemViewDef::EMaskHiddenFields ); RStoreReadStream rstream; rstream.OpenLC(*textstore,textId); fieldSet2->RestoreL(*store,streamId,blobstore,*viewDef,rstream); test(fieldSet2->Count()==3); CntTest->TestField((*fieldSet2)[0],KStorageTypeText,KUidContactFieldCompanyName,KUidContactFieldVCardMapORG); CntTest->TestField((*fieldSet2)[1],KStorageTypeText,KUidContactFieldPhoneNumber,KUidContactFieldVCardMapTEL); CntTest->TestField((*fieldSet2)[2],KStorageTypeDateTime,KUidContactFieldBirthday,KUidContactFieldVCardMapBDAY); CleanupStack::PopAndDestroy(7); // viewDef,fieldSet2 stream store textstore rstream,blobstore //zzz more to do here }
TInt CSecMgrStore::ReadCounter(TExecutableID& aExecID) { HBufC *configFile = HBufC::NewLC(KMaxName); TPtr ptr(configFile->Des()); TInt ret(GetConfigFile (ptr)); if ( KErrNone==ret) { if ( !BaflUtils::FileExists(iFsSession,*configFile)) { aExecID = (TExecutableID)KCRUIdSecMgr.iUid; BaflUtils::EnsurePathExistsL (iFsSession, *configFile); CleanupStack::PopAndDestroy (configFile); return WriteCounter (aExecID); } CFileStore* store = CPermanentFileStore::OpenLC (iFsSession, *configFile, EFileRead); RStoreReadStream instream; instream.OpenLC (*store, store->Root ()); aExecID = instream.ReadInt32L (); CleanupStack::PopAndDestroy (&instream); CleanupStack::PopAndDestroy (store); } CleanupStack::PopAndDestroy (configFile); return ret; }
EXPORT_C TSize CApaDoorBase::InternalizeBaseStreamL(const CStreamStore& aStore,const CStreamDictionary& aStreamDict) /** Internalises the information for this base class from a stream in the specified store, and returns the size of the icon or glass door. The stream ID is extracted from the specified stream dictionary. The UID associated with the stream ID is the same as that used when externalising. @publishedAll @released @param aStore The store containing the stream. @param aStreamDict The steam dictionary containing the stream ID. @return The size of the icon or glass door, in twips. */ { TStreamId id=aStreamDict.At(KUidApaDoorBaseStream); if (id==KNullStreamId) User::Leave(KErrCorrupt); // there is no base stream - the file is not valid (used to panic EPanicNoBaseDoorStream) RStoreReadStream stream; stream.OpenLC(aStore,id); iFormat = (TFormat)stream.ReadInt8L(); __ASSERT_DEBUG(iFormat==EIconic || iFormat==EGlassDoor,Panic(EDPanicIllegalDoorFormat)); TSize size; stream>> size; stream>> iSource; CleanupStack::PopAndDestroy(); // stream return size; }
void CCompound::RestoreL(CStreamStore& aStore,TStreamId anId) { RStoreReadStream instream; instream.OpenLC(aStore,anId); InternalizeL(instream); // Cleanup the stream object. CleanupStack::PopAndDestroy(); }
/** @SYMTestCaseID SYSLIB-STORE-CT-1129 @SYMTestCaseDesc Tests for reading from a store @SYMTestPriority High @SYMTestActions Attempt for reading from a root store and temporary store @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void testReadL() { test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1129 Opening host file ")); TDriveUnit drive(static_cast<TUint>(RFs::GetSystemDrive())); TParse parse; parse.Set(drive.Name(), &KFileLocationSpec, NULL); CFileStore* file=CFileStore::OpenLC(TheFs,parse.NameAndExt(),EFileRead); // test.Next(_L("Reading from root store")); TStreamId root=file->Root(); RStoreReadStream stream; stream.OpenLC(*file,root); RDecryptStream decrypt; decrypt.AttachLC(stream,*thePBEKey); TStreamId embed; TBuf8<5> b; decrypt>>b>>embed; test(b==_L8(" root")); CleanupStack::PopAndDestroy(2); stream.OpenL(*file,embed); CEmbeddedStore* store=CEmbeddedStore::FromLC(stream); CSecureStore* secure=NULL; secure=CSecureStore::NewLC(*store,*thePBEKey); testReadL(*secure,store->Root()); CleanupStack::PopAndDestroy(2); // test.Next(_L("Reading from temp store")); stream.OpenLC(*file,TheTempId); decrypt.OpenLC(stream,*thePBEKey); decrypt>>b>>embed; test(b==_L8(" temp")); CleanupStack::PopAndDestroy(2); stream.OpenL(*file,embed); store=CEmbeddedStore::FromLC(stream); secure=CSecureStore::NewLC(*store,*thePBEKey); testReadL(*secure,store->Root()); // CleanupStack::PopAndDestroy(3); }
/** Construct a clipboard store for reading from. */ void CClipboard::ConstructForReadingL(const TDesC& aFileName) { iStore=CDirectFileStore::OpenL(iFsSession,aFileName,EFileRead); iStreamDictionary=CStreamDictionary::NewL(); RStoreReadStream root; root.OpenLC(*iStore,iStore->Root()); root>> *iStreamDictionary; CleanupStack::PopAndDestroy(); // root }
void CSecMgrStore::RestorePoliciesL(RPolicies& aPolicy) { //Fetch all the individual policy files from "epoc32\winscw\c\private\<SECMGR_UID>\policy" directory //Iteratively internalise the policy files, with the policyID (PolicyID is = to filename) HBufC *privateDir = HBufC::NewLC(KMaxName); TPtr privateDirptr(privateDir->Des()); GetPolicyPath (privateDirptr); // create search string HBufC* searchBuf = privateDirptr.AllocLC (); TPtr searchPtr(searchBuf->Des()); CDir* dir= NULL; iFsSession.GetDir (searchPtr, KEntryAttNormal, ESortByName | EAscending, dir); if ( dir) { CleanupStack::PushL (dir); for (TInt i=0; i!=dir->Count ();++i) { TEntry entry = dir->operator[] (i); HBufC *fileName = HBufC::NewLC(KMaxName); TPtr ptr(fileName->Des()); ptr = entry.iName; HBufC *policyFile = HBufC::NewLC(KMaxName); TPtr policyFileptr(policyFile->Des()); policyFileptr.Copy(privateDirptr) ; policyFileptr.Append (ptr); CFileStore* store = CPermanentFileStore::OpenLC (iFsSession, policyFileptr, EFileShareAny); RStoreReadStream instream; instream.OpenLC (*store, store->Root ()); TLex16 lexer(ptr); TPolicyID pID; lexer.Val (pID); CPolicy* policy = CPolicy::NewL (pID, instream); aPolicy.Append (policy); CleanupStack::PopAndDestroy (&instream); //instream CleanupStack::PopAndDestroy (store); //store CleanupStack::PopAndDestroy (policyFile); CleanupStack::PopAndDestroy (fileName); } CleanupStack::PopAndDestroy (dir); } CleanupStack::PopAndDestroy (searchBuf); CleanupStack::PopAndDestroy (privateDir); }
void TIniData::RestoreL(CStreamStore& aStore,TStreamId anId) { RStoreReadStream stream; stream.OpenLC(aStore,anId); TStreamId id1,id2; stream >> id1 >> id2; CleanupStack::PopAndDestroy(); stream.OpenLC(aStore,id1); stream >> *this; CleanupStack::PopAndDestroy(); { TReal x=0.501; for (TInt ii=0;ii<200;++ii) x=4.0*x*(1.0-x); } stream.OpenLC(aStore,id2); stream >> *this; CleanupStack::PopAndDestroy(); }
EXPORT_C void CXzeDoor::RestoreL(const CStreamStore& aStore,TStreamId aStreamId) // Create a read-stream over aStore, and open it over the specified stream ID. // Internalize picture from this stream. // { RStoreReadStream stream; stream.OpenLC(aStore,aStreamId); stream>> *this; CleanupStack::PopAndDestroy(); }
void CApaProcess::DoReadRootStreamL(CStreamDictionary& aStreamDictionary, const CFileStore& aStore) { // static const TStreamId rootStreamId=aStore.Root(); if ((aStore.Type()[1] != KUidAppDllDoc) || (rootStreamId == KNullStreamId)) User::Leave(KErrCorrupt); RStoreReadStream rootStream; rootStream.OpenLC(aStore, rootStreamId); rootStream >> aStreamDictionary; CleanupStack::PopAndDestroy(&rootStream); }
const QMimeData* QClipboard::mimeData(Mode mode) const { if (mode != Clipboard) return 0; QClipboardData *d = clipboardData(); bool dataExists(false); if (d) { TRAPD(err,{ RFs fs = qt_s60GetRFs(); CClipboard* cb = CClipboard::NewForReadingLC(fs); Q_ASSERT(cb); //stream for qt RStoreReadStream stream; TStreamId stid = (cb->StreamDictionary()).At(KQtCbDataStream); if (stid != 0) { stream.OpenLC(cb->Store(),stid); QT_TRYCATCH_LEAVING(readFromStreamLX(d->source(),stream)); CleanupStack::PopAndDestroy(&stream); dataExists = true; } else { //symbian clipboard RStoreReadStream symbianStream; TStreamId symbianStId = (cb->StreamDictionary()).At(KClipboardUidTypePlainText); if (symbianStId != 0) { symbianStream.OpenLC(cb->Store(), symbianStId); QT_TRYCATCH_LEAVING(readSymbianStoreLX(d->source(), cb)); CleanupStack::PopAndDestroy(&symbianStream); dataExists = true; } } CleanupStack::PopAndDestroy(cb); }); if (err != KErrNone){ qDebug()<< "clipboard is empty/err: " << err; } if (dataExists) { return d->source(); } }
CStreamDictionary* CApaModelDoor::ReadStreamDictionaryLC(const CStreamStore& aSourceStore,TStreamId aStreamId) // static method // { // read the stream dic from the doc's root stream CStreamDictionary* streamDic=CStreamDictionary::NewLC(); RStoreReadStream stream; stream.OpenLC(aSourceStore,aStreamId); stream>> *streamDic; CleanupStack::PopAndDestroy(); // root return streamDic; }
/** * Restore the root stream dictionary from the specified store * * @return A stream dictionary object on the cleanup stack */ CStreamDictionary* CASSrvAlarmStore::OpenDictionaryLC(CPersistentStore& aStore) const { const TStreamId rootId = aStore.Root(); // CStreamDictionary* dictionary = CStreamDictionary::NewLC(); RStoreReadStream stream; stream.OpenLC(aStore, rootId); stream >> *dictionary; CleanupStack::PopAndDestroy(&stream); // return dictionary; }
// // Test reading from a store // // Reads back and checks the data written to a store by testWriteL(), // given the store and the id returned. // LOCAL_C void testReadL(const CStreamStore& aStore,TStreamId anId) { test.Next(_L("Reading...")); RStoreReadStream in; in.OpenLC(aStore,anId); in>>TheBuf; TStreamId id; in>>id; in.Close(); in.OpenL(aStore,id); testReadL(in); CleanupStack::PopAndDestroy(); }
// // Test reading from a store // LOCAL_C void testReadL(const CPersistentStore& aStore) { test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1148 Reading... ")); RStoreReadStream in; in.OpenLC(aStore,aStore.Root()); in>>TheBuf; TStreamId id; in>>id; in.Close(); in.OpenL(aStore,id); testReadL(in); CleanupStack::PopAndDestroy(); }
/** @SYMTestCaseID SYSLIB-STORE-CT-1197 @SYMTestCaseDesc Reading from a file buffer test @SYMTestPriority High @SYMTestActions Tests for reading from root and temporary store. @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void testReadL() { test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1197 Opening host file ")); TParsePtrC parse(KFileLocationSpec); CFileStore* file=CFileStore::OpenLC(TheFs,parse.NameAndExt(),EFileRead); // test.Next(_L("Reading from root store")); TStreamId root=file->Root(); RStoreReadStream stream; stream.OpenLC(*file,root); TBuf8<5> b; stream.ReadL(b); test(b==_L8(" root")); CleanupStack::Pop(&stream); CEmbeddedStore* store=CEmbeddedStore::FromL(stream); CleanupStack::PushL(store); testReadL(*store); CleanupStack::PopAndDestroy(store); stream.OpenLC(*file,root); stream.ReadL(b); test(b==_L8(" root")); CleanupStack::Pop(&stream); store=CEmbeddedStore::FromLC(stream); testReadL(*store); CleanupStack::PopAndDestroy(); // test.Next(_L("Reading from temp store")); stream.OpenLC(*file,TheTempId); stream.ReadL(b); test(b==_L8(" temp")); CleanupStack::Pop(); store=CEmbeddedStore::FromLC(stream); testReadL(*store); // CleanupStack::PopAndDestroy(2); }
void CSettingsManager::ReadGeneralSettingsL(CMVSAppUi* aAppUI) { if(!FileExists()) return; OpenStore2ReadLC(); RStoreReadStream instream; iRootId = iStore->Root(); instream.OpenLC(*iStore,iRootId); //open root stream for reading instream >> iGenSettingsId; CleanupStack::PopAndDestroy(); //check for the validity of the streamid if(!iGenSettingsId.Value()) { CleanupStack::PopAndDestroy(); return; } //open the stream for general settings instream.OpenLC(*iStore,iGenSettingsId); aAppUI->InternalizeL(instream); CleanupStack::PopAndDestroy(2); }
/** Replaces any currently used bitmap with the bitmap that corresponds to the new zoom size. @param aNewZoom The new zoom size. @pre A valid zoom size is passed to the function. @post All currently used bitmaps are replaced with bitmaps that correspond to the new zoom size. @see CHlpDatabase::ImageForIdLC() @see CHlpDatabase::ImageCountForIdL() @see RStoreReadStream::OpenLC() */ void CHlpPicture::RestoreL(const CStreamStore& aStore, TStreamId aStreamId, CHlpDatabase& aDatabase, THlpZoomState aZoomState) { RStoreReadStream stream; stream.OpenLC(aStore, aStreamId); iImageId = stream.ReadUint32L(); CleanupStack::PopAndDestroy(); // stream iImageCountForPicture = aDatabase.ImageCountForIdL(iImageId); // Fetch the specified bitmap from the help files image table. // This method will leave if the image isn't in the table. CFbsBitmap* bitmap = aDatabase.ImageForIdLC(iImageId, aZoomState); delete iImage; iImage = bitmap; CleanupStack::Pop(); // bitmap }
// ----------------------------------------------------------------------------- // CShapeListManager::RestoreL() // Restore the instance from the specified stream within the specified store // ----------------------------------------------------------------------------- // EXPORT_C void CShapeListManager::RestoreL( const CStreamStore& aStore, const TStreamId& aStreamId ) { Clear(); RStoreReadStream stream; // Open the stream stream.OpenLC( aStore, aStreamId ); // Read the data from the stream InternalizeL( stream ); CleanupStack::PopAndDestroy(); // the stream }
/** Reads the application identifier from its stream in the specified store and returns it. The location of the stream is found in the specified stream dictionary. @param aStore The store from which the application identifier should be read. @param aStreamDic The stream dictionary containing the stream ID of the application identifier stream. The stream dictionary can be found in the root stream of the store. @return The application identifier. */ EXPORT_C TApaAppIdentifier CApaProcess::ReadAppIdentifierL(const CStreamStore& aStore,const CStreamDictionary& aStreamDic) { // this is a static method __SHOW_TRACE(_L("Starting CApaProcess::ReadAppIdentifierL")); TStreamId infoStreamId = aStreamDic.At(KUidAppIdentifierStream); TApaAppIdentifier appId; // create a stream and read in the data RStoreReadStream stream; stream.OpenLC(aStore,infoStreamId); stream >> appId; stream.Close(); CleanupStack::PopAndDestroy(); // stream return appId; }
/** @SYMTestCaseID SYSLIB-STORE-CT-1151 @SYMTestCaseDesc Copying to a single file store test. @SYMTestPriority High @SYMTestActions Test for copying using different buffer sizes @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void testCopyL() { test.Next(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1151 Copying using small transfers ")); TParsePtrC parse(KFileLocationSpec); CFileStore* store=CFileStore::OpenLC(TheFs,parse.NameAndExt(),EFileRead|EFileWrite); RStoreReadStream in; in.OpenLC(*store,store->Root()); in>>TheBuf; TStreamId copyId; in>>copyId; in.Close(); in.OpenL(*store,copyId); RStoreWriteStream out; TStreamId id=out.CreateLC(*store); testCopyL(out,in); out.CommitL(); out.Close(); in.Close(); in.OpenL(*store,id); testReadL(in); in.Close(); // test.Next(_L("Copying using a single big transfer")); in.OpenL(*store,copyId); id=out.CreateL(*store); in.ReadL(out,KTestTotal); out.CommitL(); out.Close(); in.Close(); in.OpenL(*store,id); testReadL(in); in.Close(); in.OpenL(*store,copyId); id=out.CreateL(*store); out.WriteL(in,KTestTotal); out.CommitL(); out.Close(); in.Close(); in.OpenL(*store,id); testReadL(in); // CleanupStack::PopAndDestroy(3); }
LOCAL_C void doRestoreL(CStreamStore& aStore,const TStreamId& anId) { // Construct "empty" CClassA and CClassB objects CClassA* theA = CClassA::NewLC(); CClassB* theB = CClassB::NewLC(); // Construct and open the input stream. // We want to access the one and only // stream from the in-memory store. RStoreReadStream instream; instream.OpenLC(aStore,anId); // Stream in the CClassA object first and // then stream in the CClassB object. This is the order // in which the objects were streamed out. // // NB the order in which the objects are streamed OUT to // a single stream is arbitrary BUT, whatever the order // chosen, the objects must be streamed in, in the SAME order // // In this example, streaming in has assignment semantics. instream >> *theA; instream >> *theB; // Equally we could have done: // outstream >> *theA >> *theB; // to the same effect // Cleanup the stream object CleanupStack::PopAndDestroy(); // Show restored contents of the CClassA object _LIT(KTxtRestoredClassA,"Restored CClassA content ..."); doShow(KTxtRestoredClassA,*theA); // Show restored contents of the CClassB object _LIT(KTxtRestoredClassB,"Restored CClassB content ..."); doShow(KTxtRestoredClassB,*theB); // Destroy the CClassB object, // Destroy the CClassA object, CleanupStack::PopAndDestroy(2); }
TBool CSettingsManager::ReadVideoDataL(CMVSConfigVideoFormatDialog* aVideoFormatDlg, const TUid& aUid) { TStreamId controllerId; // if the controller settings is not available return if(!IsControllerAvailableL(aUid,controllerId)) return 0; //open the store to read if(!FileExists()) return 0; OpenStore2ReadLC(); //open the stream of the given controller for reading RStoreReadStream instream; instream.OpenLC(*iStore,controllerId); aVideoFormatDlg->InternalizeL(instream); CleanupStack::PopAndDestroy(2); return 1; }