本文整理汇总了C++中HBufC::AllocL方法的典型用法代码示例。如果您正苦于以下问题:C++ HBufC::AllocL方法的具体用法?C++ HBufC::AllocL怎么用?C++ HBufC::AllocL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HBufC
的用法示例。
在下文中一共展示了HBufC::AllocL方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveTask
void CEditorAppView::SaveTask()
{
CMsgRecipientArray* numbers = iContainer->GetNumbers();
TTime time = iContainer->GetDateTime();
TPtrC content = iContainer->GetContent();
TInt count = numbers->Count();
if (count <= 0)
{
ShowInfomationDlgL(R_NOTE_RECIPIENT_NULL);
return;
}
for (TInt i = 0; i < count; i++)
{
CMsgRecipientItem* item = (*numbers)[i];
HBufC* address = item->Address();
HBufC* name = item->Name();
SimMsgData* task = new (ELeave) SimMsgData;
task->iNumber = address->AllocL();
task->iName = name->AllocL();
task->iTime = time;
task->iContent = content.AllocL();
SHSession().AddTask(*task);
delete task;
}
SHChangeViewParam(ESimulateMessageMainScreenViewId,KViewChangeParamReboot);
}
示例2: SaveServerCertToTrustedSiteCertStoreL
// ---------------------------------------------------------------------------
// CServerAuthFailOperation::SaveServerCertToTrustedSiteCertStoreL()
// ---------------------------------------------------------------------------
//
void CServerAuthFailOperation::SaveServerCertToTrustedSiteCertStoreL()
{
TRACE( "CServerAuthFailOperation::SaveServerCertToTrustedSiteCertStoreL" );
ASSERT( iCertLabel == NULL );
CX509Certificate* serverCert = CX509Certificate::NewLC( iEncodedServerCert );
const CX500DistinguishedName& dName = serverCert->SubjectName();
HBufC* commonName = dName.ExtractFieldL( KX520CommonName );
if( commonName )
{
CleanupStack::PushL( commonName );
TInt commonNameLen = commonName->Length();
if( commonNameLen > 0 && commonNameLen <= KMaxCommonNameLength )
{
iCertLabel = commonName->AllocL();
}
CleanupStack::PopAndDestroy( commonName );
}
CleanupStack::PopAndDestroy( serverCert );
if( !iCertLabel )
{
iCertLabel = iServerName->AllocL();
}
iTrustedSiteCertStore->Add( *iCertLabel, EX509Certificate, EPeerCertificate,
NULL, NULL, iEncodedServerCert, iStatus );
iMode = ESavingServerCert;
SetActive();
}
示例3: ConstructL
// ---------------------------------------------------------
// CNSmlCmdsBase::ConstructL
//
// ---------------------------------------------------------
EXPORT_C void CNSmlCmdsBase::ConstructL( CNSmlAgentBase* aAgentBase, const TDesC8& aSessionID, const TDesC8& aVerProto, const TInt aPublicId, const HBufC& aSyncMLUserName, CNSmlURI* aSyncServer, TBool aVersionCheck )
{
iMaxWorkspaceSize = KNSmlDefaultWorkspaceSize;
iAgent = aAgentBase;
iSessionID = aSessionID.AllocL();
iWorkspaceSize = iMaxWorkspaceSize;
iVerProto = aVerProto.AllocL();
iVersionPublicId = aPublicId;
//1.2 CHANGES: 1.1 and 1.2 version support
if ( aPublicId == KNSmlSyncMLPublicId )
{
iVerDTD = KNSmlAgentVerDTD11().AllocL();
}
else
{
iVerDTD = KNSmlAgentVerDTD12().AllocL();
}
//end changes
iVersionCheck = aVersionCheck;
iSyncMLUserName = aSyncMLUserName.AllocL();
iSyncServer = CNSmlURI::NewL( aSyncServer->HostNameWithPortL() );
iPhoneInfo = CNSmlPhoneInfo::NewL();
iStatusToServer = CNSmlStatusContainer::NewL();
iResponseController = CNSmlResponseController::NewL();
iResultsToServer = CNSmlResultsContainer::NewL();
iServerAuth = CNSmlAuth::NewL();
}
示例4: GetProxyInformationForConnectionL
void CPodcastModel::GetProxyInformationForConnectionL(TBool& aIsUsed, HBufC*& aProxyServerName, TUint32& aPort)
{
TInt iapId = GetIapId();
CCommsDbTableView* table = iCommDB->OpenViewMatchingUintLC(TPtrC(IAP), TPtrC(COMMDB_ID), iapId);
TUint32 iapService;
HBufC* iapServiceType;
table->ReadUintL(TPtrC(IAP_SERVICE), iapService);
iapServiceType = table->ReadLongTextLC(TPtrC(IAP_SERVICE_TYPE));
CCommsDbTableView* proxyTableView = iCommDB->OpenViewOnProxyRecordLC(iapService, *iapServiceType);
TInt err = proxyTableView->GotoFirstRecord();
if( err != KErrNone)
{
User::Leave(KErrNotFound);
}
proxyTableView->ReadBoolL(TPtrC(PROXY_USE_PROXY_SERVER), aIsUsed);
if(aIsUsed)
{
HBufC* serverName = proxyTableView->ReadLongTextLC(TPtrC(PROXY_SERVER_NAME));
proxyTableView->ReadUintL(TPtrC(PROXY_PORT_NUMBER), aPort);
aProxyServerName = serverName->AllocL();
CleanupStack::PopAndDestroy(serverName);
}
CleanupStack::PopAndDestroy(proxyTableView);
CleanupStack::PopAndDestroy(iapServiceType);
CleanupStack::PopAndDestroy(table);
}
示例5: DoDeactivate
void CEmTubeSearchView::DoDeactivate()
{
HBufC* t = iContainer->FindBoxText();
if( t )
{
delete iFindBoxText;
iFindBoxText = t->AllocL();
}
iAppUi->RemoveFromStack(iContainer);
delete iContainer;
iContainer = NULL;
}
示例6: ResolveSubStringL
/**
Resolves sub string and directionality of the sub string.
Adds no dir marker if directionality of the string not found.
*/
HBufC* CResourceLoader::ResolveSubStringL(TDes& aText, TBool* aMarker)
{
// Allocating heap buffer for return string.
TInt destlength(aText.Length());
HBufC* retbuf = HBufC::NewLC(destlength + 1); // no dir marker
TPtr retptr(retbuf->Des());
TBuf<1> marker;
marker.Append(KDirNotFound);
TPtrC remainder = aText.Right(aText.Length());
TInt nextKey = remainder.Locate(KSubStringSeparator);
if (nextKey == 0)
{
remainder.Set(remainder.Mid(1));
nextKey = remainder.Locate(KSubStringSeparator);
if (nextKey != KErrNotFound)
{
retptr.Insert(0, aText.Mid(1, nextKey));
// Remove string from aText
aText.Delete(0, nextKey + 1);
}
else
{
TInt length = aText.Length();
retptr.Insert(0, aText.Mid(1, length - 1));
// Remove string from aText
aText.Delete(0, length);
}
}
else if (nextKey == KErrNotFound)
{
retptr.Insert(0, aText);
// Remove string from aText
aText.Delete(0, aText.Length());
}
else
{
retptr.Insert(0, aText.Mid(0, nextKey));
// Remove string from aText
aText.Delete(0, nextKey);
}
// Resolve directionality of sub string
HBufC* dirbuf = retbuf->AllocL();
TPtr dirptr = dirbuf->Des();
TBool found(EFalse);
TBidiText::TDirectionality mainDir = ResolveDirectionality(dirptr, &found);
delete dirbuf;
if (!found)
{
retptr.Insert(0, marker);
*aMarker = ETrue;
}
else
{
*aMarker = EFalse;
}
retbuf = retbuf->ReAllocL(retptr.Length());
CleanupStack::Pop(); //retbuf
// If the key string wasn't found, retbuf is empty.
return retbuf;
}