mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-16 02:02:51 -07:00
Using wstring instead of wstringstream where appropriate (#881)
This commit is contained in:
parent
be4e437f4d
commit
a21b4a2d1a
6 changed files with 57 additions and 53 deletions
|
@ -599,16 +599,15 @@ String ^ LocalizationService::GetNarratorReadableToken(String ^ rawToken)
|
|||
|
||||
String ^ LocalizationService::GetNarratorReadableString(String ^ rawString)
|
||||
{
|
||||
wstringstream readableString{};
|
||||
readableString << L"";
|
||||
wstring readableString{};
|
||||
|
||||
wstring asWstring = rawString->Data();
|
||||
for (const auto& c : asWstring)
|
||||
{
|
||||
readableString << LocalizationService::GetNarratorReadableToken(L"" + c)->Data();
|
||||
readableString += LocalizationService::GetNarratorReadableToken(ref new String(&c, 1))->Data();
|
||||
}
|
||||
|
||||
return ref new String(readableString.str().c_str());
|
||||
return ref new String(readableString.c_str());
|
||||
}
|
||||
|
||||
void LocalizationService::Sort(std::vector<Platform::String ^>& source)
|
||||
|
|
|
@ -31,13 +31,12 @@ String
|
|||
_In_ String ^ fallbackExpression)
|
||||
{
|
||||
// updating accessibility names for expression and result
|
||||
wstringstream accExpression{};
|
||||
accExpression << L"";
|
||||
wstring accExpression{};
|
||||
|
||||
for (const auto& tokenItem : *spTokens)
|
||||
{
|
||||
accExpression << LocalizationService::GetNarratorReadableToken(StringReference(tokenItem.first.c_str()))->Data();
|
||||
accExpression += LocalizationService::GetNarratorReadableToken(StringReference(tokenItem.first.c_str()))->Data();
|
||||
}
|
||||
|
||||
return ref new String(accExpression.str().c_str());
|
||||
return ref new String(accExpression.c_str());
|
||||
}
|
||||
|
|
|
@ -177,21 +177,20 @@ String ^ StandardCalculatorViewModel::CalculateNarratorDisplayValue(_In_ wstring
|
|||
|
||||
String ^ StandardCalculatorViewModel::GetNarratorStringReadRawNumbers(_In_ String ^ localizedDisplayValue)
|
||||
{
|
||||
wstringstream wss;
|
||||
auto& locSettings = LocalizationSettings::GetInstance();
|
||||
wstring ws;
|
||||
const auto& locSettings = LocalizationSettings::GetInstance();
|
||||
|
||||
// Insert a space after each digit in the string, to force Narrator to read them as separate numbers.
|
||||
wstring wstrValue(localizedDisplayValue->Data());
|
||||
for (wchar_t& c : wstrValue)
|
||||
for (const wchar_t& c : localizedDisplayValue)
|
||||
{
|
||||
wss << c;
|
||||
ws += c;
|
||||
if (locSettings.IsLocalizedHexDigit(c))
|
||||
{
|
||||
wss << L' ';
|
||||
ws += L' ';
|
||||
}
|
||||
}
|
||||
|
||||
return ref new String(wss.str().c_str());
|
||||
return ref new String(ws.c_str());
|
||||
}
|
||||
|
||||
void StandardCalculatorViewModel::SetPrimaryDisplay(_In_ String ^ displayStringValue, _In_ bool isError)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue