mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-16 02:02:51 -07:00
Updating comments per the C++ core guidelines and removing trailing whitespace (#194)
Fixed comments that were inconsistent with the style guidelines described in C++ core guidelines and the modern C++/WinRT language projections and removed trailing whitespace. Inserted a space after the beginning of the comment so the text wasn't touching the // on all occurrences. Removed all occurrences of trailing whitespace
This commit is contained in:
parent
62317fd63b
commit
1113ff4b86
82 changed files with 509 additions and 510 deletions
|
@ -142,7 +142,7 @@ UnitConverterViewModel::UnitConverterViewModel(const shared_ptr<UCM::IUnitConver
|
|||
m_currencyFormatter->Mode = CurrencyFormatterMode::UseCurrencyCode;
|
||||
m_currencyFormatter->ApplyRoundingForCurrency(RoundingAlgorithm::RoundHalfDown);
|
||||
m_currencyMaxFractionDigits = m_currencyFormatter->FractionDigits;
|
||||
|
||||
|
||||
auto resourceLoader = AppResourceProvider::GetInstance();
|
||||
m_localizedValueFromFormat = resourceLoader.GetResourceString(UnitConverterResourceKeys::ValueFromFormat);
|
||||
m_localizedValueToFormat = resourceLoader.GetResourceString(UnitConverterResourceKeys::ValueToFormat);
|
||||
|
@ -257,7 +257,7 @@ void UnitConverterViewModel::OnUnitChanged(Object^ parameter)
|
|||
|
||||
void UnitConverterViewModel::OnSwitchActive(Platform::Object^ unused)
|
||||
{
|
||||
// this can be false if this switch occurs without the user having explicitly updated any strings
|
||||
// this can be false if this switch occurs without the user having explicitly updated any strings
|
||||
// (for example, during deserialization). We only want to try this cleanup if there's actually
|
||||
// something to clean up.
|
||||
if (m_relocalizeStringOnSwitch)
|
||||
|
@ -279,7 +279,7 @@ void UnitConverterViewModel::OnSwitchActive(Platform::Object^ unused)
|
|||
|
||||
m_valueFromUnlocalized.swap(m_valueToUnlocalized);
|
||||
Utils::Swap(&m_localizedValueFromFormat, &m_localizedValueToFormat);
|
||||
|
||||
|
||||
Utils::Swap(&m_Unit1AutomationName, &m_Unit2AutomationName);
|
||||
RaisePropertyChanged(UnitConverterViewModelProperties::Unit1AutomationName);
|
||||
RaisePropertyChanged(UnitConverterViewModelProperties::Unit2AutomationName);
|
||||
|
@ -324,7 +324,7 @@ String^ UnitConverterViewModel::ConvertToLocalizedString(const std::wstring& str
|
|||
if (allowPartialStrings)
|
||||
{
|
||||
// allow "in progress" strings, like "3." that occur during the composition of
|
||||
// a final number. Without this, when typing the three characters in "3.2"
|
||||
// a final number. Without this, when typing the three characters in "3.2"
|
||||
// you don't see the decimal point when typing it, you only see it once you've finally
|
||||
// typed a post-decimal digit.
|
||||
|
||||
|
@ -341,7 +341,7 @@ String^ UnitConverterViewModel::ConvertToLocalizedString(const std::wstring& str
|
|||
{
|
||||
wstring currencyResult = m_currencyFormatter->Format(stod(stringToLocalize))->Data();
|
||||
wstring currencyCode = m_currencyFormatter->Currency->Data();
|
||||
|
||||
|
||||
// CurrencyFormatter always includes LangCode or Symbol. Make it include LangCode
|
||||
// because this includes a non-breaking space. Remove the LangCode.
|
||||
auto pos = currencyResult.find(currencyCode);
|
||||
|
@ -367,7 +367,7 @@ String^ UnitConverterViewModel::ConvertToLocalizedString(const std::wstring& str
|
|||
if (hasDecimal)
|
||||
{
|
||||
// Since the output from GetLocaleInfoEx() and DecimalFormatter are differing for decimal string
|
||||
// we are adding the below work-around of editing the string returned by DecimalFormatter
|
||||
// we are adding the below work-around of editing the string returned by DecimalFormatter
|
||||
// and replacing the decimal separator with the one returned by GetLocaleInfoEx()
|
||||
String^ formattedSampleString = m_decimalFormatter->Format(stod("1.1"));
|
||||
wstring formattedSampleWString = wstring(formattedSampleString->Data());
|
||||
|
@ -378,7 +378,7 @@ String^ UnitConverterViewModel::ConvertToLocalizedString(const std::wstring& str
|
|||
{
|
||||
resultWithDecimal.replace(pos, 1, &m_decimalSeparator);
|
||||
}
|
||||
|
||||
|
||||
// Copy back the edited string to the result
|
||||
result = ref new String(resultWithDecimal.c_str());
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ void UnitConverterViewModel::OnButtonPressed(Platform::Object^ parameter)
|
|||
NumbersAndOperatorsEnum numOpEnum = CalculatorButtonPressedEventArgs::GetOperationFromCommandParameter(parameter);
|
||||
UCM::Command command = CommandFromButtonId(numOpEnum);
|
||||
|
||||
//Don't clear the display if combo box is open and escape is pressed
|
||||
// Don't clear the display if combo box is open and escape is pressed
|
||||
if (command == UCM::Command::Clear && IsDropDownOpen)
|
||||
{
|
||||
return;
|
||||
|
@ -674,7 +674,7 @@ void UnitConverterViewModel::Deserialize(Platform::String^ state)
|
|||
RaisePropertyChanged(nullptr); // Update since all props have been updated.
|
||||
}
|
||||
|
||||
//Saving User Preferences of Category and Associated-Units across Sessions.
|
||||
// Saving User Preferences of Category and Associated-Units across Sessions.
|
||||
void UnitConverterViewModel::SaveUserPreferences()
|
||||
{
|
||||
if (UnitsAreValid())
|
||||
|
@ -695,7 +695,7 @@ void UnitConverterViewModel::SaveUserPreferences()
|
|||
}
|
||||
}
|
||||
|
||||
//Restoring User Preferences of Category and Associated-Units.
|
||||
// Restoring User Preferences of Category and Associated-Units.
|
||||
void UnitConverterViewModel::RestoreUserPreferences()
|
||||
{
|
||||
if (!IsCurrencyCurrentCategory)
|
||||
|
@ -973,7 +973,7 @@ void UnitConverterViewModel::OnPaste(String^ stringToPaste, ViewMode mode)
|
|||
{
|
||||
if (isFirstLegalChar)
|
||||
{
|
||||
// Send Clear before sending something that will actually apply
|
||||
// Send Clear before sending something that will actually apply
|
||||
// to the field.
|
||||
m_model->SendCommand(UCM::Command::Clear);
|
||||
isFirstLegalChar = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue