本文整理汇总了C++中HBufC16类的典型用法代码示例。如果您正苦于以下问题:C++ HBufC16类的具体用法?C++ HBufC16怎么用?C++ HBufC16使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HBufC16类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _LIT
//Encode and Decode the Uri
void CExampleInetProtUtil::EscapeEncodeDecodeL()
{
//Take an eg file to encode it and then decode it....
_LIT(KFullUriName,"K:\\ws\\direct\\direct.mmp");
TBuf<40> desFullUriName(KFullUriName);
//UTF-8 defines a mapping from sequences of octets to sequences of chars
HBufC8* convert = EscapeUtils::ConvertFromUnicodeToUtf8L(desFullUriName);
//Encode the eg Uri and display it
_LIT(KTextEncode, "\n\n\nThe Encoded Uri is....\n");
iConsole->Printf ( KTextEncode );
HBufC16* encode = EscapeUtils::EscapeEncodeL(desFullUriName,EscapeUtils::EEscapeNormal);
TPtr uriEncoded = encode->Des();
TBuf16<100> desEncodedUri;
desEncodedUri.Copy (uriEncoded);
iConsole->Printf ( _L("%S"), &desEncodedUri );
//Decode the eg Uri and display it
_LIT(KTextDecode, "\nThe Decoded Uri is....\n");
iConsole->Printf ( KTextDecode );
HBufC16* decode = EscapeUtils::EscapeDecodeL(desFullUriName);
TPtr uriDecoded = decode->Des();
TBuf16<100> desDecodedUri;
desDecodedUri.Copy (uriDecoded);
iConsole->Printf ( _L("%S"), &desDecodedUri );
delete decode;
delete encode;
delete convert;
iConsole->Getch();
iConsole->Printf ( KLeaveALine );
}
示例2: INFO_PRINTF1
TInt CT_DataRGavdp::GAVDP_SecurityControlIndication(TSEID /*aSEID*/, TDes8& aSecurityDataInOut)
{
INFO_PRINTF1(KLogInfoSecurityControlIndication);
//verify
CheckEvent(EGAVDP_SecurityControlIndication);
HBufC16* securityDataInOut = HBufC16::NewL(aSecurityDataInOut.Length());
securityDataInOut->Des().Copy(aSecurityDataInOut);
if (KLogDataFixed().Compare(*securityDataInOut)==0)
{
INFO_PRINTF1(KLogInfoSecurityDataUnchanged);
}
else if(KLogDataChange().Compare(*securityDataInOut)==0)
{
aSecurityDataInOut.Copy(KLogDataChanged());
INFO_PRINTF2(KLogInfoSecurityDataChanged, &KLogDataChanged());
}
else
{
ERR_PRINTF1(KLogErrReceivedSecurityData);
SetAsyncError(iCmdIndex, KErrGeneral);
}
delete securityDataInOut;
DecOutstanding();
return KErrNone;
}
示例3: id
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
TInt CMgAppUi::OpenMobileWEBSiteL(TAny* /*aAny*/)
{
const TInt KWmlBrowserUid = 0x10008D39;
TUid id( TUid::Uid( KWmlBrowserUid ) );
TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( id );
if ( task.Exists() )
{
HBufC8* param = HBufC8::NewLC( KMobileJukkaLink().Length() + 2);
//"4 " is to Start/Continue the browser specifying a URL
param->Des().Append(_L("4 "));
param->Des().Append(KMobileJukkaLink);
task.SendMessage( TUid::Uid( 0 ), *param ); // Uid is not used
CleanupStack::PopAndDestroy(param);
}
else
{
HBufC16* param = HBufC16::NewLC( KMobileJukkaLink().Length() + 2);
//"4 " is to Start/Continue the browser specifying a URL
param->Des().Append(_L("4 "));
param->Des().Append(KMobileJukkaLink);
RApaLsSession appArcSession;
// connect to AppArc server
User::LeaveIfError(appArcSession.Connect());
TThreadId id;
appArcSession.StartDocument( *param, TUid::Uid( KWmlBrowserUid), id );
appArcSession.Close();
CleanupStack::PopAndDestroy(param);
}
return KErrNone;
}
示例4: KAudioStream
// -----------------------------------------------------------------------------
// CMCETestUISessionViewModel::PopulateStreamsL
// Populate streams of a session
// -----------------------------------------------------------------------------
//
void CMCETestUISessionViewModel::PopulateStreamsL()
{
const RPointerArray<CMCETestUIEngineAudioStream>& audioStreams =
iSession.AudioStreamsL();
for ( TInt i = 0; i < audioStreams.Count(); ++i )
{
TInt itemLength = KAudioStream().Length() +
KLeftParenthesis().Length() +
audioStreams[i]->TextualDirection().Length() +
KRightParenthesis().Length() +
audioStreams[i]->State().Length() +
KTab().Length() * 3;
HBufC16* item = HBufC16::NewLC( itemLength );
TPtr16 itemPtr = item->Des();
itemPtr.Append( KTab );
itemPtr.Append( KAudioStream );
itemPtr.Append( KLeftParenthesis() );
itemPtr.Append( audioStreams[i]->TextualDirection() );
itemPtr.Append( KRightParenthesis() );
itemPtr.Append( KTab );
itemPtr.Append( audioStreams[i]->State() );
itemPtr.Append( KTab );
iArray->AppendL( *item );
CleanupStack::PopAndDestroy( item );
item = NULL;
}
}
示例5: while
HBufC16* CResourceManager::MakeFileName(const TDesC8& aUrl)
{
HBufC16* fileName = NULL;
if (aUrl.Length()) {
char* p = (char*) aUrl.Ptr();
char* tooFar = p + aUrl.Length();
if(*(tooFar-1) == '/')
tooFar--;
char* q = tooFar - 1;
while (q > p && *q != '/')
q--;
if (*q == '/' && *(q + 1) != '/' && q < tooFar - 1) {
q++;
p = q;
while (*p != '?' && p < tooFar)
p++;
int l;
wchr* nameu16 = uni_utf8_to_utf16_str((uint8*) q, p - q, &l);
fileName = HBufC16::NewL(l);
fileName->Des().Copy(nameu16, l);
NBK_free(nameu16);
}
}
return fileName;
}
示例6: DEBUG
// ---------------------------------------------------------------------------
// CIctsEngine::ConstructL
// ---------------------------------------------------------------------------
//
void CIctsEngine::ConstructL()
{
DEBUG("CIctsEngine::ConstructL");
_LIT8(KIp, "http://connectivity-test.ext.nokia.com/");
// CenRep uses UTF 16
HBufC16* uriBuffer = HBufC16::NewLC( KMaxIpLength );
TPtr16 uriPtr = uriBuffer->Des();
// For HTTP FW change it to 8bit
HBufC8* uriBuffer8 = HBufC8::NewLC( KMaxIpLength );
TPtr8 uriPtr8 = uriBuffer8->Des();
TRAPD(err, iRepository = CRepository::NewL(
KCRUidInternetConnectivitySettings ) );
if ( KErrNone == err )
{
TInt err = iRepository->Get( KIctsIpDestination, uriPtr );
uriPtr8.Copy( uriPtr );
iIPAddress = uriPtr8;
if ( KErrNone != err )
{
iIPAddress = KIp();
}
}
else
{
iIPAddress = KIp();
}
CleanupStack::PopAndDestroy(uriBuffer8);
CleanupStack::PopAndDestroy(uriBuffer);
iPollingIntervalTimer = CIctsPollingIntervalTimer::NewL( *this );
iPollingTimeTimer = CIctsPollingTimeTimer::NewL( *this );
iHttpHandler = CIctsHttpHandler::NewL( *this, KHttpResponseTime );
}
示例7:
/**
Converts the 8 bit descriptor to 16 bit descriptor and logs it
@param aModify8BitDesC The 8 bit descriptor that needs to be converted to
16 bit descriptor.
@param aEngine The engine that is used to log data.
@leave leaves with a standard error
*/
EXPORT_C void TSrvAddrVal::LogUsing8BitDesL(CHttpTestEngine* aEngine, const TDesC8& aModify8BitDesC)
{
HBufC16* modifiedBuf = HBufC16::NewLC(aModify8BitDesC.Length());
modifiedBuf->Des().Copy(aModify8BitDesC);
TPtr16 logValuePtr16 = modifiedBuf->Des();
aEngine->Utils().LogIt(_L("URI: "));
aEngine->Utils().LogIt(logValuePtr16);
CleanupStack::PopAndDestroy(modifiedBuf);
}
示例8: TagNameL
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//
HBufC16* CPosLmXmlEncoder::ETagStringLC( TPosXmlTagType aTagType )
{
TPtrC tag = TagNameL( aTagType );
if ( !IsTagLeaf( aTagType ) )
{
iIndentationDepth = Max( iIndentationDepth - 1, 0 );
}
HBufC16* indent = IndentationLC();
HBufC16* string = HBufC16::NewLC( KPosStringLength + indent->Length() );
if ( !IsTagLeaf( aTagType ) )
{
string->Des().Append( *indent );
}
string->Des().Append( KPosXmlETagStart );
string->Des().Append( KPosXmlNameSpacePrefix );
string->Des().Append( tag );
string->Des().Append( KPosXmlTagEnd );
string->Des().Append( KPosXmlNewLine );
CleanupStack::Pop( string );
CleanupStack::PopAndDestroy( indent );
CleanupStack::PushL( string );
return string;
}
示例9: ASSERT
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//
HBufC16* CPosLmXmlEncoder::IndentationLC()
{
ASSERT( iIndentationDepth >= 0 );
TInt indentLength = iIndentationDepth * KPosXmlTab().Length();
HBufC16* indent = HBufC16::NewLC( indentLength );
for ( TInt i=0; i < iIndentationDepth; i++ )
{
indent->Des().Append( KPosXmlTab );
}
return indent;
}
示例10: _NSmlDebugPrintArgs16L
// --------------------------------------------------------------------------------
// void NSmlDebugPrintArgs16L( TText8* aFmt, ... )
// --------------------------------------------------------------------------------
void _NSmlDebugPrintArgs16L( const TDesC16& aFmt, VA_LIST aList )
{
HBufC16* buf = HBufC16::NewLC(1024*2);
buf->Des().FormatList(aFmt, aList);
HBufC8* pBuf8 = HBufC8::NewLC(1024*2);
TPtr8 buf8 = pBuf8->Des();
buf8.Copy(*buf);
buf8.Append(_L8("\r\n"));
DumpToFileL(buf8);
CleanupStack::PopAndDestroy(2); // buf, bBuf8
}
示例11: new
//将Utf8转换成Unicode
HBufC16* CCommonUtils::ConvertToUnicodeFromUTF8(const TDesC8& aStr)
{
HBufC16* ret = HBufC16::NewLC(aStr.Length());
CnvUtfConverter* Converter = new (ELeave) CnvUtfConverter();
TPtr ptr = ret->Des();
Converter->ConvertToUnicodeFromUtf8(ptr,aStr);
delete Converter;
CleanupStack::Pop(ret);
return ret;
}
示例12: _LIT
// ----------------------------------------------------------------------------
// CAudioStreamEngine::MaiscBufferCopied(
// TInt aError, const TDesC8& aBuffer)
//
// called when a block of audio data has been read and is available at the
// buffer reference *aBuffer. calls to ReadL() will be issued until all blocks
// in the audio data buffer (iStreamBuffer) are filled.
// ----------------------------------------------------------------------------
void CAudioStreamEngine::MaiscBufferCopied(TInt aError, const TDesC8& /*aBuffer*/)
{
if (aError!=KErrNone)
{
_LIT(KMessage,"CAudioStreamEngine::MaiscBufferCopied Recording error: %d");
HBufC16* message = HBufC16::NewLC(KMessage().Length()+10);
message->Des().AppendFormat(KMessage,aError);
ShowMessage(*message, ETrue);
CleanupStack::PopAndDestroy(); // message
message = NULL;
}
if (aError==KErrNone)
{
// stop recording if at the end of the buffer
/*iStreamIdx++;
if (iStreamIdx == iFrameCount)
{
ShowMessage(_L("CAudioStreamEngine::MaiscBufferCopied Recording complete!"), ETrue);
iStreamEnd = iStreamIdx - 1;
iBufferOK = ETrue;
// Playback is complete:
// Start the active object that will stop the stream
iStop->Start( TCallBack(BackgroundStop, this) );
return;
}*/
//while(!_bFreeAccessBuffer);
_bAccessBuffer=EFalse;
// issue ReadL() for next frame
//iAudioBuffer2Send.Append(iAudioBuffer);
iAppUi->SendAudioFrame(iAudioBuffer);
TRAPD(error, iInputStream->ReadL(iAudioBuffer));
_bAccessBuffer=ETrue;
PanicIfError(error);
}
else if (aError==KErrAbort)
{
// Recording was aborted, due to call to CMdaAudioInputStream::Stop()
// This KErrAbort will occur each time the Stop() method in this class is executed.
// Also, MaiscRecordComplete() will be called after exiting this method.
iStreamEnd = iStreamIdx - 1;
iBufferOK = ETrue;
iInputStatus = ENotReady;
}
else
{
ShowMessage(_L("CAudioStreamEngine::MaiscBufferCopied Error reading data from input"), ETrue);
iInputStatus = ENotReady;
}
}
示例13: ExternalizeLC
HBufC16* CEnvironment::ExternalizeLC(TUint& aCount)
{
TInt length=0;
TUint i=0;
for (i=0; i<iCount; ++i)
length+=iVars[i].Length();
HBufC16* retBuf = HBufC16::NewLC(length);
TInt nvars=0;
TPtr16 hbuf16=retBuf->Des();
for (i=0; i<iCount; i++)
nvars+=iVars[i].Externalize(hbuf16);
aCount=nvars;
return retBuf;
}
示例14: InternalizeFieldL
// -----------------------------------------------------------------------------
HBufC* CPresenceCacheBuddyInfo::InternalizeFieldL( RReadStream& aStream )
{
HBufC16* temp = NULL;
TInt32 length = aStream.ReadInt32L();
if ( length > 0 )
{
temp = HBufC::NewLC( length);
TPtr stringPtr = temp->Des();
aStream.ReadL( stringPtr, length );
CleanupStack::Pop( temp );
}
else
{
}
return temp;
}
示例15: ShowDeckL
/**
* Function that displays the deck to the dealer.
*/
void CScabbyQueenDealer::ShowDeckL()
{
TInt cardNum;
iConsole.Printf(_L("\nThe Deck...\n"));
for (TInt i=0; i<=iFullDeck->Length()-KCardLength; i=i+KCardLength)
{
if (i==0)
cardNum = i;
else
cardNum = i/2;
HBufC16* buffer = HBufC16::NewL(4);
buffer->Des().Copy(iFullDeck->Mid(i,2));
iConsole.Printf(_L("%d - %S | "),cardNum,buffer);
}
iConsole.Getch();
}