当前位置: 首页>>代码示例>>C++>>正文


C++ TDesC16类代码示例

本文整理汇总了C++中TDesC16的典型用法代码示例。如果您正苦于以下问题:C++ TDesC16类的具体用法?C++ TDesC16怎么用?C++ TDesC16使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TDesC16类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: generatedFirstPartOfUnicode

/**
@SYMTestCaseID          SYSLIB-CHARCONV-CT-0538
@SYMTestCaseDesc        Splitting and converting from EucJpPacked to Unicode test
@SYMTestPriority        Medium
@SYMTestActions         Tests for conversion after splitting, from EucJpPacked to Unicode and back to EucJpPacked
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
void CT_EUCJP_PACKED_2::TestSplittingConvertingToUnicodeFromEucJpPacked(CCnvCharacterSetConverter& aCharacterSetConverter, TInt aMaximumLengthLowerLimit, TInt aMaximumLengthUpperLimit, TInt aExpectedNumberOfEucJpPackedBytesNotConvertedAtSplit, TInt aExpectedLengthOfFirstPartOfUnicode, const TDesC16& aExpectedUnicode, const TDesC8& aOriginalEucJpPacked)
	{
	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0538 "));
	test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
	test(aMaximumLengthUpperLimit<=KBufferLength);
	TUint16 unicodeBuffer[KBufferLength];
	for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
		{
		TPtr16 generatedFirstPartOfUnicode(unicodeBuffer, i);
		TInt state=CCnvCharacterSetConverter::KStateDefault;
		test(aCharacterSetConverter.ConvertToUnicode(generatedFirstPartOfUnicode, aOriginalEucJpPacked, state)==aExpectedNumberOfEucJpPackedBytesNotConvertedAtSplit);
		test(generatedFirstPartOfUnicode==aExpectedUnicode.Left(aExpectedLengthOfFirstPartOfUnicode));
		test(state==CCnvCharacterSetConverter::KStateDefault);
		TBuf16<KBufferLength> generatedSecondPartOfUnicode;
		test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, aOriginalEucJpPacked.Right(aExpectedNumberOfEucJpPackedBytesNotConvertedAtSplit), state)==0);
		test(generatedSecondPartOfUnicode==aExpectedUnicode.Mid(aExpectedLengthOfFirstPartOfUnicode));
		test(state==CCnvCharacterSetConverter::KStateDefault);
		TBuf8<KBufferLength> generatedEucJpPacked;
		test(aCharacterSetConverter.ConvertFromUnicode(generatedEucJpPacked, generatedFirstPartOfUnicode)==0);
		TBuf8<KBufferLength> generatedSecondPartOfEucJpPacked;
		test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfEucJpPacked, generatedSecondPartOfUnicode)==0);
		generatedEucJpPacked.Append(generatedSecondPartOfEucJpPacked);
		test(generatedEucJpPacked==aOriginalEucJpPacked);
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:33,代码来源:t_eucjp_packed_2.cpp

示例2: Set

/** Sets an existing descriptor setting to a new value or creates a new setting
with a descriptor value if it doesn't exist.
@param aKey Key of setting to be written to.
@param aValue Value to be written.
@return
	KErrNone if successful,
	KErrArgument if aValue is longer than KMaxUnicodeStringLength or
	the setting exists but is not a descriptor,
	plus other system-wide error codes.
@post
	Transactions fail on all error conditions.
	Outside transactions: on success the new value is persistent,
	on failure the repository is unmodified.
@capability Dependent Caller must satisfy the write access policy of that key in the repository.
*/
EXPORT_C TInt CRepository::Set(TUint32 aKey, const TDesC16& aValue)
	{
	if (aValue.Length()>KMaxUnicodeStringLength)
		return KErrArgument;	
	TPtrC8 pVal((const TUint8*)aValue.Ptr(), aValue.Length()*2);
	return Set(aKey,pVal);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:22,代码来源:pccenrep.cpp

示例3: Write

// ==========================================================================
// METHOD:  Write
//
// DESIGN:  Write the given buffer.  Chunk the string if it is longer than
//          KMaxTextPerLine. 
// ==========================================================================
void CLogFileHandler::Write( const TDesC8&  aClassName,
                             const TDesC8&  aFuncName,
                             const TDesC16& aDes )
    {
    TRAP_IGNORE( AddTimestampToOutputBufferL() );
        
    TInt prefixLength = iOutputBuffer.Length();
        
    TRAP_IGNORE( AddClassAndFunctionToOutputBufferL( aClassName, aFuncName ) );
            
    TInt curPos = 0;
    
	while( curPos < aDes.Length() )
	    {
        TInt lengthToWrite = Min( KMaxTextPerLine - iOutputBuffer.Length(), aDes.Length() - curPos );
        
		TRAP_IGNORE( WriteLineL( aDes.Mid( curPos, lengthToWrite ) ) );
		    
		iOutputBuffer.SetLength( prefixLength );
				    
		curPos += lengthToWrite;

    	} // end while
    
    } // END Write
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:31,代码来源:DebugLog.cpp

示例4: SetFieldInfoL

// ---------------------------------------------------------------------------
// From MsearchInfo class.
// CSearchInfoImp::SetFieldInfoL()
// ---------------------------------------------------------------------------
//
void CSearchInfoImp::SetFieldInfoL(const TDesC16& aFieldInfo ,TInfoType aType) 
    
    {
    switch(aType)
	     {
	   	 case EFirstName:
		   	 {
		   	 HBufC16* buf = aFieldInfo.AllocL();
    		 iFirstname.Close();
    		 iFirstname.Assign( buf );
		   	 break;
		   	 }
	   	 case ELastName:
		   	 {
		   	 HBufC16* buf= aFieldInfo.AllocL();
    		 iLastname.Close();
             iLastname.Assign( buf );
		   	 break;	
		   	 }
	   	 case EEmailAddress:
		   	 {
		   	 HBufC16* buf = aFieldInfo.AllocL();
    		 iEmailId.Close();
    		 iEmailId.Assign( buf );
		   	 break;	
		   	 }
	   
	     }
   
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:35,代码来源:searchinfoimp.cpp

示例5: ActivateViewL

void CTestVwAppUi::ActivateViewL(const TVwsViewId& aViewId,TUid aCustomMessageId,const TDesC16& aCustomMessage)
	{
	HBufC8* narrowMessage=HBufC8::NewLC(aCustomMessage.Size());
	TPtr8 ptr=narrowMessage->Des();
	ptr.Copy((TUint8*)aCustomMessage.Ptr(),aCustomMessage.Size());

	CCoeAppUi::ActivateViewL(aViewId,aCustomMessageId,*narrowMessage);
	CleanupStack::PopAndDestroy(); // narrowMessage.
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:9,代码来源:tvwappui.CPP

示例6: FindL

/** Finds all the settings that match the specification given by aPartialKey
and aMask, but are either not string values or do not match the given string.
@param aPartialKey
	Contains a bit pattern that all the keys returned must at least partially
	match.
@param aMask
	Has bits set for all the bits in aPartialKey that must match the returned
	keys.
@param aValue
	Settings for the keys found will be settings that either contain values
	that are not strings or strings with value other than aValue.
@param aFoundKeys All the keys found.
	For each key k in aFoundKeys, (k & aMask) == (aPartialKey & aMask) and
	the setting with key k is either not a string value or a string value not
	equal to aValue.
@see FindL()
@return
	KErrNone if successful,
	KErrNotFound if capability check passed but no non-matching items are found,
	plus other system-wide error codes.
@post Transactions fail only on those "other system-wide error codes".
@capability Dependent Caller must satisfy the read policies of all settings found in the source range.
*/
EXPORT_C TInt CRepository::FindNeqL(TUint32 aPartialKey, TUint32 aMask,
	const TDesC16& aValue, RArray<TUint32>& aFoundKeys)
	{
	TPtrC8 pVal((const TUint8*)aValue.Ptr(), aValue.Length()*2);	
	TRAPD(ret,iImpl->FindSettingsComparisonL(aPartialKey,aMask,pVal,ENotEqual,aFoundKeys));
	if (ret==KErrNoMemory)
		User::LeaveNoMemory();
	return ret;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:32,代码来源:pccenrep.cpp

示例7: SchemeType

/**
	@internalComponent

	Returns the type of the URIs scheme
	
	@param			aScheme	The descriptor with the scheme.
	@return			The scheme type
 */
TUriSchemeType SchemeType(const TDesC16& aScheme)
	{
	// Compares the scheme with both sip and sips
	if (aScheme.CompareF(KSipScheme()) == 0 || aScheme.CompareF(KSipsScheme()) == 0)
		{
		// there's a match so this is a sip scheme
		return ESchemeTypeSip;
		}

	return ESchemeTypeUnknown;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:19,代码来源:UriUtils.cpp

示例8:

void TDes8::Copy(const TDesC16 &aDes)
{
	TInt len=aDes.Length();
	SetLength(len);
	const TUint16 *pS=aDes.Ptr();
	const TUint16 *pE=pS+len;
	TUint8 *pT=const_cast<TUint8 *>(Ptr());
	while (pS<pE)
		{
		TUint c=(*pS++);
		if (c>=0x100)
			c=1;
		*pT++=(TUint8)c;
		}
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:15,代码来源:e32base.cpp

示例9:

// -----------------------------------------------------------------------------
// CSyncMLFilterProperty::AddDefaultValueText16L
// Adds default value for text16 property.
// This is useful only if data type is text16.
// -----------------------------------------------------------------------------
EXPORT_C void CSyncMLFilterProperty::AddDefaultValueText16L( 
                TDesC16& aNewDefaultValue, const TBool aSelected )
	{
	if ( iDataTypeForDefaultValues != ESyncMLDataTypeText16 )
		{
		User::Leave( KErrNotSupported );
		}
	if ( aNewDefaultValue.Length() > iMaxTextLength )
		{
		User::Leave( KErrArgument );
		}
	iDefaultValueText16List.AppendL( aNewDefaultValue.AllocLC() );
	CleanupStack::Pop(); // aNewDefaultValue.AllocLC()
	iDefaultValueSelected.AppendL( aSelected );
	}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:20,代码来源:SyncMLDataFilterProperty.cpp

示例10: DLTRACEIN

void CCatalogsBaseMessageImpl::CompleteAndReleaseL(
    const TDesC16& aOutputData,
    TInt aStatus ) 
    {
    DLTRACEIN(("TDesC16, TInt, handle: %d, this: %x", Handle(), this));
    if ( iSenderLost )
        {
        DLINFO(("Sender was lost, deleting message"));
        delete this;
        DLTRACEOUT((""));
        return;
        }

    TInt clientDescLength( iMessage.GetDesMaxLengthL( 3 ) );

    if ( clientDescLength < aOutputData.Length() )
        {
        if( iMessage.Function() == ECatalogsExternalAllocMessage )
            {
            TInt incompMsgHandle( iSession.WriteToLargerDesL( aOutputData,
                                                              aStatus ) );
                                                              
            TBuf16<KCatalogsMinimumAllocSize> internalMsg(
                                               KCatalogsMinimumAllocLength );
            
            internalMsg.Num( incompMsgHandle );
            internalMsg.Append( KCatalogsTooSmallDescMsgElementDivider );
            internalMsg.AppendNum( aOutputData.Length() );

            TRAPD( error, iMessage.WriteL( KOutputSlot, internalMsg ) );
            if ( error != KErrNone )
                {
                iSession.RemoveIncompleteMessage( incompMsgHandle );
                User::Leave( error );
                }
            }

        iMessage.Complete( KCatalogsErrorTooSmallDescriptor );
        }
    else
        {
        iMessage.WriteL( KOutputSlot, aOutputData );
        iMessage.Complete( aStatus );
        }
        
    delete this;
    DLTRACEOUT((""));
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:48,代码来源:catalogsbasemessageimpl.cpp

示例11:

// -----------------------------------------------------------------------------
// CSatNotifySendSs::CreateTerminalRespL
// Constructs SendSs specific part of terminal response and calls 
// DOS to send the actual message.
// -----------------------------------------------------------------------------
//
TInt CSatNotifySendSs::CreateTerminalRespL
        ( 
        TUint8 aPCmdNumber,        
        TUint8 aGeneralResult,      
        const TDesC16& aAdditionalInfo
		)
    {
	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYSENDSS_CREATETERMINALRESPL_1, "CSAT:: CSatNotifySendSs::CreateTerminalRespL");
    // Create and append response data
    TTlv tlvSpecificData;
    tlvSpecificData.AddTag( KTlvResultTag );    
	// Append general result
    tlvSpecificData.AddByte( aGeneralResult );
	for (TInt i = 0; i < aAdditionalInfo.Length(); i++ )
		{
		tlvSpecificData.AddByte( static_cast<TUint8>( aAdditionalInfo[i] ) );
		}
		
    // Prepare data
    iNotificationsTsy->iTerminalRespData.iPCmdNumber = aPCmdNumber;
    TPtrC8 data = tlvSpecificData.GetDataWithoutTopLevelTag();
    // Pack data
    CSatDataPackage dataPackage;
	dataPackage.PackData( &iNotificationsTsy->iTerminalRespData, &data );
    // Forward request to the DOS
    return iNotificationsTsy->iSatTsy->MessageManager()->HandleRequestL( 
		ESatTerminalRsp, &dataPackage );
    }
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:34,代码来源:CSatNotifySendSs.cpp

示例12: NTChallengeResponseL

inline void CPppMsChap::NTChallengeResponseL(const TDesC8& aChallenge,
					     const TDesC16& aPassword,
					     TDes8& aResponse)
/**
   Computes a MS-CHAP Windows NT compatible Challenge Response.
   @param aChallenge [in] A MS-CHAP Challenge (8 octets).
   @param aPassword [in] The Microsoft Windows NT password (0 to 256
   Unicode char).
   @param aResponse [out] The MS-CHAP Windows NT compatible Challenge
   Response (24 octets).
   @note This function implements the NTChallengeResponse routine
   specified in RFC 2433.
   @internalComponent
*/
	{
	ASSERT(aChallenge.Length() == KPppMsChapChallengeSize);
	ASSERT(aPassword.Length() <= KPppMsChapMaxNTPasswordLength);
	ASSERT(aResponse.Length() == KPppMsChapNTResponseSize);

	HBufC8* paddedPasswordHashBuf =
			HBufC8::NewLC(KPppMsChapPaddedHashSize);
	TPtr8 paddablePasswordHash(paddedPasswordHashBuf->Des());

	paddablePasswordHash.SetLength(KPppMsChapHashSize);
	NtPasswordHashL(aPassword, paddablePasswordHash);

	ChallengeResponseL(aChallenge, 
			paddablePasswordHash,
			aResponse);

	CleanupStack::PopAndDestroy(paddedPasswordHashBuf);
	ASSERT(aResponse.Length() == KPppMsChapNTResponseSize);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:33,代码来源:MSCHAP.CPP

示例13: new

// -----------------------------------------------------------------------------
// Sets poly1D points.
// -----------------------------------------------------------------------------
//
void CAknsAlPolyBase::SetPolyPoints1DL( const TDesC16& aPointString )
    {
    TInt coordCount = aPointString.Length();

    if ((coordCount & 0x1) || coordCount < 4) // odd number or too few point coordinates
        User::Leave(KErrArgument);

    iPointCount = coordCount >> 1;
    iPoints = new (ELeave) TPolyPoint[iPointCount];

    iPoints[0].iX = aPointString[0];
    iPoints[0].iY = aPointString[1];

    TUint16 oldX = iPoints[0].iX;

    // parse numbers from the descriptor
    for (TInt i = 1; i < iPointCount; i++) // first point already set
        {
        iPoints[i].iX = aPointString[i*2];
        iPoints[i].iY = aPointString[i*2+1];

        if (iPoints[i].iX < oldX) // points must be in ascending order
            User::Leave(KErrArgument);

        oldX = iPoints[i].iX;
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:31,代码来源:AknsAlPolyBase.cpp

示例14: SetPolyPointsL

// -----------------------------------------------------------------------------
// Sets poly points.
// -----------------------------------------------------------------------------
//
void CAknsAlPolyBase::SetPolyPointsL( const TDesC16& aPointString )
    {
    TInt coordCount = aPointString.Length();

    if ((coordCount & 0x1) || coordCount < 4) // odd number or too few point coordinates
        {
        RDebug::Printf("%s, line %d, ERROR: Illegal coordinate count", __FILE__, __LINE__);
        User::Leave(KErrArgument);
        }

    iPointCount = coordCount >> 1;
    iPoints = new (ELeave) TPolyPoint[iPointCount];

    iPoints[0].iX = aPointString[0];
    iPoints[0].iY = aPointString[1];

    TUint16 oldX = iPoints[0].iX;
    TUint16 oldY = iPoints[0].iY;

    // parse numbers from the descriptor
    for (TInt i = 1; i < iPointCount; i++) // first point already set
        {
        iPoints[i].iX = aPointString[i*2];
        iPoints[i].iY = aPointString[i*2+1];

        if (oldX == iPoints[i].iX && oldY == iPoints[i].iY)
            {
            RDebug::Printf("%s, line %d, ERROR: subsequent coordinates cannot be equal", __FILE__, __LINE__);
            User::Leave(KErrArgument);
            }

        oldX = iPoints[i].iX;
        oldY = iPoints[i].iY;
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:39,代码来源:AknsAlPolyBase.cpp

示例15:

void CT_ISO2022JP1_2::TestSplittingConvertingFromUnicodeToIso2022Jp(
                CCnvCharacterSetConverter& aCharacterSetConverter,
                TInt aMaximumLengthLowerLimit,
                TInt aMaximumLengthUpperLimit,
                TInt aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit,
                const TDesC8& aExpectedFirstPartOfIso2022Jp,
                const TDesC8& aExpectedSecondPartOfIso2022Jp,
                const TDesC16& aOriginalUnicode)
	{
	INFO_PRINTF1(_L(" TestTruncatedConversionFromUnicodeToIso2022Jp "));
	test(aMaximumLengthLowerLimit<=aMaximumLengthUpperLimit);
	test(aMaximumLengthUpperLimit<=KBufferLength);
	TUint8 iso2022JpBuffer[KBufferLength];
	for (TInt i=aMaximumLengthLowerLimit; i<=aMaximumLengthUpperLimit; ++i)
		{
		TPtr8 generatedFirstPartOfIso2022Jp(iso2022JpBuffer, i);
		test(aCharacterSetConverter.ConvertFromUnicode(generatedFirstPartOfIso2022Jp, aOriginalUnicode)==aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit);
		test(generatedFirstPartOfIso2022Jp==aExpectedFirstPartOfIso2022Jp);
		TBuf8<KBufferLength> generatedSecondPartOfIso2022Jp;
		test(aCharacterSetConverter.ConvertFromUnicode(generatedSecondPartOfIso2022Jp, aOriginalUnicode.Right(aExpectedNumberOfUnicodeCharactersNotConvertedAtSplit))==0);
		test(generatedSecondPartOfIso2022Jp==aExpectedSecondPartOfIso2022Jp);
		TInt state=CCnvCharacterSetConverter::KStateDefault;
		TBuf16<KBufferLength> generatedUnicode;
		test(aCharacterSetConverter.ConvertToUnicode(generatedUnicode, generatedFirstPartOfIso2022Jp, state)==0);
		TBuf16<KBufferLength> generatedSecondPartOfUnicode;
		test(aCharacterSetConverter.ConvertToUnicode(generatedSecondPartOfUnicode, generatedSecondPartOfIso2022Jp, state)==0);
		generatedUnicode.Append(generatedSecondPartOfUnicode);
		test(generatedUnicode==aOriginalUnicode);
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:30,代码来源:t_iso2022jp1_2.cpp


注:本文中的TDesC16类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。