// ---------------------------------------------------------
// CNSmlDsProvisioningAdapter::GetTitleL
// ---------------------------------------------------------
void CNSmlDsProvisioningAdapter::GetTitleL()
	{
	if( iTitle == 0 )
		{
		RFs	fs;
		User::LeaveIfError( fs.Connect() );
		CleanupClosePushL( fs );

		TFileName fileName;
		TParse parse;
		parse.Set( KNSmlDsPovisioningDirAndResource, &KDC_RESOURCE_FILES_DIR, NULL );
		fileName = parse.FullName();

		RResourceFile resourceFile;
		BaflUtils::NearestLanguageFile( fs, fileName );
		resourceFile.OpenL( fs, fileName );
		CleanupClosePushL( resourceFile );

		HBufC8* dataBuffer = resourceFile.AllocReadLC( R_SYNC_PROVISIONING_TITLE );
			
		TResourceReader reader;
		reader.SetBuffer( dataBuffer ); 
		iTitle = reader.ReadHBufC16L(); 
		CleanupStack::PopAndDestroy( 3 ); //fs, resourcefile, databuffer
		}
	}
// -----------------------------------------------------------------------------
// CPIMLocalizationData::ConstructFromResourceL
// -----------------------------------------------------------------------------
//
void CPIMLocalizationData::ConstructFromResourceL(
    RResourceFile& aResourceFile,
    TResourceReader& aReader)
{
    TInt listCount(aReader.ReadInt16());

    __ASSERT_DEBUG(listCount > iSubType,
                   User::Panic(KPIMPanicCategory, EPIMPanicGeneral));

    // Find the correct resource structure for the requested sub-type. If
    // the list type is incorrect the reader skips the incorrect resource
    // structure and tries the next one until no lists can be processed.
    for (TInt i(1); i <= listCount; i++)
    {
        TInt listType(aReader.ReadInt8());
        if (listType == iSubType)
        {
            ReadListInfoFromResourceL(aResourceFile, aReader);
            break;
        }
        else if (i < listCount)
        {
            // Advance in resource file since this wasn't the list which
            // was requested. Currently there are three LLINK:s to skip
            aReader.Advance(sizeof(TInt32) * KPIMNumListResourceLinks);
        }
    }
}
void CImConvertCharconv::SetSystemDefaultCharsetL()
	{	
	TBuf8<KMaxMIMECharSetLength> charsetName;
	TUint charset = KDefaultPlainCharset;
	
	// Try to get the character set from the Central Repository
	TInt err = GetSystemCharsetFromCenRepL(charsetName);
	if (KErrNone != err)
		{
		// That failed, fallback to reading from the resource file
		// Check the resource file..
		RResourceFile resFile;
		OpenResourceFileL(resFile, iFs);	// NB leaves if file not found

		// make sure the resource file will be closed if anything goes wrong
		TCleanupItem close( CloseResourceFile, &resFile );
		CleanupStack::PushL( close );		
			
		HBufC8* buf = resFile.AllocReadLC( DEFAULT_SYSTEM_CHARSET );

		TResourceReader reader;
		reader.SetBuffer(buf);
		charsetName.Copy(reader.ReadTPtrC8());
		
		CleanupStack::PopAndDestroy(2,&resFile); // buf, resFile
		}

	charset = GetMimeCharsetUidL(charsetName);

	// If the character set in the resource file is not recognised. Leave..
	if (charset==KUidMsvCharsetNone || !CharsetAvailable(charset))
		User::Panic(_L("IMCM"),EImcmSystemDefaultCharsetNotSupported);
	else
		iSystemDefaultCharset=charset;
	}
TBool CGsaStatePolicyStartup::ConditionalCommandAllowedL(CResourceFile& /*aResourceFile*/, TInt /*aResourceId*/)
#endif
	{
	TBool isAllowed = EFalse;        
#ifdef SYMBIAN_SSM_GRACEFUL_SHUTDOWN
   	HBufC8* buf = aResourceFile.AllocReadLC(aResourceId);
   	TResourceReader reader; 
	reader.SetBuffer(buf);
	//Read the type of the command from the resource file
	TUint16 type = reader.ReadUint16();
	CleanupStack::PopAndDestroy(buf);
	// check that the type is equal to "EGracefulShutdown"
	if(type == EGracefulShutdown)    
		{
		//Check whether SSM graceful shutdown is enabled or not
		if(IsSsmGracefulShutdown())   
			{
			isAllowed = ETrue;
			}
		}
#else
	// no commands use 'conditional_information' in Startup state command list.
	PanicNow(KPanicGsaStartupState, EConditionalInfoNotImplemented);
#endif
	return isAllowed;
	}
Example #5
0
/**
 * @SYMTestCaseID T_ServicesTestStep_TestServiceDiscovery28L
 *
 * @SYMPREQ 538
 *
 * @SYMTestCaseDesc Test the functionality of GetServiceImplementationsLC 
 * which gets all the implementation details about a specific service 
 * @SYMTestPriority 
 *
 * @SYMTestStatus Implemented
 * 
 * @SYMTestActions Call GetServiceImplementationsLC with the service uid as parameter
 * on z: drive.\n
 * API Calls:\n	
 * RApaLsSession::GetServiceImplementationsLC(TUid aServiceUid, const TDataType& aDataType) const
 * 
 * @SYMTestExpectedResults Returns an array of TApaAppServiceInfo objects. 
 * The size of the array is equal to the number of apps offering the specified service that
 * also handles the speficied datatype. 
 * Each TApaAppServiceInfo contain an app uid and  the respective opaquedata. 
 * The returned data should be the same as that defined in the registration files.
 *  
 */
void CT_ServicesTestStep::TestServiceDiscovery28L()
	{
	INFO_PRINTF1(_L("TestServiceDiscovery28 about to start..."));
	const TUid KUidService1234 = {0x01020304};
	//const TUid KUidServerApp1 = {0x10004c56};
	const TUid KUidServerApp2 = {0x10004c57};
	
	TDataType datatype(KLitCustom1Text);
	CApaAppServiceInfoArray* array = iApaLsSession.GetServiceImplementationsLC(KUidService1234, datatype);
	TArray<TApaAppServiceInfo> implArray(array->Array());
	TInt count = implArray.Count();	
	TEST(count==1);
	_LIT(KService,"Non-localised text for service uid 0x01020304");
	TPtrC8 opaqueData;
	TResourceReader reader;
	TPtrC16 theText;
	TInt val(0);
	TUid myuid = implArray[0].Uid(); 
	TEST(myuid==KUidServerApp2);
	const CArrayFixFlat<TDataTypeWithPriority>& datatypes = implArray[0].DataTypes();
	TEST(datatypes.Count()==1);
	TEST(0 == datatypes[0].iDataType.Des8().CompareF(KLitCustom1Text));
	opaqueData.Set(implArray[0].OpaqueData());
	reader.SetBuffer(&opaqueData); // opaqueData is an LTEXT resource
	theText.Set(reader.ReadTPtrC16());
	User::LeaveIfError(val = theText.Compare(KService));
	TEST(val==KErrNone);
	CleanupStack::PopAndDestroy(array);
	array = NULL;
	}
Example #6
0
EXPORT_C void CEikHotKeyTable::ConstructFromResourceL(TInt aResourceId)
    {
    TResourceReader reader;
    CCoeEnv::Static()->CreateResourceReaderLC(reader,aResourceId);
    iNumberPlain=reader.ReadInt16();
    if (iNumberPlain)
        {
	    const SEikHotKey* ptr=(const SEikHotKey*)reader.Ptr();
	    reader.Advance(iNumberPlain*sizeof(SEikHotKey));
	    AppendL(ptr,iNumberPlain);
        }
    iNumberCtrl=reader.ReadInt16();
    if (iNumberCtrl)
        {
	    const SEikHotKey* ptr=(const SEikHotKey*)reader.Ptr();
	    reader.Advance(iNumberCtrl*sizeof(SEikHotKey));
	    AppendL(ptr,iNumberCtrl);
        }
    iNumberShiftCtrl=reader.ReadInt16();
    if (iNumberShiftCtrl)
        {
	    const SEikHotKey* ptr=(const SEikHotKey*)reader.Ptr();
	    reader.Advance(iNumberShiftCtrl*sizeof(SEikHotKey));
	    AppendL(ptr,iNumberShiftCtrl);
        }
    CleanupStack::PopAndDestroy();
    }
