Пример #1
0
void THighscoreHolder::RestoreL(const CStreamStore& aStore, TStreamId aStreamId)
{
	RStoreReadStream stream;
	stream.OpenLC(aStore, aStreamId);
	InternalizeL(stream);
	CleanupStack::PopAndDestroy();
}
Пример #2
0
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;
	}
Пример #3
0
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;
	}
Пример #4
0
/** 
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
	}
Пример #5
0
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
	}
Пример #6
0
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);
	}
Пример #7
0
void CCompound::RestoreL()
	{
	RStoreReadStream stream;
	stream.OpenLC(iStore,iId);
	InternalizeL(stream);
	CleanupStack::PopAndDestroy();
	}
Пример #8
0
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
	}
Пример #9
0
void CCompound::RestoreL(CStreamStore& aStore,TStreamId anId)
{
    RStoreReadStream instream;
    instream.OpenLC(aStore,anId);
    InternalizeL(instream);
    // Cleanup the stream object.
    CleanupStack::PopAndDestroy();
}
/**
Utility method used to read text fields from blob and fill item field set,Provides a mechanism to restore a 
contact item field set from text 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 text 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::RestoreTextL(CContactItemFieldSet& aFieldSet, CStreamStore& aHeaderStore, TStreamId aId, HBufC* textStream, 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;
	
	TInt textFieldIndex=0;

	for (TInt ii = 0; ii < fieldCount; ++ii)
		{
		// Restore text for every CContactItemField in provided CContactItemFieldSet.
		CContactItemField* field = CContactItemField::NewLC();
		
		if(aTemplate)
		    {
    		field->RestoreFieldTypesL(stream, &(aTemplate->CardFields()));
		    }
		else
		    {
    		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
		    {
    		field->RestoreTextL(textStream, textFieldIndex);
			aFieldSet.AddL(*field);
    		CleanupStack::Pop(field); 	
		    }	
		    
        ++textFieldIndex;
		}
	CleanupStack::PopAndDestroy(&stream);	
	}
Пример #11
0
/**
@SYMTestCaseID          SYSLIB-STORE-CT-1200
@SYMTestCaseDesc	    Shape streaming test
@SYMTestPriority 	    High
@SYMTestActions  	    Attempt for streaming of different shapes
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void testShapesL()
    {
	test.Start(_L(" @SYMTestCaseID:SYSLIB-STORE-CT-1200 Shape streaming "));

	TParsePtrC parse(KFileLocationSpec);
//
//	TheStore=CDirectFileStore::ReplaceLC(TheFs,KTestFile,EFileRead|EFileWrite);
	TheStore=CPermanentFileStore::ReplaceLC(TheFs,parse.NameAndExt(),EFileRead|EFileWrite);
	TheStore->SetTypeL(TheStore->Layout());
//
	RStoreWriteStream snk;
	TStreamId id=snk.CreateL(*TheStore);
	TShapeHolder hldr(ESquare,new(ELeave) CSquare(TPoint(20,30),40));
	hldr.ExternalizeSerialL(snk);
	delete hldr.Shape();
	hldr=TShapeHolder(ECircle,new(ELeave) CCircle(TPoint(70,80),40));
	hldr.ExternalizeSerialL(snk);
	delete hldr.Shape();
	snk.Close();
	RStoreReadStream src;
	src.OpenL(*TheStore,id);
	hldr.InternalizeSerialL(src);
	delete hldr.Shape();
	hldr.InternalizeSerialL(src);
	delete hldr.Shape();
	src.Close();
//
	hldr=TShapeHolder(ESquare,new(ELeave) CSquare(TPoint(20,30),40));
	id=hldr.StoreL(*TheStore);
	delete hldr.Shape();
	hldr.RestoreL(*TheStore,id);
	delete hldr.Shape();
//
	CShape* shape=new(ELeave) CCircle(TPoint(70,80),40);
	CStoreMap* map=CStoreMap::NewL(*TheStore);
	TStreamId id2 = shape->StoreL(*TheStore);

	testExtraStoreMapAPIsL();
	
	map->BindL(shape,id2);
	snk=RStoreWriteStream(*map);
	id=snk.CreateL(*TheStore);
	snk<<shape;
	snk.Close();
	delete shape;
	src.OpenL(*TheStore,id);
	src>>id;
	src.Close();
	shape=new(ELeave) CCircle;
	shape->RestoreL(*TheStore,id);
	delete map;
	TRAPD(r,shape->RestoreL(*TheStore,id));
	test(r==KErrNotFound);
	delete shape;
//
	CleanupStack::PopAndDestroy();
    }
Пример #12
0
/**
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
	}
Пример #13
0
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);
	}
Пример #14
0
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();
}
Пример #15
0
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);
	}
Пример #16
0
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;
	}
Пример #17
0
/**
 * 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;
	}
Пример #18
0
//
// 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();
	}
Пример #19
0
//
// 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();
	}
Пример #20
0
/** 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
	}
Пример #21
0
// -----------------------------------------------------------------------------
// 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
    }
Пример #22
0
/**
@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);
	}
Пример #23
0
void CTTypes::InitialiseReadStream()
	{
	TRAPD(ret,readstore=CDirectFileStore::OpenL(fs,_L("c:\\ttypes.str"),EFileStream|EFileRead)); //* --Geert
	TEST2(ret, KErrNone);
	TStreamId headerid=readstore->Root();
	TRAP(ret,readstrm.OpenL(*readstore,headerid));
	TEST2(ret, KErrNone);
	}
Пример #24
0
/**
@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);
	}
Пример #25
0
/** 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;	
	}
Пример #26
0
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);
	}
Пример #27
0
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();
	}
Пример #28
0
EXPORT_C void CHeaderFooter::RestoreL(const CStreamStore& aStore,TStreamId aStreamId,MPictureFactory* aFactory)
/** Restores this object and all associated components from a stream store. 

Components include fields and pictures.

@param aStore Stream store from which to restore the CHeaderFooter. 
@param aStreamId ID of the stream containing the external representation of 
the CHeaderFooter object. 
@param aFactory Picture factory. Must be supplied if the header or footer contains 
pictures which should be restored. */
	{
	// retrieve the headstream from the store
	RStoreReadStream stream;
	stream.OpenLC(aStore,aStreamId);
	// internalize the headstream, then fetch the components from their own streams
	InternalizeL(stream);
	CleanupStack::PopAndDestroy(); // stream
	RestoreComponentsL(aStore,aFactory);
	}
Пример #29
0
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;
	}
Пример #30
0
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();
        }
    }