本文整理汇总了C++中TPtrC::AllocL方法的典型用法代码示例。如果您正苦于以下问题:C++ TPtrC::AllocL方法的具体用法?C++ TPtrC::AllocL怎么用?C++ TPtrC::AllocL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPtrC
的用法示例。
在下文中一共展示了TPtrC::AllocL方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ShowConfirmationQueryL
void CDPOFPrintingDevice::ShowConfirmationQueryL()
{
LOG("CDPOFPrintingDevice::ShowConfirmationQueryL begin");
RFs fs;
User::LeaveIfError( fs.Connect() );
CleanupClosePushL( fs );
TFileName resourceFileName;
resourceFileName.Append ( KDC_RESOURCE_FILES_DIR );
resourceFileName.Append ( KResourceFileName );
BaflUtils::NearestLanguageFile( fs, resourceFileName );
RResourceFile resFile;
resFile.OpenL( fs, resourceFileName );
CleanupClosePushL( resFile );
HBufC8 *resBuffer = resFile.AllocReadLC( R_QTN_PRINT_DPOF_CONFIRMATION_DIALOG );
TResourceReader reader;
reader.SetBuffer( resBuffer );
TPtrC ptrQuestion = reader.ReadTPtrC();
iQuestion = ptrQuestion.AllocL();
CleanupStack::PopAndDestroy( 3 ); // resBuffer, resFile, fs
iPQ = CAknGlobalConfirmationQuery::NewL();
iConfirmationQuery = CConfirmationQuery::NewL( *this );
iConfirmationQuery->StartWaitingAnswer( );
iPQ->ShowConfirmationQueryL( iConfirmationQuery->iStatus, *iQuestion, R_AVKON_SOFTKEYS_YES_NO );
LOG("CDPOFPrintingDevice::ShowConfirmationQueryL end");
}
示例3: constructL
// -----------------------------------------------------------------------------
// WebPopupDrawer::constructL
// The constructor that can contain code that might leave.
// -----------------------------------------------------------------------------
//
void WebPopupDrawer::constructL(TPtrC& textToDraw)
{
if (textToDraw.Length() == 0)
{
User::Leave(KErrArgument);
}
m_textToDraw = textToDraw.AllocL();
CleanupStack::PushL(m_textToDraw);
m_removePopupPeriodic = CPeriodic::NewL( CActive::EPriorityLow );
CleanupStack::PushL(m_removePopupPeriodic);
m_removePopupPeriodic->Start( KPopupTimeout, 0, TCallBack( &removePopupCallback, this ) );
sizeChangedL();
constructSprite();
CleanupStack::Pop(2, m_textToDraw); //m_removePopupPeriodic, m_textToDraw
}
示例4: ConstructL
void CCategorySearchResult::ConstructL(const TDesC& aDes)
{
TLex line(aDes);
line.Mark();
TInt redefined=0;
if (line.Peek() != '#' && line.Peek() != '\t')
{
TInt index=0;
while (line.Peek() != '\n' && !(line.Peek()).Eos())
{
line.Inc();
if (line.Peek() == '\t')
{
TPtrC token = line.MarkedToken();
TLex val(token);
switch(index)
{
case ETextCriteria:
iTextCriteria = token.AllocL();
break;
case ELmSearchResult:
ParseSearchResult(token);
break;
case ERedefined:
val.Val(redefined);
if (redefined == 1)
{
iRedefined = ETrue;
}
break;
}
line.Inc();
while (line.Peek() == '\t') // Empty value
{
line.Inc();
++index;
}
line.Mark();
++index;
}
}
}
}
示例5: SetVideoUrlL
void CVideoEntry::SetVideoUrlL( const TDesC& aUrl )
{
delete iUrl;
delete iVideoId;
iUrl = aUrl.AllocL();
TInt index = iUrl->LocateReverse( '=' );
if( index != KErrNotFound )
{
TPtrC name = iUrl->Right( iUrl->Length() - index - 1 );
iVideoId = name.AllocL();
}
else
{
iVideoId = KNullDesC().AllocL();
}
SetRelatedUrlL( *iVideoId );
}
示例6: ConstructL
void CUrl::ConstructL(const TDesC& aUrl)
//
// Non-trivial c'tor - can be used for all general urls
{
// Stripe any leading whitespace
TPtrC url = aUrl;
while( url.Locate(' ') == 0 )
{
// Remove the leading whitespace -> set pointer to second character
url.Set(url.Mid(1));
}
iUrlDes = url.AllocL();
// Check to see if there's ':' at start of aUrl
TInt colonPos = aUrl.Locate(':');
if (colonPos == 0)
User::Leave(EWapErrCorruptUrl);
TPtrC scheme(Component(EUrlScheme));
CheckSchemeValidL(scheme);
}
示例7: LoadTitleL
// --------------------------------------------------------------------------
// CUPnPMetaDataUtility::LoadTitleL
// Finds the title(ID3 tag) of the file according to give file name
// (other items were commented in a header).
// --------------------------------------------------------------------------
//
EXPORT_C void CUPnPMetaDataUtility::LoadTitleL( const TDesC& aFileName )
{
// Cleanup existing information
Reset();
RArray<TMetaDataFieldId> wantedFields;
CleanupClosePushL( wantedFields );
wantedFields.Append( EMetaDataSongTitle );
// Reset to be sure that no allocations are left over
iMetaDataUtility->ResetL();
// Open the file
iMetaDataUtility->OpenFileL( aFileName, wantedFields );
// wantedFields is not needed anymore
CleanupStack::PopAndDestroy( &wantedFields );
// Go through the meta data fields and pick the required ones
TInt count = iMetaDataUtility->MetaDataCount();
if ( count > 0 )
{
const CMetaDataFieldContainer& container =
iMetaDataUtility->MetaDataFieldsL();
TMetaDataFieldId fieldId;
for ( TInt index = 0; index < count; index++ )
{
TPtrC content = container.At( index, fieldId );
if ( EMetaDataSongTitle == fieldId )
{
iTitle = content.AllocL();
break;
}
}
}
// Cleanup
iMetaDataUtility->ResetL();
}
示例8: decoderGeneric
//.........这里部分代码省略.........
break;
case EStateOrProvinceName:
ptr.Set(KX520StateOrProvinceName);
maxlen = KX520MaxSOPLength;
break;
case EPostalCode:
ptr.Set(KX520PostalCode);
maxlen = KX520MaxPostalCodeLength;
break;
case EOrganizationName:
ptr.Set(KX520OrganizationName);
maxlen = KX520MaxOLength;
break;
case EOrganizationalUnitName:
ptr.Set(KX520OrganizationalUnitName);
maxlen = KX520MaxOULength;
break;
case ETitle:
ptr.Set(KX520Title);
maxlen = KX520MaxTLength;
break;
case EDNQualifier:
ptr.Set(KX520DNQualifier);
maxlen = 64; // no information was found on this one, so set to a safe minimum
break;
case ECountryName:
ptr.Set(KX520CountryName);
maxlen = KX520MaxCNLength;
break;
case EGivenName:
ptr.Set(KX520GivenName);
maxlen = KX520MaxGNLength;
break;
case ESurname:
ptr.Set(KX520Surname);
maxlen = KX520MaxSLength;
break;
case EInitials:
ptr.Set(KX520Initials);
maxlen = KX520MaxILength;
break;
case EGenerationQualifier:
ptr.Set(KX520GenerationQualifier);
maxlen = KX520MaxGQLength;
break;
case EPKCS9EmailAddress:
ptr.Set(KPKCS9EmailAddress);
maxlen = KPKCS9MaxEmailAddressLength;
type = EASN1IA5String;
break;
case ESerialNumber:
ptr.Set(KX520SerialNumber);
maxlen = KX520MaxSNLength;
break;
case ERFC2247DomainComponent:
ptr.Set(KRFC2247DomainComponent);
maxlen = KRFC2247MaxDomainComponentLength;
type = EASN1IA5String;
break;
case ERFC2256Street:
ptr.Set(KRFC2256Street);
maxlen = KRFC2256StreetLength;
break;
case EPKCS9UnstructuredName:
{
ptr.Set(KPKCS9UnstructuredName);
maxlen = KPKCS9MaxUnstructuredNameLength;
// Determine the encoded value. It could be a IA5String or a UTF8String
TASN1DecGeneric decoderGeneric(aValue);
decoderGeneric.InitL();
type = decoderGeneric.Tag();
break;
}
case EX520Description:
{
ptr.Set(KX520Description);
maxlen = KX520MaxDescriptionLength;
break;
}
default:
User::Leave(KErrArgument);
}
// Verify if the passed length is within limits
if(aValue.Length() > maxlen)
User::Leave(KErrArgument);
// Allocate OID string for iType
iType = ptr.AllocL();
// iValue must be stored in ASN.1-encoded form
CASN1EncOctetString* enc = CASN1EncOctetString::NewLC(aValue);
enc->SetTag(type, EUniversal);
TUint len = enc->LengthDER();
HBufC8* buf = HBufC8::NewMaxLC(len);
TUint pos = 0;
TPtr8 bufptr(buf->Des());
enc->WriteDERL(bufptr, pos);
iValue = bufptr.AllocL();
CleanupStack::PopAndDestroy(2);
}
示例9: LoadMetaDataL
// --------------------------------------------------------------------------
// CUPnPMetaDataUtility::LoadMetaDataL
// Finds correct MMF controller according to give file name
// (other items were commented in a header).
// --------------------------------------------------------------------------
//
EXPORT_C void CUPnPMetaDataUtility::LoadMetaDataL( const TDesC& aFileName )
{
// Cleanup existing information
Reset();
RArray<TMetaDataFieldId> wantedFields;
CleanupClosePushL( wantedFields );
wantedFields.AppendL( EMetaDataSongTitle );
wantedFields.AppendL( EMetaDataArtist );
wantedFields.AppendL( EMetaDataAlbum );
wantedFields.AppendL( EMetaDataGenre );
wantedFields.AppendL( EMetaDataDate );
// Reset to be sure that no allocations are left over
iMetaDataUtility->ResetL();
// Open the file
iMetaDataUtility->OpenFileL( aFileName, wantedFields );
// wantedFields is not needed anymore
CleanupStack::PopAndDestroy( &wantedFields );
// Go through the meta data fields and pick the required ones
TInt count = iMetaDataUtility->MetaDataCount();
if ( count > 0 )
{
const CMetaDataFieldContainer& container =
iMetaDataUtility->MetaDataFieldsL();
TMetaDataFieldId fieldId;
for ( TInt index = 0; index < count; index++ )
{
TPtrC content = container.At( index, fieldId );
switch ( fieldId )
{
case EMetaDataSongTitle:
{
iTitle = content.AllocL();
break;
}
case EMetaDataArtist:
{
iArtist = content.AllocL();
break;
}
case EMetaDataAlbum:
{
iAlbum = content.AllocL();
break;
}
case EMetaDataGenre:
{
iGenre = content.AllocL();
break;
}
case EMetaDataDate:
{
iDate = content.AllocL();
break;
}
default:
{
// Nothing to do
break;
}
}
}
}
if( !iDate )
{
// Date was not found from metadata, so get it from file properties
RFs fs;
User::LeaveIfError( fs.Connect() );
CleanupClosePushL( fs );
RFile file;
User::LeaveIfError( file.Open( fs,aFileName, EFileRead |
EFileShareReadersOrWriters ) );
CleanupClosePushL( file );
TTime time;
User::LeaveIfError( file.Modified( time ) );
iDate = UPnPCommonUtils::TTimeToUPnPDateL( time );
CleanupStack::PopAndDestroy( &file );
CleanupStack::PopAndDestroy( &fs );
}
// Cleanup
iMetaDataUtility->ResetL();
}
示例10: TryResumeDownloadL
// -----------------------------------------------------------------------------
// Cfota_engine_api::TryResumeDownload
// TryResumeDownload test method function.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt Cfota_engine_api::TryResumeDownloadL( CStifItemParser& aItem )
{
RSyncMLSession syncSession;
syncSession.OpenL();
CleanupClosePushL(syncSession);
RSyncMLDevManProfile DMProfile;
DMProfile.CreateL( syncSession );
CleanupClosePushL( DMProfile);
DMProfile.SetDisplayNameL(_L("####´53"));
DMProfile.SetServerIdL(_L8("ServerID53"));
DMProfile.SetCreatorId(85);
DMProfile.SetPasswordL(_L8("Password"));
DMProfile.SetServerPasswordL(_L8("ServerPassword"));
DMProfile.SetUserNameL(_L8("Username"));
DMProfile.UpdateL();
RSyncMLConnection connection;
connection.OpenL( DMProfile, KUidNSmlMediumTypeInternet.iUid );
CleanupClosePushL( connection );
TPtrC stringHostaddress;
if( aItem.GetNextString ( stringHostaddress ) == KErrNone )
{
HBufC16* newaddr = stringHostaddress.AllocL();
TBuf8<100> hostAddress((newaddr->Des()).Collapse());
connection.SetServerURIL( hostAddress );
delete newaddr;
}
TSmlProfileId ProfileId = DMProfile.Identifier();
CleanupStack::PopAndDestroy(); // connection
CleanupStack::PopAndDestroy(); // DMProfile
CleanupStack::PopAndDestroy(); // syncSession
session.OpenL();
TInt PkgId = 1;
TBuf8<10> PkgName;
PkgName.Copy(_L8("zkg"));
TBuf8<10> PkgVersion;
PkgVersion.Copy(_L8("1.0"));
TPtrC stringPkgUrl;
if( aItem.GetNextString ( stringPkgUrl ) == KErrNone )
{
HBufC16* newurl = stringHostaddress.AllocL();
TBuf8<100> PkgURL((newurl->Des()).Collapse());
delete newurl;
TInt err = session.Download(PkgId,PkgURL,ProfileId,PkgName,PkgVersion);
if(err)
{
iLog->Log(_L("CFMSInterruptAob::TryResumeDownloadL()- download error"));
return err;
}
}
User::After(5000000*6);
session.Close();
RWsSession iWsSession;
TInt err = iWsSession.Connect();
if(err)
{
iLog->Log(_L("CFMSInterruptAob::TryResumeDownloadL()- Window server session error"));
return err;
}
TApaTask(CCoeEnv::Static()->WsSession());
TApaTaskList tasklist(iWsSession);
TApaTask task=tasklist.FindApp(TUid::Uid(0x101F6DE5));
if(task.Exists())
{
task.KillTask();
}
iWsSession.Close();
User::After(5000000*3);
session.OpenL();
session.TryResumeDownload();
User::After(5000000*3);
return KErrNone;
}
示例11: DownloadL
// -----------------------------------------------------------------------------
// Cfota_engine_api::DownloadL
// DownloadL test method function.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt Cfota_engine_api::DownloadL( CStifItemParser& aItem )
{
RSyncMLSession syncSession;
syncSession.OpenL();
CleanupClosePushL(syncSession);
RSyncMLDevManProfile DMProfile;
DMProfile.CreateL( syncSession );
CleanupClosePushL( DMProfile);
DMProfile.SetDisplayNameL(_L("####´52"));
DMProfile.SetServerIdL(_L8("ServerID52"));
DMProfile.SetCreatorId(85);
DMProfile.SetPasswordL(_L8("Password"));
DMProfile.SetServerPasswordL(_L8("ServerPassword"));
DMProfile.SetUserNameL(_L8("Username"));
DMProfile.UpdateL();
RSyncMLConnection connection;
connection.OpenL( DMProfile, KUidNSmlMediumTypeInternet.iUid );
CleanupClosePushL( connection );
TPtrC stringHostaddress;
if( aItem.GetNextString ( stringHostaddress ) == KErrNone )
{
HBufC16* newaddr = stringHostaddress.AllocL();
TBuf8<100> hostAddress((newaddr->Des()).Collapse());
connection.SetServerURIL( hostAddress );
delete newaddr;
}
TSmlProfileId ProfileId = DMProfile.Identifier();
CleanupStack::PopAndDestroy(); // connection
CleanupStack::PopAndDestroy(); // DMProfile
CleanupStack::PopAndDestroy(); // syncSession
RFotaEngineSession session;
session.OpenL();
TInt PkgId = 1;
TPtrC stringPkgUrl;
if( aItem.GetNextString ( stringPkgUrl ) == KErrNone )
{
HBufC16* newurl = stringHostaddress.AllocL();
TBuf8<100> PkgURL((newurl->Des()).Collapse());
delete newurl;
TBuf8<10> PkgName;
PkgName.Copy(_L8("zkg"));
TBuf8<10> PkgVersion;
PkgVersion.Copy(_L8("1.0"));
TInt err = session.Download(PkgId,PkgURL,ProfileId,PkgName,PkgVersion);
session.Close();
if(KErrNone != err)
{
return err;
}
}
return KErrNone;
}
示例12: ParseConfigLineL
void CWebServerEnv::ParseConfigLineL(const RFs& aFs, const TDesC& aLine)
// Function which parse the config file and set the configuration
{
TLex lex(aLine);
TPtrC value;
TParse parse;
lex.SkipSpaceAndMark();
// SkipCharacters until we find a '='
while ((!lex.Eos()) && (lex.Peek() != '='))
lex.Inc();
TPtrC variable = lex.MarkedToken();
if (!lex.Eos())
{
//Skip the '=' character.
lex.Inc();
lex.SkipSpaceAndMark();
lex.SkipCharacters();
value.Set(lex.MarkedToken());
}
else
value.Set(_L(""));
if (variable.Compare(_L("SERVER_PATH")) == 0)
{
User::LeaveIfError(parse.Set(value,NULL,NULL));
User::LeaveIfError(aFs.Parse(value,parse));
delete iServerPath;
iServerPath = value.AllocL();
}
else if (variable.Compare(_L("CGI_PATH")) == 0)
{
User::LeaveIfError(parse.Set(value,NULL,NULL));
User::LeaveIfError(aFs.Parse(value,parse));
delete iCgiPath;
iCgiPath = value.AllocL();
}
else if (variable.Compare(_L("ERROR_PATH")) == 0)
{
User::LeaveIfError(parse.Set(value,NULL,NULL));
User::LeaveIfError(aFs.Parse(value,parse));
delete iErrorPath;
iErrorPath = value.AllocL();
}
else if (variable.Compare(_L("BACKUP_PATH")) == 0)
{
User::LeaveIfError(parse.Set(value,NULL,NULL));
User::LeaveIfError(aFs.Parse(value,parse));
delete iBackupPath;
iBackupPath = value.AllocL();
}
else if (variable.Compare(_L("DEFAULT_RESOURCE")) == 0)
{
delete iDefaultResource;
iDefaultResource = value.AllocL();
}
else if (variable.Compare(_L("PORT")) == 0)
{
lex.UnGetToMark();
User::LeaveIfError(lex.Val(iPort));
}
else if (variable.Compare(_L("DELETE_METHOD")) == 0)
{
if (value.CompareF(_L("Yes")) == 0)
iDeleteMethod = TRUE;
else
iDeleteMethod = FALSE;
}
else if (variable.Compare(_L("PUT_METHOD")) == 0)
{
if (value.CompareF(_L("Yes")) == 0)
iPutMethod = TRUE;
else
iPutMethod = FALSE;
}
else if (variable.Compare(_L("HTTP_REQ")) == 0)
{
if (value.CompareF(_L("Yes")) == 0)
iHttpReq = TRUE;
else
iHttpReq= FALSE;
}
else if (variable.Compare(_L("HTTP_RESP")) == 0)
{
if (value.CompareF(_L("Yes")) == 0)
iHttpResp = TRUE;
else
iHttpResp= FALSE;
}
else if (variable.Compare(_L("MISC_DATA")) == 0)
{
if (value.CompareF(_L("Yes")) == 0)
iMiscData = TRUE;
//.........这里部分代码省略.........
示例13: ConstructFromResourceL
/*
* Construct attributes using resource file information
* Mainly called by control during initialisation
*/
void CAknNoteAttributes::ConstructFromResourceL(TResourceReader& aRes)
{
delete iNoteText;
iNoteText = NULL;
delete iImageFile;
iImageFile = NULL;
if ( !iBrushAndPenContext && iNoteControl )
{
iBrushAndPenContext=CCoeBrushAndPenContext::NewL();
iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ENullBrush);
iNoteControl->SetControlContext(iBrushAndPenContext);
}
iNoteText = CAknTextControl::NewL(CAknText::ENotFormatted);
iNoteText->ConstructFromResourceL(aRes);
TCallBack cb( StaticPictographCallBack, this );
iNoteText->SetPictographCallBackL( cb );
TransferToControlL(iNoteText);
const TPtrC imageFile = aRes.ReadTPtrC();
iImageFile = imageFile.AllocL();
iImageId = aRes.ReadInt16();
iImageMask = aRes.ReadInt16();
const TPtrC iconFile = aRes.ReadTPtrC();
const TInt iconId = aRes.ReadInt16();
const TInt iconMask = aRes.ReadInt16();
TInt animationId = aRes.ReadUint32();
TInt flagIndexes = aRes.ReadInt16();
TInt majorSkinIdForImage = EAknsMajorNone;
TInt minorSkinIdForImage = EAknsMinorNone;
iFlags.SetValue(flagIndexes);
// Checks whether note is using AVKON_NOTE_SKINNED resource.
if (iFlags.IsSet(ENoteWithSkinnableGraphics))
{
majorSkinIdForImage = aRes.ReadUint32();
minorSkinIdForImage = aRes.ReadUint32();
}
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
if (iImageFile->CompareF(KNullDesC) != 0)
{
iImage = new(ELeave) CEikImage;
// Check for skin icon.
if (iFlags.IsSet(ENoteWithSkinnableGraphics))
{
iSkinIdForImage.Set(majorSkinIdForImage, minorSkinIdForImage);
}
else
{
iSkinIdForImage = GetSkinnedBitmapID(iImageId);
}
CFbsBitmap* bitmap = NULL;
CFbsBitmap* mask = NULL;
AknsUtils::CreateIconL(
skin, iSkinIdForImage,
bitmap, mask,
*iImageFile,
iImageId, iImageMask);
iImage->SetPicture(bitmap,mask);
TransferToControlL(iImage);
// FIXME: Experimental heuristics for finding out popup context from image/animation
#ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
// Check if the image file is the standard one
if ( iImageFile->CompareF( AknIconUtils::AvkonIconFileName() ) == 0 )
{
switch ( iImageId )
{
case EMbmAvkonQgn_note_ok:
CAknTransitionUtils::SetData( ( TInt )iNoteControl,
( TAny* )KGfxConfirmationNoteControlUid.iUid );
break;
case EMbmAvkonQgn_note_error:
CAknTransitionUtils::SetData( ( TInt )iNoteControl,
( TAny* )KGfxErrorNoteControlUid.iUid );
break;
case EMbmAvkonQgn_note_info:
CAknTransitionUtils::SetData( ( TInt )iNoteControl,
( TAny* )KGfxInformationNoteControlUid.iUid );
break;
case EMbmAvkonQgn_note_warning:
CAknTransitionUtils::SetData( ( TInt )iNoteControl,
( TAny* )KGfxWarningNoteControlUid.iUid );
//.........这里部分代码省略.........