mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 06:13:14 -07:00
refactor: simplified if statements
This commit is contained in:
parent
bc24c088c7
commit
6e4d0a8b2c
1 changed files with 3 additions and 17 deletions
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -109,22 +109,8 @@ CategorySelectionInitializer UnitConverter::SetCurrentCategory(const Category& i
|
|||
vector<Unit>& unitVector = m_categoryToUnits[m_currentCategory];
|
||||
for (unsigned int i = 0; i < unitVector.size(); i++)
|
||||
{
|
||||
if (unitVector[i].id == m_fromType.id)
|
||||
{
|
||||
unitVector[i].isConversionSource = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
unitVector[i].isConversionSource = false;
|
||||
}
|
||||
if (unitVector[i].id == m_toType.id)
|
||||
{
|
||||
unitVector[i].isConversionTarget = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
unitVector[i].isConversionTarget = false;
|
||||
}
|
||||
unitVector[i].isConversionSource = unitVector[i].id == m_fromType.id;
|
||||
unitVector[i].isConversionTarget = unitVector[i].id == m_toType.id;
|
||||
}
|
||||
m_currentCategory = input;
|
||||
if (!m_currentCategory.supportsNegative && m_currentDisplay.front() == L'-')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue