本文整理汇总了C++中TResourceReader类的典型用法代码示例。如果您正苦于以下问题:C++ TResourceReader类的具体用法?C++ TResourceReader怎么用?C++ TResourceReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TResourceReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CleanupClosePushL
// ---------------------------------------------------------
// 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
}
}
示例2: ConstructFromResourceL
// -----------------------------------------------------------------------------
// 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);
}
}
}
示例3: GetSystemCharsetFromCenRepL
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;
}
示例4: ConditionalCommandAllowedL
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;
}
示例5: INFO_PRINTF1
/**
* @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;
}
示例6: ConstructFromResourceL
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();
}
示例7: GetSystemDrivesL
// ---------------------------------------------------------------------------
// 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();
}
示例8: __ASSERT_DEBUG
/**
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);
}
示例9: ReadFromResource
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();
}
示例10: ConstructFromResourceL
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;
}
示例11: CreateStandardEntriesFromResourceFileL
/**
* 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));
}
}
示例12: LOG
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");
}
示例13: TRAPD
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
}
示例14: ReadResourceStringL
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);
}
示例15: new
// -----------------------------------------------------------------------------
// 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;
}