// ---------------------------------------------------------------------------
// CAknMemorySelectionDialogMultiDrive::GetSystemDrivesL
// ---------------------------------------------------------------------------
//
void CAknMemorySelectionDialogMultiDrive::GetSystemDrivesL( TInt aUserDefinedId )
    {
    TInt locations = 0;
    TResourceReader reader;
    if( aUserDefinedId )
        {        
        iCoeEnv->CreateResourceReaderLC( reader, aUserDefinedId );
        reader.ReadTPtrC();   //Rede title   
        reader.ReadTPtrC();   // Read left softkey text.
        reader.ReadTPtrC();   // Read right softkey text.
        locations = reader.ReadInt16();
        if ( locations > 0 )
            {
            // Read user defined data into model
            iModel->ReadUserDefinedDataL( reader, locations );
            }
        CleanupStack::PopAndDestroy(); // reader
        }
    
    //Update root path and default folder arrays.
    iModel->UpdateDataArraysL();
    
    // Updates items in listbox.
    iModel->UpdateItemsL();
    }
Example #8
0
/**
Static private utility used by exported inline functions to read from resource file.
@param aResourceId 
@param aEnv May be Null
@param aSize Specifies integer size: EResourceInt8, EResourceInt16, EResourceInt32
@return Integer value read from resource.  May be 8, 16 or 32 bit value.
*/
EXPORT_C TInt32 EikResourceUtils::ReadResourceIntL(TInt aResourceId,CEikonEnv* aEnv,TResourceTypeInt aSize)
//
//	Read a resource specifying a number
//
	{
	if (aEnv==NULL)
		aEnv=CEikonEnv::Static();
	__ASSERT_DEBUG(aEnv!=NULL,Panic(EEikPanicResourceNonEnvironment));
	TResourceReader reader;
	aEnv->CreateResourceReaderLC(reader,aResourceId);
	TInt32 value=0;
	switch(aSize)
		{
	case EResourceInt8:
		value=reader.ReadInt8();
		break;
	case EResourceInt16:
		value=reader.ReadInt16();
		break;
	case EResourceInt32:
		value=reader.ReadInt32();
		break;
	default:
		Panic(EEikPanicResourceInvalidNumberType);
		}
	CleanupStack::PopAndDestroy(); // resource reader
	return(value);
	}
void TAknNoteResData::ReadFromResource(TResourceReader& aResReader)
	{
    iResId = aResReader.ReadInt32();
    iTimeout = STATIC_CAST(CAknNoteDialog::TTimeout, aResReader.ReadInt32());
    iTone = STATIC_CAST(CAknNoteDialog::TTone, aResReader.ReadInt16());
    iText = aResReader.ReadTPtrC();
	}
Example #10
0
EXPORT_C void CEikTextListBox::ConstructFromResourceL(TResourceReader& aReader)
    {
    _AKNTRACE_FUNC_ENTER;
	RestoreCommonListBoxPropertiesL(aReader);
	iRequiredCellCharWidth = aReader.ReadInt16();

    TInt array_id = aReader.ReadInt32();
    if (array_id)
		{
		CDesCArray* desArray = iCoeEnv->ReadDesCArrayResourceL(array_id);
		CleanupStack::PushL(desArray);
		iModel = new(ELeave) CTextListBoxModel;
		((CTextListBoxModel*)iModel)->ConstructL(desArray);
		CleanupStack::Pop();
		}
	else
		{
		iModel = new(ELeave) CTextListBoxModel;
		((CTextListBoxModel*)iModel)->ConstructL();
		}
	CreateItemDrawerL();
	((CTextListItemDrawer*)iItemDrawer)->SetCellWidthInChars(iRequiredCellCharWidth);
	CreateViewL();
	UpdateViewColors();
	UpdateItemDrawerColors();
	_AKNTRACE_FUNC_EXIT;
    }
Example #11
0
/**
 * CreateStandardEntriesFromResourceFileL()
 * @param None:
 *
 * Will read messaging resource file and create entries.
 */	
