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


C++ TDes16::Length方法代码示例

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


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

示例1: ConvertASCIIInPlace

// -----------------------------------------------------------------------------
// UnicodeTextUtil::ConvertASCIIInPlace
// Converts all ASCII *in-place* from either Half to Full-width or vice versa,
// depending on the direction specified by aDirection.
// Returns: The total number of characters converted.
// -----------------------------------------------------------------------------
//
TInt UnicodeTextUtil::ConvertASCIIInPlace( TConvDirection aDirection,
                                           TDes16& aUnicodeText )
    {
    TInt totalConverted( 0 );
    TText lowerBound( ( aDirection == EHalfToFullWidth ) ?
                        KHalfWidthASCIILowerBound :
                        KFullWidthASCIILowerBound );
    TText upperBound( ( aDirection == EHalfToFullWidth ) ?
                        KHalfWidthASCIIUpperBound :
                        KFullWidthASCIIUpperBound );
    TInt offset( ( aDirection == EHalfToFullWidth ) ?
                   KHalfToFullWidthASCIIOffset :
                   -KHalfToFullWidthASCIIOffset );
    for( TInt i( 0 ); i < aUnicodeText.Length(); ++i )
        {
        const TText uniChar( aUnicodeText[i] );
        if( uniChar >= lowerBound && uniChar <= upperBound )
            {
            TText convertedChar( static_cast<TText>( uniChar + offset ) );
            aUnicodeText[i] = convertedChar;
            totalConverted++;
            }
        }
    return totalConverted;
    }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:32,代码来源:jplangutil.cpp

示例2: Temperature

void CBatmonContainer::Temperature(TDes16& aValue,TUint16 aAddress) const
{
  TRAPD(err,HWNetmon::ValueL(KPhoneEnergyUnit,aAddress,aValue,HWNetmon::EExt|HWNetmon::ERaw));
  if(err==KErrNone&&aValue.Length()>2)
  {
    TInt value=aValue[1]*256+aValue[2]-273;
    aValue.Num(value);
    aValue.Append(0xb0);
    aValue.Append('C');
  }
  else
  {
    aValue.Zero();
    aValue.Append('?');
  }
}
开发者ID:flaithbheartaigh,项目名称:almalert,代码行数:16,代码来源:BatmonContainer.cpp

示例3: Hellenize

