本文整理汇总了C++中TChar::GetNumericValue方法的典型用法代码示例。如果您正苦于以下问题:C++ TChar::GetNumericValue方法的具体用法?C++ TChar::GetNumericValue怎么用?C++ TChar::GetNumericValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TChar
的用法示例。
在下文中一共展示了TChar::GetNumericValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*
* Generates a hash value by reversing the matchLength least significant digits,
* ignoring non-digits and zeroes at the end of the number. Returns error if no phone
* digits are supplied.
* \param phoneNumberString A descriptor containing a phone number.
* \param matchLength The number of digits from the right of the phone number to use.
* \param numPhoneDigits The number of digits found in the phone number string.
* \param error Qt error code.*
* \return An integer representation of the phone number string in reverse.
*/
TInt32 CntFilterDetail::TMatch::createHash(
const TDesC& phoneNumberString,
TInt matchLength,
TInt& numPhoneDigits)
{
TInt phoneNumberLength = phoneNumberString.Length();
TInt startIndex = 0;
if (phoneNumberLength > matchLength) {
startIndex = phoneNumberLength - matchLength;
}
numPhoneDigits = 0;
TUint reversedDigits = 0;
TInt mult = 1;
for (TInt chrIndex = startIndex; (numPhoneDigits < matchLength) && (chrIndex < phoneNumberLength); chrIndex++) {
TChar chr = phoneNumberString[chrIndex];
if (chr.IsDigit()) {
reversedDigits += (chr.GetNumericValue()) * mult;
mult = mult * 10;
++numPhoneDigits;
}
}
return reversedDigits ;
}
示例2:
/**
Generates a hash value by reversing the aMatchLength least significant digits,
ignoring non-digits and zeroes at the end of the number. Asserts if no phone
digits are supplied.
@param aPhoneNumberString A descriptor containing a phone number.
@param aMatchLength The number of digits from the right of the phone number to use.
@param aNumPhoneDigits The number of digits found in the phone number string.
@return An integer representation of the phone number string in reverse.
*/
TInt32 CPplCommAddrTable::TMatch::CreateHashL(const TDesC& aPhoneNumberString, TInt aMatchLength, TInt& aNumPhoneDigits)
{
TInt phoneNumberLength = aPhoneNumberString.Length();
__ASSERT_DEBUG(phoneNumberLength > 0, User::Leave(KErrNotSupported) );
TInt startIndex = 0;
if (phoneNumberLength > aMatchLength)
{
startIndex = phoneNumberLength - aMatchLength;
}
aNumPhoneDigits = 0;
TUint reversedDigits = 0;
TInt mult = 1;
for (TInt chrIndex = startIndex; (aNumPhoneDigits < aMatchLength) && (chrIndex < phoneNumberLength); chrIndex++)
{
TChar chr = aPhoneNumberString[chrIndex];
if (chr.IsDigit() )
{
reversedDigits += (chr.GetNumericValue() ) * mult;
mult = mult * 10;
++aNumPhoneDigits;
}
}
return reversedDigits ;
}
示例3: GetCipher
TUint TInputManager::GetCipher(TChar aChar)
{
TUint value;
switch(aChar)
{
case 'a': value = 10; break;
case 'b': value = 11; break;
case 'c': value = 12; break;
case 'd': value = 13; break;
case 'e': value = 14; break;
case 'f': value = 15; break;
default: value = aChar.GetNumericValue();
}
return value;
}
示例4: HandleDTMFEvent
void CTestDtmfObserver::HandleDTMFEvent( const MCCEDtmfObserver::TCCEDtmfEvent aEvent,
const TInt aError,
const TChar aTone )
{
TEvent newEvent;
newEvent.iCallID = 0; // not a call specific event
newEvent.iEventType = CEventStorage::EDtmfEvent;
newEvent.iEventID = aEvent;
newEvent.iParam1 = aError;
newEvent.iParam2 = aTone.GetNumericValue();
// If TChar is empty, set param2 to zero
if ( newEvent.iParam2 == KErrNotFound )
{
newEvent.iParam2 = 0;
}
iEventStorage->StoreEvent( newEvent );
}
示例5: ProcessKeyPressL
void CActiveConsole::ProcessKeyPressL(TChar aChar)
{
if (aChar == EKeyEscape)
{
PRINT(_L("CActiveConsole: ESC key pressed -> stopping active scheduler...\n"));
CActiveScheduler::Stop();
return;
}
aChar.UpperCase();
if (iCmdGetValue != 0 && aChar == '\r')
{
if (iLastChar == 'K')
{
iValue *= iGetHexValue ? 0x400 : 1000;
}
if (iLastChar == 'M')
{
iValue *= iGetHexValue ? 0x10000 : 1000000;
}
PRINT1(_L("CActiveConsole: Value %d\n"),iValue);
ProcessValue();
}
if (iCmdGetValue != 0 )
{
if (iGetHexValue)
{
if (aChar.IsDigit())
{
iValue = iValue * 16 + aChar.GetNumericValue();
}
else
{
if (aChar.IsHexDigit())
{
iValue = iValue * 16 + (TUint)aChar - 'A' + 10;
}
else
{
if (aChar != 'K' && aChar != 'M')
{
PRINT(_L("Illegal hexadecimal character - Enter command\n"));
iCmdGetValue = 0;
}
}
}
}
else
{
if (aChar.IsDigit())
{
iValue = iValue * 10 + aChar.GetNumericValue();
}
else
{
if ((aChar == 'X') && (iLastChar == '0') && (iValue == 0))
iGetHexValue = ETrue;
else
{
if (aChar != 'K' && aChar != 'M')
{
test.Printf(_L("Illegal decimal character - Enter command\n"));
iCmdGetValue = 0;
}
}
}
}
}
else
{
switch (aChar)
{
case 'F' :
TESTNEXT(_L("Flushing Cache"));
test_KErrNone(DPTest::FlushCache());
ShowMemoryUse();
iPrompt = ETrue;
break;
case 'I' :
CacheSize(0,0);
ShowMemoryUse();
iPrompt = ETrue;
break;
case 'Q' :
gQuiet = ETrue;
iPrompt = ETrue;
break;
case 'V' :
gQuiet = EFalse;
iPrompt = ETrue;
break;
case '?' :
ShowHelp();
break;
case '=' :
iCmdGetValue = iLastChar;
//.........这里部分代码省略.........