void CMsvIndexContext::CreateStandardEntriesFromResourceFileL(TUint aDriveId)
	{
	// Read initial entries from resources
	TResourceReader reader;
	reader.SetBuffer(iBuf);	
	const TInt numberOfEntries = reader.ReadInt16();
	
	for (TInt index=0; index < numberOfEntries; ++index)
		{
		TMsvEntry newEntry;
				
		// Values from resource file
		newEntry.iId = MaskTMsvId(aDriveId, reader.ReadInt32());
		newEntry.iParentId = reader.ReadInt32();
		newEntry.iServiceId = reader.ReadInt32();
		newEntry.iType.iUid = reader.ReadInt32();
		newEntry.iMtm.iUid = reader.ReadInt32();
		newEntry.iData = reader.ReadInt32();
		newEntry.iDescription.Set(reader.ReadTPtrC());
		newEntry.iDetails.Set(reader.ReadTPtrC());
		newEntry.iDate.UniversalTime();
		newEntry.iSize=0;

		// Create the new entry.
		// This is required to create associated service directory.
		User::LeaveIfError(iServer.AddEntry(this, newEntry, KMsvServerId, EFalse));
		}
	}
Example #12
0
/**
   @SYMTestCaseID T-RApaLsSessionTestStep-TestServiceDiscovery8L
  
   @SYMPREQ 538
  
   @SYMTestCaseDesc Test for the functionality of GetAppServiceOpaqueDataLC, particularly in the case 
   where an app offers two services with the same uid but different opaque data
   
   @SYMTestPriority 
  
   @SYMTestStatus Implemented
   
   @SYMTestActions Call GetAppServiceOpaqueDataLC with two parameters: an app uid and a service uid
   on z: drive.\n
   API Calls:\n	
   RApaLsSession::GetAppServiceOpaqueDataLC(TUid aAppUid, TUid aServiceUid) const
   
   @SYMTestExpectedResults Returns an array of TApaAppServiceInfo objects. Each TApaAppServiceInfo object 
   contains the same service uid but different opaque data. The returned data should be the same as that 
   defined in the registration files.
    
 */
void CT_ServicesTestStep::TestServiceDiscovery8L()
	{
	INFO_PRINTF1(_L("TestServiceDiscovery8 about to start..."));
	const TUid KUidServerApp = {0x10004c56};
	const TUid KUidService = {0x05060708};	
	CApaAppServiceInfoArray* array = iApaLsSession.GetAppServiceOpaqueDataLC(KUidServerApp, KUidService);
	TArray<TApaAppServiceInfo> implArray(array->Array());
	TInt count = implArray.Count();
	_LIT(KFirstService,"Non-localised resource A");
	_LIT(KSecondService,"Non-localised resource B");
	TPtrC8 opaqueData;
	TResourceReader reader;
	TPtrC16 theText;
		if(count>0)
		{
		TEST(count==2);
		
		TEST(implArray[0].Uid()==KUidService);
		opaqueData.Set(implArray[0].OpaqueData());
		reader.SetBuffer(&opaqueData); // opaqueData is an LTEXT resource
		theText.Set(reader.ReadTPtrC16());
		TInt val(0);
		User::LeaveIfError(val=theText.Compare(KSecondService));
		TEST(val==KErrNone);
		TEST(implArray[1].Uid()==KUidService);
		opaqueData.Set(implArray[1].OpaqueData());
		reader.SetBuffer(&opaqueData); // opaqueData is an LTEXT resource
		theText.Set(reader.ReadTPtrC16());
		User::LeaveIfError(val=theText.Compare(KFirstService));
		TEST(val==KErrNone);	
		}
	
	CleanupStack::PopAndDestroy(array);
	array = NULL;
	}
void CDPOFPrintingDevice::ShowConfirmationQueryL() 
    {
    LOG("CDPOFPrintingDevice::ShowConfirmationQueryL begin");
  	
  	RFs fs;
	User::LeaveIfError( fs.Connect() );
	CleanupClosePushL( fs );
	TFileName resourceFileName;
	resourceFileName.Append ( KDC_RESOURCE_FILES_DIR );
	resourceFileName.Append ( KResourceFileName );
	BaflUtils::NearestLanguageFile( fs, resourceFileName );
	RResourceFile resFile;
	resFile.OpenL( fs, resourceFileName );
	CleanupClosePushL( resFile );
	HBufC8 *resBuffer = resFile.AllocReadLC( R_QTN_PRINT_DPOF_CONFIRMATION_DIALOG );
	TResourceReader reader;
	reader.SetBuffer( resBuffer );
	TPtrC ptrQuestion = reader.ReadTPtrC();
	iQuestion = ptrQuestion.AllocL();
	CleanupStack::PopAndDestroy( 3 ); // resBuffer, resFile, fs

	iPQ = CAknGlobalConfirmationQuery::NewL();
    
    iConfirmationQuery = CConfirmationQuery::NewL( *this );
    
    iConfirmationQuery->StartWaitingAnswer( );        
    
    iPQ->ShowConfirmationQueryL( iConfirmationQuery->iStatus, *iQuestion, R_AVKON_SOFTKEYS_YES_NO );

    LOG("CDPOFPrintingDevice::ShowConfirmationQueryL end");
    }
