本文整理汇总了C++中TResourceReader::ReadTPtrC8方法的典型用法代码示例。如果您正苦于以下问题:C++ TResourceReader::ReadTPtrC8方法的具体用法?C++ TResourceReader::ReadTPtrC8怎么用?C++ TResourceReader::ReadTPtrC8使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TResourceReader
的用法示例。
在下文中一共展示了TResourceReader::ReadTPtrC8方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetSystemDefaultCharsetL
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;
}
示例2:
/**
@SYMTestCaseID SYSLIB-BAFL-CT-0437
@SYMTestCaseDesc Reading ALIGNMENT_HORROR resources test
Test for TResourceReader::ReadTPtrC8(),TResourceReader::ReadTPtrC16() function
@SYMTestPriority High
@SYMTestActions Tests for reading descriptors and checks for alignment
@SYMTestExpectedResults Tests must not fail
@SYMREQ REQ0000
*/
void TRsReadTester::TestAlignment1L()
{
test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0437 Test reading ALIGNMENT_HORROR resources "));
TPtrC8 ref8 =_L8("xyz");
TPtrC16 ref16=_L16("xyz");
TResourceReader reader;
for (TInt rr=0; horrors[rr]!=0; rr++)
{
CreateResourceReaderLC(reader,horrors[rr]);
test(reader.ReadTPtrC8() ==ref8.Left(rr));
test(reader.ReadTPtrC16()==ref16.Left(rr));
CleanupStack::PopAndDestroy(1);
}
}
示例3: CreateResourceReaderLC
/**
@SYMTestCaseID SYSLIB-BAFL-CT-0438
@SYMTestCaseDesc Reading ALIGNMENT_HORROR_ARRAY resource test
@SYMTestPriority High
@SYMTestActions Tests for reading descriptors and checks for alignment
@SYMTestExpectedResults Tests must not fail
@SYMREQ REQ0000
*/
void TRsReadTester::TestAlignment2L()
{
test.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0438 Test reading ALIGNMENT_HORROR_ARRAY resource "));
TResourceReader reader;
CreateResourceReaderLC(reader,SYS_ALIGNMENT_HORROR_ARRAY);
test(reader.ReadInt16()==7); // how many items following
TPtrC8 ref8 =_L8("abcdef");
TPtrC16 ref16=_L16("abcdef");
for (TInt ii=0; ii<=6; ii++)
{
test(reader.ReadTPtrC8() ==ref8.Left(ii));
test(reader.ReadTPtrC16()==ref16.Mid(ii));
}
CleanupStack::PopAndDestroy(1);
}