本文整理汇总了C++中TDesC类的典型用法代码示例。如果您正苦于以下问题:C++ TDesC类的具体用法?C++ TDesC怎么用?C++ TDesC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TDesC类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetImageFileNameL
void CHuiTexture::SetImageFileNameL(const TDesC& aFileName)
{
delete iImageFileName;
iImageFileName = 0;
iImageFileName = aFileName.AllocL();
}
示例2: ParseL
// ---------------------------------------------------------
// TDdParser::ParseL()
// ---------------------------------------------------------
//
void TDdParser::ParseL( const TDesC& aBuf, CCodData& aData, const TBool aIsDd2, TBool& aIsLicenseTag )
{
CLOG(( EParse, 2, _L("-> TDdParser::ParseL") ));
CDUMP(( EParse, 2, _S("Buf:"), _S(" "), \
(const TUint8*)aBuf.Ptr(), aBuf.Size() ));
iError = KErrNone;
iData = &aData;
// XML Parser expects the buffer contain a BOM and be in
// network byte order (this is hard-coded into cXmlParser).
// We already have the buffer converted to UCS-2, native byte order, BOM
// removed, and this cannot be changed without changing API.
// So we have to re-add BOM and convert the buffer back to network byte
// order. This is an annoying a waste, luckily a DD file is small
// enough not to be significant.
HBufC* buf = HBufC::NewLC( aBuf.Length() + 1 );
buf->Des().Append( 0xFFFE ); // Add BOM, little endian as aBuf.
buf->Des().Append( aBuf ); // Append buffer.
// Now turn the whole buffer big-endian.
TUint8* ptr = (TUint8*)buf->Ptr();
for ( TInt i = 0; i < buf->Size(); i += 2 )
{
TUint8 tmp = ptr[i];
ptr[i] = ptr[i + 1];
ptr[i + 1] = tmp;
}
NW_WBXML_Dictionary_t* dictArray[ 1 ] =
{ (NW_WBXML_Dictionary_t*)&NW_DdDummy_WBXMLDictionary };
RNwWbxmlDictionary wbxmlDict;
User::LeaveIfError( wbxmlDict.Initialize( 1, dictArray ) );
CleanupClosePushL<RNwWbxmlDictionary>( wbxmlDict );
NW_TinyDom_Handle_t domHandle;
NW_Status_t stat;
CNwDomDocumentNode* docNode = new (ELeave) CNwDomDocumentNode();
CleanupStack::PushL( docNode );
docNode->iDocNode = CXML_DOM_DocumentNode_BuildTree
(
&domHandle,
(NW_Byte*)buf->Ptr(),
(NW_Int32)buf->Size(),
/*encoded=*/NW_FALSE,
/*publicID=*/NW_DdDummy_PublicId,
/*extTNotStringTable=*/NW_FALSE,
&stat
);
LeaveIfNwErrorL( stat );
User::LeaveIfNull( docNode->iDocNode ); // Safety code.
if (!aIsDd2)
{
DocNodeL( docNode->iDocNode );
}
else
{
iIsLicenseTag = EFalse;
ParseDd2DocNodeL( docNode->iDocNode );
}
CleanupStack::PopAndDestroy( 3, buf ); // docNode, close wbxmlDict, buf
#ifdef __TEST_COD_LOG
TPtrC ptr16;
TPtrC8 ptr8;
CLOG(( EParse, 3, _L("TCodParser::ParseL data:") ));
ptr16.Set( aData.Name() );
CLOG(( EParse, 3, _L(" Name<%S>"), &ptr16 ));
ptr16.Set( aData.Vendor() );
CLOG(( EParse, 3, _L(" Vendor<%S>"), &ptr16 ));
ptr16.Set( aData.Description() );
CLOG(( EParse, 3, _L(" Desc<%S>"), &ptr16 ));
CLOG(( EParse, 3, _L(" Size(%d)"), aData.Size() ));
ptr8.Set( aData.InstallNotify() );
CLOG(( EParse, 3, _L8(" InstNotif<%S>"), &ptr8 ));
ptr8.Set( aData.NextUrl() );
CLOG(( EParse, 3, _L8(" NextUrl<%S>"), &ptr8 ));
ptr8.Set( aData.NextUrlAtError() );
CLOG(( EParse, 3, _L8(" NextUrlAtErr<%S>"), &ptr8 ));
ptr8.Set( aData.InfoUrl() );
CLOG(( EParse, 3, _L8(" InfoUrl<%S>"), &ptr8 ));
ptr16.Set( aData.Price() );
CLOG(( EParse, 3, _L(" Price<%S>"), &ptr16 ));
ptr8.Set( aData.Icon() );
CLOG(( EParse, 3, _L8(" Icon<%S>"), &ptr8 ));
//TODO add logs for OMA 2
#endif /* def __TEST_COD_LOG */
//If there are no media objects present to download,
if( !iData->Count() )
{
User::Leave( KErrCodInvalidDescriptor );
}
// NULL data for clarity. These are never used later, but don't keep
// pointers to objects which are out of reach.
iData = NULL;
User::LeaveIfError( iError );
aIsLicenseTag = iIsLicenseTag;
//.........这里部分代码省略.........
示例3: ConstructL
// ---------------------------------------------------------
// CContextbookContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CContextbookContainer::ConstructL(const TRect& aRect, phonebook_i* i_book, bool i_searchable, const TDesC& title, Cfile_output_base * aLog, CAknIconArray * aIconlist, TInt current_item_index, TInt top_item_index, TBuf<20> current_filter)
{
CALLSTACKITEM(_L("CContextbookContainer::ConstructL"));
iCurrentContactId=KErrNotFound;
iconlist = new (ELeave) CAknIconArray(30);
//copy
for (TInt i = 0; i< aIconlist->Count();i++)
{
CGulIcon * ic, *icon_from;
icon_from= (*aIconlist)[i];
ic=CGulIcon::NewL( icon_from->Bitmap(), icon_from->Mask());
ic->SetBitmapsOwnedExternally(ETrue);
iconlist->AppendL( ic );
}
iLog = aLog;
CreateWindowL();
CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
HBufC* t=HBufC::NewL(title.Length());
*t=title;
tp->SetText(t);
if (iLog) {
iLog->write_time();
iLog->write_to_output(_L("Showing "));
iLog->write_to_output(title);
iLog->write_nl();
}
sendui=CSendAppUi::NewL(0);
searchable=i_searchable;
resource_files=new (ELeave) CArrayFixFlat<TInt>(5);
// for phonebook dialogs
TFileName resfile=_L("z:\\System\\data\\PBKVIEW.rSC");
BaflUtils::NearestLanguageFile(iEikonEnv->FsSession(), resfile); //for localization
resource_files->AppendL(iEikonEnv->AddResourceFileL(resfile));
book=i_book;
book->set_observer(this);
listbox=new (ELeave) doublelinebox(book,iLog);
listbox->SetContainerWindowL(*this);
listbox->ConstructL(this, EAknListBoxSelectionList);
listbox->SetItemHeightL(40);
listbox->View()->SetMatcherCursor(EFalse);
listbox->ItemDrawer()->FormattedCellData()->SetIconArray(iconlist);
listbox->SetListBoxObserver(this);
listbox->Model()->SetItemTextArray(book->get_array());
listbox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);
listbox->CreateScrollBarFrameL(ETrue);
listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
listbox->SetCurrentItemIndex(current_item_index);
listbox->SetTopItemIndex(top_item_index);
if (is_searchable())
{
edit=new (ELeave) CEikEdwin;
edit->SetBorder(TGulBorder::ESingleBlack);
edit->SetContainerWindowL(*this);
edit->ConstructL();
edit->AddEdwinObserverL(this);
edit->SetFocus(ETrue);
edit->SetTextL(¤t_filter);
filter();
}
phone=new (ELeave) phonehelper;
phone->ConstructL();
globalNote=CAknGlobalNote::NewL();
pbkengine=CPbkContactEngine::Static();
if (pbkengine) {
owns_engine=false;
} else {
pbkengine=CPbkContactEngine::NewL();
owns_engine=true;
}
SetRect(aRect);
ActivateL();
}
示例4: SetEmailAddressL
EXPORT_C void CImSSmtpSettings::SetEmailAddressL( const TDesC& aEmailAddress )
{
HBufC* newEmailAddress = aEmailAddress.AllocL();
delete iEmailAddress;
iEmailAddress = newEmailAddress;
}
示例5: SetMetaAttrL
// ---------------------------------------------------------
// TDdParser::SetMetaAttrL()
// ---------------------------------------------------------
//
void TDdParser::SetMetaAttrL( TDdAttr aAttr, const TDesC& aValue, CMediaObjectData *& aMediaObject )
{
TInt ok( ETrue );
switch( aAttr )
{
case EDdName:
{
if ( !aMediaObject->Name().Length() )
{
ok = aMediaObject->SetNameL( aValue );
}
break;
}
case EDdDescription:
{
if ( !aMediaObject->Description().Length() )
{
ok = aMediaObject->SetDescriptionL( aValue );
}
break;
}
case EDdInstallNotify:
{
if ( !aMediaObject->InstallNotify().Length() )
{
ok = aMediaObject->SetInstallNotifyL( aValue );
}
break;
}
case EDdInfoUrl:
{
if ( !aMediaObject->InfoUrl().Length() )
{
ok = aMediaObject->SetInfoUrlL( aValue );
}
break;
}
case EDdIcon:
{
if ( !aMediaObject->Icon().Length() )
{
ok = aMediaObject->SetIconL( aValue );
}
break;
}
case EDdOrder:
{
TBool isPostOrder( EFalse );
if ( !aValue.CompareF( KDdPost ) )
{
isPostOrder = ETrue;
}
else if ( aValue.CompareF( KDdAny ) )
{
// Expected 'post' or 'any'
Error( KErrCodInvalidDescriptor );
break;
}
aMediaObject->SetOrderIsPost( isPostOrder );
break;
}
case EDdText:
{
//TODO for OMA2
/*
if ( !iData->Text().Length() )
{
ok = iData->SetTextL( aValue );
}
*/
break;
}
default:
{
// Unexpected value.
CodPanic( ECodInternal );
}
}
if ( !ok )
{
Error( KErrCodInvalidDescriptor );
}
}
示例6: SetErrorPathL
void CWebServerEnv::SetErrorPathL(const TDesC& aErrorPath)
{
delete iErrorPath;
iErrorPath = aErrorPath.AllocL();
}
示例7: HexToDec
TBool CCommonUtils::HexToDec(const TDesC& aHexDes,TInt& aDec)
{
TInt i,mid;
TInt len = aHexDes.Length();//lstrlen( aHexDes );
//if( len > 9 )//#00ff00ff?
// return EFalse;
mid = 0; aDec = 0;
for( i = 0;i < len; i++ )
{
if( (aHexDes.Ptr())[i]>='0' && (aHexDes.Ptr())[i]<='9' )
{
mid = (aHexDes.Ptr())[i]-'0';
}
else if( (aHexDes.Ptr())[i]>='a'&& (aHexDes.Ptr())[i]<='f' )
{
mid = (aHexDes.Ptr())[i] -'a' +10;
}
else if( (aHexDes.Ptr())[i]>='A'&& (aHexDes.Ptr())[i]<='F' )
{
mid = (aHexDes.Ptr())[i] -'A' +10;
}
else if ((aHexDes.Ptr())[i] == '#')
{
continue;
}
else
{
return EFalse;
}
mid <<= ((len-i-1)<<2);
aDec |= mid;
}
return ETrue;
}
示例8: mode
/**
Retrieves the database system settings from the settings table.
@param aDbName Logical database name: "main" for the main database or attached database name,
@param aCollationDllName Output parameter, will contain the stored collation dll name,
@param aDbConfigFileVersion Output parameter, will contain the stored database config file version,
@param aSettingsVersion Output parameter, will contain the version of the settings table.
@param aCompactionMode Output parameter. Database compaction mode (one of TSqlCompactionMode enum item values except ESqlCompactionNotSet).
@see TSqlCompactionMode
@leave KErrGeneral, either unable to retrieve the data from the settings table or the
stored table version or config file version is invalid or the stored compaction mode is invalid.
KErrOverflow, aCollationDllName is not large enough to store the name of the
collation dll that is stored in the settings table.
KErrNoMemory, an out of memory condition has occurred.
Note that the function may also leave with other system-wide error codes or SQL
errors of ESqlDbError type
@panic SqlDb 2 In _DEBUG mode if iDbHandle is NULL (uninitialized TSqlDbSysSettings object).
*/
void TSqlDbSysSettings::GetSettingsL(const TDesC& aDbName, TDes& aCollationDllName, TInt& aDbConfigFileVersion,
TInt& aSettingsVersion, TSqlCompactionMode& aCompactionMode)
{
__ASSERT_DEBUG(iDbHandle != NULL, __SQLPANIC(ESqlPanicInvalidObj));
HBufC* buf = HBufC::NewLC(sizeof(KGetSettingsSql) + aDbName.Length());
TPtr sql = buf->Des();
//Prepare statement handle
sql.Format(KGetSettingsSql(), &aDbName);
sqlite3_stmt* stmtHandle = ::StmtPrepare16L(iDbHandle, sql);
CleanupStack::PushL(TCleanupItem(&FinalizeStatementHandle, stmtHandle));
//Move to the first record
TInt err = ::StmtNext(stmtHandle);
__SQLLEAVE_IF_ERROR(err);
//Check that it is a valid row. The error is checked on the previous line.
//The "if" bellow will check whether there is a valid record or not.
if(err != KSqlAtRow)
{
__SQLLEAVE(KErrGeneral);
}
//Get the system settings version
aSettingsVersion = sqlite3_column_int(stmtHandle, KSysVersionColIdx);
if(aSettingsVersion < ESqlSystemVersion1)
{
__SQLLEAVE(KErrGeneral);
}
if(aSettingsVersion > ESqlSystemVersion2)
{
//The "ConfigFileVersion" column exists and is used to store the most recent
//version of the database's config file (if there is one) that has
//been successfully processed
aDbConfigFileVersion = sqlite3_column_int(stmtHandle, KConfigFileVersionColIdx);
if(aDbConfigFileVersion < KSqlNullDbConfigFileVersion)
{
__SQLLEAVE(KErrGeneral);
}
//The "CollationDllName" column exists and its value can be read.
//The column type might be different than SQLITE_TEXT - malformed database.
if(sqlite3_column_type(stmtHandle, KCollationDllNameColIdx) != SQLITE_TEXT)
{
__SQLLEAVE(KErrGeneral);
}
const void* ptr = sqlite3_column_text16(stmtHandle, KCollationDllNameColIdx);
//Null column value - this might be an indication of an "out of memory" problem, if the column text
//is in UTF8 format. (sqlite3_column_text16() may allocate memory for UTF8->UTF16 conversion)
__SQLLEAVE_IF_NULL(const_cast<void*>(ptr));
TPtrC16 src(reinterpret_cast <const TUint16*> (ptr));
if(src.Length() > aCollationDllName.MaxLength())
{
__SQLLEAVE(KErrOverflow);
}
aCollationDllName.Copy(src);
}
if(aSettingsVersion > ESqlSystemVersion3)
{
aCompactionMode = static_cast <TSqlCompactionMode> (sqlite3_column_int(stmtHandle, KCompactionModeColIdx));
if(aCompactionMode != ESqlCompactionManual && aCompactionMode != ESqlCompactionBackground && aCompactionMode != ESqlCompactionAuto)
{
__SQLLEAVE(KErrGeneral);
}
}
CleanupStack::PopAndDestroy();//TCleanupItem(&FinalizeStatementHandle, stmtHandle)
CleanupStack::PopAndDestroy(buf);
}
示例9: StoreAttributesL
// ---------------------------------------------------------
// CNSmlDsProvisioningAdapter::StoreAttributesL
// ---------------------------------------------------------
void CNSmlDsProvisioningAdapter::StoreAttributesL( const TDesC& aType )
{
_DBG_FILE("CNSmlDsProvisioningAdapter::StoreAttributesL(): begin");
TInt iDataProvElementCount = iProfiles[iProfiles.Count()-1]->iDataProvElement.Count()-1;
// Leave if aType cannot be assigned
if( ( aType.Length() > 0 ) &&
( iProfiles[iProfiles.Count()-1]->iDataProvElement[iDataProvElementCount]->iRemoteDBUri ) )
{
TBool dataProvIdFoundInZ = FALSE;
TSmlDataProviderId firstDataProvIdFound = 0;
TSmlDataProviderId uidFound = 0;
TBool doSearch = ETrue;
if ( aType.FindF( KXVcardMimeType ) != KErrNotFound )
{
if ( IsOperatorProfile( *iProfiles[iProfiles.Count()-1] ) )
{
const CNSmlDsProfileElement& profile = *iProfiles[iProfiles.Count()-1];
StoreOperatorUrlL( *profile.iHostAddress );
// Do not make a search through adapter implementations
doSearch = EFalse;
uidFound = OperatorAdapterUid();
if ( !uidFound )
{
// If OperatorAdapterUid returns 0, do a search
doSearch = ETrue;
}
}
}
// look through every implementation adapter until one found
// which supports MIME type in question
// The first one located in ROM is chosen. If none found in ROM then
// the first adapter found is chosen.
HBufC8 *type = HBufC8::NewLC(aType.Size());
TPtr8 typePtr = type->Des();
CnvUtfConverter::ConvertFromUnicodeToUtf8( typePtr, aType);
// get list of dataproviderIds
RImplInfoPtrArray implArray;
CleanupStack::PushL( PtrArrCleanupItemRArr( CImplementationInformation, &implArray ) );
TUid ifUid = { KNSmlDSInterfaceUid };
REComSession::ListImplementationsL( ifUid, implArray );
if ( doSearch )
{
TInt countProviders = implArray.Count();
for( TInt i = 0; i < countProviders; i++ )
{
CImplementationInformation* implInfo = implArray[i];
RSyncMLDataProvider dataProvider;
dataProvider.OpenL( iSession, implInfo->ImplementationUid().iUid );
CleanupClosePushL( dataProvider );
TInt mimeTypeCount = dataProvider.MimeTypeCount();
for( TInt j = 0; j < mimeTypeCount; j++ )
{
HBufC* mimeType = dataProvider.MimeType( j ).AllocLC();
TPtrC8 convMimeType = ConvertTo8LC( *mimeType );
if( typePtr.Find( convMimeType ) == 0)
{
// MIME type in question was found
uidFound = implInfo->ImplementationUid().iUid;
if( firstDataProvIdFound == 0 )
{
// save the first in case of none found from ROM
firstDataProvIdFound = uidFound;
}
// check whether the provider is located in ROM (drive Z)
if( implInfo->Drive() == EDriveZ )
{
dataProvIdFoundInZ = TRUE;
}
}
CleanupStack::PopAndDestroy(2); // mimetype, ConvertTo8LC
if( uidFound )
{
break;
}
}
CleanupStack::PopAndDestroy(); // dataProvider
if ( dataProvIdFoundInZ )
{
break;
}
else
{
//.........这里部分代码省略.........
示例10: SetAdvInUse
// ---------------------------------------------------------------------------
// CIRAdvertisement::SetAdvInUse()
// Function to set the advertisement in use
// ---------------------------------------------------------------------------
//
EXPORT_C void CIRAdvertisement::SetAdvInUse( const TDesC& aAdvInUse )
{
IRLOG_DEBUG( "CIRAdvertisement::SetAdvInUse - Entering" );
iAdvInUse = aAdvInUse.Alloc();
IRLOG_DEBUG( "CIRAdvertisement::SetAdvInUse - Exiting." );
}
示例11: SetActionIdL
void CMtfTestAction::SetActionIdL(const TDesC& aActionId)
{
iActionId = aActionId.AllocL();
}
示例12: ConstructL
void ConstructL(const TDesC& aText) { iText = aText.AllocL(); }
示例13:
/**
Description:Function is intended to set the integrity password
@param aIntegrityPassword, contains the integrity password
@internalTechnology
@test
*/
void CPkcs12Parser::SetIntegrityPasswordL(const TDesC& aIntegrityPassword)
{
iIntegrityPassword = aIntegrityPassword.AllocL();
}
示例14: ConstructL
void CTextModeTestMultiTrans::ConstructL(const TDesC& aHostName)
{
iHostName = HBufC8::NewL(aHostName.Length());
iHostName->Des().Copy(aHostName);
}
示例15: SetServerPathL
void CWebServerEnv::SetServerPathL(const TDesC& aServerPath)
{
delete iServerPath;
iServerPath = aServerPath.AllocL();
}