void CNSmlDSSettings::CreateHiddenProfilesL()
	{
	TFileName fileName;
	Dll::FileName( fileName );
	TParse parse;

	parse.Set( KNSmlDSProfilesRsc, &fileName, NULL );
	fileName = parse.FullName();

	RResourceFile resourceFile; 
	BaflUtils::NearestLanguageFile( iFsSession, fileName );

	TRAPD(leavecode,resourceFile.OpenL( iFsSession,fileName));
	if(leavecode != 0)
		{
		return;
		}
	CleanupClosePushL(resourceFile);
	
	HBufC8* profileRes = resourceFile.AllocReadLC( NSML_DS_PROFILES );
	TResourceReader reader;
	reader.SetBuffer( profileRes );

	CNSmlDSResourceProfiles* profileResReader = CNSmlDSResourceProfiles::NewLC( reader, this );
	profileResReader->SaveProfilesL(iResourceProfileArray);
	CleanupStack::PopAndDestroy(3); // profileResReader, profileRes, resourceFile
	}
EXPORT_C void CTestUtils::ReadResourceStringL(RResourceFile& aResFile, TInt aId, TDes& rString)
	{
	HBufC8* buf = aResFile.AllocReadLC(aId);
	TResourceReader reader;
	reader.SetBuffer(buf);
	rString.Copy(reader.ReadTPtrC());
	CleanupStack::PopAndDestroy(buf);
	}
// -----------------------------------------------------------------------------
// CTestSDKCFD::TestEHKEYConstructFromResourceL
// -----------------------------------------------------------------------------
//
TInt CTestSDKEIKHKEYT::TestEHKEYConstructFromResourceL( CStifItemParser& /*aItem*/ )
    {
    CEikHotKeyTable* hotkeytableptr = new( ELeave ) CEikHotKeyTable;
    CleanupStack::PushL( hotkeytableptr );
    
    hotkeytableptr->ConstructFromResourceL( R_TEST_HOTKEYS );
    
    TResourceReader reader;
    CCoeEnv::Static()->CreateResourceReaderLC(reader,R_TEST_HOTKEYS);
    
    TInt numberPlain( KZero );
    numberPlain = reader.ReadInt16();
    if( numberPlain )
        {
        const SEikHotKey* ptr=(const SEikHotKey*)reader.Ptr();
        reader.Advance(numberPlain*sizeof(SEikHotKey));
        TBool flag(EFalse);
        TInt keycode( KZero );
        TInt commandId( KZero );
        TInt modifires( KZero );
        commandId = ptr->iCommandId;
        flag = hotkeytableptr->HotKeyFromCommandId( commandId, keycode, modifires );
        STIF_ASSERT_TRUE( flag );
        }
    
    TInt numberCtrl( KZero );
    numberCtrl = reader.ReadInt16();
    if( numberCtrl )
        {
        const SEikHotKey* ptr=(const SEikHotKey*)reader.Ptr();
        reader.Advance(numberCtrl*sizeof(SEikHotKey));
        TBool flag(EFalse);
        TInt keycode( KZero );
        TInt commandId( KZero );
        TInt modifires(EModifierCtrl);
        commandId = ptr->iCommandId;
        flag = hotkeytableptr->HotKeyFromCommandId( commandId, keycode, modifires );
        STIF_ASSERT_TRUE( flag );
        }
    
    TInt numberShiftCtrl( KZero );
    numberShiftCtrl = reader.ReadInt16();
    if( numberShiftCtrl )
        {
        const SEikHotKey* ptr=(const SEikHotKey*)reader.Ptr();
        reader.Advance(numberShiftCtrl*sizeof(SEikHotKey));
        TBool flag(EFalse);
        TInt keycode( KZero );
        TInt commandId( KZero );
        TInt modifires(EModifierShift|EModifierCtrl);
        commandId = ptr->iCommandId;
        flag = hotkeytableptr->HotKeyFromCommandId( commandId, keycode, modifires );
        STIF_ASSERT_TRUE( flag );
        }
    
    CleanupStack::PopAndDestroy( KTwo );//reader, hotkeytableptr
    return KErrNone;
    }
