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


C++ TLocale::DigitType方法代码示例

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


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

示例1: symbianZeroDigit

/*!
    Retrieves Symbian locale zero digit.
*/
static QString symbianZeroDigit()
{
    TLocale *locale = _s60Locale.GetLocale();

    // TDigitType enumeration value returned by TLocale
    // will always correspond to zero digit unicode value.
    TDigitType digit = locale->DigitType();
    return QChar(digit);
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:12,代码来源:qlocale_symbian.cpp

示例2:

/**
This routine is used to check if conversion of digits is needed.
Conversion is needed if user language is   
- Arabic, Urdu or Farsi and if digit type is Arabic-Indic
- Urdu or Farsi and digit type is Eastern Arabic_indic
- Hindi and digit type is Devanagari. 

@return  ETrue if conversion is needed, EFalse if not
*/
TBool CResourceLoader::LanguageSpecificNumberConverter::IsConversionNeeded()
    {
    TLocale locale;
    locale.Refresh();
    const TLanguage language = User::Language();
    const TDigitType digitType = locale.DigitType();
    
    if ( ( ( language == ELangArabic || language == ELangUrdu || language == ELangFarsi ) &&
         digitType == EDigitTypeArabicIndic ) 
         || ( ( language == ELangUrdu || language == ELangFarsi ) &&
         digitType == EDigitTypeEasternArabicIndic )
         || ( language == ELangHindi && digitType == EDigitTypeDevanagari )
        )
        {
        return ETrue;
        }

    return EFalse;
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:28,代码来源:basepluginresourceloader.cpp

示例3: switch

/**
This routine is used to convert between European digits and 
Arabic-Indic, Eastern Arabic-Indic, Devanagari or Thai digits 
based on existing digit type setting. 

@param aDes  Parameter to change
*/
void CResourceLoader::LanguageSpecificNumberConverter::Convert( TDes &aDes )
    {   
    TLocale locale;
    locale.Refresh();
    const TDigitType digitType = locale.DigitType();
    TChar toArea = 0x030;
    switch( digitType )
        {
        case EDigitTypeWestern:
        case EDigitTypeArabicIndic:
        case EDigitTypeEasternArabicIndic:
        case EDigitTypeDevanagari:
        case EDigitTypeThai:
            toArea = digitType;
            break;
        case EDigitTypeUnknown:
        case EDigitTypeAllTypes:
            return;
        }
    
    const TInt length = aDes.Length();
    for( TInt i = 0; i < length; i++ )
        {
        TChar character = aDes[i];
        TChar fromArea = NumberToBase( character );
        TChar::TBdCategory cat = character.GetBdCategory();
        switch( cat )
            {
            case TChar::EArabicNumber:
            case TChar::EEuropeanNumber:
                character += toArea;
                character -= fromArea;
                aDes[i] = TUint16( character );
                break;
            default: 
                break;
            }
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:46,代码来源:basepluginresourceloader.cpp

示例4: DateFieldReOrderingNeeded

/**
* Current implementation of this should work for any RTL language if it sets the 
* digit type to digit types checked for below
*
* It is meant as a patch for S60 2.0, not as a complete solution to the problem of date
* presentation.
*/
TBool AknDateFormatUtils::DateFieldReOrderingNeeded(TLanguage* aForceLanguage )
    {
    TBool reorderingNeeded(EFalse);
    TLocale locale;
    TLanguage language = (aForceLanguage != NULL) ? *aForceLanguage : AknLangUtils::UserLanguage();

    // Reordering needed in case of RTL language, we have arabic digits and if the separator is not 
    // numeric separator.
     if ( TBidiText::ScriptDirectionality( language ) == TBidiText::ERightToLeft )
        {
        TInt digitType = locale.DigitType();
        if ( digitType == EDigitTypeArabicIndic ||
             digitType == EDigitTypeEasternArabicIndic )
            {
            TChar sep( locale.DateSeparator(1) );
            if ( sep.GetBdCategory() != TChar::ECommonNumberSeparator )
                {
                reorderingNeeded = ETrue;
                }
            }
        }
        
    return reorderingNeeded;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:31,代码来源:AknDateFormatUtils.cpp


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