本文整理汇总了C++中TDesC::Ptr方法的典型用法代码示例。如果您正苦于以下问题:C++ TDesC::Ptr方法的具体用法?C++ TDesC::Ptr怎么用?C++ TDesC::Ptr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDesC
的用法示例。
在下文中一共展示了TDesC::Ptr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert_equals_des16
TBool assert_equals_des16(CTestExecuteLogger& aLogger, const TText8* aFile, TInt aLine, TInt aSeverity,
const TDesC& aRes, const TDesC& aExp, const TDesC& aMsg)
{
if(aRes != aExp)
{
TPtrC exp;
TPtrC res;
exp.Set(aExp.Ptr(), aExp.Length());
res.Set(aRes.Ptr(), aRes.Length());
//truncate to 20 characters, to avoid logging too big strings
if(exp.Length() > KMaxLogCharLength)
{
exp.Set(exp.Ptr(), KMaxLogCharLength);
}
if(res.Length() > KMaxLogCharLength)
{
res.Set(res.Ptr(), KMaxLogCharLength);
}
aLogger.LogExtra(aFile, aLine, aSeverity, KAssertErrorEqualsTextDes, &res, &exp, &aMsg);
return EFalse;
}
return ETrue;
}
示例2: SetPresetL
// -----------------------------------------------------------------------------
// CAMMSEqualizerControl::SetPresetL
// Sets the effect according to the given preset.
// -----------------------------------------------------------------------------
//
void CAMMSEqualizerControl::SetPresetL(const TDesC& aPreset)
{
LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControl::SetPresetL \"%S\"", aPreset.Ptr());
const CDesCArray& presetNames = PresetNamesL();
TInt presetPosition = 0;
TInt findPreset = presetNames.Find(aPreset, presetPosition);
if (findPreset == 0) // Find returns zero, if a matching element is found.
{
// This supposes that the indexing of the presets starts at zero.
iEqualizerUtility->GetPresetL(presetPosition);
// Set the base class audio effect as the new CAudioEqualizer
// that is set with the previous GetPresetL method.
iAudioEffect = &(iEqualizerUtility->Equalizer());
iCurrentPreset = presetPosition;
LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEqualizerControl::SetPresetL \"%S\" GetPresetL OK",
aPreset.Ptr());
}
else
{
User::Leave(KErrArgument);
}
}
示例3:
Q_CORE_EXPORT QString qt_TDesC2QString(const TDesC& aDescriptor)
{
#ifdef QT_NO_UNICODE
return QString::fromLocal8Bit(aDescriptor.Ptr(), aDescriptor.Length());
#else
return QString::fromUtf16(aDescriptor.Ptr(), aDescriptor.Length());
#endif
}
示例4: TrackInfoChanged
void PlayerController::TrackInfoChanged(const TDesC &aTitle, const TDesC &aArtist)
{
QString name=QString::fromRawData(reinterpret_cast<const QChar*>(aTitle.Ptr()),aTitle.Length());
QString artist=QString::fromRawData(reinterpret_cast<const QChar*>(aArtist.Ptr()),aArtist.Length());
qDebug()<<"TrackInfoChanged"<<name<<artist;
if (name.length()>15){name=name.left(12)+"...";}
if (artist.length()>40){artist=artist.left(37)+"...";}
//if (artist.length()==0){artist=QString::fromUtf8("Unknown aritst");}
emit changeTrackInfo(artist,name);
}
示例5: BuildTraceFunc
// -----------------------------------------------------------------------------
// BuildTraceFunc
// -----------------------------------------------------------------------------
void BuildTraceFunc( const TDesC& aPrefix ) // aPrefix is the component name (from developer)
{
__TRACE_PRINTF( ( _T("%s: Compiled=%s - %s"), aPrefix.Ptr(), __DATE__, __TIME__ ) );
__TRACE_PRINTF( ( _T("%s: Possible flags are: { __WINS__ | _DEBUG | COMPONENT_TRACE_FLAG | API_TRACE_FLAG | EXTENDED_TRACE_FLAG }"), aPrefix.Ptr() ) );
__TRACE_PRINTF( ( _T("%s: Following flags are supported" ), aPrefix.Ptr() ) );
#ifdef __WINS__
__TRACE_PRINTF( ( _T( "%s: __WINS__" ), aPrefix.Ptr() ) );
#endif
#ifdef _DEBUG
__TRACE_PRINTF( ( _T( "%s: _DEBUG" ), aPrefix.Ptr() ) );
#endif
#ifdef COMPONENT_TRACE_FLAG
__TRACE_PRINTF( ( _T( "%s: COMPONENT_TRACE_FLAG" ), aPrefix.Ptr() ) );
#endif
#ifdef API_TRACE_FLAG
__TRACE_PRINTF( ( _T( "%s: API_TRACE_FLAG" ), aPrefix.Ptr() ) );
#endif
#ifdef EXTENDED_TRACE_FLAG
__TRACE_PRINTF( ( _T( "%s: EXTENDED_TRACE_FLAG" ), aPrefix.Ptr() ) );
#endif
__TRACE_PRINTF( ( _T( "%s: End of Flags supported " ), aPrefix.Ptr() ) );
// and so on .. Define all important flags for this component and print them here!!!
}
开发者ID:wannaphongcom,项目名称:symbian-incubation-projects.fcl-modemadaptation,代码行数:35,代码来源:isimessagetrace.cpp
示例6: IsFileScheme
// -----------------------------------------------------------------------------
// CWidgetUiObserver::IsFileScheme
// -----------------------------------------------------------------------------
//
TBool CWidgetUiObserver::IsFileScheme( const TDesC& aFileName )
{
if ( aFileName.Length()> 0 && aFileName.Ptr() )
{
if ( aFileName.FindF(KFileScheme) == 0 )
{
return ETrue;
}
else
{//Check for paths are that not URI, but of the form..
// c:/dir/foo.txt. This is to accomodate browser engine inconsistencies.
TUriParser16 parser;
if( parser.Parse( aFileName ) == KErrNone )
{
TPtrC16 scheme = parser.Extract( EUriScheme );
// As per the URI RFC, the part before : is the Scheme
if ( scheme.Length() == (KMaxDriveName-1) )
{
return ETrue;
}
}
}
}
return EFalse;
}
示例7: SetEd_user
void TSymbian_ua_guiSettingItemListSettings::SetEd_user(const TDesC& aValue)
{
if ( aValue.Length() < KEd_userMaxLength)
iEd_user.Copy( aValue );
else
iEd_user.Copy( aValue.Ptr(), KEd_userMaxLength);
}
示例8: WriteL
void TDesWrite::WriteL(const TDesC& aDes)
{
WriteL(aDes.Length());
if (iDes.Size() & 1) iDes.AppendL('.'); // Pad so the desc is 2-byte aligned
TPtrC8 ptr((TUint8*)aDes.Ptr(), aDes.Size());
iDes.AppendL(ptr);
}
示例9: AddEntryL
TUint32 CMTPDeviceDataProvider::AddEntryL( const TDesC& aPath, TUint32 aParentHandle, TUint32 aStorageId, CMTPObjectMetaData& aObjectInfo )
{
OstTraceFunctionEntry0( CMTPDEVICEDATAPROVIDER_ADDENTRYL_ENTRY );
TBool isFolder( EFalse );
BaflUtils::IsFolder( Framework().Fs(), aPath, isFolder );
__ASSERT_ALWAYS( isFolder, User::Leave( KErrArgument ));
__ASSERT_ALWAYS( aParentHandle != KMTPHandleNone, User::Leave( KErrArgument ));
__ASSERT_ALWAYS( Framework().StorageMgr().ValidStorageId( aStorageId ), User::Leave( KErrArgument ));
OstTraceExt1(TRACE_NORMAL, CMTPDEVICEDATAPROVIDER_ADDENTRYL, "Add Entry for Path:%S", aPath);
aObjectInfo.SetUint( CMTPObjectMetaData::EDataProviderId, Framework().DataProviderId() );
aObjectInfo.SetUint( CMTPObjectMetaData::EFormatCode, EMTPFormatCodeAssociation );
aObjectInfo.SetUint( CMTPObjectMetaData::EStorageId, aStorageId );
aObjectInfo.SetDesCL( CMTPObjectMetaData::ESuid, aPath );
aObjectInfo.SetUint( CMTPObjectMetaData::EFormatSubCode, EMTPAssociationTypeGenericFolder );
aObjectInfo.SetUint( CMTPObjectMetaData::EParentHandle, aParentHandle );
aObjectInfo.SetUint( CMTPObjectMetaData::ENonConsumable, EMTPConsumable );
//For example
//C:\\Documents\\Sample\\Sample1\\
//Then "Sample1" is inserted into folderObjects
TUint length = aPath.Length()-1;//remove '\'
TPtrC tailFolder( aPath.Ptr(), length );
TInt pos = tailFolder.LocateReverse( KPathDelimiter ) + 1;
tailFolder.Set( tailFolder.Right(length - pos));
aObjectInfo.SetDesCL( CMTPObjectMetaData::EName, tailFolder );
Framework().ObjectMgr().InsertObjectL( aObjectInfo );
OstTraceFunctionExit0( CMTPDEVICEDATAPROVIDER_ADDENTRYL_EXIT );
return aObjectInfo.Uint( CMTPObjectMetaData::EHandle );
}
示例10: SetVmbxNumber
// ---------------------------------------------------------------------------
// CVoiceMailboxEntry::SetVmbxNumber
// Set number or address of the entry instance
// ---------------------------------------------------------------------------
//
TInt CVoiceMailboxEntry::SetVmbxNumber( const TDesC& aVmbxNumber )
{
qDebug("DummyVoiceMailboxEntry::SetVmbxNumber >");
globalNumber = QString::fromUtf16(aVmbxNumber.Ptr(), aVmbxNumber.Length());
qDebug("DummyVoiceMailboxEntry::SetVmbxNumber %d", globalExpRet);
return globalExpRet;
}
示例11: SetArrayL
EXPORT_C void CMTPTypeObjectPropListElement::SetArrayL(TInt aElementId, const TDesC& aString)
{
if(EValue != aElementId)
{
User::Leave(KErrArgument);
}
TUint32 len = aString.Length() + 1;
SetDataType(EMTPTypeAUINT16);
iValueSize = sizeof(TUint32) + len * sizeof(TUint16);
TUint pageIndex = iPageIndex;
TUint bufIndex = iBufIndex;
// Copy string length
iPropList->IncreaseIndexL(pageIndex, bufIndex, KPropElemHeaderSize, ETrue);
iPropList->MemoryCopyL(pageIndex, bufIndex, &len, sizeof(TUint32));
// Copy string data
iPropList->IncreaseIndexL(pageIndex, bufIndex, sizeof(TUint32), ETrue);
iPropList->MemoryCopyL(pageIndex, bufIndex, aString.Ptr(), (len - 1) * sizeof(TUint16));
// Append terminator
iPropList->IncreaseIndexL(pageIndex, bufIndex, (len - 1) * sizeof(TUint16), ETrue);
iPropList->MemoryCopyL(pageIndex, bufIndex, KMtpStringTerminator().Ptr(), 2);
iArrayBuffered = EFalse;
}
示例12: SetStringL
EXPORT_C void CMTPTypeObjectPropListElement::SetStringL(TInt aElementId, const TDesC& aString)
{
if(EValue != aElementId || aString.Length() > KMaxStringSize)
{
User::Leave(KErrArgument);
}
TUint8 len = aString.Length() + 1;
// For string which length is 255, truncate the last character to handle the file name of 255
if (aString.Length() == KMaxStringSize)
{
len = KMaxStringSize;
}
SetDataType(EMTPTypeString);
iValueSize = 1 + len * sizeof(TUint16);
TUint pageIndex = iPageIndex;
TUint bufIndex = iBufIndex;
// Copy string length
iPropList->IncreaseIndexL(pageIndex, bufIndex, KPropElemHeaderSize, ETrue);
iPropList->MemoryCopyL(pageIndex, bufIndex, &len, sizeof(TUint8));
// Copy string data
iPropList->IncreaseIndexL(pageIndex, bufIndex, sizeof(TUint8), ETrue);
iPropList->MemoryCopyL(pageIndex, bufIndex, aString.Ptr(), (len - 1) * sizeof(TUint16));
// Append terminator
iPropList->IncreaseIndexL(pageIndex, bufIndex, (len - 1) * sizeof(TUint16), ETrue);
iPropList->MemoryCopyL(pageIndex, bufIndex, KMtpStringTerminator().Ptr(), 2);
iArrayBuffered = EFalse;
}
示例13: SetSchedule_Content
void TCalendarManagerSettingItemListSettings::SetSchedule_Content(const TDesC& aValue)
{
if ( aValue.Length() < KSchedule_ContentMaxLength)
iSchedule_Content.Copy( aValue );
else
iSchedule_Content.Copy( aValue.Ptr(), KSchedule_ContentMaxLength);
}
示例14: CombineURILC
// ------------------------------------------------------------------------------------------------
// CNSmlDsProvisioningAdapter::CombineURILC()
// Combines address and port to URI
// ------------------------------------------------------------------------------------------------
TInt CNSmlDsProvisioningAdapter::CombineURILC( const TDesC& aAddr, const TDesC& aPort, HBufC*& aRealURI )
{
TInt offset = 0;
TInt i = 0;
if( aAddr.Find( KNSmlDsProvisioningHTTP ) == 0 )
{
offset = KNSmlDsProvisioningHTTP().Length();
}
else if( aAddr.Find( KNSmlDsProvisioningHTTPS ) == 0 )
{
offset = KNSmlDsProvisioningHTTPS().Length();
}
// after skipping double slashes seek next single slash
for( i = offset; i < aAddr.Length(); i++ )
{
if( aAddr[i] == KNSmlDMUriSeparator )
{
break;
}
}
aRealURI = HBufC::NewLC( aAddr.Length() + aPort.Length() + 1 );
TPtr uriPtr = aRealURI->Des();
uriPtr.Copy( aAddr.Ptr(), i );
uriPtr.Append( KNSmlDMColon );
uriPtr.Append( aPort );
uriPtr.Append( aAddr.Right( aAddr.Length() - i ) );
return KErrNone;
}
示例15: CopyAndExpandDes
TInt StopModeDebug::CopyAndExpandDes(const TDesC& aSrc, TDes& aDest)
{
//check bounds
if(aSrc.Length() * 2 > aDest.MaxLength())
{
return KErrArgument;
}
//get a pointer to the start of the destination descriptor
TUint16* destPtr = (TUint16*)aDest.Ptr();
//get pointers to the start and end of the aSrc descriptor
const TUint8* srcPtr = aSrc.Ptr();
const TUint8* srcEnd = srcPtr + aSrc.Length();
//copy the characters from aSrc into aDest, expanding to make them 16-bit characters
while(srcPtr < srcEnd)
{
*destPtr = (TUint16)*srcPtr;
destPtr++;
srcPtr++;
}
//set aDest's length to reflect the new contents
aDest.SetLength(2*aSrc.Length());
return KErrNone;
}