本文整理汇总了C++中TPtrC8::AllocL方法的典型用法代码示例。如果您正苦于以下问题:C++ TPtrC8::AllocL方法的具体用法?C++ TPtrC8::AllocL怎么用?C++ TPtrC8::AllocL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPtrC8
的用法示例。
在下文中一共展示了TPtrC8::AllocL方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DecodeBodyL
/**
* Decodes the raw data out of an information element into this class.
*
* @param aPtr The raw predefined animation data
* @param TBool boolean to indicate if it is from serialisation
* @leave KErrCorrupt If the size of the data does not match what is expected.
*/
void CEmsSoundIE::DecodeBodyL(const TPtrC8 aPtr, TBool)
{
__ASSERT_ALWAYS(aPtr.Length()<=EMaxSoundLength, User::Leave(KErrCorrupt));
Reset();
iMelody = aPtr.AllocL();
}
示例2: AddAttributeL
EXPORT_C void CSenAttributes::AddAttributeL(const CSenAttribute& aValue) //codescannerwarnings
{
TPtrC8 name = aValue.Name();
if ( KErrNotFound != iAttrList.Find(name) )
{
// Replace, if attribute exists
iAttrList.RemoveByKey(name);
}
iAttrList.Append(name.AllocL(),&aValue);
}
示例3: GetThumbnailL
// ---------------------------------------------------------------------------
// CThumbnailAudioProvider::GetThumbnailL()
// Provides the thumbnail image
// ---------------------------------------------------------------------------
//
void CThumbnailAudioProvider::GetThumbnailL( RFs& aFs, RFile64& aFile, const
TDataType& aMimeType , const CThumbnailManager::TThumbnailFlags aFlags,
const TDisplayMode /*aDisplayMode*/, const CThumbnailManager::TThumbnailQualityPreference /*aQualityPreference*/ )
{
TN_DEBUG1( "CThumbnailAudioProvider::GetThumbnailL() - rfile " );
OstTrace0( TRACE_NORMAL, CTHUMBNAILAUDIOPROVIDER_GETTHUMBNAILL, "CThumbnailAudioProvider::GetThumbnailL - rfile" );
CMetaDataUtility* metaDataUtil = CMetaDataUtility::NewL();
CleanupStack::PushL( metaDataUtil );
RArray<TMetaDataFieldId> wantedFields;
CleanupClosePushL(wantedFields);
wantedFields.AppendL(EMetaDataJpeg);
metaDataUtil->OpenFileL(aFile, wantedFields, aMimeType.Des8());
const CMetaDataFieldContainer& metaCont = metaDataUtil->MetaDataFieldsL();
TPtrC8 ptr = metaCont.Field8( EMetaDataJpeg );
HBufC8* data = ptr.AllocL();
CleanupStack::PopAndDestroy(&wantedFields);
CleanupStack::PopAndDestroy(metaDataUtil);
CleanupStack::PushL( data );
if(data->Length() == 0)
{
User::Leave( KErrNotFound );
}
if ( !iImageDecoderv3 )
{
iImageDecoderv3 = new( ELeave )CThumbnailImageDecoderv3( aFs );
}
iMimeType = TDataType(KJpegMime);
iFlags = aFlags;
//set default mode displaymode from global constants
iDisplayMode = KStoreDisplayMode;
TRAPD( err, iImageDecoderv3->CreateL( data, *iObserver, iFlags, iMimeType, iTargetSize ) );
if (err == KErrNone)
{
CleanupStack::Pop( data );
}
else
{
// this is because data buffer is already released in CreateDecoderL
// and we must prevent automatic PopAndDestroy
CleanupStack::Pop( data );
User::Leave(err);
}
iOriginalSize = iImageDecoderv3->OriginalSize();
iImageDecoderv3->DecodeL( iDisplayMode );
}
示例4: bufWs
HBufC8* CSenLayeredXmlProperties::AsUtf8L()
{
CBufFlat *pBuf = CBufFlat::NewL(KFlatBufSize);
CleanupStack::PushL(pBuf);
RBufWriteStream bufWs(*pBuf);
CleanupClosePushL(bufWs);
this->WriteToL(bufWs);
CleanupStack::PopAndDestroy(); // bufWs.Close();
TPtrC8 p = pBuf->Ptr(0);
HBufC8* pRet = p.AllocL();
CleanupStack::PopAndDestroy(); // pBuf;
return pRet;
// return ipFragment->AsXmlL();
}
示例5: seqGen
void CDecPkcs12Attribute::ConstructL(const TDesC8& aBagAttributes)
{
TASN1DecGeneric seqGen(aBagAttributes);
seqGen.InitL();
// Check if this is a Sequence
if (seqGen.Tag() != EASN1Sequence || seqGen.Class() != EUniversal)
{
User::Leave(KErrArgument);
}
TASN1DecSequence seq;
CArrayPtrFlat<TASN1DecGeneric>* attributeSet = seq.DecodeDERLC(seqGen);
const TASN1DecGeneric* attributeSetAt0 = attributeSet->At(0);
if(attributeSetAt0->Tag() != EASN1ObjectIdentifier || attributeSetAt0->Class() != EUniversal)
{
User::Leave(KErrArgument);
}
// Decode the ObjectIdentifier
TASN1DecObjectIdentifier oid;
iAttributeId = oid.DecodeDERL(*attributeSetAt0);
const TASN1DecGeneric* attributeSetAt1 = attributeSet->At(1);
if(attributeSetAt1->Tag() != EASN1Set || attributeSetAt1->Class() != EUniversal)
{
User::Leave(KErrArgument);
}
// Attribute Set
TASN1DecSet decSet;
CArrayPtrFlat<TASN1DecGeneric>* attributeValues = decSet.NewDERLC(attributeSetAt1->Encoding());
TInt attributeCount = attributeValues->Count();
for(TInt index = 0; index < attributeCount; ++index)
{
const TASN1DecGeneric* attributeValuesAt = attributeValues->At(index);
TASN1DecGeneric seqGen(*attributeValuesAt);
seqGen.InitL();
TPtrC8 attrValue = seqGen.Encoding();
TDesC8* attributeVal = attrValue.AllocL();
CleanupStack::PushL(attributeVal);
iAttributeValue.AppendL(attributeVal);
CleanupStack::Pop(attributeVal);
}
CleanupStack::PopAndDestroy(2,attributeSet); // attributeSet,attributeValues
}
示例6: ConstructL
void CSenBaseIdentityManager::ConstructL()
{
TLSLOG_L(KSenCoreServiceManagerLogChannelBase , KMinLogLevel,"CSenBaseIdentityManager::ConstructL - Version 2 [2006-05-09]");
BaseConstructL(KIdentityElementLocalName);
delete ipDeviceID;
ipDeviceID=NULL;
#ifndef __WINS__
//Since plpvariant.h is depricated in TB9.2 from wk48 2009 on words.
//provided alternative solution
/*
// This only works on target machine
TPlpVariantMachineId imei;
PlpVariant::GetMachineIdL(imei);
ipDeviceID = SenXmlUtils::ToUtf8LC(imei);
CleanupStack::Pop(); // ipDeviceID
*/
TPtrC8 imei ;
imei.Set(iManager.IMEI());
ipDeviceID = imei.AllocL();
#else
// Return a fake IMEI when working on emulator
_LIT8(KEmulatorImei, "012345678901234");
ipDeviceID = KEmulatorImei().AllocL();
#endif
// Device ID is now resolved, fake or not
TPtr8 imeiTPtr = ipDeviceID->Des();
iIdentity = CSenBaseIdentity::NewL(imeiTPtr);
HBufC* file = KIdentityFile().AllocL();
CleanupStack::PushL(file);
LoadFromL(*file, *iManager.XMLReader());
// ValidateDefaultIdentity()
ReloadSenSecurityMechanismsL();
iObserver = CSenSenSecurityMechanismObserver::NewL(*this);
iObserver->Start();
CleanupStack::PopAndDestroy(); // file
}
示例7: ConstructL
void CPrimitiveAssertion::ConstructL(CPrimitiveAssertion* aValue)
{
CQName* temp = aValue->QName();
if(temp)
{
TPtrC8 name = temp->Name();
TPtrC8 prefix = temp->Prefix();
TPtrC8 uri = temp->Uri();
ConstructL(name, prefix,uri);
SetAttributesL(aValue->Attributes());
TPtrC8 strval = aValue->StrValue();
iStrValue = strval.AllocL();
RPolicyTerms terms = aValue->GetTerms();
if(terms.Count() > 0)
AddTermsCopyL(terms);
}
}
示例8: ConstructL
// -----------------------------------------------------------------------------
// CWPMessage::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CWPMessage::ConstructL( CPushMessage& aMessage )
{
FLOG( _L( "CWPMessage::ConstructL: Opening msg session" ) );
iSession = CMsvSession::OpenSyncL(*this);
FLOG( _L( "CWPMessage::ConstructL: Constructing push message" ) );
iMessage = CWPPushMessage::NewL();
TPtrC8 bodyValue;
TPtrC8 headerValue;
if (aMessage.GetMessageBody(bodyValue)
&& aMessage.GetHeader(headerValue) )
{
iMessage->SetL( headerValue, bodyValue );
}
TPtrC8 serverValue;
if( aMessage.GetServerAddress( serverValue ) )
{
FLOG( _L( "CWPMessage::Begin originator" ) );
DHEX( serverValue );
FLOG( _L( "CWPMessage::End originator" ) );
iMessage->SetOriginatorL( serverValue );
iSender = serverValue.AllocL();
}
FLOG( _L( "CWPMessage::Begin header" ));
DHEX( iMessage->Header() );
FLOG( _L( "CWPMessage::Begin message body" ) );
DHEX( iMessage->Body() );
FLOG( _L( "CWPMessage::End message" ) );
FLOG( _L( "CWPMessage::ConstructL: Retrieving BIO message type" ) );
BioMessageTypeL( aMessage );
FLOG( _L( "CWPMessage::ConstructL: Finished" ) );
}
示例9: CreateOperatorCacheL
void CHttpCacheManager::CreateOperatorCacheL( CRepository& aRepository, const TDesC& aOpCacheFolder, const TInt& aOpCacheSize, const TInt& aCriticalLevel, const THttpCachePostponeParameters& aPostpone )
{
TBuf<512> url;
// if domain is missing, then no need to read further
if (aRepository.Get(KOperatorDomainUrl, url) == KErrNone)
{
HBufC8* opDomain8 = HBufC8::NewL(url.Length());
CleanupStack::PushL(opDomain8);
opDomain8->Des().Append(url);
TInt slashPos = opDomain8->LocateReverse('/');
if (slashPos == -1)
{
slashPos = 0;
}
TPtrC8 temp = opDomain8->Left(slashPos);
iOpDomain = temp.AllocL();
CleanupStack::PopAndDestroy(opDomain8);
// create op cache
iOperatorCache = CHttpCacheHandler::NewL( aOpCacheSize, aOpCacheFolder, KDefaultOpIndexFile(), aCriticalLevel, aPostpone);
}
}
示例10: DoConstructL
// ----------------------------------------------------------
// CSimplePresenceList::DoConstructL
// ----------------------------------------------------------
//
void CSimplePresenceList::DoConstructL(
RPointerArray<CBodyPart>& aParts, const TDesC8& aStart )
{
_LIT8( KMyContentType, "Content-Type: multipart/related;");
_LIT8( KMyBoundary, "boundary=");
const TInt myBoundaryLen = 9; // boundary= 9 characters
// Handle body parts one by one
TInt size = aParts.Count();
TInt i;
CBodyPart* cp = NULL;
TPtrC8 boundary;
TPtrC8 start;
// remove "..." quoted marks when needed
TPtrC8 pStartUnquoted( KNullDesC8 );
if ( aStart.Locate( '"') == 0 )
{
pStartUnquoted.Set( aStart.Mid( 1, aStart.Length() - 2 ));
}
else
{
pStartUnquoted.Set( aStart );
}
// remove <...> marks when needed
if ( pStartUnquoted.Locate( '<') == 0 )
{
pStartUnquoted.Set( pStartUnquoted.Mid( 1, pStartUnquoted.Length() - 2 ));
}
TPtrC8 p8;
p8.Set( KSimpleDocumentType );
TInt mySize = p8.Length();
p8.Set( KSimpleMultipartType );
TInt mySize2 = p8.Length();
#ifdef _DEBUG
TPtrC p16b; // notice: for debug
TPtrC8 p8b;
#endif
// Make this handle direct content too in the RLMI list, i.e.
// content-type: multipart/related; type="application/pidf+xml"; boundary=...;
for (i = 0; i < size; i++)
{
cp = aParts[i];
// inline const TDesC8& Headers() { return iHeaders; }
TPtrC8 allHeaders = cp->Headers();
HBufC8* headersBuff = allHeaders.AllocL();
CleanupStack::PushL( headersBuff );
#ifdef _DEBUG
p16b.Set( cp->Url() ); // debug only
p8b.Set( cp->ContentType() ); // debug only
p8b.Set( cp->ContentID() ); // debug only
#endif
if ( !pStartUnquoted.Compare( cp->ContentID()) &&
!cp->ContentType().Left(sizeof(KSimpleListType)).CompareF( KSimpleListType ))
{
// Meta data is the root
iMeta = CSimpleMeta::NewL( cp->Body() );
}
else if ( !cp->ContentType().CompareF( KSimpleDocumentType ))
{
// Ordinary presence element
CSimpleDocument* cd = CSimpleDocument::NewL( cp->Body() );
CleanupStack::PushL( cd );
User::LeaveIfError( iDocuments.Append( cd ) );
CleanupStack::Pop( cd );
}
else if ( (!cp->ContentType().Left(mySize2).CompareF( KSimpleMultipartType )))
{
// multipart for user's direct content data
// get boundary from headers
TPtrC8 pStart(KNullDesC8);
TPtrC8 pBoundary(KNullDesC8);
TPtrC8 pHeaders = headersBuff->Des();
TPtrC8 pContentType;
TInt pos1 = pHeaders.Find( KMyContentType );
if ( pos1 >= 0 )
{
TPtrC8 h2 = pHeaders.Mid( pos1 );
TInt pos2 = h2.Locate( '\r');
if ( pos2 < 0 )
{
pContentType.Set( h2 );
}
else
{
pContentType.Set( h2.Left( h2.Length() - pos2 ));
}
//.........这里部分代码省略.........
示例11: StoreItemDataL
// -----------------------------------------------------------------------------
// CNSmlDSBatchBuffer::StoreItemDataL
// Stores data to the current item.
// -----------------------------------------------------------------------------
//
void CNSmlDSBatchBuffer::StoreItemDataL( TPtrC8 aData )
{
iBuffer[iBuffer.Count() - 1]->iItemData = aData.AllocL();
}
示例12: ServiceL
TInt CTestHostlet::ServiceL(MSenHostletRequest& aRequest, MSenHostletResponse& aResponse)
{
iTxnIds.Append(aRequest.RequestId());
iResponseCodes.Append(KErrNone);
TInt retVal(KErrNone);
// Setup default response, can be overridden by test case:
// Dummy response
TPtrC8 request = aRequest.RequestUtf8();
iRequests.Append(request.AllocL());
MSenProperties::TSenPropertiesClassType propType;
TPtrC8 requestProperties = aRequest.Properties(propType);
iRequestProps.Append(requestProperties.AllocL());
iRequestPropTypes.Append(propType);
// _LIT8(KResponseFmt, "<Response><ReplyMessage>CSenHostletConnectionBCTest is alive.</ReplyMessage><Request>%S</Request></Response>");
_LIT8(KResponseFmt, "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Header></S:Header><S:Body>testing text hostlet</S:Body></S:Envelope>");
HBufC8* pResponse = HBufC8::NewLC(request.Length()+KResponseFmt().Length());
TInt appendError = iResponses.Append(pResponse);
if( appendError )
{
CleanupStack::PopAndDestroy(pResponse); // delete orphan HBufC8 / pResponse
}
else
{
CleanupStack::Pop(pResponse); // now owned by iResponses -array..
}
TPtr8 response = iResponses[iTxnIds.Count()-1]->Des();
response.Format(KResponseFmt, &request);
aResponse.SetResponseUtf8L(response, iResponseCodes[iTxnIds.Count()-1]); // by default, all requests are "accepted"
if ( ip2ServiceL )
{
// NOTE(!): if RESPONSE CODE in aResponse is modified in YOUR test case,
// remember set iResponseCodes for this test hostlet instance in your test
// case code (ServiceL callback)
retVal = (*ip2ServiceL)(ipTestSuite, aRequest, aResponse);
}
TPtrC8 providedResponse = aResponse.ResponseUtf8();
if ( iResponses[iTxnIds.Count()-1]->Compare(providedResponse) != 0 )
{
// response was altered by TEST CASE:
iResponses.Insert(aResponse.ResponseUtf8().AllocL(),iTxnIds.Count()-1);
}
RDebug::Print(_L("CTestHostlet::ServiceL received:"));
RDebug::RawPrint(request);
if (ipTestSuite->ipUsedHostletConnection)
{
iRespondRetCode = ipTestSuite->ipUsedHostletConnection->RespondL(aResponse);
}
else
iRespondRetCode = ipTestSuite->ipHostletConnection->RespondL(aResponse);
return retVal;
}
示例13: MHFRunL
void CSTTrackerConnection::MHFRunL(RHTTPTransaction aTransaction,
const THTTPEvent& aEvent)
{
switch (aEvent.iStatus)
{
case THTTPEvent::EGotResponseHeaders:
{
// HTTP response headers have been received. Use
// aTransaction.Response() to get the response. However, it's not
// necessary to do anything with the response when this event occurs.
LWRITELN(iLog, _L("[Trackerconnection] Got HTTP headers"));
// Get HTTP status code from header (e.g. 200)
RHTTPResponse resp = aTransaction.Response();
TInt status = resp.StatusCode();
if (status != 200) // ERROR, hiba esetén mi legyen? 404-et lekezelni!
{
LWRITE(iLog, _L("[Trackerconnection] Error, status = "));
TBuf<20> numBuf;
numBuf.Num(status);
LWRITELN(iLog, numBuf);
Cancel();
if (iObserver)
iObserver->TrackerConnectionFailedL();
break;
}
// Get status text (e.g. "OK")
HLWRITE(iLog, _L("[Trackerconnection] Status text = "));
TBuf<32> statusText;
statusText.Copy(resp.StatusText().DesC());
HLWRITELN(iLog, statusText);
#ifdef LOG_TO_FILE
RHTTPHeaders headers =
aTransaction.Response().GetHeaderCollection();
THTTPHdrFieldIter i =
headers.Fields();
for (i.First(); !(i.AtEnd()); ++i)
{
RStringF header = iSession.StringPool().StringF(i());
if ((header.DesC() == _L8("Content-Type")))
{
HLWRITE(iLog, header.DesC());
HLWRITE(iLog, _L(": "));
THTTPHdrVal val;
headers.GetField(header, 0, val);
RStringF value = val.StrF();
HLWRITELN(iLog, value.DesC());
}
else
HLWRITELN(iLog, header.DesC());
}
#endif
}
break;
case THTTPEvent::EGotResponseBodyData:
{
// Part (or all) of response's body data received. Use
// aTransaction.Response().Body()->GetNextDataPart() to get the actual
// body data.
// Get the body data supplier
MHTTPDataSupplier* body = aTransaction.Response().Body();
TPtrC8 dataChunk;
// GetNextDataPart() returns ETrue, if the received part is the last
// one.
TBool isLast = body->GetNextDataPart(dataChunk);
//iDownloadedSize += dataChunk.Size();
HLWRITELN(iLog, _L8("[TrackerConnection] HTTP response body chunk received: "));
HLWRITELN(iLog, dataChunk);
if (iReceiveBuffer)
{
HBufC8* temp = HBufC8::NewL(
iReceiveBuffer->Length() + dataChunk.Length());
TPtr8 tempPtr(temp->Des());
tempPtr.Copy(*iReceiveBuffer);
tempPtr.Append(dataChunk);
delete iReceiveBuffer;
iReceiveBuffer = temp;
}
else
iReceiveBuffer = dataChunk.AllocL();
// Always remember to release the body data.
body->ReleaseData();
// NOTE: isLast may not be ETrue even if last data part received.
// (e.g. multipart response without content length field)
// Use EResponseComplete to reliably determine when body is completely
//.........这里部分代码省略.........
示例14: DoPerformPrerequisite
void CActionSet::DoPerformPrerequisite(TRequestStatus& aStatus)
{
TRequestStatus* status = &aStatus;
TInt err = KErrNone;
TInt pos = 0;
TPtrC8 encryptElement = Input::ParseElement(*iBody, KSetStart,
KSetEnd, pos, err);
pos = 0;
TPtrC8 kdf = Input::ParseElement(*iBody, KKdfStart, KKdfEnd, pos, err);
if (err == KErrNone)
iKdf = kdf.AllocL();
pos = 0;
TPtrC8 saltLenBytes = Input::ParseElement(*iBody, KSaltLenBytesStart, KSaltLenBytesEnd, pos, err);
if (err == KErrNone)
iSaltLenBytes = saltLenBytes.AllocL();
pos = 0;
TPtrC8 iterCount = Input::ParseElement(*iBody, KIterCountStart, KIterCountEnd, pos, err);
if (err == KErrNone)
iIterCount = iterCount.AllocL();
pos = 0;
TPtrC8 passwdTemp = Input::ParseElement(encryptElement, KPasswdStart,
KPasswdEnd, pos, err);
iPasswd = HBufC::NewL(passwdTemp.Length());
TPtr16 passwdTemp3( iPasswd->Des());
passwdTemp3.Copy(passwdTemp);
pos = 0;
TPtrC8 inputTemp = Input::ParseElement(encryptElement, KInputStart,
KInputEnd, pos, err);
iInput = HBufC8::NewL(inputTemp.Length());
*iInput = inputTemp;
TPtrC8 cipher = Input::ParseElement(*iBody, KCipherStart, KCipherEnd);
if (cipher.Compare(KECipherAES_CBC_128) == 0)
{
iCipher = ECipherAES_CBC_128;
}
else if (cipher.Compare(KECipherAES_CBC_192) == 0)
{
iCipher = ECipherAES_CBC_192;
}
else if (cipher.Compare(KECipherAES_CBC_256) == 0)
{
iCipher = ECipherAES_CBC_256;
}
else if (cipher.Compare(KECipherDES_CBC) == 0)
{
iCipher = ECipherDES_CBC;
}
else if (cipher.Compare(KECipher3DES_CBC) == 0)
{
iCipher = ECipher3DES_CBC;
}
else if (cipher.Compare(KECipherRC2_CBC_40) == 0)
{
iCipher = ECipherRC2_CBC_40;
}
else if (cipher.Compare(KECipherRC2_CBC_128) == 0)
{
iCipher = ECipherRC2_CBC_128;
}
else if (cipher.Compare(KECipherRC2_CBC_40_16) == 0)
{
iCipher = ECipherRC2_CBC_40_16;
}
else if (cipher.Compare(KECipherRC2_CBC_128_16) == 0)
{
iCipher = ECipherRC2_CBC_128_16;
}
else if(cipher.Compare(KECipher2Key3DES_CBC) == 0)
{
iCipher = ECipher2Key3DES_CBC;
}
else if(cipher.Compare(KECipherRC2_CBC_40_5) == 0)
{
iCipher = ECipherRC2_CBC_40_5;
}
else
{
iCipher = ECipherAES_CBC_128; // Default value if the <cipher> tag is missing
}
User::RequestComplete(status, KErrNone);
iActionState = CTestAction::EAction;
}