Updating code to append a wchar_t instead of const wchar_t (#778)
This commit is contained in:
parent
4c81ed83c7
commit
01299a92cd
@ -179,7 +179,7 @@ bool CalcInput::TryAddDecimalPt()
|
|||||||
|
|
||||||
if (m_base.IsEmpty())
|
if (m_base.IsEmpty())
|
||||||
{
|
{
|
||||||
m_base.value += L"0"; // Add a leading zero
|
m_base.value += L'0'; // Add a leading zero
|
||||||
}
|
}
|
||||||
|
|
||||||
m_decPtIndex = m_base.value.size();
|
m_decPtIndex = m_base.value.size();
|
||||||
|
@ -640,9 +640,9 @@ namespace CalculationManager
|
|||||||
if (pHistory)
|
if (pHistory)
|
||||||
{
|
{
|
||||||
pHistory->ClearHistory();
|
pHistory->ClearHistory();
|
||||||
for (unsigned int i = 0; i < history.size(); ++i)
|
for (auto const& historyItem : history)
|
||||||
{
|
{
|
||||||
pHistory->AddItem(history[i]);
|
pHistory->AddItem(historyItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -275,14 +275,12 @@ const wstring& COpndCommand::GetToken(wchar_t decimalSymbol)
|
|||||||
|
|
||||||
wstring COpndCommand::GetString(uint32_t radix, int32_t precision)
|
wstring COpndCommand::GetString(uint32_t radix, int32_t precision)
|
||||||
{
|
{
|
||||||
wstring result{};
|
|
||||||
|
|
||||||
if (m_fInitialized)
|
if (m_fInitialized)
|
||||||
{
|
{
|
||||||
result = m_value.ToString(radix, eNUMOBJ_FMT::FMT_FLOAT, precision);
|
return m_value.ToString(radix, eNUMOBJ_FMT::FMT_FLOAT, precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return wstring{};
|
||||||
}
|
}
|
||||||
|
|
||||||
void COpndCommand::Accept(_In_ ISerializeCommandVisitor& commandVisitor)
|
void COpndCommand::Accept(_In_ ISerializeCommandVisitor& commandVisitor)
|
||||||
|
@ -16,8 +16,7 @@ namespace CalcManager::NumberFormattingUtils
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring::iterator iter;
|
for (auto iter = number.end() - 1;; iter--)
|
||||||
for (iter = number.end() - 1;; iter--)
|
|
||||||
{
|
{
|
||||||
if (*iter != L'0')
|
if (*iter != L'0')
|
||||||
{
|
{
|
||||||
@ -25,9 +24,9 @@ namespace CalcManager::NumberFormattingUtils
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*(number.end() - 1) == L'.')
|
if (number.back() == L'.')
|
||||||
{
|
{
|
||||||
number.erase(number.end() - 1, number.end());
|
number.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,43 +401,43 @@ void UnitConverter::SendCommand(Command command)
|
|||||||
switch (command)
|
switch (command)
|
||||||
{
|
{
|
||||||
case Command::Zero:
|
case Command::Zero:
|
||||||
m_currentDisplay += L"0";
|
m_currentDisplay += L'0';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::One:
|
case Command::One:
|
||||||
m_currentDisplay += L"1";
|
m_currentDisplay += L'1';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::Two:
|
case Command::Two:
|
||||||
m_currentDisplay += L"2";
|
m_currentDisplay += L'2';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::Three:
|
case Command::Three:
|
||||||
m_currentDisplay += L"3";
|
m_currentDisplay += L'3';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::Four:
|
case Command::Four:
|
||||||
m_currentDisplay += L"4";
|
m_currentDisplay += L'4';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::Five:
|
case Command::Five:
|
||||||
m_currentDisplay += L"5";
|
m_currentDisplay += L'5';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::Six:
|
case Command::Six:
|
||||||
m_currentDisplay += L"6";
|
m_currentDisplay += L'6';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::Seven:
|
case Command::Seven:
|
||||||
m_currentDisplay += L"7";
|
m_currentDisplay += L'7';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::Eight:
|
case Command::Eight:
|
||||||
m_currentDisplay += L"8";
|
m_currentDisplay += L'8';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::Nine:
|
case Command::Nine:
|
||||||
m_currentDisplay += L"9";
|
m_currentDisplay += L'9';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::Decimal:
|
case Command::Decimal:
|
||||||
@ -445,7 +445,7 @@ void UnitConverter::SendCommand(Command command)
|
|||||||
clearBack = false;
|
clearBack = false;
|
||||||
if (!m_currentHasDecimal)
|
if (!m_currentHasDecimal)
|
||||||
{
|
{
|
||||||
m_currentDisplay += L".";
|
m_currentDisplay += L'.';
|
||||||
m_currentHasDecimal = true;
|
m_currentHasDecimal = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -252,7 +252,7 @@ String ^ DateCalculatorViewModel::GetDateDiffString() const
|
|||||||
if (yearCount > 0)
|
if (yearCount > 0)
|
||||||
{
|
{
|
||||||
result += GetLocalizedNumberString(yearCount)->Data();
|
result += GetLocalizedNumberString(yearCount)->Data();
|
||||||
result += L" ";
|
result += L' ';
|
||||||
|
|
||||||
if (yearCount > 1)
|
if (yearCount > 1)
|
||||||
{
|
{
|
||||||
@ -280,7 +280,7 @@ String ^ DateCalculatorViewModel::GetDateDiffString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
result += GetLocalizedNumberString(monthCount)->Data();
|
result += GetLocalizedNumberString(monthCount)->Data();
|
||||||
result += L" ";
|
result += L' ';
|
||||||
|
|
||||||
if (monthCount > 1)
|
if (monthCount > 1)
|
||||||
{
|
{
|
||||||
@ -305,7 +305,7 @@ String ^ DateCalculatorViewModel::GetDateDiffString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
result += GetLocalizedNumberString(weekCount)->Data();
|
result += GetLocalizedNumberString(weekCount)->Data();
|
||||||
result += L" ";
|
result += L' ';
|
||||||
|
|
||||||
if (weekCount > 1)
|
if (weekCount > 1)
|
||||||
{
|
{
|
||||||
@ -330,7 +330,7 @@ String ^ DateCalculatorViewModel::GetDateDiffString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
result += GetLocalizedNumberString(dayCount)->Data();
|
result += GetLocalizedNumberString(dayCount)->Data();
|
||||||
result += L" ";
|
result += L' ';
|
||||||
|
|
||||||
if (dayCount > 1)
|
if (dayCount > 1)
|
||||||
{
|
{
|
||||||
@ -348,7 +348,7 @@ String ^ DateCalculatorViewModel::GetDateDiffString() const
|
|||||||
String ^ DateCalculatorViewModel::GetDateDiffStringInDays() const
|
String ^ DateCalculatorViewModel::GetDateDiffStringInDays() const
|
||||||
{
|
{
|
||||||
wstring result = GetLocalizedNumberString(m_dateDiffResultInDays.day)->Data();
|
wstring result = GetLocalizedNumberString(m_dateDiffResultInDays.day)->Data();
|
||||||
result += L" ";
|
result += L' ';
|
||||||
|
|
||||||
// Display the result as '1 day' or 'N days'
|
// Display the result as '1 day' or 'N days'
|
||||||
if (m_dateDiffResultInDays.day > 1)
|
if (m_dateDiffResultInDays.day > 1)
|
||||||
|
@ -309,7 +309,7 @@ namespace CalculatorEngineTests
|
|||||||
wstring maxStr{};
|
wstring maxStr{};
|
||||||
for (size_t i = 0; i < MAX_STRLEN + 1; i++)
|
for (size_t i = 0; i < MAX_STRLEN + 1; i++)
|
||||||
{
|
{
|
||||||
maxStr += L"1";
|
maxStr += L'1';
|
||||||
m_calcInput.TryAddDigit(1, 10, false, maxStr, 64, 100);
|
m_calcInput.TryAddDigit(1, 10, false, maxStr, 64, 100);
|
||||||
}
|
}
|
||||||
auto result = m_calcInput.ToString(10);
|
auto result = m_calcInput.ToString(10);
|
||||||
@ -323,7 +323,7 @@ namespace CalculatorEngineTests
|
|||||||
bool exponentCapped = false;
|
bool exponentCapped = false;
|
||||||
for (size_t i = 0; i < MAX_STRLEN + 1; i++)
|
for (size_t i = 0; i < MAX_STRLEN + 1; i++)
|
||||||
{
|
{
|
||||||
maxStr += L"1";
|
maxStr += L'1';
|
||||||
if (!m_calcInput.TryAddDigit(1, 10, false, maxStr, 64, MAX_STRLEN + 25))
|
if (!m_calcInput.TryAddDigit(1, 10, false, maxStr, 64, MAX_STRLEN + 25))
|
||||||
{
|
{
|
||||||
exponentCapped = true;
|
exponentCapped = true;
|
||||||
|
@ -67,7 +67,7 @@ namespace CalculatorUnitTests
|
|||||||
StringReference(exp_TooLong.c_str()), ViewMode::Standard, CategoryGroupType::Calculator, -1, BitLength::BitLengthUnknown),
|
StringReference(exp_TooLong.c_str()), ViewMode::Standard, CategoryGroupType::Calculator, -1, BitLength::BitLengthUnknown),
|
||||||
StringReference(exp_TooLong.c_str()),
|
StringReference(exp_TooLong.c_str()),
|
||||||
L"Verify ValidatePasteExpression handles expressions up to max length");
|
L"Verify ValidatePasteExpression handles expressions up to max length");
|
||||||
exp_TooLong += L"1";
|
exp_TooLong += L'1';
|
||||||
VERIFY_ARE_EQUAL(
|
VERIFY_ARE_EQUAL(
|
||||||
m_CopyPasteManager->ValidatePasteExpression(
|
m_CopyPasteManager->ValidatePasteExpression(
|
||||||
StringReference(exp_TooLong.c_str()), ViewMode::Standard, CategoryGroupType::Calculator, -1, BitLength::BitLengthUnknown),
|
StringReference(exp_TooLong.c_str()), ViewMode::Standard, CategoryGroupType::Calculator, -1, BitLength::BitLengthUnknown),
|
||||||
|
Loading…
Reference in New Issue
Block a user