// ----------------------------------------------------------------------------
// Get a heap descriptor from the resource file
// ----------------------------------------------------------------------------
//
EXPORT_C HBufC* CMPXResource::ReadHBufCL(TInt aResourceId)
    {
    //MPX_DEBUG1("CMPXResource::ReadHBufCL");
    HBufC8* readBuffer = iResourceFile.AllocReadLC(aResourceId);
    TResourceReader resReader;
    resReader.SetBuffer(readBuffer);
    //resource type has to be LBUF
    HBufC* hbuf = resReader.ReadHBufCL();
    CleanupStack::PopAndDestroy(readBuffer);
    return hbuf;
    }
CCapabilityArray* CDPOFPrintingDevice::LoadCapabilityL(RResourceFile& aResFile, TInt aCapID)
	{
	LOG1("CDPOFPrintingDevice::LoadCapabilityL begins with capID: %d", aCapID);
	HBufC8* res = aResFile.AllocReadLC(aCapID);
	TResourceReader theReader;
	theReader.SetBuffer( res );
	CCapabilityArray *capabilities = CCapabilityArray::NewL( theReader );
	CleanupStack::PopAndDestroy(); // res
	LOG("CDPOFPrintingDevice::LoadCapabilityL end");
	return capabilities;
	}
Example #19
0
LOCAL_C void CheckDefaultTemplate(CContactDatabase* aDb, RFs& aFs, TContactItemId aSystemTemplateId)
	{
	test.Next(_L("System template"));
	
    _LIT(KCntSystemTemplate,"z:\\resource\\cntmodel\\customisedcntmodel.rsc");
	
	TFileName fileName(KCntSystemTemplate);
	BaflUtils::NearestLanguageFile(aFs,fileName);
//
	RResourceFile resourceFile;
	resourceFile.OpenL(CntTest->Fs(),fileName);
	CleanupClosePushL(resourceFile);
	resourceFile.ConfirmSignatureL(4);
	TResourceReader resReader;
	resReader.SetBuffer(resourceFile.AllocReadLC(R_CNTUI_NEW_FIELD_DEFNS));
//
	CContactTemplate *testTemplate=CContactTemplate::NewLC();
	TInt count=resReader.ReadInt16(); // num fields
	while(count--)
		{
		TStorageType storageType=resReader.ReadInt32();
		TUid contactFieldUid=TUid::Uid(resReader.ReadInt32());
		TUid vCardMappingUid=TUid::Uid(resReader.ReadInt32());
//
		CContactItemField* field=CContactItemField::NewLC(storageType);
//
		field->SetMapping(vCardMappingUid);
		if (contactFieldUid!=KUidContactFieldNone)
			field->AddFieldTypeL(contactFieldUid);
//
		TInt mappingCount;
		if((mappingCount=resReader.ReadInt16())!=0)
			{
			while(mappingCount--)
				field->AddFieldTypeL(TUid::Uid(resReader.ReadInt32()));
			}
		field->SetUserFlags(resReader.ReadInt32());
		field->SetLabel(resReader.ReadHBufCL());
		TUint flags=resReader.ReadInt32();
		if (flags&EContactFieldFlagHidden)
			field->SetHidden(ETrue);
		if (flags&EContactFieldFlagReadOnly)
			field->SetReadOnly(ETrue);
		if (flags&EContactFieldFlagSynchronize)
			field->SetSynchronize(ETrue);
		if (flags&EContactFieldFlagDisabled)
			field->SetDisabled(ETrue);
//
		testTemplate->AddFieldL(*field);
		CleanupStack::Pop();
		}
	doTestTemplate(aDb,aSystemTemplateId,testTemplate,ETrue);
	CleanupStack::PopAndDestroy(3);	// testTemplate,resourceFile close, resBuffer
	}
HBufC* CHtmlToCrtConverter::ReadResourceHBufCLC(TInt aResourceId)
	{
	HBufC8* resource=iResourceFile.AllocReadLC(aResourceId);
	TResourceReader resourceReader;
	resourceReader.SetBuffer(resource);

	HBufC* resourceText=resourceReader.ReadHBufCL();
	CleanupStack::PopAndDestroy(resource);
	CleanupStack::PushL(resourceText);
	return resourceText;
	}
void CLogServDatabaseMarshall::ReadResourceFileConfigurationL(TLogConfig& aConfig) const
	{	
	TResourceReader reader;
	iResourceInterface.CreateResourceReaderLC(reader, R_LOG_INITIAL_CONFIG);
	//
	aConfig.iMaxLogSize = static_cast<TLogSize>(reader.ReadUint16());
	aConfig.iMaxRecentLogSize = static_cast<TLogRecentSize>(reader.ReadUint8());
	aConfig.iMaxEventAge = static_cast<TLogAge>(reader.ReadUint32());
	//
	CleanupStack::PopAndDestroy(); // reader	
	}
// ----------------------------------------------------------------------------
// Read array of descriptors, leave on cleanup stack
// ----------------------------------------------------------------------------
//
EXPORT_C CDesCArrayFlat* CMPXResource::ReadDesCArrayLC(TInt aResourceId)
    {
    //MPX_DEBUG1("CMPXResource::ReadDesCArrayLC");
    TResourceReader resReader;
    HBufC8* readBuffer = iResourceFile.AllocReadLC(aResourceId);
    resReader.SetBuffer(readBuffer);
    CDesCArrayFlat* descArray = resReader.ReadDesCArrayL();
    CleanupStack::PopAndDestroy(readBuffer);
    //MPX_DEBUG1("CMPXResource::ReadDesCArrayLC End");
    CleanupStack::PushL(descArray);
    return descArray;
    }
/**
 * Reads in the resource structure associated with a password confirmation (old or new)
 *
 */
EXPORT_C void CAknPasswordSettingPage::ReadConfirmationResourceL( TInt aResourceId, SAknConfirmationResource& resources )
	{
	TResourceReader reader;
	iCoeEnv->CreateResourceReaderLC( reader,aResourceId );

	resources.iEntryQueryResourceId = reader.ReadInt32();
	resources.iSuccessNoteResourceId = reader.ReadInt32();
	resources.iFailureNoteResourceId = reader.ReadInt32();

	CleanupStack::PopAndDestroy(); //reader	

	}
Example #24
0
EXPORT_C void CEikFloatingPointEditor::ConstructFromResourceL(TResourceReader& aReader)
	{
	TInt textLimit=aReader.ReadUint16();
	TReal min=aReader.ReadReal64();
	TReal max=aReader.ReadReal64();
	TReal defaultValue=aReader.ReadReal64(); // does not work with queries !!!
	ConstructL(min,max,textLimit);
    // added to give a default value, to work with forms.  Unsure if this is desirable.
	if ((min>defaultValue)||(defaultValue>max)) 
		defaultValue=min;
	SetValueL(&defaultValue);
	}
EXPORT_C HBufC* CResourceLoader::LoadLC( TInt aResourceId )
    {
    TResourceReader reader;
    HBufC8* readBuffer = CreateResourceReaderLC( reader, aResourceId );
    TPtrC textdata = reader.ReadTPtrC();
    
    HBufC16* textBuffer = HBufC16::NewL( textdata.Length() );
    *textBuffer = textdata;
    CleanupStack::PopAndDestroy( readBuffer );
    CleanupStack::PushL( textBuffer );
    return textBuffer;
    }
// -----------------------------------------------------------------------------
// CPhSrvResourceManager::ReadResourceLC
// 
// Read resource text
// -----------------------------------------------------------------------------
//
HBufC* CPhSrvResourceManager::ReadResourceLC( TUint aResourceId )
    {
    HBufC8* resourceBuffer = iResourceFile.AllocReadLC( aResourceId );

    TResourceReader reader;
    reader.SetBuffer( resourceBuffer );

    HBufC* ret = reader.ReadHBufCL();
    CleanupStack::PopAndDestroy( resourceBuffer );

    CleanupStack::PushL( ret );
    return ret;
    }