static void Hellenize(TDes16& text)
{
    static const TUint16* roman = (TUint16*)(L"ABGDEZJQIKLMNXOPRVSTUFHCW");

    for (int i = 0; i < text.Length(); i++)
        for (int j = 0; j < 25; j++)
            if (roman[j] == text[i])
            {
                text[i] = (TUint16)(0x391 + j);
                break;
            }
            else if (roman[j] + 32 == text[i])
            {
                text[i] = (TUint16)(0x3B1 + j);
                break;
            }
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:17,代码来源:testharness.cpp

示例4: if

 /**
   * Converts a descriptor of type TBuf16 to character stream
   *
   * @param aSrc is the descriptor to be converted , aDes is the 
   * reference to the character sream where the result of conversion 
   * is stored , n_size specifies the conversion size of the string 
   * @return Status code (0 is ESuccess, -1 is EInsufficientMemory, 
   * -2 is EInvalidSize , -4 is EInvalidPointer, -8 is EInvalidWCSSequence)
   */
EXPORT_C int Tbuf16ToChar(TDes16& aSrc, char* aDes, int& n_size)
{	
    unsigned int ilen = aSrc.Length();
    int retval = ESuccess;
    wchar_t *temp16String = NULL;
    int minusone = -1;
    
    if (0 == ilen)
    {
    	return EDescriptorNoData;
    }
    else if(!aDes)
    {
    	return EInvalidPointer;
    }
    
    else if(n_size < ilen*2+1)
    {
    	n_size = ilen*2;
    	return EInvalidSize;
    }
        		
	temp16String = new wchar_t [ilen+1];
	if (!temp16String)
	{
		return EInsufficientSystemMemory;
	}
	
	wmemcpy(temp16String, (const wchar_t *)aSrc.Ptr(), ilen);
	temp16String[ilen] = L'\0'; 	
	
	if(minusone != wcstombs(aDes, (const wchar_t*)temp16String, ilen*2))
	{
	    aDes[ilen*2] = '\0'; 
	}
	else 
	{
		retval = EInvalidWCSSequence;
	}
	
	delete []temp16String;	
	return retval;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:52,代码来源:descriptor16tochar.cpp

示例5: totalConverted

// -----------------------------------------------------------------------------
// UnicodeTextUtil::ConvertSpecialCharactersInPlace
// Converts all special characters in the aUnicodeText descriptor in-place
// that have both Full and Half-width variants.
// Conversion occurs in the direction specified by aDirection.
// Returns: The total number of characters converted.
// -----------------------------------------------------------------------------
//
TInt UnicodeTextUtil::ConvertSpecialCharactersInPlace
                             ( TConvDirection aDirection, TDes16& aUnicodeText )
    {
    TInt totalConverted( 0 );
    const TInt directionIndex( ( aDirection == EHalfToFullWidth ) ?
                                 KHalfWidthIndex : KFullWidthIndex );
    for( TInt i( 0 ); i < aUnicodeText.Length(); ++i )
        {
        const TText uniChar( aUnicodeText[i] );
        for( TInt j( 0 ); j < KHalfWidthSpecialCharRange; ++j )
            {
            if( uniChar == KHalfToFullWidthSpecialCharTable[j][directionIndex] )
                {
                aUnicodeText[i] =
                    KHalfToFullWidthSpecialCharTable[j][!directionIndex];
                totalConverted++;
                break;
                }
            }
        }
    return totalConverted;
    }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:30,代码来源:jplangutil.cpp

示例6: Battery

void CBatmonContainer::Battery(TDes16& aValue,TUint16 aAddress) const
{
  TInt value=0;
  TRAPD(err,HWNetmon::ValueL(KPhoneEnergyUnit,aAddress,aValue,HWNetmon::EExt|HWNetmon::ERaw));
  if(err==KErrNone&&aValue.Length()>0) value=aValue[0];
  aValue.Zero();
  switch(value)
  {
    case 11:
      aValue.Append(_L("BL-4C"));
      break;
    case 12:
      aValue.Append(_L("BL-5C"));
      break;
    case 17:
      aValue.Append(_L("BL-6C"));
      break;
    default:
      aValue.Append('?');
      break;
  }
}
开发者ID:flaithbheartaigh,项目名称:almalert,代码行数:22,代码来源:BatmonContainer.cpp

示例7:

 /**
   * Converts a descriptor of type RBuf16 to Wstring
   *
   * @param aSrc is the descriptor to be converted , aDes is the 
   * reference to the Wstring array where the result of conversion 
   * is stored  
   * @return Status code (0 is ESuccess, -1 is EInsufficientMemory, 
   *  -2 is EInvalidSize , -4 is EInvalidPointer , -5 is EDescriptorNoData)
   */
EXPORT_C int Rbuf16ToWstring(TDes16& aSrc, wstring& aDes)
{
    unsigned int ilen = aSrc.Length();
    if (0 == ilen)
    {
    	return EDescriptorNoData;
    }
    
    wchar_t* buf = new wchar_t[ilen+1];
    if(!buf)
    {
    	return EInsufficientSystemMemory;
    }
    
   	wmemcpy (buf,(wchar_t *)aSrc.Ptr(), ilen);
    buf[ilen]=L'\0';
    
    aDes.assign(buf);
	delete[] buf;
	
	return ESuccess;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:31,代码来源:descriptor16towstring.cpp

示例8: Overflow

/*
-------------------------------------------------------------------------------

    Class: TDesLoggerOverflowHandler

    Method: Overflow

    Description: Simple overflow handling(16 bit)

    Parameters: TDes16 &aDes: in: Reference to over flow data

    Return Values: None

    Errors/Exceptions: None

    Status: Approved

-------------------------------------------------------------------------------
*/
void TDesLoggerOverflowHandler::Overflow( TDes16& aDes )
    {
    __TRACE( KError, ( _L( "STIFLOGGER: Over flow" ) ) );

    // If overflow
    TInt len( 0 );
    len = aDes.Length();

    // const TInt to TInt avoiding warnings
    TInt maxLogData = KMaxLogData;
    TInt maxTestFileName = KMaxFileName;

    // Overflow: Log() without aStyle or Log() with aStyle
    if ( ( iOverFlowSource == 1 || iOverFlowSource == 2 )
            &&  maxLogData > 60 )
        {
        // Log overflow info if info is in allowed limits
        aDes[len-2] = 13;   // 13 or '\' in Symbian OS
        aDes[len-1] = 10;   // 10 or 'n' in Symbian OS
        // ~60
        iLogger->Send( 0, _L("Log() OVERFLOW: Check aLogInfo and KMaxLogData !!!") );
        }
    // Overflow: WriteDelimiter()
    if ( iOverFlowSource == 3 &&  maxLogData > 70 )
        {
        // Log overflow info if info is in allowed limits, ~70
        iLogger->Send( 0, _L( "WriteDelimiter() OVERFLOW: Check delimiter and KMaxLogData !!!" ) );
        }
    // Overflow: StartHtmlPage()
    if ( iOverFlowSource == 4 &&  maxTestFileName > 70 )
        {
        // Log overflow info if info is in allowed limits, ~70
        iLogger->Send( 0, _L( "aTestFile OVERFLOW: Check aTestFile and KMaxFileName !!!" ) );
        }

    }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:55,代码来源:LoggerOverFlow.cpp


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