本文整理汇总了C++中TBuf16类的典型用法代码示例。如果您正苦于以下问题:C++ TBuf16类的具体用法?C++ TBuf16怎么用?C++ TBuf16使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TBuf16类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _LIT16
/**
@SYMTestCaseID UIF-ETUL-0024
@SYMREQ DEF114388
@SYMTestCaseDesc Test of CTulAddressStringTokenizer::SearchPhoneNumberL( const TDesC& aText )
with all the phone number separators.
@SYMTestPriority Normal
@SYMTestStatus Implemented
@SYMTestActions There should be 5 phone numbers separators:
- KCharLinefeed = 0x000A
- KCharFormfeed = 0x000C
- KCharCarriageReturn = 0x000D
- KCharLineSeparator = 0x2028
- KCharParagraphSeparator = 0x2029
With a simple string _LIT16(KTestPhoneSeparator, "11111%c22222")
and with all the separators above, we apply the tested function:
CTulAddressStringTokenizer::SearchPhoneNumberL( const TDesC& aText )
@SYMTestExpectedResults On the 5 cases, the function should find 2 phone numbers
i.e: multiSearch->ItemCount() should be equal to 2
otherwise the test fail.
*/
void CT_AddressStringTokenizerStep::TestPhoneSearchSeparatorsL()
{
TInt KCharLinefeed = 0x000A;
TInt KCharFormfeed = 0x000C;
TInt KCharCarriageReturn = 0x000D;
TInt KCharLineSeparator = 0x2028;
TInt KCharParagraphSeparator = 0x2029;
TInt KSeparators[5]={KCharLinefeed,KCharFormfeed,KCharCarriageReturn,KCharLineSeparator,KCharParagraphSeparator};
_LIT16(KTestPhoneSeparator, "11111%c22222");
TBool succeed=ETrue;
TBuf16<16> str;
for (TInt k=0;k<5;k++)
{
str.Format(KTestPhoneSeparator,KSeparators[k]);
CTulAddressStringTokenizer* multiSearch = CTulAddressStringTokenizer::NewL(str,
CTulAddressStringTokenizer::EFindItemSearchPhoneNumberBin);
if (multiSearch->ItemCount()!=2)
{
succeed=EFalse;
}
delete multiSearch;
if (succeed==EFalse)
{
break;
}
}
TEST(succeed);
}
示例2: _LIT
//Create an URI
void CExampleInetProtUtil::CreateUriL()
{
//Set the physical path of the file
_LIT(KText1, "\n\n\nThe Physical location of the file is....");
iConsole->Printf ( KText1 );
_LIT(KFullUriName, "K:\\ws\\direct\\direct.mmp");
//display it
TBuf<40> desFullUriName(KFullUriName);
iConsole->Printf ( KLeaveALine );
iConsole->Printf ( KFullUriName );
//create the Uri for the path
CUri8* uri8 = CUri8::CreateFileUriL(desFullUriName);
const TDesC8& desUriDisplay = uri8->Uri().UriDes();
TBuf16<100> desCreateUri;
desCreateUri.Copy (desUriDisplay);
//display it
_LIT(KText2, "And its Uri is....");
iConsole->Printf ( KLeaveALine );
iConsole->Printf ( KText2 );
iConsole->Printf ( KLeaveALine );
iConsole->Printf ( desCreateUri );
delete uri8;
iConsole->Getch ();
}
示例3: _LIT
void CMemoryUsageLogger::WriteMaxHeapToLog()
{
_LIT(KLogMaxHeapFormat, "%d, %d");
//connect to file iLogger
TInt err = iLogger.Connect();
if (KErrNone == err)
{
//create new log file name out of existing
TInt pos = iFileName.LocateReverse(TChar('.'));
if (KErrNotFound != pos)
{
iFileName.Insert(pos, _L("_max_ram"));
//create log file
iLogger.CreateLog(KLbsDevLogFolder, iFileName, EFileLoggingModeOverwrite);
//write header to log file
iLogger.SetDateAndTime(EFalse, EFalse);
//create log text and write to log file
TBuf16<KLbsDevLogMaxBufSize> logData;
logData.Format(KLogMaxHeapFormat, iMaxHeapTotal, iMaxChunkTotal);
iLogger.Write(logData);
iLogger.Write(KNullDesC8);
}
iLogger.Close();
}
}
示例4: INFO_PRINTF1
/**
@SYMTestCaseID SYSLIB-CHARCONV-CT-0536
@SYMTestCaseDesc Splitting and converting from Unicode to EucJpPacked test
@SYMTestPriority Medium
@SYMTestActions Tests for conversion after splitting, from Unicode to EucJpPacked and back to Unicode
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ0000
*/
void CT_EUCJP_PACKED_2::TestSplittingConvertingFromUnicodeToEucJpPacked(CCnvCharacterSetConverter& aCharacterSetConverter, TInt aMaximumLengthLowerLimit, TInt aMaximumLengthUpperLimit, TInt aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit, TInt aExpectedLengthOfFirstPartOfEucJpPacked, const TDesC8& aExpectedEucJpPacked, const TDesC16& aOriginalUnicode)
{
INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0536 "));
test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
test(aMaximumLengthUpperLimit<=KBufferLength);
TUint8 eucJpPackedBuffer[KBufferLength];
for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
{
TPtr8 generatedFirstPartOfEucJpPacked(eucJpPackedBuffer, i);
test(aCharacterSetConverter.ConvertFromUnicode(generatedFirstPartOfEucJpPacked, aOriginalUnicode)==aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit);
test(generatedFirstPartOfEucJpPacked==aExpectedEucJpPacked.Left(aExpectedLengthOfFirstPartOfEucJpPacked));
TBuf8<KBufferLength> generatedSecondPartOfEucJpPacked;
test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfEucJpPacked, aOriginalUnicode.Right(aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit))==0);
test(generatedSecondPartOfEucJpPacked==aExpectedEucJpPacked.Mid(aExpectedLengthOfFirstPartOfEucJpPacked));
TInt state=CCnvCharacterSetConverter::KStateDefault;
TBuf16<KBufferLength> generatedUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedUnicode, generatedFirstPartOfEucJpPacked, state)==0);
test(state==CCnvCharacterSetConverter::KStateDefault);
TBuf16<KBufferLength> generatedSecondPartOfUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, generatedSecondPartOfEucJpPacked, state)==0);
test(state==CCnvCharacterSetConverter::KStateDefault);
generatedUnicode.Append(generatedSecondPartOfUnicode);
test(generatedUnicode==aOriginalUnicode);
}
}
示例5: SetDefaultNetTypeAndAddrType
// ---------------------------------------------------------------------------
// SdpUtil::SetDefaultNetTypeAndAddrType
// Sets network type and address type to their "default" values
// ---------------------------------------------------------------------------
//
void SdpUtil::SetDefaultNetTypeAndAddrType(
RStringPool aPool,
const TInetAddr& aAddress,
RStringF& aNetType,
RStringF& aAddressType )
{
// Sets network type to IN
aNetType.Close();
aNetType = aPool.StringF( SdpCodecStringConstants::ENetType,
SdpCodecStringConstants::Table ).Copy();
// Address type
aAddressType.Close();
TBuf16 <KMaxAddressLength> output;
aAddress.Output(output);
//addresstype for IPv4
if((aAddress.Address() && !aAddress.IsV4Mapped()) ||
(!aAddress.Address() && aAddress.IsWildAddr() &&
output.Match(KWildAddr) == 0))
{
aAddressType = aPool.StringF( SdpCodecStringConstants::EAddressTypeIP4,
SdpCodecStringConstants::Table ).Copy();
}
else
{
//addresstype for IPv4-Mapped IPv6 && IPv6
aAddressType = aPool.StringF( SdpCodecStringConstants::EAddressType,
SdpCodecStringConstants::Table ).Copy();
}
}
示例6: CleanupClosePushL
HBufC* CPluginUtils::ConvertUtfToUnicodeL( const TDesC8& aUtf7 )
{
RBuf output;
CleanupClosePushL( output );
TBuf16<20> outputBuffer;
TPtrC8 remainderOfUtf7( aUtf7 );
for(;;)
{
const TInt returnValue = CnvUtfConverter::ConvertToUnicodeFromUtf8(outputBuffer, remainderOfUtf7);
if (returnValue==CnvUtfConverter::EErrorIllFormedInput)
return NULL;
else if (returnValue<0)
return NULL;
output.ReAllocL( output.Length() + outputBuffer.Length() );
output.Append( outputBuffer );
if (returnValue == 0)
break;
remainderOfUtf7.Set(remainderOfUtf7.Right(returnValue));
}
HBufC* ret = output.AllocL();
CleanupStack::PopAndDestroy( &output );
return ret;
}
示例7: INFO_PRINTF1
void CT_ISO2022JP1_2::TestSplittingConvertingFromUnicodeToIso2022Jp(
CCnvCharacterSetConverter& aCharacterSetConverter,
TInt aMaximumLengthLowerLimit,
TInt aMaximumLengthUpperLimit,
TInt aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit,
const TDesC8& aExpectedFirstPartOfIso2022Jp,
const TDesC8& aExpectedSecondPartOfIso2022Jp,
const TDesC16& aOriginalUnicode)
{
INFO_PRINTF1(_L(" TestTruncatedConversionFromUnicodeToIso2022Jp "));
test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
test(aMaximumLengthUpperLimit<=KBufferLength);
TUint8 iso2022JpBuffer[KBufferLength];
for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
{
TPtr8 generatedFirstPartOfIso2022Jp(iso2022JpBuffer, i);
test(aCharacterSetConverter.ConvertFromUnicode(generatedFirstPartOfIso2022Jp, aOriginalUnicode)==aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit);
test(generatedFirstPartOfIso2022Jp==aExpectedFirstPartOfIso2022Jp);
TBuf8<KBufferLength> generatedSecondPartOfIso2022Jp;
test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfIso2022Jp, aOriginalUnicode.Right(aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit))==0);
test(generatedSecondPartOfIso2022Jp==aExpectedSecondPartOfIso2022Jp);
TInt state=CCnvCharacterSetConverter::KStateDefault;
TBuf16<KBufferLength> generatedUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedUnicode, generatedFirstPartOfIso2022Jp, state)==0);
TBuf16<KBufferLength> generatedSecondPartOfUnicode;
test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, generatedSecondPartOfIso2022Jp, state)==0);
generatedUnicode.Append(generatedSecondPartOfUnicode);
test(generatedUnicode==aOriginalUnicode);
}
}
示例8: roadmap_internet_open_browser
void roadmap_internet_open_browser (char *url) {
RApaLsSession apaLsSession;
const TUid KOSSBrowserUidValue = {0x10008D39}; // 0x1020724D for S60 3rd Ed
TUid id(KOSSBrowserUidValue);
TApaTaskList taskList(CEikonEnv::Static()->WsSession());
TApaTask task = taskList.FindApp(id);
if(task.Exists())
{
task.BringToForeground();
task.SendMessage(TUid::Uid(0), TPtrC8((TUint8 *)url,strlen(url))); // UID not used
}
else
{
if(!apaLsSession.Handle())
{
User::LeaveIfError(apaLsSession.Connect());
}
TThreadId thread;
TBuf16<128> buf;
buf.Copy(TPtrC8((TUint8 *)url,strlen(url)));
User::LeaveIfError(apaLsSession.StartDocument(buf, KOSSBrowserUidValue, thread));
apaLsSession.Close();
}
}
示例9: _LIT
TInt CSEIConnector::RunError(TInt aError)
{
//TODO: see how to handle this
_LIT(KErrorPattern, "@CSEIConnector::RunError: %d");
TBuf16<128> buf;
buf.Format(KErrorPattern, aError);
iDriver->Log(buf);
return KErrNone;
}
示例10: remParty
void CPhoneCallMonitor::RunL()
{
CTelephony::TCallStatus status = iCallStatus.iStatus;
// use callback function to tell owner that call status has changed
//iCallBack.NotifyChangeInCallStatusL(status,errVal);
if(iStatus.Int() == KErrNone)
{
if(status == CTelephony::EStatusConnected)
{
CTelephony::TRemotePartyInfoV1 remInfoUse;
CTelephony::TCallInfoV1 callInfoUse;
CTelephony::TCallSelectionV1 callSelectionUse;
// we are interested only voice lines
callSelectionUse.iLine = CTelephony::EVoiceLine;
// and calls that are currently connected
callSelectionUse.iSelect = CTelephony::EActiveCall; //EHeldCall, EInProgressCall
CTelephony::TRemotePartyInfoV1Pckg remParty(remInfoUse);
CTelephony::TCallInfoV1Pckg callInfo(callInfoUse);
CTelephony::TCallSelectionV1Pckg callSelection(callSelectionUse);
// Some S60 devices have a bug that requires some delay in here
// othervise the telephone application gets "Out of Memory" error
User::After(100000);
if(KErrNone == iTelephony->GetCallInfo(callSelection,callInfo,remParty))
{
if(remInfoUse.iDirection == CTelephony::EMobileOriginated) //outgoign call
{
iCallBack.NotifyConnectedCallStatusL(callInfoUse.iDialledParty.iTelNumber);
}
else //incoming call
{
// if the call is mobile terminated then the remote party is the calling party.
// TCallRemoteIdentityStatus::ERemoteIdentityUnknown, ERemoteIdentityAvailable, ERemoteIdentitySuppressed
if(remInfoUse.iRemoteIdStatus == CTelephony::ERemoteIdentityAvailable)
{
iCallBack.NotifyConnectedCallStatusL(remInfoUse.iRemoteNumber.iTelNumber);
}
else // private number
{
TBuf16<1> privNum;
privNum.Zero();
iCallBack.NotifyConnectedCallStatusL(privNum);
}
}
}
}
if(status == CTelephony::EStatusIdle)
{
iCallBack.NotifyDisconnectedCallStatusL();
}
//iPreviousStatus = status;
}
StartListeningForEvents();
}
示例11: ResetPrintLine
void CTextWindow::Draw()
//This function is virtual and so cannot have an 'L' at the end of it's name
{
iGc->Clear();
ResetPrintLine();
switch(iDrawMode)
{
case EDrawModeWordJust:
User::LeaveIfError(Client()->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)iTmpFont, TFontSpec(KTestFontTypefaceName,200)));
iGc->UseFont(iTmpFont);
DrawWordJustified(_L("Hello World"));
DrawWordJustified(_L("One Two Three Four Five Six Seven"));
DrawWordJustified(_L("AA B CC D"));
DrawWordJustified(_L("ONEWORD"));
iGc->DiscardFont();
Client()->iScreen->ReleaseFont(iTmpFont);
iTmpFont=NULL;
break;
case EDrawModeCharJust:
User::LeaveIfError(Client()->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)iTmpFont, TFontSpec(KTestFontTypefaceName,200)));
iGc->UseFont(iTmpFont);
DrawCharJustified(_L("Hello World"));
DrawCharJustified(_L("One Two Three Four Five Six Seven"));
DrawCharJustified(_L("AA B CC D"));
DrawCharJustified(_L("ONEWORD"));
iGc->DiscardFont();
Client()->iScreen->ReleaseFont(iTmpFont);
iTmpFont=NULL;
break;
case EDrawModeFonts:
{
TTypefaceSupport typefaceSupport;
Client()->iScreen->TypefaceSupport(typefaceSupport,iTypeFaceIndex);
TBuf<0x40> title;
TBuf16<KMaxTypefaceNameLength> tmpBuf;
tmpBuf.Copy(typefaceSupport.iTypeface.iName);
title.Append(tmpBuf);
title.AppendFormat(TRefByValue<const TDesC>(_L(", Heights (Min=%d, Max=%d, Num=%d)")),typefaceSupport.iMinHeightInTwips,typefaceSupport.iMaxHeightInTwips,typefaceSupport.iNumHeights);
PrintLine(iFont,title);
PrintDivider();
for (TInt tfHeight=0;tfHeight<typefaceSupport.iNumHeights;tfHeight++)
{
TFontSpec fspec(typefaceSupport.iTypeface.iName,Client()->iScreen->FontHeightInTwips(iTypeFaceIndex,tfHeight));
PrintStylesL(_L("Normal, "), fspec, TFontStyle());
PrintStylesL(_L("Bold, "), fspec, TFontStyle(EPostureUpright,EStrokeWeightBold,EPrintPosNormal));
PrintStylesL(_L("Italic, "), fspec, TFontStyle(EPostureItalic,EStrokeWeightNormal,EPrintPosNormal));
PrintStylesL(_L("Bold/italic, "), fspec, TFontStyle(EPostureItalic,EStrokeWeightBold,EPrintPosNormal));
if (iYpos>Size().iHeight)
break;
}
}
break;
}
}
示例12: VA_START
EXPORT_C void TcLog::WriteFormat( TRefByValue< const TDesC16 > aFormat, ... )
{
VA_LIST list;
VA_START( list, aFormat );
TBuf16< KTcBufferSize > buf;
TTcDes16Overflow handler;
buf.AppendFormatList( aFormat, list, &handler );
Write( buf );
}
示例13: SetTestPath
TVerdict CSysUtilsGetLangSWVersionNoNewLinesStep::doTestStepL()
{
TInt err = SetTestPath(ETrue);
if( err != KErrNone )
{
ERR_PRINTF2(_L("Could not turn test path on. Error = %d"), err);
SetTestStepResult(EAbort);
return TestStepResult();
}
INFO_PRINTF1(_L("Test path turned on."));
err = DeletePSProperties();
if( err != KErrNone )
{
ERR_PRINTF2(_L("Could not delete P&S properties. Error = %d"), err);
SetTestStepResult(EAbort);
return TestStepResult();
}
INFO_PRINTF1(_L("Deleted P&S properties successfully."));
_LIT16(KDummy,"xxxxx");
TBuf16<KSysUtilVersionTextLength> version;
version.Insert(0,KDummy);
err = SysUtil::GetLangSWVersion( version );
if ( err == KErrNone)
{
_LIT(KLangSw, "LangSW");
TPtrC16 line;
TESTL( GetStringFromConfig(ConfigSection(), KLangSw, line) );
TBuf16<KSysUtilVersionTextLength> testBuf(line);
if (version.Compare(testBuf)==0)
{
INFO_PRINTF1(_L("Got version "));
INFO_PRINTF1(version);
}
else
{
ERR_PRINTF1(_L("Version not correct"));
INFO_PRINTF1(version);
SetTestStepResult(EFail);
}
}
else
{
ERR_PRINTF2(_L("Error code = %d"), err);
SetTestStepResult(EFail);
}
return TestStepResult();
}
示例14: processUid
void CMemoryUsageLogger::WriteToLog()
{
//seconds passed since start of application
TTime currentTime;
TTimeIntervalSeconds seconds;
currentTime.UniversalTime();
currentTime.SecondsFrom(iStartTime, seconds);
if (seconds.Int() <= 60)
{
TInt heapTotal = 0;
TInt heapAvail = 0;
TInt chunkTotal = 0;
TInt chunkAvail = 0;
TInt cellsTotal = 0;
TInt cellsAvail = 0;
TInt heapStackTotal = 0;
TInt ramTotal = 0;
TInt ramAvail = 0;
//get system memory info from hardware abstraction layer
HAL::Get(HAL::EMemoryRAM, ramTotal);
HAL::Get(HAL::EMemoryRAMFree, ramAvail);
//get process UID
TSecureId processUid(iProcess.SecureId());
//get various heap and chunk memory sizes
iHeap.AllocSize(heapTotal);
if (heapTotal > iMaxHeapTotal)
{
iMaxHeapTotal = heapTotal;
}
iHeap.Available(heapAvail);
chunkTotal = iHeap.Size();
chunkAvail = chunkTotal - heapTotal;
if (chunkTotal > iMaxChunkTotal)
{
iMaxChunkTotal = chunkTotal;
}
//get cells info
cellsTotal = iHeap.Count(cellsAvail);
//sum up the total heap and stack sizes
heapStackTotal = heapTotal + iStackSize;
//create log text and write to log file
TBuf16<KLbsDevLogMaxBufSize> logData;
logData.Format(KLogFormat, seconds.Int(), processUid.iId, iStackSize, heapTotal, heapAvail, chunkTotal, chunkAvail, cellsTotal, cellsAvail, heapStackTotal, ramTotal, ramAvail);
iLogger.Write(logData);
}
}
示例15: DeleteAll
/** Delete content of directory
@param aDir Target directory
@return Error returned if any, otherwise KErrNone
*/
TInt DeleteAll(TDes16& aDir)
{
TBuf16<100> dir;
CFileMan* fMan=CFileMan::NewL(TheFs);
TInt r=0;
dir = aDir;
dir.Append(_L("F*.*"));
r = fMan->Delete(dir);
delete fMan;
return r;
}