本文整理汇总了C++中TResourceReader::ReadHBufCL方法的典型用法代码示例。如果您正苦于以下问题:C++ TResourceReader::ReadHBufCL方法的具体用法?C++ TResourceReader::ReadHBufCL怎么用?C++ TResourceReader::ReadHBufCL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TResourceReader
的用法示例。
在下文中一共展示了TResourceReader::ReadHBufCL方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadResourceHBufCLC
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;
}
示例2: ReadHBufCL
// ----------------------------------------------------------------------------
// 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;
}
示例3: ReadResourceLC
// -----------------------------------------------------------------------------
// 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;
}
示例4: ConstructL
// ----------------------------------------------------
// CAlfExCalendarEngine::ConstructL
// ----------------------------------------------------
void CAlfExCalendarEngine::ConstructL()
{
TReal randomNumber;
TInt randomNumberInt;
TInt64 seed=0;
CDesCArrayFlat* array = new(ELeave) CDesCArrayFlat(KAlfExCalendarEngineArrayGranularity);
CleanupStack::PushL( array );
CEikonEnv* coeEnv = CEikonEnv::Static();
TResourceReader reader;
coeEnv->CreateResourceReaderLC(reader, R_ALFEXCALENDAR_CALENDAR_EVENTS_ARRAY);
const TInt count = reader.ReadInt16();
for(TInt loop = 0; loop < count; loop++)
{
HBufC* txt = reader.ReadHBufCL();
CleanupStack::PushL(txt);
array->AppendL(*txt);
CleanupStack::PopAndDestroy(txt);
}
CleanupStack::PopAndDestroy(); //reader2
TAlfExCalendarEngineListItem event;
event.iItemDay.HomeTime();
seed = event.iItemDay.Int64();
randomNumber = count * Math::FRand(seed);
randomNumberInt = (TInt) randomNumber;
TTimeIntervalDays days(KAlfExCalendarEngineDayTenDays);
event.iItemDay -= days; // lets start 10 days before present
for(TInt i=0; i<KAlfExCalendarEngineDayRandomizeLoopCount; i++)
{
for(TInt loop = 0; loop < count; loop++)
{
randomNumber = Math::FRand(seed);
if(randomNumber < KAlfExCalendarEngineChangeDay)
{
randomNumber *= KAlfExCalendarEngineDayRandomize;
randomNumberInt = (TInt) randomNumber;
days = TTimeIntervalDays(randomNumberInt);
event.iItemDay += days;
}
event.iItemText.Copy((*array)[loop]);
iCalendarEventArray.AppendL(event);
}
}
CleanupStack::PopAndDestroy(array);
}
示例5: TestButtonL
/**
@SYMTestCaseID SYSLIB-BAFL-CT-0433
@SYMTestCaseDesc Tests for TResourceReader::ReadInt16(),TResourceReader::ReadUint16() functions
@SYMTestPriority Medium
@SYMTestActions Attempt to read a BUTTON resource
@SYMTestExpectedResults Tests must not fail
@SYMREQ REQ0000
*/
void TRsReadTester::TestButtonL()
{
test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0433 Test reading BUTTON resource "));
TResourceReader reader;
CreateResourceReaderLC(reader,SYS_BUTTON_ONE);
test(reader.ReadInt16()==3);
test(reader.ReadUint16()==5);
TPtrC ptr=reader.ReadTPtrC();
test(ptr==_L("Text"));
ptr.Set(reader.ReadTPtrC());
test(ptr.Length()==0);
HBufC* hBuf=reader.ReadHBufCL();
test(*hBuf==_L("Bitmap placeholder"));
delete(hBuf);
CleanupStack::PopAndDestroy();
}
示例6: ReadListInfoFromResourceL
// -----------------------------------------------------------------------------
// CPIMLocalizationData::ReadListInfoFromResourceL
// -----------------------------------------------------------------------------
//
void CPIMLocalizationData::ReadListInfoFromResourceL(
RResourceFile& aResourceFile,
TResourceReader& aReader)
{
TInt32 listNameLabelId(aReader.ReadInt32());
TInt32 fieldsId(aReader.ReadInt32());
TInt32 attrsId(aReader.ReadInt32());
// Read label from resource
aReader.SetBuffer(aResourceFile.AllocReadLC(listNameLabelId));
iListName = aReader.ReadHBufCL();
// Resource buffer is not needed anymore
CleanupStack::PopAndDestroy(); // AllocReadLC()
// Read fields from resource. Fields must be specified in the resource
// file since empty lists are not allowed.
aReader.SetBuffer(aResourceFile.AllocReadLC(fieldsId));
TInt count(aReader.ReadInt16());
for (TInt i(0); i < count; i++)
{
CPIMLabelProvider* provider = CPIMLabelProvider::NewLC(aReader);
iFields.AppendL(provider);
CleanupStack::Pop(provider);
}
// Resource buffer is not needed anymore
CleanupStack::PopAndDestroy(); // AllocReadLC()
// Read attributes from resource. Do nothing if attributes not specified
if (attrsId != 0)
{
// Create buffer to the attributes lists
aReader.SetBuffer(aResourceFile.AllocReadLC(attrsId));
count = aReader.ReadInt16();
for (TInt i(0); i < count; i++)
{
CPIMLabelProvider* provider = CPIMLabelProvider::NewLC(aReader);
iAttributes.AppendL(provider);
CleanupStack::Pop(provider);
}
// Resource buffer is not needed anymore
CleanupStack::PopAndDestroy(); // AllocReadLC()
}
}
示例7: ReadHBufCL
// -----------------------------------------------------------------------------
// WPAdapterUtil::ReadHBufCL
// -----------------------------------------------------------------------------
//
EXPORT_C HBufC* WPAdapterUtil::ReadHBufCL( const TDesC& aDllPath,
const TDesC& aAdapterName,
TInt aResourceId )
{
// Open a file server session
RFs fs;
User::LeaveIfError(fs.Connect());
CleanupClosePushL(fs);
// Open the resource file
RResourceFile resourceFile;
FindAndOpenResourceFileLC(fs, aDllPath, aAdapterName, resourceFile);
TResourceReader resReader;
resReader.SetBuffer( resourceFile.AllocReadLC( aResourceId ) );
HBufC* text = resReader.ReadHBufCL();
CleanupStack::PopAndDestroy(3); // resourceFile, fs, aResourceId
return text;
}
示例8: ReadMenuArrayLC
// ----------------------------------------------------------------------------
// Read array of menu items, leave on cleanup stack
// ----------------------------------------------------------------------------
//
EXPORT_C CDesCArrayFlat* CMPXResource::ReadMenuArrayLC(TInt aResourceId, RArray<TInt>& aIdArray)
{
//MPX_DEBUG1("CMPXResource::ReadMenuArrayLC");
TResourceReader resReader;
HBufC8* readBuffer = iResourceFile.AllocReadLC(aResourceId);
resReader.SetBuffer(readBuffer);
TInt count(resReader.ReadInt16());
CDesCArrayFlat* descArray = new (ELeave) CDesCArrayFlat(count);
for (TInt k = 0; k < count; k++)
{
aIdArray.AppendL (resReader.ReadInt32());
HBufC* hbuf = resReader.ReadHBufCL();
CleanupStack::PushL(hbuf);
descArray->AppendL (*hbuf);
CleanupStack::PopAndDestroy(hbuf);
}
CleanupStack::PopAndDestroy(readBuffer);
//MPX_DEBUG1("CMPXResource::ReadDesCArrayLC End");
CleanupStack::PushL(descArray);
return descArray;
}
示例9: ConstructFromResourceL
void CStartupProperties::ConstructFromResourceL(TResourceReader& aSource)
{
const TStartupCommandType commandType = static_cast<TStartupCommandType>(aSource.ReadUint16());
iStartupType = ((commandType==EStartupApp)||(commandType==EStartupApp2)) ? EStartApp : EStartProcess;
iFileName = aSource.ReadHBufCL();
if(iFileName)
{
TPtr writeableFilename = iFileName->Des();
writeableFilename.TrimAll();
}
iArgs = aSource.ReadHBufCL();
if(iArgs)
{
TPtr writeableArgs = iArgs->Des();
writeableArgs.TrimAll();
}
iStartMethod = static_cast<TStartMethod>(aSource.ReadUint16());
switch(commandType)
{
case EStartupApp:
delete iArgs; // deleted for backwards compatibility
iArgs = NULL;
iViewless = static_cast<TUint16>(aSource.ReadUint16());
iStartInBackground = static_cast<TUint16>(aSource.ReadUint16());
iTimeout = aSource.ReadInt32();
iRecoveryMethod.iActionOnCommandFailure = static_cast<TActionOnCommandFailure> (aSource.ReadUint16());
iNoOfRetries = static_cast<TUint16> (aSource.ReadUint16());
break;
case EStartupApp2:
iViewless = static_cast<TUint16>(aSource.ReadUint16());
iStartInBackground = static_cast<TUint16>(aSource.ReadUint16());
iTimeout = aSource.ReadInt32();
iRecoveryMethod.iRecoveryMethod = static_cast<TRecoveryMethod> (aSource.ReadUint16());
iNoOfRetries = static_cast<TUint16> (aSource.ReadUint16());
iMonitored = static_cast<TUint16>(aSource.ReadUint16());
iRestartMode = aSource.ReadInt16();
break;
case EStartupProcess:
iTimeout = aSource.ReadInt32();
iRecoveryMethod.iActionOnCommandFailure = static_cast<TActionOnCommandFailure>(aSource.ReadUint16());
iNoOfRetries = static_cast<TUint16> (aSource.ReadUint16());
break;
case EStartupProcess2:
iTimeout = aSource.ReadInt32();
iRecoveryMethod.iRecoveryMethod = static_cast<TRecoveryMethod>(aSource.ReadUint16());
iNoOfRetries = static_cast<TUint16> (aSource.ReadUint16());
iMonitored = static_cast<TUint16>(aSource.ReadUint16());
iRestartMode = aSource.ReadInt16();
break;
default:
PanicNow(KPanicStartupProperties, EInvalidCommandType);
break;
}
DoSanityCheck(commandType);
}