// ---------------------------------------------------------------------------
// CAknMemorySelectionDialogMultiDrive::ReadFromResourceL
// ---------------------------------------------------------------------------
//
void CAknMemorySelectionDialogMultiDrive::ReadFromResourceL( TInt aResourceId )
    {
    TResourceReader reader;
    iCoeEnv->CreateResourceReaderLC( reader, aResourceId );
    // Read title.
    AknCFDUtility::AllocateIfNullL( iTitle, reader.ReadTPtrC() );
    // Read left softkey text.
    AknCFDUtility::AllocateIfNullL( iLeftSoftkey, reader.ReadTPtrC() );
    // Read right softkey text.
    AknCFDUtility::AllocateIfNullL( iRightSoftkey, reader.ReadTPtrC() );

    CleanupStack::PopAndDestroy(); // reader
    }
Example #28
0
/**
@SYMTestCaseID          SYSLIB-BAFL-CT-0435
@SYMTestCaseDesc        Tests for TResourceReader::ReadInt16(),TResourceReader::ReadInt64() function
@SYMTestPriority        High
@SYMTestActions         Attempt for reading FLPTED resource
@SYMTestExpectedResults Tests must not fail
@SYMREQ                 REQ0000
*/
void TRsReadTester::TestFlPtEdL()
	{
	test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0435 Test reading FLPTED resource "));
    TResourceReader reader;
    CreateResourceReaderLC(reader,SYS_FLPTED_ONE);
    test(reader.ReadInt16()==18);
    TReal little=reader.ReadReal64();
    test(little==0.0);
    TReal big=reader.ReadReal64();
    test(big>9.89e99);
    test(big<9.91e99);
    CleanupStack::PopAndDestroy(1);
	}
// ---------------------------------------------------------------------------
// CAknStylusPopUpMenu::ConstructFromResourceL
// ---------------------------------------------------------------------------
//
EXPORT_C void CAknStylusPopUpMenu::ConstructFromResourceL( TResourceReader&
                                                           aReader )
    {
    TInt count = aReader.ReadInt16();
    TInt commandId;
    for ( TInt i = 0; i < count; i++ )
        {
        TPtrC text = aReader.ReadTPtrC();
        commandId = aReader.ReadInt32();
        iContent->AddMenuItemL( text, commandId );
        aReader.ReadInt32(); // extension link
        }
    }
// Populates given icon array. Icons are defined in R_GRID_ICONS resource. 
void CIconsList::SetIconArray( CArrayPtr<CGulIcon>* aIconArray ) 
{
	TResourceReader reader;

	if(iScreenValue == 0)
	{		
		CEikonEnv::Static()->CreateResourceReaderLC(reader, R_MAINSCREEN_ICONS);
	}	
	else if(iScreenValue == 1)
	{
		CEikonEnv::Static()->CreateResourceReaderLC(reader, R_MAINSUBSCREEN_CONTACTS_ICONS);
	}
	else if(iScreenValue == 2)
	{
		CEikonEnv::Static()->CreateResourceReaderLC(reader, R_MAINSUBSCREEN_PHOTOS_ICONS);
	}
	else if(iScreenValue == 3)
	{
		CEikonEnv::Static()->CreateResourceReaderLC(reader, R_MAINSUBSCREEN_VIDEOS_ICONS);
	}
	else if(iScreenValue == 4)
	{
		CEikonEnv::Static()->CreateResourceReaderLC(reader, R_MAINSUBSCREEN_SMS_ICONS);
	}
	
	TInt numIcons = reader.ReadInt16();

	for (TInt count = 0; count < numIcons; ++count)
	{
		CEikImage* image = new (ELeave) CEikImage;
		CleanupStack::PushL(image);

		//image->ConstructFromResourceL(reader);
		TBuf<128> imagename = CRippleVaultAppUi::ApplicationDriveAndPath();
		imagename.Append(KSmsMbmFileName);
		image->CreatePictureFromFileL(imagename,0,0);
		image->SetPictureOwnedExternally(ETrue);


		CGulIcon* icon = CGulIcon::NewL(const_cast<CFbsBitmap*>(image->Bitmap()), const_cast<CFbsBitmap*>(image->Mask()));
		CleanupStack::PushL(icon);

		aIconArray->AppendL(icon);

		CleanupStack::Pop(icon);
		CleanupStack::PopAndDestroy(image);
	}

	CleanupStack::PopAndDestroy(); // reader
	
}