From 9f01c8168b921a82ada80be24203de7729b1b6fa Mon Sep 17 00:00:00 2001 From: Daniel Belcher Date: Thu, 2 May 2019 16:48:33 -0700 Subject: [PATCH 01/13] Secondary formatting changes (#489) Description of the changes: Adjusted some of the values in .clang-format Add clang-format-all.ps1 Fix path to .clang-format in Calculator.sln How changes were validated: Manual. --- .clang-format | 10 +- .../Scripts/clang-format/clang-format-all.ps1 | 91 +++ src/CalcManager/CEngine/History.cpp | 13 +- src/CalcManager/CEngine/Number.cpp | 13 +- src/CalcManager/CEngine/Rational.cpp | 12 +- src/CalcManager/CEngine/calc.cpp | 8 +- src/CalcManager/CEngine/scicomm.cpp | 8 +- src/CalcManager/CalculatorHistory.cpp | 9 +- src/CalcManager/CalculatorHistory.h | 6 +- src/CalcManager/CalculatorManager.cpp | 5 +- src/CalcManager/CalculatorManager.h | 5 +- src/CalcManager/ExpressionCommand.cpp | 13 +- src/CalcManager/Header Files/CalcEngine.h | 8 +- src/CalcManager/Header Files/CalcInput.h | 15 +- src/CalcManager/Header Files/ICalcDisplay.h | 5 +- .../Header Files/IHistoryDisplay.h | 7 +- src/CalcManager/Ratpack/ratpak.h | 10 +- src/CalcManager/UnitConverter.cpp | 3 +- src/CalcManager/UnitConverter.h | 41 +- .../Common/AlwaysSelectedCollectionView.h | 36 +- .../Common/Automation/LiveRegionHost.cpp | 3 +- .../Automation/NarratorAnnouncement.cpp | 68 +- .../Common/Automation/NarratorAnnouncement.h | 7 +- .../Common/Automation/NarratorNotifier.cpp | 12 +- .../Common/Automation/NarratorNotifier.h | 9 +- .../Common/Automation/NotificationHost.cpp | 10 +- .../Common/CalculatorButtonPressedEventArgs.h | 3 +- .../Common/CalculatorDisplay.cpp | 5 +- src/CalcViewModel/Common/CalculatorDisplay.h | 5 +- .../Common/ConversionResultTaskHelper.cpp | 3 +- src/CalcViewModel/Common/CopyPasteManager.cpp | 15 +- src/CalcViewModel/Common/CopyPasteManager.h | 41 +- src/CalcViewModel/Common/DateCalculator.h | 17 +- src/CalcViewModel/Common/DelegateCommand.h | 4 +- .../Common/DisplayExpressionToken.h | 7 +- .../Common/ExpressionCommandDeserializer.cpp | 3 +- .../Common/ExpressionCommandSerializer.cpp | 3 +- .../Common/KeyboardShortcutManager.cpp | 5 +- .../Common/KeyboardShortcutManager.h | 8 +- .../Common/LocalizationService.cpp | 51 +- .../Common/LocalizationService.h | 12 +- .../Common/LocalizationSettings.h | 30 +- src/CalcViewModel/Common/NavCategory.cpp | 216 +++-- src/CalcViewModel/Common/NavCategory.h | 26 +- src/CalcViewModel/Common/TraceActivity.h | 23 +- src/CalcViewModel/Common/TraceLogger.cpp | 4 +- src/CalcViewModel/Common/TraceLogger.h | 4 +- src/CalcViewModel/Common/Utils.cpp | 6 +- src/CalcViewModel/Common/Utils.h | 14 +- .../Common/ValidatingConverters.h | 28 +- .../DataLoaders/CurrencyDataLoader.cpp | 17 +- .../DataLoaders/CurrencyDataLoader.h | 14 +- .../DataLoaders/CurrencyHttpClient.cpp | 4 +- .../DataLoaders/UnitConverterDataLoader.cpp | 758 ++++++++++++------ .../DataLoaders/UnitConverterDataLoader.h | 27 +- src/CalcViewModel/DateCalculatorViewModel.cpp | 11 +- src/CalcViewModel/HistoryItemViewModel.cpp | 17 +- src/CalcViewModel/HistoryItemViewModel.h | 13 +- src/CalcViewModel/HistoryViewModel.cpp | 26 +- src/CalcViewModel/HistoryViewModel.h | 4 +- src/CalcViewModel/MemoryItemViewModel.h | 4 +- .../StandardCalculatorViewModel.cpp | 29 +- .../StandardCalculatorViewModel.h | 10 +- src/CalcViewModel/UnitConverterViewModel.cpp | 17 +- src/CalcViewModel/UnitConverterViewModel.h | 26 +- src/Calculator.sln | 3 +- src/Calculator/App.xaml.cpp | 12 +- src/Calculator/App.xaml.h | 4 +- .../Common/AlwaysSelectedCollectionView.h | 36 +- src/Calculator/Common/AppLifecycleLogger.cpp | 4 +- src/Calculator/Controls/CalculationResult.cpp | 4 +- .../CalculationResultAutomationPeer.cpp | 3 +- src/Calculator/Controls/OverflowTextBlock.cpp | 5 +- .../OverflowTextBlockAutomationPeer.cpp | 3 +- .../BitFlipAutomationNameConverter.h | 14 +- .../Converters/BooleanNegationConverter.h | 7 +- .../Converters/BooleanToVisibilityConverter.h | 14 +- .../ItemSizeToVisibilityConverter.h | 14 +- .../Converters/RadixToStringConverter.h | 7 +- .../Converters/VisibilityNegationConverter.h | 7 +- .../DesignStandardCalculatorViewModel.h | 9 +- .../DesignData/DesignUnitConverterViewModel.h | 21 +- src/Calculator/Views/Calculator.xaml.cpp | 6 +- src/Calculator/Views/Calculator.xaml.h | 10 +- .../CalculatorProgrammerBitFlipPanel.xaml.cpp | 3 +- .../CalculatorProgrammerBitFlipPanel.xaml.h | 6 +- .../CalculatorProgrammerDisplayPanel.xaml.cpp | 3 +- ...alculatorProgrammerRadixOperators.xaml.cpp | 3 +- .../CalculatorScientificAngleButtons.xaml.cpp | 3 +- .../CalculatorScientificOperators.xaml.cpp | 5 +- .../CalculatorStandardOperators.xaml.cpp | 3 +- src/Calculator/Views/DateCalculator.xaml.cpp | 15 +- src/Calculator/Views/DateCalculator.xaml.h | 15 +- src/Calculator/Views/MainPage.xaml.cpp | 3 +- src/Calculator/Views/MainPage.xaml.h | 5 +- src/Calculator/Views/Memory.xaml.cpp | 3 +- src/Calculator/Views/NumberPad.xaml.cpp | 3 +- .../Views/SupplementaryResults.xaml.h | 14 +- src/Calculator/Views/TitleBar.xaml.cpp | 7 +- src/Calculator/Views/UnitConverter.xaml.cpp | 4 +- src/Calculator/WindowFrameService.h | 4 +- src/CalculatorUnitTests/CalcEngineTests.cpp | 41 +- src/CalculatorUnitTests/CalcInputTest.cpp | 4 +- .../CalculatorManagerTest.cpp | 5 +- .../CopyPasteManagerTest.cpp | 218 +++-- .../CurrencyConverterUnitTests.cpp | 6 +- .../DateCalculatorUnitTests.cpp | 4 +- src/CalculatorUnitTests/DateUtils.h | 6 +- src/CalculatorUnitTests/HistoryTests.cpp | 9 +- .../Mocks/CurrencyHttpClient.cpp | 3 +- .../StandardViewModelUnitTests.cpp | 8 +- src/CalculatorUnitTests/UnitConverterTest.cpp | 73 +- .../UnitConverterViewModelUnitTests.cpp | 3 +- 113 files changed, 1780 insertions(+), 819 deletions(-) create mode 100644 Tools/Scripts/clang-format/clang-format-all.ps1 diff --git a/.clang-format b/.clang-format index 6f60f7bf..16412e51 100644 --- a/.clang-format +++ b/.clang-format @@ -1,11 +1,11 @@ AccessModifierOffset: -4 -AlignAfterOpenBracket: Align +AlignAfterOpenBracket: AlwaysBreak AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false AlignEscapedNewlines: Right AlignOperands: true AlignTrailingComments: true -AllowAllParametersOfDeclarationOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: None @@ -15,8 +15,8 @@ AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: true -BinPackArguments: true -BinPackParameters: true +BinPackArguments: false +BinPackParameters: false BreakBeforeBinaryOperators: NonAssignment BreakBeforeBraces: Allman BreakBeforeInheritanceComma: false @@ -28,7 +28,7 @@ BreakStringLiterals: true ColumnLimit: 160 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: true -ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: false diff --git a/Tools/Scripts/clang-format/clang-format-all.ps1 b/Tools/Scripts/clang-format/clang-format-all.ps1 new file mode 100644 index 00000000..107f3f2c --- /dev/null +++ b/Tools/Scripts/clang-format/clang-format-all.ps1 @@ -0,0 +1,91 @@ +<# + .DESCRIPTION + Helper script to format all header and source files in the repository. + + By default, the script will recursively search under the repo root for + files to format. Users can give explicit parameters indicating how the + search should include and exclude filetypes. + + If users don't want the search functionality, they can instead provide + an explicit list of files to format. + + .PARAMETER RepoRoot + Full path to the root of the repository which is the target of the search. + Will default to the root of the current working directory. + + .PARAMETER Include + Array of filetype extensions to target for formatting. + By default, targets standard extensions for header and source files. + Follows the same rules as the -Include parameter for Get-ChildItem. + + .PARAMETER Exclude + Array of filetype extensions to exclude from formatting. + By default, excludes generated XAML files. + Follows the same rules as the -Exclude paramter for Get-ChildItem. + + .PARAMETER Files + Array of files to format. The script will exit if one of the provided + filepaths does not exist. + + .EXAMPLE + .\clang-format-all.ps1 + + Formats all header and source files under the repository root. + + .EXAMPLE + .\clang-format-all.ps1 -RepoRoot 'S:\repos\calculator' -Include '*.h', '*.cpp' -Exclude '*.g.*' + + Formats all *.h and *.cpp files under 'S:\repos\calculator', excluding files with an extension + like *.g.* + + .EXAMPLE + .\clang-format-all.ps1 -File 'S:\repos\calculator\src\CalcViewModel\UnitConverterViewModel.h', 'S:\repos\calculator\src\CalcViewModel\MemoryItemViewModel.cpp' + + Formats the specified files. +#> +[CmdletBinding( DefaultParameterSetName = 'Search' )] +param( + [Parameter( ParameterSetName = 'Search' )] + [ValidateScript({ Test-Path -PathType Container -Path $_ })] + [string] $RepoRoot = "$( git rev-parse --show-toplevel )", + + [Parameter( ParameterSetName = 'Search' )] + [string[]] $Include = ( '*.h', '*.hh', '*.hpp', '*.c', '*.cc', '*.cpp' ), + + [Parameter( ParameterSetName = 'Search' )] + [string[]] $Exclude = '*.g.*', + + [Parameter( + ParameterSetName = 'Explicit', + Mandatory)] + [ValidateScript({ + $_ | Where-Object { -not (Test-Path -PathType Leaf -Path $_) } | + ForEach-Object { throw "Could not find file: [$_]" } + + return $true + })] + [string[]] $Files +) + +if ($PSCmdlet.ParameterSetName -eq 'Explicit') +{ + # Use the file paths we were given. + $targetFiles = @($Files) +} +else +{ + # Gather the files to be formatted. + $targetFiles = @( + Get-ChildItem -Recurse -Path $RepoRoot -Include $Include -Exclude $Exclude | + Select-Object -ExpandProperty FullName + ) +} + +# Format the files. +$formatParams = @( + '-i' # In-place + '-style=file' # Search for a .clang-format file in the parent directory of the source file. + '-verbose' +) + +clang-format $formatParams $targetFiles \ No newline at end of file diff --git a/src/CalcManager/CEngine/History.cpp b/src/CalcManager/CEngine/History.cpp index a7ea93ed..37add769 100644 --- a/src/CalcManager/CEngine/History.cpp +++ b/src/CalcManager/CEngine/History.cpp @@ -40,7 +40,10 @@ void CHistoryCollector::ReinitHistory() // Constructor // Can throw Out of memory error CHistoryCollector::CHistoryCollector(ICalcDisplay* pCalcDisplay, std::shared_ptr pHistoryDisplay, wchar_t decimalSymbol) - : m_pHistoryDisplay(pHistoryDisplay), m_pCalcDisplay(pCalcDisplay), m_iCurLineHistStart(-1), m_decimalSymbol(decimalSymbol) + : m_pHistoryDisplay(pHistoryDisplay) + , m_pCalcDisplay(pCalcDisplay) + , m_iCurLineHistStart(-1) + , m_decimalSymbol(decimalSymbol) { ReinitHistory(); } @@ -300,8 +303,8 @@ void CHistoryCollector::CompleteHistoryLine(wstring_view numStr) { if (nullptr != m_pCalcDisplay) { - m_pCalcDisplay->SetExpressionDisplay(std::make_shared>>(), - std::make_shared>>()); + m_pCalcDisplay->SetExpressionDisplay( + std::make_shared>>(), std::make_shared>>()); } if (nullptr != m_pHistoryDisplay) @@ -322,8 +325,8 @@ void CHistoryCollector::ClearHistoryLine(wstring_view errStr) { if (nullptr != m_pCalcDisplay) { - m_pCalcDisplay->SetExpressionDisplay(std::make_shared>>(), - std::make_shared>>()); + m_pCalcDisplay->SetExpressionDisplay( + std::make_shared>>(), std::make_shared>>()); } m_iCurLineHistStart = -1; // It will get recomputed at the first Opnd ReinitHistory(); diff --git a/src/CalcManager/CEngine/Number.cpp b/src/CalcManager/CEngine/Number.cpp index 685974a7..7b3be21b 100644 --- a/src/CalcManager/CEngine/Number.cpp +++ b/src/CalcManager/CEngine/Number.cpp @@ -7,15 +7,22 @@ using namespace std; namespace CalcEngine { - Number::Number() noexcept : Number(1, 0, { 0 }) + Number::Number() noexcept + : Number(1, 0, { 0 }) { } - Number::Number(int32_t sign, int32_t exp, vector const& mantissa) noexcept : m_sign{ sign }, m_exp{ exp }, m_mantissa{ mantissa } + Number::Number(int32_t sign, int32_t exp, vector const& mantissa) noexcept + : m_sign{ sign } + , m_exp{ exp } + , m_mantissa{ mantissa } { } - Number::Number(PNUMBER p) noexcept : m_sign{ p->sign }, m_exp{ p->exp }, m_mantissa{} + Number::Number(PNUMBER p) noexcept + : m_sign{ p->sign } + , m_exp{ p->exp } + , m_mantissa{} { m_mantissa.reserve(p->cdigit); copy(p->mant, p->mant + p->cdigit, back_inserter(m_mantissa)); diff --git a/src/CalcManager/CEngine/Rational.cpp b/src/CalcManager/CEngine/Rational.cpp index be2fcb7e..a0bcd97d 100644 --- a/src/CalcManager/CEngine/Rational.cpp +++ b/src/CalcManager/CEngine/Rational.cpp @@ -7,7 +7,9 @@ using namespace std; namespace CalcEngine { - Rational::Rational() noexcept : m_p{}, m_q{ 1, 0, { 1 } } + Rational::Rational() noexcept + : m_p{} + , m_q{ 1, 0, { 1 } } { } @@ -23,7 +25,9 @@ namespace CalcEngine m_q = Number(1, qExp, { 1 }); } - Rational::Rational(Number const& p, Number const& q) noexcept : m_p{ p }, m_q{ q } + Rational::Rational(Number const& p, Number const& q) noexcept + : m_p{ p } + , m_q{ q } { } @@ -58,7 +62,9 @@ namespace CalcEngine m_q = Number{ temp.Q() }; } - Rational::Rational(PRAT prat) noexcept : m_p{ Number{ prat->pp } }, m_q{ Number{ prat->pq } } + Rational::Rational(PRAT prat) noexcept + : m_p{ Number{ prat->pp } } + , m_q{ Number{ prat->pq } } { } diff --git a/src/CalcManager/CEngine/calc.cpp b/src/CalcManager/CEngine/calc.cpp index 41d41c7b..c71d2927 100644 --- a/src/CalcManager/CEngine/calc.cpp +++ b/src/CalcManager/CEngine/calc.cpp @@ -58,8 +58,12 @@ void CCalcEngine::InitialOneTimeOnlySetup(CalculationManager::IResourceProvider& // CCalcEngine::CCalcEngine // ////////////////////////////////////////////////// -CCalcEngine::CCalcEngine(bool fPrecedence, bool fIntegerMode, CalculationManager::IResourceProvider* const pResourceProvider, - __in_opt ICalcDisplay* pCalcDisplay, __in_opt shared_ptr pHistoryDisplay) +CCalcEngine::CCalcEngine( + bool fPrecedence, + bool fIntegerMode, + CalculationManager::IResourceProvider* const pResourceProvider, + __in_opt ICalcDisplay* pCalcDisplay, + __in_opt shared_ptr pHistoryDisplay) : m_fPrecedence(fPrecedence) , m_fIntegerMode(fIntegerMode) , m_pCalcDisplay(pCalcDisplay) diff --git a/src/CalcManager/CEngine/scicomm.cpp b/src/CalcManager/CEngine/scicomm.cpp index 12cde360..eabb7f94 100644 --- a/src/CalcManager/CEngine/scicomm.cpp +++ b/src/CalcManager/CEngine/scicomm.cpp @@ -382,8 +382,8 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam) if (nullptr != m_pCalcDisplay) { m_pCalcDisplay->SetParenthesisNumber(0); - m_pCalcDisplay->SetExpressionDisplay(make_shared>>(), - make_shared>>()); + m_pCalcDisplay->SetExpressionDisplay( + make_shared>>(), make_shared>>()); } m_HistoryCollector.ClearHistoryLine(wstring()); @@ -476,8 +476,8 @@ void CCalcEngine::ProcessCommandWorker(OpCode wParam) m_HistoryCollector.CompleteHistoryLine(groupedString); if (nullptr != m_pCalcDisplay) { - m_pCalcDisplay->SetExpressionDisplay(make_shared>>(), - make_shared>>()); + m_pCalcDisplay->SetExpressionDisplay( + make_shared>>(), make_shared>>()); } } diff --git a/src/CalcManager/CalculatorHistory.cpp b/src/CalcManager/CalculatorHistory.cpp index 8929cc0c..14a94a8c 100644 --- a/src/CalcManager/CalculatorHistory.cpp +++ b/src/CalcManager/CalculatorHistory.cpp @@ -7,12 +7,15 @@ using namespace std; using namespace CalculationManager; -CalculatorHistory::CalculatorHistory(size_t maxSize) : m_maxHistorySize(maxSize) +CalculatorHistory::CalculatorHistory(size_t maxSize) + : m_maxHistorySize(maxSize) { } -unsigned int CalculatorHistory::AddToHistory(_In_ shared_ptr>> const& tokens, - _In_ shared_ptr>> const& commands, _In_ wstring_view result) +unsigned int CalculatorHistory::AddToHistory( + _In_ shared_ptr>> const& tokens, + _In_ shared_ptr>> const& commands, + _In_ wstring_view result) { unsigned int addedIndex; wstring generatedExpression; diff --git a/src/CalcManager/CalculatorHistory.h b/src/CalcManager/CalculatorHistory.h index eadb04af..75b74255 100644 --- a/src/CalcManager/CalculatorHistory.h +++ b/src/CalcManager/CalculatorHistory.h @@ -30,8 +30,10 @@ namespace CalculationManager { public: CalculatorHistory(const size_t maxSize); - unsigned int AddToHistory(_In_ std::shared_ptr>> const& spTokens, - _In_ std::shared_ptr>> const& spCommands, std::wstring_view result); + unsigned int AddToHistory( + _In_ std::shared_ptr>> const& spTokens, + _In_ std::shared_ptr>> const& spCommands, + std::wstring_view result); std::vector> const& GetHistory(); std::shared_ptr const& GetHistoryItem(unsigned int uIdx); void ClearHistory(); diff --git a/src/CalcManager/CalculatorManager.cpp b/src/CalcManager/CalculatorManager.cpp index 5d542843..569e0114 100644 --- a/src/CalcManager/CalculatorManager.cpp +++ b/src/CalcManager/CalculatorManager.cpp @@ -85,8 +85,9 @@ namespace CalculationManager /// Used to set the expression display value on ViewModel /// /// wstring representing expression to be displayed - void CalculatorManager::SetExpressionDisplay(_Inout_ shared_ptr>> const& tokens, - _Inout_ shared_ptr>> const& commands) + void CalculatorManager::SetExpressionDisplay( + _Inout_ shared_ptr>> const& tokens, + _Inout_ shared_ptr>> const& commands) { if (!m_inHistoryItemLoadMode) { diff --git a/src/CalcManager/CalculatorManager.h b/src/CalcManager/CalculatorManager.h index 91a519d2..a288bdf2 100644 --- a/src/CalcManager/CalculatorManager.h +++ b/src/CalcManager/CalculatorManager.h @@ -91,8 +91,9 @@ namespace CalculationManager // ICalcDisplay void SetPrimaryDisplay(_In_ const std::wstring& displayString, _In_ bool isError) override; void SetIsInError(bool isError) override; - void SetExpressionDisplay(_Inout_ std::shared_ptr>> const& tokens, - _Inout_ std::shared_ptr>> const& commands) override; + void SetExpressionDisplay( + _Inout_ std::shared_ptr>> const& tokens, + _Inout_ std::shared_ptr>> const& commands) override; void SetMemorizedNumbers(_In_ const std::vector& memorizedNumbers) override; void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) override; void SetParenthesisNumber(_In_ unsigned int parenthesisCount) override; diff --git a/src/CalcManager/ExpressionCommand.cpp b/src/CalcManager/ExpressionCommand.cpp index c177de02..079e02aa 100644 --- a/src/CalcManager/ExpressionCommand.cpp +++ b/src/CalcManager/ExpressionCommand.cpp @@ -13,7 +13,8 @@ constexpr wchar_t chNegate = L'-'; constexpr wchar_t chExp = L'e'; constexpr wchar_t chPlus = L'+'; -CParentheses::CParentheses(_In_ int command) : m_command(command) +CParentheses::CParentheses(_In_ int command) + : m_command(command) { } @@ -73,7 +74,8 @@ void CUnaryCommand::Accept(_In_ ISerializeCommandVisitor& commandVisitor) commandVisitor.Visit(*this); } -CBinaryCommand::CBinaryCommand(int command) : m_command(command) +CBinaryCommand::CBinaryCommand(int command) + : m_command(command) { } @@ -98,7 +100,12 @@ void CBinaryCommand::Accept(_In_ ISerializeCommandVisitor& commandVisitor) } COpndCommand::COpndCommand(shared_ptr> const& commands, bool fNegative, bool fDecimal, bool fSciFmt) - : m_commands(commands), m_fNegative(fNegative), m_fSciFmt(fSciFmt), m_fDecimal(fDecimal), m_fInitialized(false), m_value{} + : m_commands(commands) + , m_fNegative(fNegative) + , m_fSciFmt(fSciFmt) + , m_fDecimal(fDecimal) + , m_fInitialized(false) + , m_value{} { } diff --git a/src/CalcManager/Header Files/CalcEngine.h b/src/CalcManager/Header Files/CalcEngine.h index ac29ba2a..03a5437e 100644 --- a/src/CalcManager/Header Files/CalcEngine.h +++ b/src/CalcManager/Header Files/CalcEngine.h @@ -54,8 +54,12 @@ namespace CalculatorEngineTests class CCalcEngine { public: - CCalcEngine(bool fPrecedence, bool fIntegerMode, CalculationManager::IResourceProvider* const pResourceProvider, __in_opt ICalcDisplay* pCalcDisplay, - __in_opt std::shared_ptr pHistoryDisplay); + CCalcEngine( + bool fPrecedence, + bool fIntegerMode, + CalculationManager::IResourceProvider* const pResourceProvider, + __in_opt ICalcDisplay* pCalcDisplay, + __in_opt std::shared_ptr pHistoryDisplay); void ProcessCommand(OpCode wID); void DisplayError(uint32_t nError); std::unique_ptr PersistedMemObject(); diff --git a/src/CalcManager/Header Files/CalcInput.h b/src/CalcManager/Header Files/CalcInput.h index 3e88f740..045cdb89 100644 --- a/src/CalcManager/Header Files/CalcInput.h +++ b/src/CalcManager/Header Files/CalcInput.h @@ -13,7 +13,9 @@ namespace CalcEngine class CalcNumSec { public: - CalcNumSec() : value(), m_isNegative(false) + CalcNumSec() + : value() + , m_isNegative(false) { } @@ -41,11 +43,18 @@ namespace CalcEngine class CalcInput { public: - CalcInput() : CalcInput(L'.') + CalcInput() + : CalcInput(L'.') { } - CalcInput(wchar_t decSymbol) : m_hasExponent(false), m_hasDecimal(false), m_decPtIndex(0), m_decSymbol(decSymbol), m_base(), m_exponent() + CalcInput(wchar_t decSymbol) + : m_hasExponent(false) + , m_hasDecimal(false) + , m_decPtIndex(0) + , m_decSymbol(decSymbol) + , m_base() + , m_exponent() { } diff --git a/src/CalcManager/Header Files/ICalcDisplay.h b/src/CalcManager/Header Files/ICalcDisplay.h index 93bb81c4..f4aebec3 100644 --- a/src/CalcManager/Header Files/ICalcDisplay.h +++ b/src/CalcManager/Header Files/ICalcDisplay.h @@ -12,8 +12,9 @@ class ICalcDisplay public: virtual void SetPrimaryDisplay(const std::wstring& pszText, bool isError) = 0; virtual void SetIsInError(bool isInError) = 0; - virtual void SetExpressionDisplay(_Inout_ std::shared_ptr>> const& tokens, - _Inout_ std::shared_ptr>> const& commands) = 0; + virtual void SetExpressionDisplay( + _Inout_ std::shared_ptr>> const& tokens, + _Inout_ std::shared_ptr>> const& commands) = 0; virtual void SetParenthesisNumber(_In_ unsigned int count) = 0; virtual void OnNoRightParenAdded() = 0; virtual void MaxDigitsReached() = 0; // not an error but still need to inform UI layer. diff --git a/src/CalcManager/Header Files/IHistoryDisplay.h b/src/CalcManager/Header Files/IHistoryDisplay.h index c7189718..7e2a9019 100644 --- a/src/CalcManager/Header Files/IHistoryDisplay.h +++ b/src/CalcManager/Header Files/IHistoryDisplay.h @@ -8,7 +8,8 @@ class IHistoryDisplay { public: virtual ~IHistoryDisplay(){}; - virtual unsigned int AddToHistory(_In_ std::shared_ptr>> const& tokens, - _In_ std::shared_ptr>> const& commands, - _In_ std::wstring_view result) = 0; + virtual unsigned int AddToHistory( + _In_ std::shared_ptr>> const& tokens, + _In_ std::shared_ptr>> const& commands, + _In_ std::wstring_view result) = 0; }; diff --git a/src/CalcManager/Ratpack/ratpak.h b/src/CalcManager/Ratpack/ratpak.h index d98b3003..2e7c973c 100644 --- a/src/CalcManager/Ratpack/ratpak.h +++ b/src/CalcManager/Ratpack/ratpak.h @@ -356,12 +356,14 @@ uint64_t rattoUi64(_In_ PRAT prat, uint32_t radix, int32_t precision); extern PNUMBER _createnum(_In_ uint32_t size); // returns an empty number structure with size digits extern PNUMBER nRadixxtonum(_In_ PNUMBER a, uint32_t radix, int32_t precision); extern PNUMBER gcd(_In_ PNUMBER a, _In_ PNUMBER b); -extern PNUMBER StringToNumber(std::wstring_view numberString, uint32_t radix, - int32_t precision); // takes a text representation of a number and returns a number. +extern PNUMBER StringToNumber( + std::wstring_view numberString, + uint32_t radix, + int32_t precision); // takes a text representation of a number and returns a number. // takes a text representation of a number as a mantissa with sign and an exponent with sign. -extern PRAT StringToRat(bool mantissaIsNegative, std::wstring_view mantissa, bool exponentIsNegative, std::wstring_view exponent, uint32_t radix, - int32_t precision); +extern PRAT +StringToRat(bool mantissaIsNegative, std::wstring_view mantissa, bool exponentIsNegative, std::wstring_view exponent, uint32_t radix, int32_t precision); extern PNUMBER i32factnum(int32_t ini32, uint32_t radix); extern PNUMBER i32prodnum(int32_t start, int32_t stop, uint32_t radix); diff --git a/src/CalcManager/UnitConverter.cpp b/src/CalcManager/UnitConverter.cpp index 6c59ae97..3b5490a0 100644 --- a/src/CalcManager/UnitConverter.cpp +++ b/src/CalcManager/UnitConverter.cpp @@ -34,7 +34,8 @@ unordered_map unquoteConversions; /// Constructor, sets up all the variables and requires a configLoader /// /// An instance of the IConverterDataLoader interface which we use to read in category/unit names and conversion data -UnitConverter::UnitConverter(_In_ const shared_ptr& dataLoader) : UnitConverter::UnitConverter(dataLoader, nullptr) +UnitConverter::UnitConverter(_In_ const shared_ptr& dataLoader) + : UnitConverter::UnitConverter(dataLoader, nullptr) { } diff --git a/src/CalcManager/UnitConverter.h b/src/CalcManager/UnitConverter.h index 87dc91dc..b111ee79 100644 --- a/src/CalcManager/UnitConverter.h +++ b/src/CalcManager/UnitConverter.h @@ -29,9 +29,19 @@ namespace UnitConversionManager { } - Unit(int id, std::wstring currencyName, std::wstring countryName, std::wstring abbreviation, bool isRtlLanguage, bool isConversionSource, - bool isConversionTarget) - : id(id), abbreviation(abbreviation), isConversionSource(isConversionSource), isConversionTarget(isConversionTarget), isWhimsical(false) + Unit( + int id, + std::wstring currencyName, + std::wstring countryName, + std::wstring abbreviation, + bool isRtlLanguage, + bool isConversionSource, + bool isConversionTarget) + : id(id) + , abbreviation(abbreviation) + , isConversionSource(isConversionSource) + , isConversionTarget(isConversionTarget) + , isWhimsical(false) { std::wstring nameValue1 = isRtlLanguage ? currencyName : countryName; std::wstring nameValue2 = isRtlLanguage ? countryName : currencyName; @@ -76,7 +86,10 @@ namespace UnitConversionManager { } - Category(int id, std::wstring name, bool supportsNegative) : id(id), name(name), supportsNegative(supportsNegative) + Category(int id, std::wstring name, bool supportsNegative) + : id(id) + , name(name) + , supportsNegative(supportsNegative) { } @@ -125,7 +138,10 @@ namespace UnitConversionManager ConversionData() { } - ConversionData(double ratio, double offset, bool offsetFirst) : ratio(ratio), offset(offset), offsetFirst(offsetFirst) + ConversionData(double ratio, double offset, bool offsetFirst) + : ratio(ratio) + , offset(offset) + , offsetFirst(offsetFirst) { } @@ -155,9 +171,10 @@ namespace UnitConversionManager }; typedef std::tuple, UnitConversionManager::Unit, UnitConversionManager::Unit> CategorySelectionInitializer; - typedef std::unordered_map, - UnitConversionManager::UnitHash> + typedef std::unordered_map< + UnitConversionManager::Unit, + std::unordered_map, + UnitConversionManager::UnitHash> UnitToUnitToConversionDataMap; typedef std::unordered_map, UnitConversionManager::CategoryHash> CategoryToUnitVectorMap; @@ -188,10 +205,10 @@ namespace UnitConversionManager { public: virtual void SetViewModelCallback(const std::shared_ptr& callback) = 0; - virtual std::pair GetCurrencySymbols(_In_ const UnitConversionManager::Unit& unit1, - _In_ const UnitConversionManager::Unit& unit2) = 0; - virtual std::pair GetCurrencyRatioEquality(_In_ const UnitConversionManager::Unit& unit1, - _In_ const UnitConversionManager::Unit& unit2) = 0; + virtual std::pair + GetCurrencySymbols(_In_ const UnitConversionManager::Unit& unit1, _In_ const UnitConversionManager::Unit& unit2) = 0; + virtual std::pair + GetCurrencyRatioEquality(_In_ const UnitConversionManager::Unit& unit1, _In_ const UnitConversionManager::Unit& unit2) = 0; virtual std::wstring GetCurrencyTimestamp() = 0; virtual concurrency::task TryLoadDataFromCacheAsync() = 0; diff --git a/src/CalcViewModel/Common/AlwaysSelectedCollectionView.h b/src/CalcViewModel/Common/AlwaysSelectedCollectionView.h index 1d0c7c49..57e1d74e 100644 --- a/src/CalcViewModel/Common/AlwaysSelectedCollectionView.h +++ b/src/CalcViewModel/Common/AlwaysSelectedCollectionView.h @@ -9,7 +9,8 @@ namespace CalculatorApp { ref class AlwaysSelectedCollectionView sealed : public Windows::UI::Xaml::DependencyObject, public Windows::UI::Xaml::Data::ICollectionView { - internal : AlwaysSelectedCollectionView(Windows::UI::Xaml::Interop::IBindableVector ^ source) : m_currentPosition(-1) + internal : AlwaysSelectedCollectionView(Windows::UI::Xaml::Interop::IBindableVector ^ source) + : m_currentPosition(-1) { m_source = source; @@ -47,8 +48,8 @@ namespace CalculatorApp throw ref new Platform::NotImplementedException(); } property Windows::Foundation::Collections::IObservableVector ^ CollectionGroups { - virtual Windows::Foundation::Collections::IObservableVector ^ get() = Windows::UI::Xaml::Data::ICollectionView::CollectionGroups::get + virtual Windows::Foundation::Collections::IObservableVector< + Platform::Object ^> ^ get() = Windows::UI::Xaml::Data::ICollectionView::CollectionGroups::get { return ref new Platform::Collections::Vector(); } @@ -80,8 +81,9 @@ namespace CalculatorApp // restore the selection to the way we wanted it to begin with if (m_currentPosition >= 0 && m_currentPosition < static_cast(m_source->Size)) { - this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, - ref new Windows::UI::Core::DispatchedHandler([this]() { m_currentChanged(this, nullptr); })); + this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([this]() { + m_currentChanged(this, nullptr); + })); } return false; } @@ -167,14 +169,14 @@ namespace CalculatorApp { throw ref new Platform::NotImplementedException(); } - virtual unsigned int - GetMany(unsigned int /*startIndex*/, - Platform::WriteOnlyArray ^ /*items*/) = Windows::Foundation::Collections::IVector::GetMany + virtual unsigned int GetMany( + unsigned int /*startIndex*/, + Platform::WriteOnlyArray ^ /*items*/) = Windows::Foundation::Collections::IVector::GetMany { throw ref new Platform::NotImplementedException(); } - virtual Windows::Foundation::Collections::IVectorView ^ GetView() = Windows::Foundation::Collections::IVector::GetView + virtual Windows::Foundation::Collections::IVectorView ^ GetView() = Windows::Foundation::Collections::IVector< + Platform::Object ^>::GetView { throw ref new Platform::NotImplementedException(); } @@ -263,8 +265,11 @@ namespace CalculatorApp private: virtual Platform::Object - ^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/, - Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::Convert + ^ Convert( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName /*targetType*/, + Platform::Object ^ /*parameter*/, + Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::Convert { auto result = dynamic_cast(value); if (result) @@ -275,8 +280,11 @@ namespace CalculatorApp } virtual Platform::Object - ^ ConvertBack(Platform::Object ^ /*value*/, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/, - Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack + ^ ConvertBack( + Platform::Object ^ /*value*/, + Windows::UI::Xaml::Interop::TypeName /*targetType*/, + Platform::Object ^ /*parameter*/, + Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack { return Windows::UI::Xaml::DependencyProperty::UnsetValue; } diff --git a/src/CalcViewModel/Common/Automation/LiveRegionHost.cpp b/src/CalcViewModel/Common/Automation/LiveRegionHost.cpp index 4fd96591..0df3a96c 100644 --- a/src/CalcViewModel/Common/Automation/LiveRegionHost.cpp +++ b/src/CalcViewModel/Common/Automation/LiveRegionHost.cpp @@ -9,7 +9,8 @@ using namespace Windows::UI::Xaml::Automation; using namespace Windows::UI::Xaml::Automation::Peers; using namespace Windows::UI::Xaml::Controls; -LiveRegionHost::LiveRegionHost() : m_host(nullptr) +LiveRegionHost::LiveRegionHost() + : m_host(nullptr) { } diff --git a/src/CalcViewModel/Common/Automation/NarratorAnnouncement.cpp b/src/CalcViewModel/Common/Automation/NarratorAnnouncement.cpp index fd5bb0a0..5b6d99bd 100644 --- a/src/CalcViewModel/Common/Automation/NarratorAnnouncement.cpp +++ b/src/CalcViewModel/Common/Automation/NarratorAnnouncement.cpp @@ -25,9 +25,15 @@ namespace CalculatorApp::Common::Automation } } -NarratorAnnouncement::NarratorAnnouncement(String ^ announcement, String ^ activityId, AutomationNotificationKind kind, - AutomationNotificationProcessing processing) - : m_announcement(announcement), m_activityId(activityId), m_kind(kind), m_processing(processing) +NarratorAnnouncement::NarratorAnnouncement( + String ^ announcement, + String ^ activityId, + AutomationNotificationKind kind, + AutomationNotificationProcessing processing) + : m_announcement(announcement) + , m_activityId(activityId) + , m_kind(kind) + , m_processing(processing) { } @@ -58,66 +64,78 @@ bool NarratorAnnouncement::IsValid(NarratorAnnouncement ^ announcement) NarratorAnnouncement ^ CalculatorAnnouncement::GetDisplayUpdatedAnnouncement(String ^ announcement) { - return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::DisplayUpdated, AutomationNotificationKind::Other, - AutomationNotificationProcessing::ImportantMostRecent); + return ref new NarratorAnnouncement( + announcement, CalculatorActivityIds::DisplayUpdated, AutomationNotificationKind::Other, AutomationNotificationProcessing::ImportantMostRecent); } NarratorAnnouncement ^ CalculatorAnnouncement::GetMaxDigitsReachedAnnouncement(String ^ announcement) { - return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::MaxDigitsReached, AutomationNotificationKind::Other, - AutomationNotificationProcessing::ImportantMostRecent); + return ref new NarratorAnnouncement( + announcement, CalculatorActivityIds::MaxDigitsReached, AutomationNotificationKind::Other, AutomationNotificationProcessing::ImportantMostRecent); } NarratorAnnouncement ^ CalculatorAnnouncement::GetMemoryClearedAnnouncement(String ^ announcement) { - return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::MemoryCleared, AutomationNotificationKind::ItemRemoved, - AutomationNotificationProcessing::ImportantMostRecent); + return ref new NarratorAnnouncement( + announcement, CalculatorActivityIds::MemoryCleared, AutomationNotificationKind::ItemRemoved, AutomationNotificationProcessing::ImportantMostRecent); } NarratorAnnouncement ^ CalculatorAnnouncement::GetMemoryItemChangedAnnouncement(String ^ announcement) { - return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::MemoryItemChanged, AutomationNotificationKind::ActionCompleted, - AutomationNotificationProcessing::MostRecent); + return ref new NarratorAnnouncement( + announcement, CalculatorActivityIds::MemoryItemChanged, AutomationNotificationKind::ActionCompleted, AutomationNotificationProcessing::MostRecent); } NarratorAnnouncement ^ CalculatorAnnouncement::GetMemoryItemAddedAnnouncement(String ^ announcement) { - return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::MemoryItemAdded, AutomationNotificationKind::ItemAdded, - AutomationNotificationProcessing::MostRecent); + return ref new NarratorAnnouncement( + announcement, CalculatorActivityIds::MemoryItemAdded, AutomationNotificationKind::ItemAdded, AutomationNotificationProcessing::MostRecent); } NarratorAnnouncement ^ CalculatorAnnouncement::GetHistoryClearedAnnouncement(String ^ announcement) { - return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::HistoryCleared, AutomationNotificationKind::ItemRemoved, - AutomationNotificationProcessing::MostRecent); + return ref new NarratorAnnouncement( + announcement, CalculatorActivityIds::HistoryCleared, AutomationNotificationKind::ItemRemoved, AutomationNotificationProcessing::MostRecent); } NarratorAnnouncement ^ CalculatorAnnouncement::GetCategoryNameChangedAnnouncement(String ^ announcement) { - return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::CategoryNameChanged, AutomationNotificationKind::ActionCompleted, - AutomationNotificationProcessing::ImportantMostRecent); + return ref new NarratorAnnouncement( + announcement, + CalculatorActivityIds::CategoryNameChanged, + AutomationNotificationKind::ActionCompleted, + AutomationNotificationProcessing::ImportantMostRecent); } NarratorAnnouncement ^ CalculatorAnnouncement::GetUpdateCurrencyRatesAnnouncement(String ^ announcement) { - return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::UpdateCurrencyRates, AutomationNotificationKind::ActionCompleted, - AutomationNotificationProcessing::ImportantMostRecent); + return ref new NarratorAnnouncement( + announcement, + CalculatorActivityIds::UpdateCurrencyRates, + AutomationNotificationKind::ActionCompleted, + AutomationNotificationProcessing::ImportantMostRecent); } NarratorAnnouncement ^ CalculatorAnnouncement::GetDisplayCopiedAnnouncement(String ^ announcement) { - return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::DisplayCopied, AutomationNotificationKind::ActionCompleted, - AutomationNotificationProcessing::ImportantMostRecent); + return ref new NarratorAnnouncement( + announcement, CalculatorActivityIds::DisplayCopied, AutomationNotificationKind::ActionCompleted, AutomationNotificationProcessing::ImportantMostRecent); } NarratorAnnouncement ^ CalculatorAnnouncement::GetOpenParenthesisCountChangedAnnouncement(String ^ announcement) { - return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::OpenParenthesisCountChanged, AutomationNotificationKind::ActionCompleted, - AutomationNotificationProcessing::ImportantMostRecent); + return ref new NarratorAnnouncement( + announcement, + CalculatorActivityIds::OpenParenthesisCountChanged, + AutomationNotificationKind::ActionCompleted, + AutomationNotificationProcessing::ImportantMostRecent); } NarratorAnnouncement ^ CalculatorAnnouncement::GetNoRightParenthesisAddedAnnouncement(String ^ announcement) { - return ref new NarratorAnnouncement(announcement, CalculatorActivityIds::NoParenthesisAdded, AutomationNotificationKind::ActionCompleted, - AutomationNotificationProcessing::ImportantMostRecent); + return ref new NarratorAnnouncement( + announcement, + CalculatorActivityIds::NoParenthesisAdded, + AutomationNotificationKind::ActionCompleted, + AutomationNotificationProcessing::ImportantMostRecent); } diff --git a/src/CalcViewModel/Common/Automation/NarratorAnnouncement.h b/src/CalcViewModel/Common/Automation/NarratorAnnouncement.h index f3582981..c4c0c526 100644 --- a/src/CalcViewModel/Common/Automation/NarratorAnnouncement.h +++ b/src/CalcViewModel/Common/Automation/NarratorAnnouncement.h @@ -58,8 +58,11 @@ public // class that can access the private constructor. friend class CalculatorAnnouncement; - NarratorAnnouncement(Platform::String ^ announcement, Platform::String ^ activityId, AutomationNotificationKind kind, - AutomationNotificationProcessing processing); + NarratorAnnouncement( + Platform::String ^ announcement, + Platform::String ^ activityId, + AutomationNotificationKind kind, + AutomationNotificationProcessing processing); Platform::String ^ m_announcement; Platform::String ^ m_activityId; diff --git a/src/CalcViewModel/Common/Automation/NarratorNotifier.cpp b/src/CalcViewModel/Common/Automation/NarratorNotifier.cpp index 0f3fb8d5..bc146e68 100644 --- a/src/CalcViewModel/Common/Automation/NarratorNotifier.cpp +++ b/src/CalcViewModel/Common/Automation/NarratorNotifier.cpp @@ -30,11 +30,13 @@ void NarratorNotifier::Announce(NarratorAnnouncement ^ announcement) void NarratorNotifier::RegisterDependencyProperties() { - s_announcementProperty = DependencyProperty::Register(L"Announcement", // The name of the dependency property. - NarratorAnnouncement::typeid, // The type of the dependency property. - NarratorNotifier::typeid, // The owner of the dependency property. - ref new PropertyMetadata(nullptr, // Default value of the dependency property. - ref new PropertyChangedCallback(OnAnnouncementChanged))); + s_announcementProperty = DependencyProperty::Register( + L"Announcement", // The name of the dependency property. + NarratorAnnouncement::typeid, // The type of the dependency property. + NarratorNotifier::typeid, // The owner of the dependency property. + ref new PropertyMetadata( + nullptr, // Default value of the dependency property. + ref new PropertyChangedCallback(OnAnnouncementChanged))); } void NarratorNotifier::OnAnnouncementChanged(_In_ DependencyObject ^ dependencyObject, _In_ DependencyPropertyChangedEventArgs ^ e) diff --git a/src/CalcViewModel/Common/Automation/NarratorNotifier.h b/src/CalcViewModel/Common/Automation/NarratorNotifier.h index fda841ce..55bed4e7 100644 --- a/src/CalcViewModel/Common/Automation/NarratorNotifier.h +++ b/src/CalcViewModel/Common/Automation/NarratorNotifier.h @@ -31,8 +31,8 @@ public ^ AnnouncementProperty { Windows::UI::Xaml::DependencyProperty ^ get() { return s_announcementProperty; } } static NarratorAnnouncement - ^ GetAnnouncement(Windows::UI::Xaml::DependencyObject - ^ element) { return safe_cast(element->GetValue(s_announcementProperty)); } + ^ GetAnnouncement( + Windows::UI::Xaml::DependencyObject ^ element) { return safe_cast(element->GetValue(s_announcementProperty)); } static void SetAnnouncement(Windows::UI::Xaml::DependencyObject ^ element, NarratorAnnouncement ^ value) { @@ -40,8 +40,9 @@ public } private: - static void OnAnnouncementChanged(_In_ Windows::UI::Xaml::DependencyObject ^ dependencyObject, - _In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ eventArgs); + static void OnAnnouncementChanged( + _In_ Windows::UI::Xaml::DependencyObject ^ dependencyObject, + _In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ eventArgs); static Windows::UI::Xaml::DependencyProperty ^ s_announcementProperty; diff --git a/src/CalcViewModel/Common/Automation/NotificationHost.cpp b/src/CalcViewModel/Common/Automation/NotificationHost.cpp index d3951846..92bf846e 100644 --- a/src/CalcViewModel/Common/Automation/NotificationHost.cpp +++ b/src/CalcViewModel/Common/Automation/NotificationHost.cpp @@ -10,7 +10,8 @@ using namespace Windows::UI::Xaml::Automation; using namespace Windows::UI::Xaml::Automation::Peers; using namespace Windows::UI::Xaml::Controls; -NotificationHost::NotificationHost() : m_host(nullptr) +NotificationHost::NotificationHost() + : m_host(nullptr) { } @@ -34,8 +35,11 @@ void NotificationHost::Announce(NarratorAnnouncement ^ announcement) auto peer = FrameworkElementAutomationPeer::FromElement(m_host); if (peer != nullptr) { - peer->RaiseNotificationEvent(GetWindowsNotificationKind(announcement->Kind), GetWindowsNotificationProcessing(announcement->Processing), - announcement->Announcement, announcement->ActivityId); + peer->RaiseNotificationEvent( + GetWindowsNotificationKind(announcement->Kind), + GetWindowsNotificationProcessing(announcement->Processing), + announcement->Announcement, + announcement->ActivityId); } } diff --git a/src/CalcViewModel/Common/CalculatorButtonPressedEventArgs.h b/src/CalcViewModel/Common/CalculatorButtonPressedEventArgs.h index 2f7bc721..27624987 100644 --- a/src/CalcViewModel/Common/CalculatorButtonPressedEventArgs.h +++ b/src/CalcViewModel/Common/CalculatorButtonPressedEventArgs.h @@ -18,7 +18,8 @@ namespace CalculatorApp PROPERTY_R(CalculatorApp::NumbersAndOperatorsEnum, Operation); CalculatorButtonPressedEventArgs(Platform::String ^ feedback, CalculatorApp::NumbersAndOperatorsEnum operation) - : m_AuditoryFeedback(feedback), m_Operation(operation) + : m_AuditoryFeedback(feedback) + , m_Operation(operation) { } diff --git a/src/CalcViewModel/Common/CalculatorDisplay.cpp b/src/CalcViewModel/Common/CalculatorDisplay.cpp index 823d9bcb..91892dda 100644 --- a/src/CalcViewModel/Common/CalculatorDisplay.cpp +++ b/src/CalcViewModel/Common/CalculatorDisplay.cpp @@ -69,8 +69,9 @@ void CalculatorDisplay::SetIsInError(bool isError) } } -void CalculatorDisplay::SetExpressionDisplay(_Inout_ std::shared_ptr>> const& tokens, - _Inout_ std::shared_ptr>> const& commands) +void CalculatorDisplay::SetExpressionDisplay( + _Inout_ std::shared_ptr>> const& tokens, + _Inout_ std::shared_ptr>> const& commands) { if (m_callbackReference != nullptr) { diff --git a/src/CalcViewModel/Common/CalculatorDisplay.h b/src/CalcViewModel/Common/CalculatorDisplay.h index 1fef3d65..93865c96 100644 --- a/src/CalcViewModel/Common/CalculatorDisplay.h +++ b/src/CalcViewModel/Common/CalculatorDisplay.h @@ -18,8 +18,9 @@ namespace CalculatorApp private: void SetPrimaryDisplay(_In_ const std::wstring& displayString, _In_ bool isError) override; void SetIsInError(bool isError) override; - void SetExpressionDisplay(_Inout_ std::shared_ptr>> const& tokens, - _Inout_ std::shared_ptr>> const& commands) override; + void SetExpressionDisplay( + _Inout_ std::shared_ptr>> const& tokens, + _Inout_ std::shared_ptr>> const& commands) override; void SetMemorizedNumbers(_In_ const std::vector& memorizedNumbers) override; void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) override; void SetParenthesisNumber(_In_ unsigned int parenthesisCount) override; diff --git a/src/CalcViewModel/Common/ConversionResultTaskHelper.cpp b/src/CalcViewModel/Common/ConversionResultTaskHelper.cpp index 3f998e6f..ec90228f 100644 --- a/src/CalcViewModel/Common/ConversionResultTaskHelper.cpp +++ b/src/CalcViewModel/Common/ConversionResultTaskHelper.cpp @@ -9,7 +9,8 @@ using namespace concurrency; using namespace std; ConversionResultTaskHelper::ConversionResultTaskHelper(unsigned int delay, const function functionToRun) - : m_delay{ delay }, m_storedFunction{ functionToRun } + : m_delay{ delay } + , m_storedFunction{ functionToRun } { auto token = m_cts.get_token(); auto delayTask = CompleteAfter(delay); diff --git a/src/CalcViewModel/Common/CopyPasteManager.cpp b/src/CalcViewModel/Common/CopyPasteManager.cpp index 4325cad4..ffe91d1b 100644 --- a/src/CalcViewModel/Common/CopyPasteManager.cpp +++ b/src/CalcViewModel/Common/CopyPasteManager.cpp @@ -38,9 +38,10 @@ static const wstring c_uIntSuffixes = L"[uU]?[lL]{0,2}"; // RegEx Patterns used by various modes static const array standardModePatterns = { wregex(c_wspc + c_signedDecFloat + c_wspc) }; -static const array scientificModePatterns = { wregex(L"(" + c_wspc + L"[-+]?)|(" + c_wspcLParenSigned + L")" + c_signedDecFloat + c_wspcRParens), - wregex(L"(" + c_wspc + L"[-+]?)|(" + c_wspcLParenSigned + L")" + c_signedDecFloat - + L"[e]([+]|[-])+\\d+" + c_wspcRParens) }; +static const array scientificModePatterns = { + wregex(L"(" + c_wspc + L"[-+]?)|(" + c_wspcLParenSigned + L")" + c_signedDecFloat + c_wspcRParens), + wregex(L"(" + c_wspc + L"[-+]?)|(" + c_wspcLParenSigned + L")" + c_signedDecFloat + L"[e]([+]|[-])+\\d+" + c_wspcRParens) +}; static const array, 4> programmerModePatterns = { { // Hex numbers like 5F, 4A0C, 0xa9, 0xFFull, 47CDh { wregex(c_wspcLParens + L"(0[xX])?" + c_hexProgrammerChars + c_uIntSuffixes + c_wspcRParens), @@ -75,9 +76,11 @@ task CopyPasteManager::GetStringToPaste(ViewMode mode, CategoryGroupTy //-- add support to allow pasting for expressions like 1.3e12(as of now we allow 1.3e+12) return create_task((dataPackageView->GetTextAsync(::StandardDataFormats::Text))) - .then([mode, modeType, programmerNumberBase, - bitLengthType](String ^ pastedText) { return ValidatePasteExpression(pastedText, mode, modeType, programmerNumberBase, bitLengthType); }, - task_continuation_context::use_arbitrary()); + .then( + [mode, modeType, programmerNumberBase, bitLengthType](String ^ pastedText) { + return ValidatePasteExpression(pastedText, mode, modeType, programmerNumberBase, bitLengthType); + }, + task_continuation_context::use_arbitrary()); } int CopyPasteManager::ClipboardTextFormat() diff --git a/src/CalcViewModel/Common/CopyPasteManager.h b/src/CalcViewModel/Common/CopyPasteManager.h index e4aa9a74..b393dab5 100644 --- a/src/CalcViewModel/Common/CopyPasteManager.h +++ b/src/CalcViewModel/Common/CopyPasteManager.h @@ -26,8 +26,11 @@ namespace CalculatorApp { public: static void CopyToClipboard(Platform::String ^ stringToCopy); - static concurrency::task GetStringToPaste(CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType, - int programmerNumberBase = -1, int bitLengthType = -1); + static concurrency::task GetStringToPaste( + CalculatorApp::Common::ViewMode mode, + CalculatorApp::Common::CategoryGroupType modeType, + int programmerNumberBase = -1, + int bitLengthType = -1); static bool HasStringToPaste() { return ClipboardTextFormat() >= 0; @@ -40,20 +43,34 @@ namespace CalculatorApp static Platform::String ^ ValidatePasteExpression(Platform::String ^ pastedText, CalculatorApp::Common::ViewMode mode, int programmerNumberBase, int bitLengthType); static Platform::String - ^ ValidatePasteExpression(Platform::String ^ pastedText, CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType, - int programmerNumberBase, int bitLengthType); + ^ ValidatePasteExpression( + Platform::String ^ pastedText, + CalculatorApp::Common::ViewMode mode, + CalculatorApp::Common::CategoryGroupType modeType, + int programmerNumberBase, + int bitLengthType); - static std::vector ExtractOperands(const std::wstring& pasteExpression, CalculatorApp::Common::ViewMode mode, - int programmerNumberBase = -1, int bitLengthType = -1); - static bool ExpressionRegExMatch(std::vector operands, CalculatorApp::Common::ViewMode mode, - CalculatorApp::Common::CategoryGroupType modeType, int programmerNumberBase = -1, int bitLengthType = -1); + static std::vector + ExtractOperands(const std::wstring& pasteExpression, CalculatorApp::Common::ViewMode mode, int programmerNumberBase = -1, int bitLengthType = -1); + static bool ExpressionRegExMatch( + std::vector operands, + CalculatorApp::Common::ViewMode mode, + CalculatorApp::Common::CategoryGroupType modeType, + int programmerNumberBase = -1, + int bitLengthType = -1); - static std::pair GetMaxOperandLengthAndValue(CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType, - int programmerNumberBase = -1, int bitLengthType = -1); + static std::pair GetMaxOperandLengthAndValue( + CalculatorApp::Common::ViewMode mode, + CalculatorApp::Common::CategoryGroupType modeType, + int programmerNumberBase = -1, + int bitLengthType = -1); static std::wstring SanitizeOperand(const std::wstring& operand); static bool TryOperandToULL(const std::wstring& operand, int numberBase, unsigned long long int& result); - static size_t OperandLength(const std::wstring& operand, CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType, - int programmerNumberBase = -1); + static size_t OperandLength( + const std::wstring& operand, + CalculatorApp::Common::ViewMode mode, + CalculatorApp::Common::CategoryGroupType modeType, + int programmerNumberBase = -1); static size_t StandardScientificOperandLength(const std::wstring& operand); static size_t ProgrammerOperandLength(const std::wstring& operand, int numberBase); static std::wstring RemoveUnwantedCharsFromWstring(const std::wstring& input); diff --git a/src/CalcViewModel/Common/DateCalculator.h b/src/CalcViewModel/Common/DateCalculator.h index dbb057a7..e71f02f1 100644 --- a/src/CalcViewModel/Common/DateCalculator.h +++ b/src/CalcViewModel/Common/DateCalculator.h @@ -44,12 +44,17 @@ namespace CalculatorApp DateCalculationEngine(_In_ Platform::String ^ calendarIdentifier); // Public Methods - bool __nothrow AddDuration(_In_ Windows::Foundation::DateTime startDate, _In_ const DateDifference& duration, - _Out_ Windows::Foundation::DateTime* endDate); - bool __nothrow SubtractDuration(_In_ Windows::Foundation::DateTime startDate, _In_ const DateDifference& duration, - _Out_ Windows::Foundation::DateTime* endDate); - void __nothrow GetDateDifference(_In_ Windows::Foundation::DateTime date1, _In_ Windows::Foundation::DateTime date2, _In_ DateUnit outputFormat, - _Out_ DateDifference* difference); + bool __nothrow + AddDuration(_In_ Windows::Foundation::DateTime startDate, _In_ const DateDifference& duration, _Out_ Windows::Foundation::DateTime* endDate); + bool __nothrow SubtractDuration( + _In_ Windows::Foundation::DateTime startDate, + _In_ const DateDifference& duration, + _Out_ Windows::Foundation::DateTime* endDate); + void __nothrow GetDateDifference( + _In_ Windows::Foundation::DateTime date1, + _In_ Windows::Foundation::DateTime date2, + _In_ DateUnit outputFormat, + _Out_ DateDifference* difference); private: // Private Variables diff --git a/src/CalcViewModel/Common/DelegateCommand.h b/src/CalcViewModel/Common/DelegateCommand.h index 325138f6..3a341287 100644 --- a/src/CalcViewModel/Common/DelegateCommand.h +++ b/src/CalcViewModel/Common/DelegateCommand.h @@ -14,7 +14,9 @@ namespace CalculatorApp typedef void (TTarget::*CommandHandlerFunc)(Platform::Object ^); - DelegateCommand(TTarget ^ target, CommandHandlerFunc func) : m_weakTarget(target), m_function(func) + DelegateCommand(TTarget ^ target, CommandHandlerFunc func) + : m_weakTarget(target) + , m_function(func) { } diff --git a/src/CalcViewModel/Common/DisplayExpressionToken.h b/src/CalcViewModel/Common/DisplayExpressionToken.h index c0e7d9e8..aaaaf37c 100644 --- a/src/CalcViewModel/Common/DisplayExpressionToken.h +++ b/src/CalcViewModel/Common/DisplayExpressionToken.h @@ -18,7 +18,12 @@ public [Windows::UI::Xaml::Data::Bindable] public ref class DisplayExpressionToken sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged { internal : DisplayExpressionToken(Platform::String ^ token, int tokenPosition, bool fEditable, TokenType type) - : m_Token(token), m_TokenPosition(tokenPosition), m_IsTokenEditable(fEditable), m_Type(type), m_OriginalToken(token), m_InEditMode(false) + : m_Token(token) + , m_TokenPosition(tokenPosition) + , m_IsTokenEditable(fEditable) + , m_Type(type) + , m_OriginalToken(token) + , m_InEditMode(false) { } diff --git a/src/CalcViewModel/Common/ExpressionCommandDeserializer.cpp b/src/CalcViewModel/Common/ExpressionCommandDeserializer.cpp index 70a39f9a..e927b262 100644 --- a/src/CalcViewModel/Common/ExpressionCommandDeserializer.cpp +++ b/src/CalcViewModel/Common/ExpressionCommandDeserializer.cpp @@ -7,7 +7,8 @@ using namespace CalculatorApp::Common; using namespace Windows::Storage::Streams; -CommandDeserializer::CommandDeserializer(_In_ DataReader ^ dataReader) : m_dataReader(dataReader) +CommandDeserializer::CommandDeserializer(_In_ DataReader ^ dataReader) + : m_dataReader(dataReader) { } diff --git a/src/CalcViewModel/Common/ExpressionCommandSerializer.cpp b/src/CalcViewModel/Common/ExpressionCommandSerializer.cpp index 4dd97887..bbf9e183 100644 --- a/src/CalcViewModel/Common/ExpressionCommandSerializer.cpp +++ b/src/CalcViewModel/Common/ExpressionCommandSerializer.cpp @@ -7,7 +7,8 @@ using namespace CalculatorApp::Common; using namespace Windows::Storage::Streams; -SerializeCommandVisitor::SerializeCommandVisitor(_In_ DataWriter ^ dataWriter) : m_dataWriter(dataWriter) +SerializeCommandVisitor::SerializeCommandVisitor(_In_ DataWriter ^ dataWriter) + : m_dataWriter(dataWriter) { } diff --git a/src/CalcViewModel/Common/KeyboardShortcutManager.cpp b/src/CalcViewModel/Common/KeyboardShortcutManager.cpp index e9895147..7d9cfffa 100644 --- a/src/CalcViewModel/Common/KeyboardShortcutManager.cpp +++ b/src/CalcViewModel/Common/KeyboardShortcutManager.cpp @@ -446,8 +446,9 @@ const std::multimap& GetCurrentKeyDictionary(MyVirt { return s_VirtualKeyAltChordsForButtons.find(viewId)->second; } - else if ((s_ShiftKeyPressed.find(viewId)->second) - && ((Window::Current->CoreWindow->GetKeyState(VirtualKey::Control) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down)) + else if ( + (s_ShiftKeyPressed.find(viewId)->second) + && ((Window::Current->CoreWindow->GetKeyState(VirtualKey::Control) & CoreVirtualKeyStates::Down) == CoreVirtualKeyStates::Down)) { return s_VirtualKeyControlShiftChordsForButtons.find(viewId)->second; } diff --git a/src/CalcViewModel/Common/KeyboardShortcutManager.h b/src/CalcViewModel/Common/KeyboardShortcutManager.h index 30b1aa24..6663f2ce 100644 --- a/src/CalcViewModel/Common/KeyboardShortcutManager.h +++ b/src/CalcViewModel/Common/KeyboardShortcutManager.h @@ -62,13 +62,13 @@ namespace CalculatorApp static void OnVirtualKeyInverseChordPropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, MyVirtualKey oldValue, MyVirtualKey newValue); - static void OnVirtualKeyControlInverseChordPropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, MyVirtualKey oldValue, - MyVirtualKey newValue); + static void + OnVirtualKeyControlInverseChordPropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, MyVirtualKey oldValue, MyVirtualKey newValue); static void OnVirtualKeyAltChordPropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, MyVirtualKey oldValue, MyVirtualKey newValue); - static void OnVirtualKeyControlShiftChordPropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, MyVirtualKey oldValue, - MyVirtualKey newValue); + static void + OnVirtualKeyControlShiftChordPropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, MyVirtualKey oldValue, MyVirtualKey newValue); static void OnCharacterReceivedHandler(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::CharacterReceivedEventArgs ^ args); static void OnKeyDownHandler(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::KeyEventArgs ^ args); diff --git a/src/CalcViewModel/Common/LocalizationService.cpp b/src/CalcViewModel/Common/LocalizationService.cpp index 6f429651..848360ee 100644 --- a/src/CalcViewModel/Common/LocalizationService.cpp +++ b/src/CalcViewModel/Common/LocalizationService.cpp @@ -434,28 +434,41 @@ unordered_map LocalizationService::GetTokenToReadableNameMap() // change given that the engine heavily relies on perfect ordering of certain elements. // To compromise, we'll declare a map from engine resource key to automation name from the // standard project resources. - static vector> s_parenEngineKeyResourceMap = { - // Sine permutations - make_pair(L"67", L"SineDegrees"), make_pair(L"73", L"SineRadians"), - make_pair(L"79", L"SineGradians"), make_pair(L"70", L"InverseSineDegrees"), - make_pair(L"76", L"InverseSineRadians"), make_pair(L"82", L"InverseSineGradians"), - make_pair(L"25", L"HyperbolicSine"), make_pair(L"85", L"InverseHyperbolicSine"), + static vector> s_parenEngineKeyResourceMap = { // Sine permutations + make_pair(L"67", L"SineDegrees"), + make_pair(L"73", L"SineRadians"), + make_pair(L"79", L"SineGradians"), + make_pair(L"70", L"InverseSineDegrees"), + make_pair(L"76", L"InverseSineRadians"), + make_pair(L"82", L"InverseSineGradians"), + make_pair(L"25", L"HyperbolicSine"), + make_pair(L"85", L"InverseHyperbolicSine"), - // Cosine permutations - make_pair(L"68", L"CosineDegrees"), make_pair(L"74", L"CosineRadians"), - make_pair(L"80", L"CosineGradians"), make_pair(L"71", L"InverseCosineDegrees"), - make_pair(L"77", L"InverseCosineRadians"), make_pair(L"83", L"InverseCosineGradians"), - make_pair(L"26", L"HyperbolicCosine"), make_pair(L"86", L"InverseHyperbolicCosine"), + // Cosine permutations + make_pair(L"68", L"CosineDegrees"), + make_pair(L"74", L"CosineRadians"), + make_pair(L"80", L"CosineGradians"), + make_pair(L"71", L"InverseCosineDegrees"), + make_pair(L"77", L"InverseCosineRadians"), + make_pair(L"83", L"InverseCosineGradians"), + make_pair(L"26", L"HyperbolicCosine"), + make_pair(L"86", L"InverseHyperbolicCosine"), - // Tangent permutations - make_pair(L"69", L"TangentDegrees"), make_pair(L"75", L"TangentRadians"), - make_pair(L"81", L"TangentGradians"), make_pair(L"72", L"InverseTangentDegrees"), - make_pair(L"78", L"InverseTangentRadians"), make_pair(L"84", L"InverseTangentGradians"), - make_pair(L"27", L"HyperbolicTangent"), make_pair(L"87", L"InverseHyperbolicTangent"), + // Tangent permutations + make_pair(L"69", L"TangentDegrees"), + make_pair(L"75", L"TangentRadians"), + make_pair(L"81", L"TangentGradians"), + make_pair(L"72", L"InverseTangentDegrees"), + make_pair(L"78", L"InverseTangentRadians"), + make_pair(L"84", L"InverseTangentGradians"), + make_pair(L"27", L"HyperbolicTangent"), + make_pair(L"87", L"InverseHyperbolicTangent"), - // Miscellaneous Scientific functions - make_pair(L"94", L"Factorial"), make_pair(L"35", L"DegreeMinuteSecond"), - make_pair(L"28", L"NaturalLog"), make_pair(L"91", L"Square") + // Miscellaneous Scientific functions + make_pair(L"94", L"Factorial"), + make_pair(L"35", L"DegreeMinuteSecond"), + make_pair(L"28", L"NaturalLog"), + make_pair(L"91", L"Square") }; static vector> s_noParenEngineKeyResourceMap = { // Programmer mode functions diff --git a/src/CalcViewModel/Common/LocalizationService.h b/src/CalcViewModel/Common/LocalizationService.h index f288d54e..73b088b5 100644 --- a/src/CalcViewModel/Common/LocalizationService.h +++ b/src/CalcViewModel/Common/LocalizationService.h @@ -44,8 +44,10 @@ namespace CalculatorApp static Windows::Globalization::NumberFormatting::DecimalFormatter ^ GetRegionalSettingsAwareDecimalFormatter(); static Windows::Globalization::DateTimeFormatting::DateTimeFormatter ^ GetRegionalSettingsAwareDateTimeFormatter(_In_ Platform::String ^ format); static Windows::Globalization::DateTimeFormatting::DateTimeFormatter - ^ GetRegionalSettingsAwareDateTimeFormatter(_In_ Platform::String ^ format, _In_ Platform::String ^ calendarIdentifier, - _In_ Platform::String ^ clockIdentifier); + ^ GetRegionalSettingsAwareDateTimeFormatter( + _In_ Platform::String ^ format, + _In_ Platform::String ^ calendarIdentifier, + _In_ Platform::String ^ clockIdentifier); static Windows::Globalization::NumberFormatting::CurrencyFormatter ^ GetRegionalSettingsAwareCurrencyFormatter(); @@ -60,8 +62,10 @@ namespace CalculatorApp // Attached property callbacks static void OnFontTypePropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, LanguageFontType oldValue, LanguageFontType newValue); - static void OnFontWeightPropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, Windows::UI::Text::FontWeight oldValue, - Windows::UI::Text::FontWeight newValue); + static void OnFontWeightPropertyChanged( + Windows::UI::Xaml::DependencyObject ^ target, + Windows::UI::Text::FontWeight oldValue, + Windows::UI::Text::FontWeight newValue); static void OnFontSizePropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, double oldValue, double newValue); static void UpdateFontFamilyAndSize(Windows::UI::Xaml::DependencyObject ^ target); diff --git a/src/CalcViewModel/Common/LocalizationSettings.h b/src/CalcViewModel/Common/LocalizationSettings.h index 881c592d..1b350154 100644 --- a/src/CalcViewModel/Common/LocalizationSettings.h +++ b/src/CalcViewModel/Common/LocalizationSettings.h @@ -60,16 +60,22 @@ namespace CalculatorApp // Get locale info for List Separator, eg. comma is used in many locales wchar_t listSeparatorString[4] = L""; - result = ::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SLIST, listSeparatorString, - static_cast(std::size(listSeparatorString))); // Max length of the expected return value is 4 + result = ::GetLocaleInfoEx( + LOCALE_NAME_USER_DEFAULT, + LOCALE_SLIST, + listSeparatorString, + static_cast(std::size(listSeparatorString))); // Max length of the expected return value is 4 if (result == 0) { throw std::runtime_error("Unexpected error while getting locale info"); } int currencyTrailingDigits = 0; - result = GetLocaleInfoEx(m_resolvedName.c_str(), LOCALE_ICURRDIGITS | LOCALE_RETURN_NUMBER, (LPWSTR)¤cyTrailingDigits, - sizeof(currencyTrailingDigits) / sizeof(WCHAR)); + result = GetLocaleInfoEx( + m_resolvedName.c_str(), + LOCALE_ICURRDIGITS | LOCALE_RETURN_NUMBER, + (LPWSTR)¤cyTrailingDigits, + sizeof(currencyTrailingDigits) / sizeof(WCHAR)); if (result == 0) { throw std::runtime_error("Unexpected error while getting locale info"); @@ -78,8 +84,11 @@ namespace CalculatorApp // Currency symbol precedence is either 0 or 1. // A value of 0 indicates the symbol follows the currency value. int currencySymbolPrecedence = 1; - result = GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_IPOSSYMPRECEDES | LOCALE_RETURN_NUMBER, (LPWSTR)¤cySymbolPrecedence, - sizeof(currencySymbolPrecedence) / sizeof(WCHAR)); + result = GetLocaleInfoEx( + LOCALE_NAME_USER_DEFAULT, + LOCALE_IPOSSYMPRECEDES | LOCALE_RETURN_NUMBER, + (LPWSTR)¤cySymbolPrecedence, + sizeof(currencySymbolPrecedence) / sizeof(WCHAR)); // As CalcEngine only supports the first character of the decimal separator, // Only first character of the decimal separator string is supported. @@ -101,10 +110,11 @@ namespace CalculatorApp // Get FirstDayOfWeek Date and Time setting wchar_t day[80] = L""; - ::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, - LOCALE_IFIRSTDAYOFWEEK, // The first day in a week - reinterpret_cast(day), // Argument is of type PWSTR - static_cast(std::size(day))); // Max return size are 80 characters + ::GetLocaleInfoEx( + LOCALE_NAME_USER_DEFAULT, + LOCALE_IFIRSTDAYOFWEEK, // The first day in a week + reinterpret_cast(day), // Argument is of type PWSTR + static_cast(std::size(day))); // Max return size are 80 characters // The LOCALE_IFIRSTDAYOFWEEK integer value varies from 0, 1, .. 6 for Monday, Tuesday, ... Sunday // DayOfWeek enum value varies from 0, 1, .. 6 for Sunday, Monday, ... Saturday diff --git a/src/CalcViewModel/Common/NavCategory.cpp b/src/CalcViewModel/Common/NavCategory.cpp index da8de6e4..9dfd905c 100644 --- a/src/CalcViewModel/Common/NavCategory.cpp +++ b/src/CalcViewModel/Common/NavCategory.cpp @@ -49,42 +49,142 @@ static constexpr int CURRENCY_ID = 16; // ^^^ THESE CONSTANTS SHOULD NEVER CHANGE ^^^ // The order of items in this list determines the order of items in the menu. -static constexpr array s_categoryManifest = { - NavCategoryInitializer{ ViewMode::Standard, STANDARD_ID, L"Standard", L"StandardMode", L"\uE8EF", CategoryGroupType::Calculator, MyVirtualKey::Number1, - SUPPORTS_ALL }, - NavCategoryInitializer{ ViewMode::Scientific, SCIENTIFIC_ID, L"Scientific", L"ScientificMode", L"\uF196", CategoryGroupType::Calculator, - MyVirtualKey::Number2, SUPPORTS_ALL }, - NavCategoryInitializer{ ViewMode::Programmer, PROGRAMMER_ID, L"Programmer", L"ProgrammerMode", L"\uECCE", CategoryGroupType::Calculator, - MyVirtualKey::Number3, SUPPORTS_ALL }, - NavCategoryInitializer{ ViewMode::Date, DATE_ID, L"Date", L"DateCalculationMode", L"\uE787", CategoryGroupType::Calculator, MyVirtualKey::Number4, - SUPPORTS_ALL }, - NavCategoryInitializer{ ViewMode::Currency, CURRENCY_ID, L"Currency", L"CategoryName_Currency", L"\uEB0D", CategoryGroupType::Converter, MyVirtualKey::None, - POSITIVE_ONLY }, - NavCategoryInitializer{ ViewMode::Volume, VOLUME_ID, L"Volume", L"CategoryName_Volume", L"\uF1AA", CategoryGroupType::Converter, MyVirtualKey::None, - POSITIVE_ONLY }, - NavCategoryInitializer{ ViewMode::Length, LENGTH_ID, L"Length", L"CategoryName_Length", L"\uECC6", CategoryGroupType::Converter, MyVirtualKey::None, - POSITIVE_ONLY }, - NavCategoryInitializer{ ViewMode::Weight, WEIGHT_ID, L"Weight and Mass", L"CategoryName_Weight", L"\uF4C1", CategoryGroupType::Converter, - MyVirtualKey::None, POSITIVE_ONLY }, - NavCategoryInitializer{ ViewMode::Temperature, TEMPERATURE_ID, L"Temperature", L"CategoryName_Temperature", L"\uE7A3", CategoryGroupType::Converter, - MyVirtualKey::None, SUPPORTS_NEGATIVE }, - NavCategoryInitializer{ ViewMode::Energy, ENERGY_ID, L"Energy", L"CategoryName_Energy", L"\uECAD", CategoryGroupType::Converter, MyVirtualKey::None, - POSITIVE_ONLY }, - NavCategoryInitializer{ ViewMode::Area, AREA_ID, L"Area", L"CategoryName_Area", L"\uE809", CategoryGroupType::Converter, MyVirtualKey::None, - POSITIVE_ONLY }, - NavCategoryInitializer{ ViewMode::Speed, SPEED_ID, L"Speed", L"CategoryName_Speed", L"\uEADA", CategoryGroupType::Converter, MyVirtualKey::None, - POSITIVE_ONLY }, - NavCategoryInitializer{ ViewMode::Time, TIME_ID, L"Time", L"CategoryName_Time", L"\uE917", CategoryGroupType::Converter, MyVirtualKey::None, - POSITIVE_ONLY }, - NavCategoryInitializer{ ViewMode::Power, POWER_ID, L"Power", L"CategoryName_Power", L"\uE945", CategoryGroupType::Converter, MyVirtualKey::None, - POSITIVE_ONLY }, - NavCategoryInitializer{ ViewMode::Data, DATA_ID, L"Data", L"CategoryName_Data", L"\uF20F", CategoryGroupType::Converter, MyVirtualKey::None, - POSITIVE_ONLY }, - NavCategoryInitializer{ ViewMode::Pressure, PRESSURE_ID, L"Pressure", L"CategoryName_Pressure", L"\uEC4A", CategoryGroupType::Converter, MyVirtualKey::None, - POSITIVE_ONLY }, - NavCategoryInitializer{ ViewMode::Angle, ANGLE_ID, L"Angle", L"CategoryName_Angle", L"\uF515", CategoryGroupType::Converter, MyVirtualKey::None, - POSITIVE_ONLY } -}; +static constexpr array s_categoryManifest = { NavCategoryInitializer{ ViewMode::Standard, + STANDARD_ID, + L"Standard", + L"StandardMode", + L"\uE8EF", + CategoryGroupType::Calculator, + MyVirtualKey::Number1, + SUPPORTS_ALL }, + NavCategoryInitializer{ ViewMode::Scientific, + SCIENTIFIC_ID, + L"Scientific", + L"ScientificMode", + L"\uF196", + CategoryGroupType::Calculator, + MyVirtualKey::Number2, + SUPPORTS_ALL }, + NavCategoryInitializer{ ViewMode::Programmer, + PROGRAMMER_ID, + L"Programmer", + L"ProgrammerMode", + L"\uECCE", + CategoryGroupType::Calculator, + MyVirtualKey::Number3, + SUPPORTS_ALL }, + NavCategoryInitializer{ ViewMode::Date, + DATE_ID, + L"Date", + L"DateCalculationMode", + L"\uE787", + CategoryGroupType::Calculator, + MyVirtualKey::Number4, + SUPPORTS_ALL }, + NavCategoryInitializer{ ViewMode::Currency, + CURRENCY_ID, + L"Currency", + L"CategoryName_Currency", + L"\uEB0D", + CategoryGroupType::Converter, + MyVirtualKey::None, + POSITIVE_ONLY }, + NavCategoryInitializer{ ViewMode::Volume, + VOLUME_ID, + L"Volume", + L"CategoryName_Volume", + L"\uF1AA", + CategoryGroupType::Converter, + MyVirtualKey::None, + POSITIVE_ONLY }, + NavCategoryInitializer{ ViewMode::Length, + LENGTH_ID, + L"Length", + L"CategoryName_Length", + L"\uECC6", + CategoryGroupType::Converter, + MyVirtualKey::None, + POSITIVE_ONLY }, + NavCategoryInitializer{ ViewMode::Weight, + WEIGHT_ID, + L"Weight and Mass", + L"CategoryName_Weight", + L"\uF4C1", + CategoryGroupType::Converter, + MyVirtualKey::None, + POSITIVE_ONLY }, + NavCategoryInitializer{ ViewMode::Temperature, + TEMPERATURE_ID, + L"Temperature", + L"CategoryName_Temperature", + L"\uE7A3", + CategoryGroupType::Converter, + MyVirtualKey::None, + SUPPORTS_NEGATIVE }, + NavCategoryInitializer{ ViewMode::Energy, + ENERGY_ID, + L"Energy", + L"CategoryName_Energy", + L"\uECAD", + CategoryGroupType::Converter, + MyVirtualKey::None, + POSITIVE_ONLY }, + NavCategoryInitializer{ ViewMode::Area, + AREA_ID, + L"Area", + L"CategoryName_Area", + L"\uE809", + CategoryGroupType::Converter, + MyVirtualKey::None, + POSITIVE_ONLY }, + NavCategoryInitializer{ ViewMode::Speed, + SPEED_ID, + L"Speed", + L"CategoryName_Speed", + L"\uEADA", + CategoryGroupType::Converter, + MyVirtualKey::None, + POSITIVE_ONLY }, + NavCategoryInitializer{ ViewMode::Time, + TIME_ID, + L"Time", + L"CategoryName_Time", + L"\uE917", + CategoryGroupType::Converter, + MyVirtualKey::None, + POSITIVE_ONLY }, + NavCategoryInitializer{ ViewMode::Power, + POWER_ID, + L"Power", + L"CategoryName_Power", + L"\uE945", + CategoryGroupType::Converter, + MyVirtualKey::None, + POSITIVE_ONLY }, + NavCategoryInitializer{ ViewMode::Data, + DATA_ID, + L"Data", + L"CategoryName_Data", + L"\uF20F", + CategoryGroupType::Converter, + MyVirtualKey::None, + POSITIVE_ONLY }, + NavCategoryInitializer{ ViewMode::Pressure, + PRESSURE_ID, + L"Pressure", + L"CategoryName_Pressure", + L"\uEC4A", + CategoryGroupType::Converter, + MyVirtualKey::None, + POSITIVE_ONLY }, + NavCategoryInitializer{ ViewMode::Angle, + ANGLE_ID, + L"Angle", + L"CategoryName_Angle", + L"\uF515", + CategoryGroupType::Converter, + MyVirtualKey::None, + POSITIVE_ONLY } }; // This function should only be used when storing the mode to app data. int NavCategory::Serialize(ViewMode mode) @@ -105,8 +205,9 @@ ViewMode NavCategory::Deserialize(Platform::Object ^ obj) if (boxed != nullptr) { int serializationId = boxed->Value; - auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest), - [serializationId](const NavCategoryInitializer& initializer) { return initializer.serializationId == serializationId; }); + auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest), [serializationId](const NavCategoryInitializer& initializer) { + return initializer.serializationId == serializationId; + }); if (iter != s_categoryManifest.end()) { @@ -144,8 +245,9 @@ bool NavCategory::IsConverterViewMode(ViewMode mode) bool NavCategory::IsModeInCategoryGroup(ViewMode mode, CategoryGroupType type) { - auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest), - [mode, type](const NavCategoryInitializer& initializer) { return initializer.viewMode == mode && initializer.groupType == type; }); + auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest), [mode, type](const NavCategoryInitializer& initializer) { + return initializer.viewMode == mode && initializer.groupType == type; + }); return iter != s_categoryManifest.end(); } @@ -160,8 +262,9 @@ String ^ NavCategory::GetFriendlyName(ViewMode mode) ViewMode NavCategory::GetViewModeForFriendlyName(String ^ name) { - auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest), - [name](const NavCategoryInitializer& initializer) { return wcscmp(initializer.friendlyName, name->Data()) == 0; }); + auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest), [name](const NavCategoryInitializer& initializer) { + return wcscmp(initializer.friendlyName, name->Data()) == 0; + }); return (iter != s_categoryManifest.end()) ? iter->viewMode : ViewMode::None; } @@ -238,8 +341,9 @@ int NavCategory::GetPosition(ViewMode mode) ViewMode NavCategory::GetViewModeForVirtualKey(MyVirtualKey virtualKey) { - auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest), - [virtualKey](const NavCategoryInitializer& initializer) { return initializer.virtualKey == virtualKey; }); + auto iter = find_if(begin(s_categoryManifest), end(s_categoryManifest), [virtualKey](const NavCategoryInitializer& initializer) { + return initializer.virtualKey == virtualKey; + }); return (iter != s_categoryManifest.end()) ? iter->viewMode : ViewMode::None; } @@ -258,7 +362,8 @@ vector NavCategory::GetCategoryAcceleratorKeys() return accelerators; } -NavCategoryGroup::NavCategoryGroup(const NavCategoryGroupInitializer& groupInitializer) : m_Categories(ref new Vector()) +NavCategoryGroup::NavCategoryGroup(const NavCategoryGroupInitializer& groupInitializer) + : m_Categories(ref new Vector()) { m_GroupType = groupInitializer.type; @@ -285,9 +390,14 @@ NavCategoryGroup::NavCategoryGroup(const NavCategoryGroupInitializer& groupIniti String ^ categoryAutomationName = ref new String( LocalizationStringUtil::GetLocalizedString(navCategoryItemAutomationNameFormat->Data(), categoryName->Data(), m_Name->Data()).c_str()); - m_Categories->Append(ref new NavCategory(categoryName, categoryAutomationName, StringReference(categoryInitializer.glyph), - resProvider.GetResourceString(nameResourceKey + "AccessKey"), groupMode, categoryInitializer.viewMode, - categoryInitializer.supportsNegative)); + m_Categories->Append(ref new NavCategory( + categoryName, + categoryAutomationName, + StringReference(categoryInitializer.glyph), + resProvider.GetResourceString(nameResourceKey + "AccessKey"), + groupMode, + categoryInitializer.viewMode, + categoryInitializer.supportsNegative)); } } } @@ -313,16 +423,18 @@ NavCategoryGroup ^ NavCategoryGroup::CreateConverterCategory() vector NavCategoryGroup::GetInitializerCategoryGroup(CategoryGroupType groupType) { vector initializers{}; - copy_if(begin(s_categoryManifest), end(s_categoryManifest), back_inserter(initializers), - [groupType](const NavCategoryInitializer& initializer) { return initializer.groupType == groupType; }); + copy_if(begin(s_categoryManifest), end(s_categoryManifest), back_inserter(initializers), [groupType](const NavCategoryInitializer& initializer) { + return initializer.groupType == groupType; + }); return initializers; } String ^ NavCategoryGroup::GetHeaderResourceKey(CategoryGroupType type) { - auto iter = find_if(begin(s_categoryGroupManifest), end(s_categoryGroupManifest), - [type](const NavCategoryGroupInitializer& initializer) { return initializer.type == type; }); + auto iter = find_if(begin(s_categoryGroupManifest), end(s_categoryGroupManifest), [type](const NavCategoryGroupInitializer& initializer) { + return initializer.type == type; + }); return (iter != s_categoryGroupManifest.end()) ? StringReference(iter->headerResourceKey) : nullptr; } diff --git a/src/CalcViewModel/Common/NavCategory.h b/src/CalcViewModel/Common/NavCategory.h index 84cfb562..b1cf1d3d 100644 --- a/src/CalcViewModel/Common/NavCategory.h +++ b/src/CalcViewModel/Common/NavCategory.h @@ -58,8 +58,15 @@ namespace CalculatorApp private struct NavCategoryInitializer { - constexpr NavCategoryInitializer(ViewMode mode, int id, wchar_t const* name, wchar_t const* nameKey, wchar_t const* glyph, CategoryGroupType group, - MyVirtualKey vKey, bool categorySupportsNegative) + constexpr NavCategoryInitializer( + ViewMode mode, + int id, + wchar_t const* name, + wchar_t const* nameKey, + wchar_t const* glyph, + CategoryGroupType group, + MyVirtualKey vKey, + bool categorySupportsNegative) : viewMode(mode) , serializationId(id) , friendlyName(name) @@ -85,7 +92,10 @@ namespace CalculatorApp struct NavCategoryGroupInitializer { constexpr NavCategoryGroupInitializer(CategoryGroupType t, wchar_t const* h, wchar_t const* n, wchar_t const* a) - : type(t), headerResourceKey(h), modeResourceKey(n), automationResourceKey(a) + : type(t) + , headerResourceKey(h) + , modeResourceKey(n) + , automationResourceKey(a) { } @@ -161,8 +171,14 @@ namespace CalculatorApp static ViewMode GetViewModeForVirtualKey(MyVirtualKey virtualKey); - internal : NavCategory(Platform::String ^ name, Platform::String ^ automationName, Platform::String ^ glyph, Platform::String ^ accessKey, - Platform::String ^ mode, ViewMode viewMode, bool supportsNegative) + internal : NavCategory( + Platform::String ^ name, + Platform::String ^ automationName, + Platform::String ^ glyph, + Platform::String ^ accessKey, + Platform::String ^ mode, + ViewMode viewMode, + bool supportsNegative) : m_name(name) , m_automationName(automationName) , m_glyph(glyph) diff --git a/src/CalcViewModel/Common/TraceActivity.h b/src/CalcViewModel/Common/TraceActivity.h index cb0d481a..41046a63 100644 --- a/src/CalcViewModel/Common/TraceActivity.h +++ b/src/CalcViewModel/Common/TraceActivity.h @@ -11,19 +11,30 @@ namespace CalculatorApp class TraceActivity { public: - TraceActivity() : m_channel(nullptr), m_activity(nullptr), m_fields(nullptr) + TraceActivity() + : m_channel(nullptr) + , m_activity(nullptr) + , m_fields(nullptr) { } - TraceActivity(winrt::Windows::Foundation::Diagnostics::LoggingChannel channel, std::wstring_view activityName, - winrt::Windows::Foundation::Diagnostics::LoggingFields fields) - : m_channel(channel), m_activityName(activityName), m_fields(fields), m_activity(nullptr) + TraceActivity( + winrt::Windows::Foundation::Diagnostics::LoggingChannel channel, + std::wstring_view activityName, + winrt::Windows::Foundation::Diagnostics::LoggingFields fields) + : m_channel(channel) + , m_activityName(activityName) + , m_fields(fields) + , m_activity(nullptr) { // Write the activity's START event. Note that you must not specify keyword // or level for START and STOP events because they always use the activity's // keyword and level. - m_activity = m_channel.StartActivity(m_activityName, m_fields, winrt::Windows::Foundation::Diagnostics::LoggingLevel::Verbose, - winrt::Windows::Foundation::Diagnostics::LoggingOptions(WINEVENT_KEYWORD_RESPONSE_TIME)); + m_activity = m_channel.StartActivity( + m_activityName, + m_fields, + winrt::Windows::Foundation::Diagnostics::LoggingLevel::Verbose, + winrt::Windows::Foundation::Diagnostics::LoggingOptions(WINEVENT_KEYWORD_RESPONSE_TIME)); } ~TraceActivity() diff --git a/src/CalcViewModel/Common/TraceLogger.cpp b/src/CalcViewModel/Common/TraceLogger.cpp index 47da9511..f7d32d99 100644 --- a/src/CalcViewModel/Common/TraceLogger.cpp +++ b/src/CalcViewModel/Common/TraceLogger.cpp @@ -607,8 +607,8 @@ namespace CalculatorApp } } - void TraceLogger::LogMemoryUsed(int windowId, unsigned int slotPosition, bool isStandard, bool isScientific, bool isProgrammer, - unsigned int memorySize) const + void + TraceLogger::LogMemoryUsed(int windowId, unsigned int slotPosition, bool isStandard, bool isScientific, bool isProgrammer, unsigned int memorySize) const { if (!GetTraceLoggingProviderEnabled()) return; diff --git a/src/CalcViewModel/Common/TraceLogger.h b/src/CalcViewModel/Common/TraceLogger.h index 3ae91ed5..870cddf8 100644 --- a/src/CalcViewModel/Common/TraceLogger.h +++ b/src/CalcViewModel/Common/TraceLogger.h @@ -96,8 +96,8 @@ namespace CalculatorApp // Trace methods for Date Calculator usage void LogDateDifferenceModeUsed(int windowId); void LogDateAddSubtractModeUsed(int windowId, bool isAddMode); - void LogDateClippedTimeDifferenceFound(winrt::Windows::Globalization::Calendar const& today, - winrt::Windows::Foundation::DateTime const& clippedTime) const; + void + LogDateClippedTimeDifferenceFound(winrt::Windows::Globalization::Calendar const& today, winrt::Windows::Foundation::DateTime const& clippedTime) const; void LogStandardException(std::wstring_view functionName, _In_ const std::exception& e) const; void LogWinRTException(std::wstring_view functionName, _In_ winrt::hresult_error const& e) const; diff --git a/src/CalcViewModel/Common/Utils.cpp b/src/CalcViewModel/Common/Utils.cpp index 45d55e89..8ad60816 100644 --- a/src/CalcViewModel/Common/Utils.cpp +++ b/src/CalcViewModel/Common/Utils.cpp @@ -92,8 +92,10 @@ wstring Utils::RemoveUnwantedCharsFromWstring(wstring input, wchar_t* unwantedCh return input; } -void Utils::SerializeCommandsAndTokens(_In_ shared_ptr>> const& tokens, - _In_ shared_ptr>> const& commands, DataWriter ^ writer) +void Utils::SerializeCommandsAndTokens( + _In_ shared_ptr>> const& tokens, + _In_ shared_ptr>> const& commands, + DataWriter ^ writer) { unsigned int commandsSize; IFTPlatformException(commands->GetSize(&commandsSize)); diff --git a/src/CalcViewModel/Common/Utils.h b/src/CalcViewModel/Common/Utils.h index 4aefcc36..45eeefe2 100644 --- a/src/CalcViewModel/Common/Utils.h +++ b/src/CalcViewModel/Common/Utils.h @@ -384,9 +384,10 @@ namespace Utils double GetDoubleFromWstring(std::wstring input); int GetWindowId(); void RunOnUIThreadNonblocking(std::function&& function, _In_ Windows::UI::Core::CoreDispatcher ^ currentDispatcher); - void SerializeCommandsAndTokens(_In_ std::shared_ptr>> const& tokens, - _In_ std::shared_ptr>> const& commands, - Windows::Storage::Streams::DataWriter ^ writer); + void SerializeCommandsAndTokens( + _In_ std::shared_ptr>> const& tokens, + _In_ std::shared_ptr>> const& commands, + Windows::Storage::Streams::DataWriter ^ writer); const std::shared_ptr>> DeserializeCommands(Windows::Storage::Streams::DataReader ^ reader); const std::shared_ptr>> DeserializeTokens(Windows::Storage::Streams::DataReader ^ reader); @@ -394,8 +395,11 @@ namespace Utils Windows::Foundation::DateTime GetUniversalSystemTime(); bool IsDateTimeOlderThan(Windows::Foundation::DateTime dateTime, const long long duration); - concurrency::task WriteFileToFolder(Windows::Storage::IStorageFolder ^ folder, Platform::String ^ fileName, Platform::String ^ contents, - Windows::Storage::CreationCollisionOption collisionOption); + concurrency::task WriteFileToFolder( + Windows::Storage::IStorageFolder ^ folder, + Platform::String ^ fileName, + Platform::String ^ contents, + Windows::Storage::CreationCollisionOption collisionOption); concurrency::task ReadFileFromFolder(Windows::Storage::IStorageFolder ^ folder, Platform::String ^ fileName); } diff --git a/src/CalcViewModel/Common/ValidatingConverters.h b/src/CalcViewModel/Common/ValidatingConverters.h index b8f3f979..bc168502 100644 --- a/src/CalcViewModel/Common/ValidatingConverters.h +++ b/src/CalcViewModel/Common/ValidatingConverters.h @@ -17,16 +17,22 @@ namespace CalculatorApp private: virtual Platform::Object - ^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/, - Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::Convert + ^ Convert( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName /*targetType*/, + Platform::Object ^ /*parameter*/, + Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::Convert { // Pass through as we don't want to change the value from the source return value; } virtual Platform::Object - ^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/, - Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack + ^ ConvertBack( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName /*targetType*/, + Platform::Object ^ /*parameter*/, + Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack { if (value) { @@ -47,16 +53,22 @@ namespace CalculatorApp private: virtual Platform::Object - ^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/, - Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::Convert + ^ Convert( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName /*targetType*/, + Platform::Object ^ /*parameter*/, + Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::Convert { // Pass through as we don't want to change the value from the source return value; } virtual Platform::Object - ^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/, - Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack + ^ ConvertBack( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName /*targetType*/, + Platform::Object ^ /*parameter*/, + Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack { // The value to be valid has to be a boxed int32 value // extract that value and ensure it is valid, ie >= 0 diff --git a/src/CalcViewModel/DataLoaders/CurrencyDataLoader.cpp b/src/CalcViewModel/DataLoaders/CurrencyDataLoader.cpp index 211605fe..b2c68dcf 100644 --- a/src/CalcViewModel/DataLoaders/CurrencyDataLoader.cpp +++ b/src/CalcViewModel/DataLoaders/CurrencyDataLoader.cpp @@ -46,8 +46,10 @@ static constexpr auto CACHE_LANGCODE_KEY = L"CURRENCY_CONVERTER_LANGCODE"; static constexpr auto CACHE_DELIMITER = L"%"; static constexpr auto STATIC_DATA_FILENAME = L"CURRENCY_CONVERTER_STATIC_DATA.txt"; -static constexpr array STATIC_DATA_PROPERTIES = { wstring_view{ L"CountryCode", 11 }, wstring_view{ L"CountryName", 11 }, - wstring_view{ L"CurrencyCode", 12 }, wstring_view{ L"CurrencyName", 12 }, +static constexpr array STATIC_DATA_PROPERTIES = { wstring_view{ L"CountryCode", 11 }, + wstring_view{ L"CountryName", 11 }, + wstring_view{ L"CurrencyCode", 12 }, + wstring_view{ L"CurrencyName", 12 }, wstring_view{ L"CurrencySymbol", 14 } }; static constexpr auto ALL_RATIOS_DATA_FILENAME = L"CURRENCY_CONVERTER_ALL_RATIOS_DATA.txt"; @@ -275,8 +277,8 @@ pair CurrencyDataLoader::GetCurrencyRatioEquality(_In_ const U wstring digitSymbol = wstring{ LocalizationSettings::GetInstance().GetDigitSymbolFromEnUsDigit(L'1') }; wstring roundedFormat = m_ratioFormatter->Format(rounded)->Data(); - wstring ratioString = LocalizationStringUtil::GetLocalizedString(m_ratioFormat.c_str(), digitSymbol.c_str(), unit1.abbreviation.c_str(), - roundedFormat.c_str(), unit2.abbreviation.c_str()); + wstring ratioString = LocalizationStringUtil::GetLocalizedString( + m_ratioFormat.c_str(), digitSymbol.c_str(), unit1.abbreviation.c_str(), roundedFormat.c_str(), unit2.abbreviation.c_str()); wstring accessibleRatioString = LocalizationStringUtil::GetLocalizedString( m_ratioFormat.c_str(), digitSymbol.c_str(), unit1.accessibleName.c_str(), roundedFormat.c_str(), unit2.accessibleName.c_str()); @@ -459,8 +461,11 @@ task CurrencyDataLoader::TryLoadDataFromWebOverrideAsync() }; #pragma optimize("", on) -bool CurrencyDataLoader::TryParseWebResponses(_In_ String ^ staticDataJson, _In_ String ^ allRatiosJson, _Inout_ vector& staticData, - _Inout_ CurrencyRatioMap& allRatiosData) +bool CurrencyDataLoader::TryParseWebResponses( + _In_ String ^ staticDataJson, + _In_ String ^ allRatiosJson, + _Inout_ vector& staticData, + _Inout_ CurrencyRatioMap& allRatiosData) { return TryParseStaticData(staticDataJson, staticData) && TryParseAllRatiosData(allRatiosJson, allRatiosData); } diff --git a/src/CalcViewModel/DataLoaders/CurrencyDataLoader.h b/src/CalcViewModel/DataLoaders/CurrencyDataLoader.h index cfd1468d..5221373a 100644 --- a/src/CalcViewModel/DataLoaders/CurrencyDataLoader.h +++ b/src/CalcViewModel/DataLoaders/CurrencyDataLoader.h @@ -43,7 +43,8 @@ namespace CalculatorApp struct CurrencyUnitMetadata { - CurrencyUnitMetadata(const std::wstring& s) : symbol(s) + CurrencyUnitMetadata(const std::wstring& s) + : symbol(s) { } @@ -71,8 +72,8 @@ namespace CalculatorApp // ICurrencyConverterDataLoader void SetViewModelCallback(const std::shared_ptr& callback) override; std::pair GetCurrencySymbols(const UCM::Unit& unit1, const UCM::Unit& unit2) override; - std::pair GetCurrencyRatioEquality(_In_ const UnitConversionManager::Unit& unit1, - _In_ const UnitConversionManager::Unit& unit2) override; + std::pair + GetCurrencyRatioEquality(_In_ const UnitConversionManager::Unit& unit1, _In_ const UnitConversionManager::Unit& unit2) override; std::wstring GetCurrencyTimestamp() override; concurrency::task TryLoadDataFromCacheAsync() override; @@ -88,8 +89,11 @@ namespace CalculatorApp concurrency::task TryFinishLoadFromCacheAsync(); - bool TryParseWebResponses(_In_ Platform::String ^ staticDataJson, _In_ Platform::String ^ allRatiosJson, - _Inout_ std::vector& staticData, _Inout_ CurrencyRatioMap& allRatiosData); + bool TryParseWebResponses( + _In_ Platform::String ^ staticDataJson, + _In_ Platform::String ^ allRatiosJson, + _Inout_ std::vector& staticData, + _Inout_ CurrencyRatioMap& allRatiosData); bool TryParseStaticData(_In_ Platform::String ^ rawJson, _Inout_ std::vector& staticData); bool TryParseAllRatiosData(_In_ Platform::String ^ rawJson, _Inout_ CurrencyRatioMap& allRatiosData); concurrency::task FinalizeUnits(_In_ const std::vector& staticData, _In_ const CurrencyRatioMap& ratioMap); diff --git a/src/CalcViewModel/DataLoaders/CurrencyHttpClient.cpp b/src/CalcViewModel/DataLoaders/CurrencyHttpClient.cpp index 649ba171..04167dab 100644 --- a/src/CalcViewModel/DataLoaders/CurrencyHttpClient.cpp +++ b/src/CalcViewModel/DataLoaders/CurrencyHttpClient.cpp @@ -13,7 +13,9 @@ using namespace Windows::Web::Http; static constexpr auto sc_MetadataUriLocalizeFor = L"https://go.microsoft.com/fwlink/?linkid=2041093&localizeFor="; static constexpr auto sc_RatiosUriRelativeTo = L"https://go.microsoft.com/fwlink/?linkid=2041339&localCurrency="; -CurrencyHttpClient::CurrencyHttpClient() : m_client(ref new HttpClient()), m_responseLanguage(L"en-US") +CurrencyHttpClient::CurrencyHttpClient() + : m_client(ref new HttpClient()) + , m_responseLanguage(L"en-US") { } diff --git a/src/CalcViewModel/DataLoaders/UnitConverterDataLoader.cpp b/src/CalcViewModel/DataLoaders/UnitConverterDataLoader.cpp index 24c3518e..e69b8e2c 100644 --- a/src/CalcViewModel/DataLoaders/UnitConverterDataLoader.cpp +++ b/src/CalcViewModel/DataLoaders/UnitConverterDataLoader.cpp @@ -18,7 +18,8 @@ using namespace Windows::Globalization; static constexpr bool CONVERT_WITH_OFFSET_FIRST = true; -UnitConverterDataLoader::UnitConverterDataLoader(GeographicRegion ^ region) : m_currentRegionCode(region->CodeTwoLetter) +UnitConverterDataLoader::UnitConverterDataLoader(GeographicRegion ^ region) + : m_currentRegionCode(region->CodeTwoLetter) { m_categoryList = make_shared>(); m_categoryToUnits = make_shared(); @@ -53,8 +54,9 @@ bool UnitConverterDataLoader::SupportsCategory(const UCM::Category& target) } static int currencyId = NavCategory::Serialize(ViewMode::Currency); - auto itr = find_if(supportedCategories->begin(), supportedCategories->end(), - [&](const UCM::Category& category) { return currencyId != category.id && target.id == category.id; }); + auto itr = find_if(supportedCategories->begin(), supportedCategories->end(), [&](const UCM::Category& category) { + return currencyId != category.id && target.id == category.id; + }); return itr != supportedCategories->end(); } @@ -182,34 +184,65 @@ void UnitConverterDataLoader::GetUnits(_In_ unordered_map energyUnits; - energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_BritishThermalUnit, GetLocalizedStringName(L"UnitName_BritishThermalUnit"), - GetLocalizedStringName(L"UnitAbbreviation_BritishThermalUnit"), 7 }); + energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_BritishThermalUnit, + GetLocalizedStringName(L"UnitName_BritishThermalUnit"), + GetLocalizedStringName(L"UnitAbbreviation_BritishThermalUnit"), + 7 }); energyUnits.push_back( OrderedUnit{ UnitConverterUnits::Energy_Calorie, GetLocalizedStringName(L"UnitName_Calorie"), GetLocalizedStringName(L"UnitAbbreviation_Calorie"), 4 }); - energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_ElectronVolt, GetLocalizedStringName(L"UnitName_Electron-Volt"), - GetLocalizedStringName(L"UnitAbbreviation_Electron-Volt"), 1 }); - energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_FootPound, GetLocalizedStringName(L"UnitName_Foot-Pound"), - GetLocalizedStringName(L"UnitAbbreviation_Foot-Pound"), 6 }); - energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_Joule, GetLocalizedStringName(L"UnitName_Joule"), - GetLocalizedStringName(L"UnitAbbreviation_Joule"), 2, true, false, false }); - energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_Kilocalorie, GetLocalizedStringName(L"UnitName_Kilocalorie"), - GetLocalizedStringName(L"UnitAbbreviation_Kilocalorie"), 5, false, true, false }); - energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_Kilojoule, GetLocalizedStringName(L"UnitName_Kilojoule"), - GetLocalizedStringName(L"UnitAbbreviation_Kilojoule"), 3 }); - energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_Battery, GetLocalizedStringName(L"UnitName_Battery"), - GetLocalizedStringName(L"UnitAbbreviation_Battery"), 8, false, false, true }); - energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_Banana, GetLocalizedStringName(L"UnitName_Banana"), - GetLocalizedStringName(L"UnitAbbreviation_Banana"), 9, false, false, true }); - energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_SliceOfCake, GetLocalizedStringName(L"UnitName_SliceOfCake"), - GetLocalizedStringName(L"UnitAbbreviation_SliceOfCake"), 10, false, false, true }); + energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_ElectronVolt, + GetLocalizedStringName(L"UnitName_Electron-Volt"), + GetLocalizedStringName(L"UnitAbbreviation_Electron-Volt"), + 1 }); + energyUnits.push_back(OrderedUnit{ + UnitConverterUnits::Energy_FootPound, GetLocalizedStringName(L"UnitName_Foot-Pound"), GetLocalizedStringName(L"UnitAbbreviation_Foot-Pound"), 6 }); + energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_Joule, + GetLocalizedStringName(L"UnitName_Joule"), + GetLocalizedStringName(L"UnitAbbreviation_Joule"), + 2, + true, + false, + false }); + energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_Kilocalorie, + GetLocalizedStringName(L"UnitName_Kilocalorie"), + GetLocalizedStringName(L"UnitAbbreviation_Kilocalorie"), + 5, + false, + true, + false }); + energyUnits.push_back(OrderedUnit{ + UnitConverterUnits::Energy_Kilojoule, GetLocalizedStringName(L"UnitName_Kilojoule"), GetLocalizedStringName(L"UnitAbbreviation_Kilojoule"), 3 }); + energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_Battery, + GetLocalizedStringName(L"UnitName_Battery"), + GetLocalizedStringName(L"UnitAbbreviation_Battery"), + 8, + false, + false, + true }); + energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_Banana, + GetLocalizedStringName(L"UnitName_Banana"), + GetLocalizedStringName(L"UnitAbbreviation_Banana"), + 9, + false, + false, + true }); + energyUnits.push_back(OrderedUnit{ UnitConverterUnits::Energy_SliceOfCake, + GetLocalizedStringName(L"UnitName_SliceOfCake"), + GetLocalizedStringName(L"UnitAbbreviation_SliceOfCake"), + 10, + false, + false, + true }); unitMap.emplace(ViewMode::Energy, energyUnits); vector lengthUnits; - lengthUnits.push_back(OrderedUnit{ UnitConverterUnits::Length_Centimeter, GetLocalizedStringName(L"UnitName_Centimeter"), - GetLocalizedStringName(L"UnitAbbreviation_Centimeter"), 4, useUSCustomary, useSI, false }); + lengthUnits.push_back(OrderedUnit{ UnitConverterUnits::Length_Centimeter, + GetLocalizedStringName(L"UnitName_Centimeter"), + GetLocalizedStringName(L"UnitAbbreviation_Centimeter"), + 4, + useUSCustomary, + useSI, + false }); lengthUnits.push_back( OrderedUnit{ UnitConverterUnits::Length_Foot, GetLocalizedStringName(L"UnitName_Foot"), GetLocalizedStringName(L"UnitAbbreviation_Foot"), 8 }); - lengthUnits.push_back(OrderedUnit{ UnitConverterUnits::Length_Inch, GetLocalizedStringName(L"UnitName_Inch"), - GetLocalizedStringName(L"UnitAbbreviation_Inch"), 7, useSI, useUSCustomary, false }); - lengthUnits.push_back(OrderedUnit{ UnitConverterUnits::Length_Kilometer, GetLocalizedStringName(L"UnitName_Kilometer"), - GetLocalizedStringName(L"UnitAbbreviation_Kilometer"), 6 }); + lengthUnits.push_back(OrderedUnit{ UnitConverterUnits::Length_Inch, + GetLocalizedStringName(L"UnitName_Inch"), + GetLocalizedStringName(L"UnitAbbreviation_Inch"), + 7, + useSI, + useUSCustomary, + false }); + lengthUnits.push_back(OrderedUnit{ + UnitConverterUnits::Length_Kilometer, GetLocalizedStringName(L"UnitName_Kilometer"), GetLocalizedStringName(L"UnitAbbreviation_Kilometer"), 6 }); lengthUnits.push_back( OrderedUnit{ UnitConverterUnits::Length_Meter, GetLocalizedStringName(L"UnitName_Meter"), GetLocalizedStringName(L"UnitAbbreviation_Meter"), 5 }); lengthUnits.push_back( OrderedUnit{ UnitConverterUnits::Length_Micron, GetLocalizedStringName(L"UnitName_Micron"), GetLocalizedStringName(L"UnitAbbreviation_Micron"), 2 }); lengthUnits.push_back( OrderedUnit{ UnitConverterUnits::Length_Mile, GetLocalizedStringName(L"UnitName_Mile"), GetLocalizedStringName(L"UnitAbbreviation_Mile"), 10 }); - lengthUnits.push_back(OrderedUnit{ UnitConverterUnits::Length_Millimeter, GetLocalizedStringName(L"UnitName_Millimeter"), - GetLocalizedStringName(L"UnitAbbreviation_Millimeter"), 3 }); - lengthUnits.push_back(OrderedUnit{ UnitConverterUnits::Length_Nanometer, GetLocalizedStringName(L"UnitName_Nanometer"), - GetLocalizedStringName(L"UnitAbbreviation_Nanometer"), 1 }); - lengthUnits.push_back(OrderedUnit{ UnitConverterUnits::Length_NauticalMile, GetLocalizedStringName(L"UnitName_NauticalMile"), - GetLocalizedStringName(L"UnitAbbreviation_NauticalMile"), 11 }); + lengthUnits.push_back(OrderedUnit{ + UnitConverterUnits::Length_Millimeter, GetLocalizedStringName(L"UnitName_Millimeter"), GetLocalizedStringName(L"UnitAbbreviation_Millimeter"), 3 }); + lengthUnits.push_back(OrderedUnit{ + UnitConverterUnits::Length_Nanometer, GetLocalizedStringName(L"UnitName_Nanometer"), GetLocalizedStringName(L"UnitAbbreviation_Nanometer"), 1 }); + lengthUnits.push_back(OrderedUnit{ UnitConverterUnits::Length_NauticalMile, + GetLocalizedStringName(L"UnitName_NauticalMile"), + GetLocalizedStringName(L"UnitAbbreviation_NauticalMile"), + 11 }); lengthUnits.push_back( OrderedUnit{ UnitConverterUnits::Length_Yard, GetLocalizedStringName(L"UnitName_Yard"), GetLocalizedStringName(L"UnitAbbreviation_Yard"), 9 }); - lengthUnits.push_back(OrderedUnit{ UnitConverterUnits::Length_Paperclip, GetLocalizedStringName(L"UnitName_Paperclip"), - GetLocalizedStringName(L"UnitAbbreviation_Paperclip"), 12, false, false, true }); - lengthUnits.push_back(OrderedUnit{ UnitConverterUnits::Length_Hand, GetLocalizedStringName(L"UnitName_Hand"), - GetLocalizedStringName(L"UnitAbbreviation_Hand"), 13, false, false, true }); - lengthUnits.push_back(OrderedUnit{ UnitConverterUnits::Length_JumboJet, GetLocalizedStringName(L"UnitName_JumboJet"), - GetLocalizedStringName(L"UnitAbbreviation_JumboJet"), 14, false, false, true }); + lengthUnits.push_back(OrderedUnit{ UnitConverterUnits::Length_Paperclip, + GetLocalizedStringName(L"UnitName_Paperclip"), + GetLocalizedStringName(L"UnitAbbreviation_Paperclip"), + 12, + false, + false, + true }); + lengthUnits.push_back(OrderedUnit{ + UnitConverterUnits::Length_Hand, GetLocalizedStringName(L"UnitName_Hand"), GetLocalizedStringName(L"UnitAbbreviation_Hand"), 13, false, false, true }); + lengthUnits.push_back(OrderedUnit{ UnitConverterUnits::Length_JumboJet, + GetLocalizedStringName(L"UnitName_JumboJet"), + GetLocalizedStringName(L"UnitAbbreviation_JumboJet"), + 14, + false, + false, + true }); unitMap.emplace(ViewMode::Length, lengthUnits); vector powerUnits; - powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_BritishThermalUnitPerMinute, GetLocalizedStringName(L"UnitName_BTUPerMinute"), - GetLocalizedStringName(L"UnitAbbreviation_BTUPerMinute"), 5 }); - powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_FootPoundPerMinute, GetLocalizedStringName(L"UnitName_Foot-PoundPerMinute"), - GetLocalizedStringName(L"UnitAbbreviation_Foot-PoundPerMinute"), 4 }); - powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_Horsepower, GetLocalizedStringName(L"UnitName_Horsepower"), - GetLocalizedStringName(L"UnitAbbreviation_Horsepower"), 3, false, true, false }); - powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_Kilowatt, GetLocalizedStringName(L"UnitName_Kilowatt"), - GetLocalizedStringName(L"UnitAbbreviation_Kilowatt"), 2, !useWattInsteadOfKilowatt }); - powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_Watt, GetLocalizedStringName(L"UnitName_Watt"), - GetLocalizedStringName(L"UnitAbbreviation_Watt"), 1, useWattInsteadOfKilowatt }); - powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_LightBulb, GetLocalizedStringName(L"UnitName_LightBulb"), - GetLocalizedStringName(L"UnitAbbreviation_LightBulb"), 6, false, false, true }); - powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_Horse, GetLocalizedStringName(L"UnitName_Horse"), - GetLocalizedStringName(L"UnitAbbreviation_Horse"), 7, false, false, true }); - powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_TrainEngine, GetLocalizedStringName(L"UnitName_TrainEngine"), - GetLocalizedStringName(L"UnitAbbreviation_TrainEngine"), 8, false, false, true }); + powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_BritishThermalUnitPerMinute, + GetLocalizedStringName(L"UnitName_BTUPerMinute"), + GetLocalizedStringName(L"UnitAbbreviation_BTUPerMinute"), + 5 }); + powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_FootPoundPerMinute, + GetLocalizedStringName(L"UnitName_Foot-PoundPerMinute"), + GetLocalizedStringName(L"UnitAbbreviation_Foot-PoundPerMinute"), + 4 }); + powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_Horsepower, + GetLocalizedStringName(L"UnitName_Horsepower"), + GetLocalizedStringName(L"UnitAbbreviation_Horsepower"), + 3, + false, + true, + false }); + powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_Kilowatt, + GetLocalizedStringName(L"UnitName_Kilowatt"), + GetLocalizedStringName(L"UnitAbbreviation_Kilowatt"), + 2, + !useWattInsteadOfKilowatt }); + powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_Watt, + GetLocalizedStringName(L"UnitName_Watt"), + GetLocalizedStringName(L"UnitAbbreviation_Watt"), + 1, + useWattInsteadOfKilowatt }); + powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_LightBulb, + GetLocalizedStringName(L"UnitName_LightBulb"), + GetLocalizedStringName(L"UnitAbbreviation_LightBulb"), + 6, + false, + false, + true }); + powerUnits.push_back(OrderedUnit{ + UnitConverterUnits::Power_Horse, GetLocalizedStringName(L"UnitName_Horse"), GetLocalizedStringName(L"UnitAbbreviation_Horse"), 7, false, false, true }); + powerUnits.push_back(OrderedUnit{ UnitConverterUnits::Power_TrainEngine, + GetLocalizedStringName(L"UnitName_TrainEngine"), + GetLocalizedStringName(L"UnitAbbreviation_TrainEngine"), + 8, + false, + false, + true }); unitMap.emplace(ViewMode::Power, powerUnits); vector tempUnits; - tempUnits.push_back(OrderedUnit{ UnitConverterUnits::Temperature_DegreesCelsius, GetLocalizedStringName(L"UnitName_DegreesCelsius"), - GetLocalizedStringName(L"UnitAbbreviation_DegreesCelsius"), 1, useFahrenheit, !useFahrenheit, false }); - tempUnits.push_back(OrderedUnit{ UnitConverterUnits::Temperature_DegreesFahrenheit, GetLocalizedStringName(L"UnitName_DegreesFahrenheit"), - GetLocalizedStringName(L"UnitAbbreviation_DegreesFahrenheit"), 2, !useFahrenheit, useFahrenheit, false }); - tempUnits.push_back(OrderedUnit{ UnitConverterUnits::Temperature_Kelvin, GetLocalizedStringName(L"UnitName_Kelvin"), - GetLocalizedStringName(L"UnitAbbreviation_Kelvin"), 3 }); + tempUnits.push_back(OrderedUnit{ UnitConverterUnits::Temperature_DegreesCelsius, + GetLocalizedStringName(L"UnitName_DegreesCelsius"), + GetLocalizedStringName(L"UnitAbbreviation_DegreesCelsius"), + 1, + useFahrenheit, + !useFahrenheit, + false }); + tempUnits.push_back(OrderedUnit{ UnitConverterUnits::Temperature_DegreesFahrenheit, + GetLocalizedStringName(L"UnitName_DegreesFahrenheit"), + GetLocalizedStringName(L"UnitAbbreviation_DegreesFahrenheit"), + 2, + !useFahrenheit, + useFahrenheit, + false }); + tempUnits.push_back(OrderedUnit{ + UnitConverterUnits::Temperature_Kelvin, GetLocalizedStringName(L"UnitName_Kelvin"), GetLocalizedStringName(L"UnitAbbreviation_Kelvin"), 3 }); unitMap.emplace(ViewMode::Temperature, tempUnits); vector timeUnits; timeUnits.push_back( OrderedUnit{ UnitConverterUnits::Time_Day, GetLocalizedStringName(L"UnitName_Day"), GetLocalizedStringName(L"UnitAbbreviation_Day"), 6 }); - timeUnits.push_back(OrderedUnit{ UnitConverterUnits::Time_Hour, GetLocalizedStringName(L"UnitName_Hour"), GetLocalizedStringName(L"UnitAbbreviation_Hour"), - 5, true, false, false }); - timeUnits.push_back(OrderedUnit{ UnitConverterUnits::Time_Microsecond, GetLocalizedStringName(L"UnitName_Microsecond"), - GetLocalizedStringName(L"UnitAbbreviation_Microsecond"), 1 }); - timeUnits.push_back(OrderedUnit{ UnitConverterUnits::Time_Millisecond, GetLocalizedStringName(L"UnitName_Millisecond"), - GetLocalizedStringName(L"UnitAbbreviation_Millisecond"), 2 }); - timeUnits.push_back(OrderedUnit{ UnitConverterUnits::Time_Minute, GetLocalizedStringName(L"UnitName_Minute"), - GetLocalizedStringName(L"UnitAbbreviation_Minute"), 4, false, true, false }); + timeUnits.push_back(OrderedUnit{ + UnitConverterUnits::Time_Hour, GetLocalizedStringName(L"UnitName_Hour"), GetLocalizedStringName(L"UnitAbbreviation_Hour"), 5, true, false, false }); + timeUnits.push_back(OrderedUnit{ + UnitConverterUnits::Time_Microsecond, GetLocalizedStringName(L"UnitName_Microsecond"), GetLocalizedStringName(L"UnitAbbreviation_Microsecond"), 1 }); + timeUnits.push_back(OrderedUnit{ + UnitConverterUnits::Time_Millisecond, GetLocalizedStringName(L"UnitName_Millisecond"), GetLocalizedStringName(L"UnitAbbreviation_Millisecond"), 2 }); + timeUnits.push_back(OrderedUnit{ UnitConverterUnits::Time_Minute, + GetLocalizedStringName(L"UnitName_Minute"), + GetLocalizedStringName(L"UnitAbbreviation_Minute"), + 4, + false, + true, + false }); timeUnits.push_back( OrderedUnit{ UnitConverterUnits::Time_Second, GetLocalizedStringName(L"UnitName_Second"), GetLocalizedStringName(L"UnitAbbreviation_Second"), 3 }); timeUnits.push_back( @@ -392,136 +531,239 @@ void UnitConverterDataLoader::GetUnits(_In_ unordered_map speedUnits; - speedUnits.push_back(OrderedUnit{ UnitConverterUnits::Speed_CentimetersPerSecond, GetLocalizedStringName(L"UnitName_CentimetersPerSecond"), - GetLocalizedStringName(L"UnitAbbreviation_CentimetersPerSecond"), 1 }); - speedUnits.push_back(OrderedUnit{ UnitConverterUnits::Speed_FeetPerSecond, GetLocalizedStringName(L"UnitName_FeetPerSecond"), - GetLocalizedStringName(L"UnitAbbreviation_FeetPerSecond"), 4 }); - speedUnits.push_back(OrderedUnit{ UnitConverterUnits::Speed_KilometersPerHour, GetLocalizedStringName(L"UnitName_KilometersPerHour"), - GetLocalizedStringName(L"UnitAbbreviation_KilometersPerHour"), 3, useUSCustomary, useSI, false }); + speedUnits.push_back(OrderedUnit{ UnitConverterUnits::Speed_CentimetersPerSecond, + GetLocalizedStringName(L"UnitName_CentimetersPerSecond"), + GetLocalizedStringName(L"UnitAbbreviation_CentimetersPerSecond"), + 1 }); + speedUnits.push_back(OrderedUnit{ UnitConverterUnits::Speed_FeetPerSecond, + GetLocalizedStringName(L"UnitName_FeetPerSecond"), + GetLocalizedStringName(L"UnitAbbreviation_FeetPerSecond"), + 4 }); + speedUnits.push_back(OrderedUnit{ UnitConverterUnits::Speed_KilometersPerHour, + GetLocalizedStringName(L"UnitName_KilometersPerHour"), + GetLocalizedStringName(L"UnitAbbreviation_KilometersPerHour"), + 3, + useUSCustomary, + useSI, + false }); speedUnits.push_back( OrderedUnit{ UnitConverterUnits::Speed_Knot, GetLocalizedStringName(L"UnitName_Knot"), GetLocalizedStringName(L"UnitAbbreviation_Knot"), 6 }); speedUnits.push_back( OrderedUnit{ UnitConverterUnits::Speed_Mach, GetLocalizedStringName(L"UnitName_Mach"), GetLocalizedStringName(L"UnitAbbreviation_Mach"), 7 }); - speedUnits.push_back(OrderedUnit{ UnitConverterUnits::Speed_MetersPerSecond, GetLocalizedStringName(L"UnitName_MetersPerSecond"), - GetLocalizedStringName(L"UnitAbbreviation_MetersPerSecond"), 2 }); - speedUnits.push_back(OrderedUnit{ UnitConverterUnits::Speed_MilesPerHour, GetLocalizedStringName(L"UnitName_MilesPerHour"), - GetLocalizedStringName(L"UnitAbbreviation_MilesPerHour"), 5, useSI, useUSCustomary, false }); - speedUnits.push_back(OrderedUnit{ UnitConverterUnits::Speed_Turtle, GetLocalizedStringName(L"UnitName_Turtle"), - GetLocalizedStringName(L"UnitAbbreviation_Turtle"), 8, false, false, true }); - speedUnits.push_back(OrderedUnit{ UnitConverterUnits::Speed_Horse, GetLocalizedStringName(L"UnitName_Horse"), - GetLocalizedStringName(L"UnitAbbreviation_Horse"), 9, false, false, true }); - speedUnits.push_back(OrderedUnit{ UnitConverterUnits::Speed_Jet, GetLocalizedStringName(L"UnitName_Jet"), GetLocalizedStringName(L"UnitAbbreviation_Jet"), - 10, false, false, true }); + speedUnits.push_back(OrderedUnit{ UnitConverterUnits::Speed_MetersPerSecond, + GetLocalizedStringName(L"UnitName_MetersPerSecond"), + GetLocalizedStringName(L"UnitAbbreviation_MetersPerSecond"), + 2 }); + speedUnits.push_back(OrderedUnit{ UnitConverterUnits::Speed_MilesPerHour, + GetLocalizedStringName(L"UnitName_MilesPerHour"), + GetLocalizedStringName(L"UnitAbbreviation_MilesPerHour"), + 5, + useSI, + useUSCustomary, + false }); + speedUnits.push_back(OrderedUnit{ UnitConverterUnits::Speed_Turtle, + GetLocalizedStringName(L"UnitName_Turtle"), + GetLocalizedStringName(L"UnitAbbreviation_Turtle"), + 8, + false, + false, + true }); + speedUnits.push_back(OrderedUnit{ + UnitConverterUnits::Speed_Horse, GetLocalizedStringName(L"UnitName_Horse"), GetLocalizedStringName(L"UnitAbbreviation_Horse"), 9, false, false, true }); + speedUnits.push_back(OrderedUnit{ + UnitConverterUnits::Speed_Jet, GetLocalizedStringName(L"UnitName_Jet"), GetLocalizedStringName(L"UnitAbbreviation_Jet"), 10, false, false, true }); unitMap.emplace(ViewMode::Speed, speedUnits); vector volumeUnits; - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_CubicCentimeter, GetLocalizedStringName(L"UnitName_CubicCentimeter"), - GetLocalizedStringName(L"UnitAbbreviation_CubicCentimeter"), 2 }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_CubicFoot, GetLocalizedStringName(L"UnitName_CubicFoot"), - GetLocalizedStringName(L"UnitAbbreviation_CubicFoot"), 13 }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_CubicInch, GetLocalizedStringName(L"UnitName_CubicInch"), - GetLocalizedStringName(L"UnitAbbreviation_CubicInch"), 12 }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_CubicMeter, GetLocalizedStringName(L"UnitName_CubicMeter"), - GetLocalizedStringName(L"UnitAbbreviation_CubicMeter"), 4 }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_CubicYard, GetLocalizedStringName(L"UnitName_CubicYard"), - GetLocalizedStringName(L"UnitAbbreviation_CubicYard"), 14 }); + volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_CubicCentimeter, + GetLocalizedStringName(L"UnitName_CubicCentimeter"), + GetLocalizedStringName(L"UnitAbbreviation_CubicCentimeter"), + 2 }); + volumeUnits.push_back(OrderedUnit{ + UnitConverterUnits::Volume_CubicFoot, GetLocalizedStringName(L"UnitName_CubicFoot"), GetLocalizedStringName(L"UnitAbbreviation_CubicFoot"), 13 }); + volumeUnits.push_back(OrderedUnit{ + UnitConverterUnits::Volume_CubicInch, GetLocalizedStringName(L"UnitName_CubicInch"), GetLocalizedStringName(L"UnitAbbreviation_CubicInch"), 12 }); + volumeUnits.push_back(OrderedUnit{ + UnitConverterUnits::Volume_CubicMeter, GetLocalizedStringName(L"UnitName_CubicMeter"), GetLocalizedStringName(L"UnitAbbreviation_CubicMeter"), 4 }); + volumeUnits.push_back(OrderedUnit{ + UnitConverterUnits::Volume_CubicYard, GetLocalizedStringName(L"UnitName_CubicYard"), GetLocalizedStringName(L"UnitAbbreviation_CubicYard"), 14 }); volumeUnits.push_back( OrderedUnit{ UnitConverterUnits::Volume_CupUS, GetLocalizedStringName(L"UnitName_CupUS"), GetLocalizedStringName(L"UnitAbbreviation_CupUS"), 8 }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_FluidOunceUK, GetLocalizedStringName(L"UnitName_FluidOunceUK"), - GetLocalizedStringName(L"UnitAbbreviation_FluidOunceUK"), 17 }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_FluidOunceUS, GetLocalizedStringName(L"UnitName_FluidOunceUS"), - GetLocalizedStringName(L"UnitAbbreviation_FluidOunceUS"), 7 }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_GallonUK, GetLocalizedStringName(L"UnitName_GallonUK"), - GetLocalizedStringName(L"UnitAbbreviation_GallonUK"), 20 }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_GallonUS, GetLocalizedStringName(L"UnitName_GallonUS"), - GetLocalizedStringName(L"UnitAbbreviation_GallonUS"), 11 }); + volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_FluidOunceUK, + GetLocalizedStringName(L"UnitName_FluidOunceUK"), + GetLocalizedStringName(L"UnitAbbreviation_FluidOunceUK"), + 17 }); + volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_FluidOunceUS, + GetLocalizedStringName(L"UnitName_FluidOunceUS"), + GetLocalizedStringName(L"UnitAbbreviation_FluidOunceUS"), + 7 }); + volumeUnits.push_back(OrderedUnit{ + UnitConverterUnits::Volume_GallonUK, GetLocalizedStringName(L"UnitName_GallonUK"), GetLocalizedStringName(L"UnitAbbreviation_GallonUK"), 20 }); + volumeUnits.push_back(OrderedUnit{ + UnitConverterUnits::Volume_GallonUS, GetLocalizedStringName(L"UnitName_GallonUS"), GetLocalizedStringName(L"UnitAbbreviation_GallonUS"), 11 }); volumeUnits.push_back( OrderedUnit{ UnitConverterUnits::Volume_Liter, GetLocalizedStringName(L"UnitName_Liter"), GetLocalizedStringName(L"UnitAbbreviation_Liter"), 3 }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_Milliliter, GetLocalizedStringName(L"UnitName_Milliliter"), - GetLocalizedStringName(L"UnitAbbreviation_Milliliter"), 1, useUSCustomary, useSI }); + volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_Milliliter, + GetLocalizedStringName(L"UnitName_Milliliter"), + GetLocalizedStringName(L"UnitAbbreviation_Milliliter"), + 1, + useUSCustomary, + useSI }); volumeUnits.push_back( OrderedUnit{ UnitConverterUnits::Volume_PintUK, GetLocalizedStringName(L"UnitName_PintUK"), GetLocalizedStringName(L"UnitAbbreviation_PintUK"), 18 }); volumeUnits.push_back( OrderedUnit{ UnitConverterUnits::Volume_PintUS, GetLocalizedStringName(L"UnitName_PintUS"), GetLocalizedStringName(L"UnitAbbreviation_PintUS"), 9 }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_TablespoonUS, GetLocalizedStringName(L"UnitName_TablespoonUS"), - GetLocalizedStringName(L"UnitAbbreviation_TablespoonUS"), 6 }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_TeaspoonUS, GetLocalizedStringName(L"UnitName_TeaspoonUS"), - GetLocalizedStringName(L"UnitAbbreviation_TeaspoonUS"), 5, useSI, useUSCustomary && m_currentRegionCode != "GB" }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_QuartUK, GetLocalizedStringName(L"UnitName_QuartUK"), - GetLocalizedStringName(L"UnitAbbreviation_QuartUK"), 19 }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_QuartUS, GetLocalizedStringName(L"UnitName_QuartUS"), - GetLocalizedStringName(L"UnitAbbreviation_QuartUS"), 10 }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_TeaspoonUK, GetLocalizedStringName(L"UnitName_TeaspoonUK"), - GetLocalizedStringName(L"UnitAbbreviation_TeaspoonUK"), 15, false, useUSCustomary && m_currentRegionCode == "GB" }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_TablespoonUK, GetLocalizedStringName(L"UnitName_TablespoonUK"), - GetLocalizedStringName(L"UnitAbbreviation_TablespoonUK"), 16 }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_CoffeeCup, GetLocalizedStringName(L"UnitName_CoffeeCup"), - GetLocalizedStringName(L"UnitAbbreviation_CoffeeCup"), 22, false, false, true }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_Bathtub, GetLocalizedStringName(L"UnitName_Bathtub"), - GetLocalizedStringName(L"UnitAbbreviation_Bathtub"), 23, false, false, true }); - volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_SwimmingPool, GetLocalizedStringName(L"UnitName_SwimmingPool"), - GetLocalizedStringName(L"UnitAbbreviation_SwimmingPool"), 24, false, false, true }); + volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_TablespoonUS, + GetLocalizedStringName(L"UnitName_TablespoonUS"), + GetLocalizedStringName(L"UnitAbbreviation_TablespoonUS"), + 6 }); + volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_TeaspoonUS, + GetLocalizedStringName(L"UnitName_TeaspoonUS"), + GetLocalizedStringName(L"UnitAbbreviation_TeaspoonUS"), + 5, + useSI, + useUSCustomary && m_currentRegionCode != "GB" }); + volumeUnits.push_back(OrderedUnit{ + UnitConverterUnits::Volume_QuartUK, GetLocalizedStringName(L"UnitName_QuartUK"), GetLocalizedStringName(L"UnitAbbreviation_QuartUK"), 19 }); + volumeUnits.push_back(OrderedUnit{ + UnitConverterUnits::Volume_QuartUS, GetLocalizedStringName(L"UnitName_QuartUS"), GetLocalizedStringName(L"UnitAbbreviation_QuartUS"), 10 }); + volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_TeaspoonUK, + GetLocalizedStringName(L"UnitName_TeaspoonUK"), + GetLocalizedStringName(L"UnitAbbreviation_TeaspoonUK"), + 15, + false, + useUSCustomary && m_currentRegionCode == "GB" }); + volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_TablespoonUK, + GetLocalizedStringName(L"UnitName_TablespoonUK"), + GetLocalizedStringName(L"UnitAbbreviation_TablespoonUK"), + 16 }); + volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_CoffeeCup, + GetLocalizedStringName(L"UnitName_CoffeeCup"), + GetLocalizedStringName(L"UnitAbbreviation_CoffeeCup"), + 22, + false, + false, + true }); + volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_Bathtub, + GetLocalizedStringName(L"UnitName_Bathtub"), + GetLocalizedStringName(L"UnitAbbreviation_Bathtub"), + 23, + false, + false, + true }); + volumeUnits.push_back(OrderedUnit{ UnitConverterUnits::Volume_SwimmingPool, + GetLocalizedStringName(L"UnitName_SwimmingPool"), + GetLocalizedStringName(L"UnitAbbreviation_SwimmingPool"), + 24, + false, + false, + true }); unitMap.emplace(ViewMode::Volume, volumeUnits); vector weightUnits; weightUnits.push_back( OrderedUnit{ UnitConverterUnits::Weight_Carat, GetLocalizedStringName(L"UnitName_Carat"), GetLocalizedStringName(L"UnitAbbreviation_Carat"), 1 }); - weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Centigram, GetLocalizedStringName(L"UnitName_Centigram"), - GetLocalizedStringName(L"UnitAbbreviation_Centigram"), 3 }); - weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Decigram, GetLocalizedStringName(L"UnitName_Decigram"), - GetLocalizedStringName(L"UnitAbbreviation_Decigram"), 4 }); - weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Decagram, GetLocalizedStringName(L"UnitName_Decagram"), - GetLocalizedStringName(L"UnitAbbreviation_Decagram"), 6 }); + weightUnits.push_back(OrderedUnit{ + UnitConverterUnits::Weight_Centigram, GetLocalizedStringName(L"UnitName_Centigram"), GetLocalizedStringName(L"UnitAbbreviation_Centigram"), 3 }); + weightUnits.push_back(OrderedUnit{ + UnitConverterUnits::Weight_Decigram, GetLocalizedStringName(L"UnitName_Decigram"), GetLocalizedStringName(L"UnitAbbreviation_Decigram"), 4 }); + weightUnits.push_back(OrderedUnit{ + UnitConverterUnits::Weight_Decagram, GetLocalizedStringName(L"UnitName_Decagram"), GetLocalizedStringName(L"UnitAbbreviation_Decagram"), 6 }); weightUnits.push_back( OrderedUnit{ UnitConverterUnits::Weight_Gram, GetLocalizedStringName(L"UnitName_Gram"), GetLocalizedStringName(L"UnitAbbreviation_Gram"), 5 }); - weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Hectogram, GetLocalizedStringName(L"UnitName_Hectogram"), - GetLocalizedStringName(L"UnitAbbreviation_Hectogram"), 7 }); - weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Kilogram, GetLocalizedStringName(L"UnitName_Kilogram"), - GetLocalizedStringName(L"UnitAbbreviation_Kilogram"), 8, useUSCustomary, useSI }); - weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_LongTon, GetLocalizedStringName(L"UnitName_LongTon"), - GetLocalizedStringName(L"UnitAbbreviation_LongTon"), 14 }); - weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Milligram, GetLocalizedStringName(L"UnitName_Milligram"), - GetLocalizedStringName(L"UnitAbbreviation_Milligram"), 2 }); + weightUnits.push_back(OrderedUnit{ + UnitConverterUnits::Weight_Hectogram, GetLocalizedStringName(L"UnitName_Hectogram"), GetLocalizedStringName(L"UnitAbbreviation_Hectogram"), 7 }); + weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Kilogram, + GetLocalizedStringName(L"UnitName_Kilogram"), + GetLocalizedStringName(L"UnitAbbreviation_Kilogram"), + 8, + useUSCustomary, + useSI }); + weightUnits.push_back(OrderedUnit{ + UnitConverterUnits::Weight_LongTon, GetLocalizedStringName(L"UnitName_LongTon"), GetLocalizedStringName(L"UnitAbbreviation_LongTon"), 14 }); + weightUnits.push_back(OrderedUnit{ + UnitConverterUnits::Weight_Milligram, GetLocalizedStringName(L"UnitName_Milligram"), GetLocalizedStringName(L"UnitAbbreviation_Milligram"), 2 }); weightUnits.push_back( OrderedUnit{ UnitConverterUnits::Weight_Ounce, GetLocalizedStringName(L"UnitName_Ounce"), GetLocalizedStringName(L"UnitAbbreviation_Ounce"), 10 }); - weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Pound, GetLocalizedStringName(L"UnitName_Pound"), - GetLocalizedStringName(L"UnitAbbreviation_Pound"), 11, useSI, useUSCustomary }); - weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_ShortTon, GetLocalizedStringName(L"UnitName_ShortTon"), - GetLocalizedStringName(L"UnitAbbreviation_ShortTon"), 13 }); + weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Pound, + GetLocalizedStringName(L"UnitName_Pound"), + GetLocalizedStringName(L"UnitAbbreviation_Pound"), + 11, + useSI, + useUSCustomary }); + weightUnits.push_back(OrderedUnit{ + UnitConverterUnits::Weight_ShortTon, GetLocalizedStringName(L"UnitName_ShortTon"), GetLocalizedStringName(L"UnitAbbreviation_ShortTon"), 13 }); weightUnits.push_back( OrderedUnit{ UnitConverterUnits::Weight_Stone, GetLocalizedStringName(L"UnitName_Stone"), GetLocalizedStringName(L"UnitAbbreviation_Stone"), 12 }); weightUnits.push_back( OrderedUnit{ UnitConverterUnits::Weight_Tonne, GetLocalizedStringName(L"UnitName_Tonne"), GetLocalizedStringName(L"UnitAbbreviation_Tonne"), 9 }); - weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Snowflake, GetLocalizedStringName(L"UnitName_Snowflake"), - GetLocalizedStringName(L"UnitAbbreviation_Snowflake"), 15, false, false, true }); - weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_SoccerBall, GetLocalizedStringName(L"UnitName_SoccerBall"), - GetLocalizedStringName(L"UnitAbbreviation_SoccerBall"), 16, false, false, true }); - weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Elephant, GetLocalizedStringName(L"UnitName_Elephant"), - GetLocalizedStringName(L"UnitAbbreviation_Elephant"), 17, false, false, true }); - weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Whale, GetLocalizedStringName(L"UnitName_Whale"), - GetLocalizedStringName(L"UnitAbbreviation_Whale"), 18, false, false, true }); + weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Snowflake, + GetLocalizedStringName(L"UnitName_Snowflake"), + GetLocalizedStringName(L"UnitAbbreviation_Snowflake"), + 15, + false, + false, + true }); + weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_SoccerBall, + GetLocalizedStringName(L"UnitName_SoccerBall"), + GetLocalizedStringName(L"UnitAbbreviation_SoccerBall"), + 16, + false, + false, + true }); + weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Elephant, + GetLocalizedStringName(L"UnitName_Elephant"), + GetLocalizedStringName(L"UnitAbbreviation_Elephant"), + 17, + false, + false, + true }); + weightUnits.push_back(OrderedUnit{ UnitConverterUnits::Weight_Whale, + GetLocalizedStringName(L"UnitName_Whale"), + GetLocalizedStringName(L"UnitAbbreviation_Whale"), + 18, + false, + false, + true }); unitMap.emplace(ViewMode::Weight, weightUnits); vector pressureUnits; - pressureUnits.push_back(OrderedUnit{ UnitConverterUnits::Pressure_Atmosphere, GetLocalizedStringName(L"UnitName_Atmosphere"), - GetLocalizedStringName(L"UnitAbbreviation_Atmosphere"), 1, true, false, false }); - pressureUnits.push_back(OrderedUnit{ UnitConverterUnits::Pressure_Bar, GetLocalizedStringName(L"UnitName_Bar"), - GetLocalizedStringName(L"UnitAbbreviation_Bar"), 2, false, true, false }); - pressureUnits.push_back(OrderedUnit{ UnitConverterUnits::Pressure_KiloPascal, GetLocalizedStringName(L"UnitName_KiloPascal"), - GetLocalizedStringName(L"UnitAbbreviation_KiloPascal"), 3 }); - pressureUnits.push_back(OrderedUnit{ UnitConverterUnits::Pressure_MillimeterOfMercury, GetLocalizedStringName(L"UnitName_MillimeterOfMercury "), - GetLocalizedStringName(L"UnitAbbreviation_MillimeterOfMercury "), 4 }); + pressureUnits.push_back(OrderedUnit{ UnitConverterUnits::Pressure_Atmosphere, + GetLocalizedStringName(L"UnitName_Atmosphere"), + GetLocalizedStringName(L"UnitAbbreviation_Atmosphere"), + 1, + true, + false, + false }); + pressureUnits.push_back(OrderedUnit{ + UnitConverterUnits::Pressure_Bar, GetLocalizedStringName(L"UnitName_Bar"), GetLocalizedStringName(L"UnitAbbreviation_Bar"), 2, false, true, false }); + pressureUnits.push_back(OrderedUnit{ + UnitConverterUnits::Pressure_KiloPascal, GetLocalizedStringName(L"UnitName_KiloPascal"), GetLocalizedStringName(L"UnitAbbreviation_KiloPascal"), 3 }); + pressureUnits.push_back(OrderedUnit{ UnitConverterUnits::Pressure_MillimeterOfMercury, + GetLocalizedStringName(L"UnitName_MillimeterOfMercury "), + GetLocalizedStringName(L"UnitAbbreviation_MillimeterOfMercury "), + 4 }); pressureUnits.push_back( OrderedUnit{ UnitConverterUnits::Pressure_Pascal, GetLocalizedStringName(L"UnitName_Pascal"), GetLocalizedStringName(L"UnitAbbreviation_Pascal"), 5 }); - pressureUnits.push_back(OrderedUnit{ UnitConverterUnits::Pressure_PSI, GetLocalizedStringName(L"UnitName_PSI"), - GetLocalizedStringName(L"UnitAbbreviation_PSI"), 6, false, false, false }); + pressureUnits.push_back(OrderedUnit{ + UnitConverterUnits::Pressure_PSI, GetLocalizedStringName(L"UnitName_PSI"), GetLocalizedStringName(L"UnitAbbreviation_PSI"), 6, false, false, false }); unitMap.emplace(ViewMode::Pressure, pressureUnits); vector angleUnits; - angleUnits.push_back(OrderedUnit{ UnitConverterUnits::Angle_Degree, GetLocalizedStringName(L"UnitName_Degree"), - GetLocalizedStringName(L"UnitAbbreviation_Degree"), 1, true, false, false }); - angleUnits.push_back(OrderedUnit{ UnitConverterUnits::Angle_Radian, GetLocalizedStringName(L"UnitName_Radian"), - GetLocalizedStringName(L"UnitAbbreviation_Radian"), 2, false, true, false }); + angleUnits.push_back(OrderedUnit{ UnitConverterUnits::Angle_Degree, + GetLocalizedStringName(L"UnitName_Degree"), + GetLocalizedStringName(L"UnitAbbreviation_Degree"), + 1, + true, + false, + false }); + angleUnits.push_back(OrderedUnit{ UnitConverterUnits::Angle_Radian, + GetLocalizedStringName(L"UnitName_Radian"), + GetLocalizedStringName(L"UnitAbbreviation_Radian"), + 2, + false, + true, + false }); angleUnits.push_back( OrderedUnit{ UnitConverterUnits::Angle_Gradian, GetLocalizedStringName(L"UnitName_Gradian"), GetLocalizedStringName(L"UnitAbbreviation_Gradian"), 3 }); unitMap.emplace(ViewMode::Angle, angleUnits); @@ -721,12 +963,24 @@ void UnitConverterDataLoader::GetExplicitConversionData(_In_ unordered_map>>& spTokens, - _In_ const shared_ptr>>& spCommands) - : m_expression(expression), m_result(result), m_spTokens(spTokens), m_spCommands(spCommands) +HistoryItemViewModel::HistoryItemViewModel( + String ^ expression, + String ^ result, + _In_ const shared_ptr>>& spTokens, + _In_ const shared_ptr>>& spCommands) + : m_expression(expression) + , m_result(result) + , m_spTokens(spTokens) + , m_spCommands(spCommands) { // updating accessibility names for expression and result m_accExpression = HistoryItemViewModel::GetAccessibleExpressionFromTokens(spTokens, m_expression); @@ -20,8 +26,9 @@ HistoryItemViewModel::HistoryItemViewModel(String ^ expression, String ^ result, } String - ^ HistoryItemViewModel::GetAccessibleExpressionFromTokens(_In_ shared_ptr>> const& spTokens, - _In_ String ^ fallbackExpression) + ^ HistoryItemViewModel::GetAccessibleExpressionFromTokens( + _In_ shared_ptr>> const& spTokens, + _In_ String ^ fallbackExpression) { // updating accessibility names for expression and result wstringstream accExpression{}; diff --git a/src/CalcViewModel/HistoryItemViewModel.h b/src/CalcViewModel/HistoryItemViewModel.h index 3d7e5888..fae51e69 100644 --- a/src/CalcViewModel/HistoryItemViewModel.h +++ b/src/CalcViewModel/HistoryItemViewModel.h @@ -14,9 +14,11 @@ namespace CalculatorApp { internal : - HistoryItemViewModel(Platform::String ^ expression, Platform::String ^ result, - _In_ std::shared_ptr>> const& spTokens, - _In_ std::shared_ptr>> const& spCommands); + HistoryItemViewModel( + Platform::String ^ expression, + Platform::String ^ result, + _In_ std::shared_ptr>> const& spTokens, + _In_ std::shared_ptr>> const& spCommands); std::shared_ptr>> const& GetTokens() { @@ -59,8 +61,9 @@ namespace CalculatorApp ^ GetStringRepresentation() { return m_accExpression + " " + m_accResult; } private : static Platform::String - ^ GetAccessibleExpressionFromTokens(_In_ std::shared_ptr>> const& spTokens, - _In_ Platform::String ^ fallbackExpression); + ^ GetAccessibleExpressionFromTokens( + _In_ std::shared_ptr>> const& spTokens, + _In_ Platform::String ^ fallbackExpression); private: Platform::String ^ m_expression; diff --git a/src/CalcViewModel/HistoryViewModel.cpp b/src/CalcViewModel/HistoryViewModel.cpp index 6e0b9814..70374252 100644 --- a/src/CalcViewModel/HistoryViewModel.cpp +++ b/src/CalcViewModel/HistoryViewModel.cpp @@ -27,7 +27,8 @@ namespace CalculatorApp::ViewModel::HistoryResourceKeys } HistoryViewModel::HistoryViewModel(_In_ CalculationManager::CalculatorManager* calculatorManager) - : m_calculatorManager(calculatorManager), m_localizedHistoryCleared(nullptr) + : m_calculatorManager(calculatorManager) + , m_localizedHistoryCleared(nullptr) { AreHistoryShortcutsEnabled = true; @@ -69,8 +70,11 @@ void HistoryViewModel::ReloadHistory(_In_ ViewMode currentMode) localizer.LocalizeDisplayValue(&expression); localizer.LocalizeDisplayValue(&result); - auto item = ref new HistoryItemViewModel(ref new Platform::String(expression.c_str()), ref new Platform::String(result.c_str()), - (*ritr)->historyItemVector.spTokens, (*ritr)->historyItemVector.spCommands); + auto item = ref new HistoryItemViewModel( + ref new Platform::String(expression.c_str()), + ref new Platform::String(result.c_str()), + (*ritr)->historyItemVector.spTokens, + (*ritr)->historyItemVector.spCommands); historyListVM->Append(item); } } @@ -87,8 +91,11 @@ void HistoryViewModel::OnHistoryItemAdded(_In_ unsigned int addedItemIndex) wstring result = newItem->historyItemVector.result; localizer.LocalizeDisplayValue(&expression); localizer.LocalizeDisplayValue(&result); - auto item = ref new HistoryItemViewModel(ref new Platform::String(expression.c_str()), ref new Platform::String(result.c_str()), - newItem->historyItemVector.spTokens, newItem->historyItemVector.spCommands); + auto item = ref new HistoryItemViewModel( + ref new Platform::String(expression.c_str()), + ref new Platform::String(result.c_str()), + newItem->historyItemVector.spTokens, + newItem->historyItemVector.spCommands); // check if we have not hit the max items if (Items->Size >= m_calculatorManager->MaxHistorySize()) @@ -310,8 +317,8 @@ Platform::String ^ HistoryViewModel::SerializeHistoryItem(_In_ std::shared_ptrValues->HasKey(historyItemKey)) @@ -352,8 +359,9 @@ CalculationManager::HISTORYITEM HistoryViewModel::DeserializeHistoryItem(_In_ Pl bool HistoryViewModel::IsValid(_In_ CalculationManager::HISTORYITEM item) { - return (!item.historyItemVector.expression.empty() && !item.historyItemVector.result.empty() && (bool)item.historyItemVector.spCommands - && (bool)item.historyItemVector.spTokens); + return ( + !item.historyItemVector.expression.empty() && !item.historyItemVector.result.empty() && (bool)item.historyItemVector.spCommands + && (bool)item.historyItemVector.spTokens); } void HistoryViewModel::UpdateItemSize() diff --git a/src/CalcViewModel/HistoryViewModel.h b/src/CalcViewModel/HistoryViewModel.h index 07336c42..4ed61d92 100644 --- a/src/CalcViewModel/HistoryViewModel.h +++ b/src/CalcViewModel/HistoryViewModel.h @@ -60,8 +60,8 @@ namespace CalculatorApp Platform::String ^ m_localizedHistoryCleared; void RestoreHistory(_In_ CalculationManager::CALCULATOR_MODE cMode); - CalculationManager::HISTORYITEM DeserializeHistoryItem(_In_ Platform::String ^ historyItemKey, - _In_ Windows::Storage::ApplicationDataContainer ^ historyContainer); + CalculationManager::HISTORYITEM + DeserializeHistoryItem(_In_ Platform::String ^ historyItemKey, _In_ Windows::Storage::ApplicationDataContainer ^ historyContainer); Windows::Storage::ApplicationDataContainer ^ GetHistoryContainer(_In_ CalculationManager::CALCULATOR_MODE cMode); Platform::String ^ GetHistoryContainerKey(_In_ CalculationManager::CALCULATOR_MODE cMode); void ClearHistoryContainer(_In_ CalculationManager::CALCULATOR_MODE cMode); diff --git a/src/CalcViewModel/MemoryItemViewModel.h b/src/CalcViewModel/MemoryItemViewModel.h index 1a67f3db..9a85a2bc 100644 --- a/src/CalcViewModel/MemoryItemViewModel.h +++ b/src/CalcViewModel/MemoryItemViewModel.h @@ -18,7 +18,9 @@ namespace CalculatorApp Windows::UI::Xaml::Data::ICustomPropertyProvider { public: - MemoryItemViewModel(StandardCalculatorViewModel ^ calcVM) : m_Position(-1), m_calcVM(calcVM) + MemoryItemViewModel(StandardCalculatorViewModel ^ calcVM) + : m_Position(-1) + , m_calcVM(calcVM) { } OBSERVABLE_OBJECT(); diff --git a/src/CalcViewModel/StandardCalculatorViewModel.cpp b/src/CalcViewModel/StandardCalculatorViewModel.cpp index be656b2e..6acda106 100644 --- a/src/CalcViewModel/StandardCalculatorViewModel.cpp +++ b/src/CalcViewModel/StandardCalculatorViewModel.cpp @@ -235,9 +235,10 @@ void StandardCalculatorViewModel::SetOpenParenthesisCountNarratorAnnouncement() wstring localizedParenthesisCount = to_wstring(m_OpenParenthesisCount).c_str(); LocalizationSettings::GetInstance().LocalizeDisplayValue(&localizedParenthesisCount); - String ^ announcement = - LocalizationStringUtil::GetLocalizedNarratorAnnouncement(CalculatorResourceKeys::OpenParenthesisCountAutomationFormat, - m_localizedOpenParenthesisCountChangedAutomationFormat, localizedParenthesisCount.c_str()); + String ^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement( + CalculatorResourceKeys::OpenParenthesisCountAutomationFormat, + m_localizedOpenParenthesisCountChangedAutomationFormat, + localizedParenthesisCount.c_str()); Announcement = CalculatorAnnouncement::GetOpenParenthesisCountChangedAnnouncement(announcement); } @@ -283,8 +284,9 @@ void StandardCalculatorViewModel::DisableButtons(CommandType selectedExpressionC } } -void StandardCalculatorViewModel::SetExpressionDisplay(_Inout_ shared_ptr>> const& tokens, - _Inout_ shared_ptr>> const& commands) +void StandardCalculatorViewModel::SetExpressionDisplay( + _Inout_ shared_ptr>> const& tokens, + _Inout_ shared_ptr>> const& commands) { m_tokens = tokens; m_commands = commands; @@ -298,8 +300,9 @@ void StandardCalculatorViewModel::SetExpressionDisplay(_Inout_ shared_ptr>> const& tokens, - _Inout_ shared_ptr>> const& commands) +void StandardCalculatorViewModel::SetHistoryExpressionDisplay( + _Inout_ shared_ptr>> const& tokens, + _Inout_ shared_ptr>> const& commands) { m_tokens = make_shared>>(*tokens); m_commands = make_shared>>(*commands); @@ -1035,8 +1038,8 @@ void StandardCalculatorViewModel::OnMemoryButtonPressed() int windowId = Utils::GetWindowId(); TraceLogger::GetInstance().InsertIntoMemoryMap(windowId, IsStandard, IsScientific, IsProgrammer); - String ^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement(CalculatorResourceKeys::MemorySave, m_localizedMemorySavedAutomationFormat, - m_DisplayValue->Data()); + String ^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement( + CalculatorResourceKeys::MemorySave, m_localizedMemorySavedAutomationFormat, m_DisplayValue->Data()); Announcement = CalculatorAnnouncement::GetMemoryItemAddedAnnouncement(announcement); } @@ -1957,9 +1960,11 @@ NarratorAnnouncement ^ StandardCalculatorViewModel::GetDisplayUpdatedNarratorAnn } else { - announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement(CalculatorResourceKeys::ButtonPressFeedbackFormat, - m_localizedButtonPressFeedbackAutomationFormat, - m_CalculationResultAutomationName->Data(), m_feedbackForButtonPress->Data()); + announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement( + CalculatorResourceKeys::ButtonPressFeedbackFormat, + m_localizedButtonPressFeedbackAutomationFormat, + m_CalculationResultAutomationName->Data(), + m_feedbackForButtonPress->Data()); } // Make sure we don't accidentally repeat an announcement. diff --git a/src/CalcViewModel/StandardCalculatorViewModel.h b/src/CalcViewModel/StandardCalculatorViewModel.h index fc433752..5a1a4dea 100644 --- a/src/CalcViewModel/StandardCalculatorViewModel.h +++ b/src/CalcViewModel/StandardCalculatorViewModel.h @@ -334,10 +334,12 @@ namespace CalculatorApp void SetPrimaryDisplay(_In_ std::wstring const& displayString, _In_ bool isError); void DisplayPasteError(); void SetTokens(_Inout_ std::shared_ptr>> const& tokens); - void SetExpressionDisplay(_Inout_ std::shared_ptr>> const& tokens, - _Inout_ std::shared_ptr>> const& commands); - void SetHistoryExpressionDisplay(_Inout_ std::shared_ptr>> const& tokens, - _Inout_ std::shared_ptr>> const& commands); + void SetExpressionDisplay( + _Inout_ std::shared_ptr>> const& tokens, + _Inout_ std::shared_ptr>> const& commands); + void SetHistoryExpressionDisplay( + _Inout_ std::shared_ptr>> const& tokens, + _Inout_ std::shared_ptr>> const& commands); void SetParenthesisCount(_In_ unsigned int parenthesisCount); void SetOpenParenthesisCountNarratorAnnouncement(); void OnNoRightParenAdded(); diff --git a/src/CalcViewModel/UnitConverterViewModel.cpp b/src/CalcViewModel/UnitConverterViewModel.cpp index f705d6e9..7c48e7c4 100644 --- a/src/CalcViewModel/UnitConverterViewModel.cpp +++ b/src/CalcViewModel/UnitConverterViewModel.cpp @@ -463,7 +463,8 @@ void UnitConverterViewModel::UpdateSupplementaryResults(const std::vectorData(), fromValue->Data(), - fromUnit->Data(), toValue->Data(), toUnit->Data()) - .c_str()); + String ^ localizedString = + ref new String(LocalizationStringUtil::GetLocalizedString( + m_localizedConversionResultFormat->Data(), fromValue->Data(), fromUnit->Data(), toValue->Data(), toUnit->Data()) + .c_str()); return localizedString; } diff --git a/src/CalcViewModel/UnitConverterViewModel.h b/src/CalcViewModel/UnitConverterViewModel.h index 5fea4721..1fb67ee8 100644 --- a/src/CalcViewModel/UnitConverterViewModel.h +++ b/src/CalcViewModel/UnitConverterViewModel.h @@ -17,7 +17,8 @@ namespace CalculatorApp { [Windows::UI::Xaml::Data::Bindable] public ref class Category sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged { - internal : Category(const UnitConversionManager::Category& category) : m_original(category) + internal : Category(const UnitConversionManager::Category& category) + : m_original(category) { } @@ -46,7 +47,8 @@ namespace CalculatorApp [Windows::UI::Xaml::Data::Bindable] public ref class Unit sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged { - internal : Unit(const UnitConversionManager::Unit& unit) : m_original(unit) + internal : Unit(const UnitConversionManager::Unit& unit) + : m_original(unit) { } @@ -80,7 +82,9 @@ namespace CalculatorApp [Windows::UI::Xaml::Data::Bindable] public ref class SupplementaryResult sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged { - internal : SupplementaryResult(Platform::String ^ value, Unit ^ unit) : m_Value(value), m_Unit(unit) + internal : SupplementaryResult(Platform::String ^ value, Unit ^ unit) + : m_Value(value) + , m_Unit(unit) { } @@ -110,7 +114,8 @@ namespace CalculatorApp TActivatable m_activatable; public: - Activatable(TActivatable activatable) : m_activatable(activatable) + Activatable(TActivatable activatable) + : m_activatable(activatable) { } @@ -207,8 +212,11 @@ namespace CalculatorApp Platform::String ^ GetLocalizedAutomationName(_In_ Platform::String ^ displayvalue, _In_ Platform::String ^ unitname, _In_ Platform::String ^ format); Platform::String - ^ GetLocalizedConversionResultStringFormat(_In_ Platform::String ^ fromValue, _In_ Platform::String ^ fromUnit, _In_ Platform::String ^ toValue, - _In_ Platform::String ^ toUnit); + ^ GetLocalizedConversionResultStringFormat( + _In_ Platform::String ^ fromValue, + _In_ Platform::String ^ fromUnit, + _In_ Platform::String ^ toValue, + _In_ Platform::String ^ toUnit); void UpdateValue1AutomationName(); void UpdateValue2AutomationName(); Platform::String ^ Serialize(); @@ -330,7 +338,8 @@ namespace CalculatorApp class UnitConverterVMCallback : public UnitConversionManager::IUnitConverterVMCallback { public: - UnitConverterVMCallback(UnitConverterViewModel ^ viewModel) : m_viewModel(viewModel) + UnitConverterVMCallback(UnitConverterViewModel ^ viewModel) + : m_viewModel(viewModel) { } @@ -356,7 +365,8 @@ namespace CalculatorApp class ViewModelCurrencyCallback : public UnitConversionManager::IViewModelCurrencyCallback { public: - ViewModelCurrencyCallback(UnitConverterViewModel ^ viewModel) : m_viewModel(viewModel) + ViewModelCurrencyCallback(UnitConverterViewModel ^ viewModel) + : m_viewModel(viewModel) { } diff --git a/src/Calculator.sln b/src/Calculator.sln index 47084340..11fe757e 100644 --- a/src/Calculator.sln +++ b/src/Calculator.sln @@ -9,8 +9,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalcManager", "CalcManager\ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3A5DF651-B8A1-45CA-9135-964A6FC7F5D1}" ProjectSection(SolutionItems) = preProject - .clang-format = .clang-format - clang-format-all.sh = clang-format-all.sh + ..\.clang-format = ..\.clang-format nuget.config = nuget.config EndProjectSection EndProject diff --git a/src/Calculator/App.xaml.cpp b/src/Calculator/App.xaml.cpp index 4373201e..29b39115 100644 --- a/src/Calculator/App.xaml.cpp +++ b/src/Calculator/App.xaml.cpp @@ -356,9 +356,11 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument) auto activatedEventArgs = dynamic_cast(args); if ((activatedEventArgs != nullptr) && (activatedEventArgs->CurrentlyShownApplicationViewId != 0)) { - create_task(ApplicationViewSwitcher::TryShowAsStandaloneAsync(frameService->GetViewId(), ViewSizePreference::Default, - activatedEventArgs->CurrentlyShownApplicationViewId, - ViewSizePreference::Default)) + create_task(ApplicationViewSwitcher::TryShowAsStandaloneAsync( + frameService->GetViewId(), + ViewSizePreference::Default, + activatedEventArgs->CurrentlyShownApplicationViewId, + ViewSizePreference::Default)) .then( [safeFrameServiceCreation](bool viewShown) { // SafeFrameServiceCreation is used to automatically remove the frame @@ -385,8 +387,8 @@ void App::OnAppLaunch(IActivatedEventArgs ^ args, String ^ argument) if (activationViewSwitcher != nullptr) { - activationViewSwitcher->ShowAsStandaloneAsync(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), - ViewSizePreference::Default); + activationViewSwitcher->ShowAsStandaloneAsync( + ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), ViewSizePreference::Default); TraceLogger::GetInstance().LogNewWindowCreationEnd(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread())); TraceLogger::GetInstance().LogPrelaunchedAppActivatedByUser(); } diff --git a/src/Calculator/App.xaml.h b/src/Calculator/App.xaml.h index 60e9f71f..1de1aa8c 100644 --- a/src/Calculator/App.xaml.h +++ b/src/Calculator/App.xaml.h @@ -47,7 +47,9 @@ namespace CalculatorApp { public: SafeFrameWindowCreation(_In_ WindowFrameService ^ frameService, App ^ parent) - : m_frameService(frameService), m_frameOpenedInWindow(false), m_parent(parent) + : m_frameService(frameService) + , m_frameOpenedInWindow(false) + , m_parent(parent) { } diff --git a/src/Calculator/Common/AlwaysSelectedCollectionView.h b/src/Calculator/Common/AlwaysSelectedCollectionView.h index 40a620a9..35d40095 100644 --- a/src/Calculator/Common/AlwaysSelectedCollectionView.h +++ b/src/Calculator/Common/AlwaysSelectedCollectionView.h @@ -9,7 +9,8 @@ namespace CalculatorApp { ref class AlwaysSelectedCollectionView sealed : public Windows::UI::Xaml::DependencyObject, public Windows::UI::Xaml::Data::ICollectionView { - internal : AlwaysSelectedCollectionView(Windows::UI::Xaml::Interop::IBindableVector ^ source) : m_currentPosition(-1) + internal : AlwaysSelectedCollectionView(Windows::UI::Xaml::Interop::IBindableVector ^ source) + : m_currentPosition(-1) { m_source = source; @@ -47,8 +48,8 @@ namespace CalculatorApp throw ref new Platform::NotImplementedException(); } property Windows::Foundation::Collections::IObservableVector ^ CollectionGroups { - virtual Windows::Foundation::Collections::IObservableVector ^ get() = Windows::UI::Xaml::Data::ICollectionView::CollectionGroups::get + virtual Windows::Foundation::Collections::IObservableVector< + Platform::Object ^> ^ get() = Windows::UI::Xaml::Data::ICollectionView::CollectionGroups::get { return ref new Platform::Collections::Vector(); } @@ -80,8 +81,9 @@ namespace CalculatorApp // restore the selection to the way we wanted it to begin with if (m_currentPosition >= 0 && m_currentPosition < static_cast(m_source->Size)) { - this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, - ref new Windows::UI::Core::DispatchedHandler([this]() { m_currentChanged(this, nullptr); })); + this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([this]() { + m_currentChanged(this, nullptr); + })); } return false; } @@ -167,14 +169,14 @@ namespace CalculatorApp { throw ref new Platform::NotImplementedException(); } - virtual unsigned int - GetMany(unsigned int /*startIndex*/, - Platform::WriteOnlyArray ^ /*items*/) = Windows::Foundation::Collections::IVector::GetMany + virtual unsigned int GetMany( + unsigned int /*startIndex*/, + Platform::WriteOnlyArray ^ /*items*/) = Windows::Foundation::Collections::IVector::GetMany { throw ref new Platform::NotImplementedException(); } - virtual Windows::Foundation::Collections::IVectorView ^ GetView() = Windows::Foundation::Collections::IVector::GetView + virtual Windows::Foundation::Collections::IVectorView ^ GetView() = Windows::Foundation::Collections::IVector< + Platform::Object ^>::GetView { throw ref new Platform::NotImplementedException(); } @@ -263,8 +265,11 @@ namespace CalculatorApp private: virtual Platform::Object - ^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/, - Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::Convert + ^ Convert( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName /*targetType*/, + Platform::Object ^ /*parameter*/, + Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::Convert { auto result = dynamic_cast(value); if (result) @@ -275,8 +280,11 @@ namespace CalculatorApp } virtual Platform::Object - ^ ConvertBack(Platform::Object ^ /*value*/, Windows::UI::Xaml::Interop::TypeName /*targetType*/, Platform::Object ^ /*parameter*/, - Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack + ^ ConvertBack( + Platform::Object ^ /*value*/, + Windows::UI::Xaml::Interop::TypeName /*targetType*/, + Platform::Object ^ /*parameter*/, + Platform::String ^ /*language*/) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack { return Windows::UI::Xaml::DependencyProperty::UnsetValue; } diff --git a/src/Calculator/Common/AppLifecycleLogger.cpp b/src/Calculator/Common/AppLifecycleLogger.cpp index 9e208508..2134fb84 100644 --- a/src/Calculator/Common/AppLifecycleLogger.cpp +++ b/src/Calculator/Common/AppLifecycleLogger.cpp @@ -58,8 +58,8 @@ namespace CalculatorApp #pragma region Tracing methods void AppLifecycleLogger::LogAppLifecycleEvent(hstring const& eventName, LoggingFields const& fields) const { - m_appLifecycleProvider.LogEvent(eventName, fields, LoggingLevel::Information, - LoggingOptions(MICROSOFT_KEYWORD_TELEMETRY | WINEVENT_KEYWORD_RESPONSE_TIME)); + m_appLifecycleProvider.LogEvent( + eventName, fields, LoggingLevel::Information, LoggingOptions(MICROSOFT_KEYWORD_TELEMETRY | WINEVENT_KEYWORD_RESPONSE_TIME)); } #pragma endregion diff --git a/src/Calculator/Controls/CalculationResult.cpp b/src/Calculator/Controls/CalculationResult.cpp index c6486c35..e6024df5 100644 --- a/src/Calculator/Controls/CalculationResult.cpp +++ b/src/Calculator/Controls/CalculationResult.cpp @@ -50,7 +50,9 @@ DEPENDENCY_PROPERTY_INITIALIZATION(CalculationResult, DisplayStringExpression); StringReference CalculationResult::s_FocusedState(L"Focused"); StringReference CalculationResult::s_UnfocusedState(L"Unfocused"); -CalculationResult::CalculationResult() : m_isScalingText(false), m_haveCalculatedMax(false) +CalculationResult::CalculationResult() + : m_isScalingText(false) + , m_haveCalculatedMax(false) { } diff --git a/src/Calculator/Controls/CalculationResultAutomationPeer.cpp b/src/Calculator/Controls/CalculationResultAutomationPeer.cpp index d736b9ee..6f381e28 100644 --- a/src/Calculator/Controls/CalculationResultAutomationPeer.cpp +++ b/src/Calculator/Controls/CalculationResultAutomationPeer.cpp @@ -9,7 +9,8 @@ using namespace Windows::UI::Xaml::Automation::Peers; namespace CalculatorApp::Controls { - CalculationResultAutomationPeer::CalculationResultAutomationPeer(FrameworkElement ^ owner) : FrameworkElementAutomationPeer(owner) + CalculationResultAutomationPeer::CalculationResultAutomationPeer(FrameworkElement ^ owner) + : FrameworkElementAutomationPeer(owner) { } diff --git a/src/Calculator/Controls/OverflowTextBlock.cpp b/src/Calculator/Controls/OverflowTextBlock.cpp index 900ce882..e9944279 100644 --- a/src/Calculator/Controls/OverflowTextBlock.cpp +++ b/src/Calculator/Controls/OverflowTextBlock.cpp @@ -155,8 +155,9 @@ void OverflowTextBlock::UpdateScrollButtons() ShowHideScrollButtons(::Visibility::Collapsed, ::Visibility::Collapsed); } // We have more number on both side. Show both arrows - else if ((m_expressionContainer->HorizontalOffset > 0) - && (m_expressionContainer->HorizontalOffset < (m_expressionContainer->ExtentWidth - m_expressionContainer->ViewportWidth))) + else if ( + (m_expressionContainer->HorizontalOffset > 0) + && (m_expressionContainer->HorizontalOffset < (m_expressionContainer->ExtentWidth - m_expressionContainer->ViewportWidth))) { ShowHideScrollButtons(::Visibility::Visible, ::Visibility::Visible); } diff --git a/src/Calculator/Controls/OverflowTextBlockAutomationPeer.cpp b/src/Calculator/Controls/OverflowTextBlockAutomationPeer.cpp index f28810d7..d5e7d392 100644 --- a/src/Calculator/Controls/OverflowTextBlockAutomationPeer.cpp +++ b/src/Calculator/Controls/OverflowTextBlockAutomationPeer.cpp @@ -10,7 +10,8 @@ using namespace Windows::Foundation::Collections; namespace CalculatorApp::Controls { - OverflowTextBlockAutomationPeer::OverflowTextBlockAutomationPeer(OverflowTextBlock ^ owner) : FrameworkElementAutomationPeer(owner) + OverflowTextBlockAutomationPeer::OverflowTextBlockAutomationPeer(OverflowTextBlock ^ owner) + : FrameworkElementAutomationPeer(owner) { } diff --git a/src/Calculator/Converters/BitFlipAutomationNameConverter.h b/src/Calculator/Converters/BitFlipAutomationNameConverter.h index b0a599db..101779ee 100644 --- a/src/Calculator/Converters/BitFlipAutomationNameConverter.h +++ b/src/Calculator/Converters/BitFlipAutomationNameConverter.h @@ -14,11 +14,17 @@ namespace CalculatorApp { public: virtual Platform::Object - ^ Convert(_In_ Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, _In_ Platform::Object ^ parameter, - _In_ Platform::String ^ language); + ^ Convert( + _In_ Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName targetType, + _In_ Platform::Object ^ parameter, + _In_ Platform::String ^ language); virtual Platform::Object - ^ ConvertBack(_In_ Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, _In_ Platform::Object ^ parameter, - _In_ Platform::String ^ language); + ^ ConvertBack( + _In_ Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName targetType, + _In_ Platform::Object ^ parameter, + _In_ Platform::String ^ language); }; } } diff --git a/src/Calculator/Converters/BooleanNegationConverter.h b/src/Calculator/Converters/BooleanNegationConverter.h index a7768dee..a0db5c33 100644 --- a/src/Calculator/Converters/BooleanNegationConverter.h +++ b/src/Calculator/Converters/BooleanNegationConverter.h @@ -16,8 +16,11 @@ namespace CalculatorApp virtual Platform::Object ^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language); virtual Platform::Object - ^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, - Platform::String ^ language); + ^ ConvertBack( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName targetType, + Platform::Object ^ parameter, + Platform::String ^ language); }; } } diff --git a/src/Calculator/Converters/BooleanToVisibilityConverter.h b/src/Calculator/Converters/BooleanToVisibilityConverter.h index b0102ae6..b03fb3eb 100644 --- a/src/Calculator/Converters/BooleanToVisibilityConverter.h +++ b/src/Calculator/Converters/BooleanToVisibilityConverter.h @@ -23,8 +23,11 @@ namespace CalculatorApp virtual Platform::Object ^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language); virtual Platform::Object - ^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, - Platform::String ^ language); + ^ ConvertBack( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName targetType, + Platform::Object ^ parameter, + Platform::String ^ language); }; /// @@ -38,8 +41,11 @@ namespace CalculatorApp virtual Platform::Object ^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language); virtual Platform::Object - ^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, - Platform::String ^ language); + ^ ConvertBack( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName targetType, + Platform::Object ^ parameter, + Platform::String ^ language); }; } diff --git a/src/Calculator/Converters/ItemSizeToVisibilityConverter.h b/src/Calculator/Converters/ItemSizeToVisibilityConverter.h index ba8f81db..90b8cd4c 100644 --- a/src/Calculator/Converters/ItemSizeToVisibilityConverter.h +++ b/src/Calculator/Converters/ItemSizeToVisibilityConverter.h @@ -13,8 +13,11 @@ namespace CalculatorApp virtual Platform::Object ^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language); virtual Platform::Object - ^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, - Platform::String ^ language); + ^ ConvertBack( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName targetType, + Platform::Object ^ parameter, + Platform::String ^ language); }; public @@ -24,8 +27,11 @@ namespace CalculatorApp virtual Platform::Object ^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language); virtual Platform::Object - ^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, - Platform::String ^ language); + ^ ConvertBack( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName targetType, + Platform::Object ^ parameter, + Platform::String ^ language); }; } } diff --git a/src/Calculator/Converters/RadixToStringConverter.h b/src/Calculator/Converters/RadixToStringConverter.h index 58b59c9c..b33c8798 100644 --- a/src/Calculator/Converters/RadixToStringConverter.h +++ b/src/Calculator/Converters/RadixToStringConverter.h @@ -16,8 +16,11 @@ namespace CalculatorApp virtual Platform::Object ^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language); virtual Platform::Object - ^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, - Platform::String ^ language); + ^ ConvertBack( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName targetType, + Platform::Object ^ parameter, + Platform::String ^ language); }; } } diff --git a/src/Calculator/Converters/VisibilityNegationConverter.h b/src/Calculator/Converters/VisibilityNegationConverter.h index 1ed9f1cf..4f06162c 100644 --- a/src/Calculator/Converters/VisibilityNegationConverter.h +++ b/src/Calculator/Converters/VisibilityNegationConverter.h @@ -16,8 +16,11 @@ namespace CalculatorApp virtual Platform::Object ^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, Platform::String ^ language); virtual Platform::Object - ^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, - Platform::String ^ language); + ^ ConvertBack( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName targetType, + Platform::Object ^ parameter, + Platform::String ^ language); }; } } diff --git a/src/Calculator/DesignData/DesignStandardCalculatorViewModel.h b/src/Calculator/DesignData/DesignStandardCalculatorViewModel.h index 78c54a39..3d61d9cd 100644 --- a/src/Calculator/DesignData/DesignStandardCalculatorViewModel.h +++ b/src/Calculator/DesignData/DesignStandardCalculatorViewModel.h @@ -13,7 +13,9 @@ namespace Numbers ref class MemorySlot sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged { public: - MemorySlot(int slotPosition, Platform::String ^ value) : m_SlotPosition(slotPosition), m_SlotValue(value) + MemorySlot(int slotPosition, Platform::String ^ value) + : m_SlotPosition(slotPosition) + , m_SlotValue(value) { } @@ -35,7 +37,10 @@ namespace Numbers { public: StandardCalculatorViewModel() - : m_DisplayValue("1234569"), m_DisplayStringExpression("14560 x 1890"), m_DegreeButtonContent("Deg"), m_IsMemoryEmpty(false) + : m_DisplayValue("1234569") + , m_DisplayStringExpression("14560 x 1890") + , m_DegreeButtonContent("Deg") + , m_IsMemoryEmpty(false) { m_MemorizedNumbers = ref new Platform::Collections::Vector(); for (int i = 1000; i < 1100; i++) diff --git a/src/Calculator/DesignData/DesignUnitConverterViewModel.h b/src/Calculator/DesignData/DesignUnitConverterViewModel.h index 1d646811..1bfd6bbb 100644 --- a/src/Calculator/DesignData/DesignUnitConverterViewModel.h +++ b/src/Calculator/DesignData/DesignUnitConverterViewModel.h @@ -21,11 +21,15 @@ namespace Numbers ref class CategoryViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged { public: - CategoryViewModel(Platform::String ^ name) : m_Name(name), m_NegateVisibility(Windows::UI::Xaml::Visibility::Collapsed) + CategoryViewModel(Platform::String ^ name) + : m_Name(name) + , m_NegateVisibility(Windows::UI::Xaml::Visibility::Collapsed) { } - CategoryViewModel(Platform::String ^ name, Windows::UI::Xaml::Visibility negateVisibility) : m_Name(name), m_NegateVisibility(negateVisibility) + CategoryViewModel(Platform::String ^ name, Windows::UI::Xaml::Visibility negateVisibility) + : m_Name(name) + , m_NegateVisibility(negateVisibility) { } @@ -39,7 +43,9 @@ namespace Numbers ref class UnitViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged { public: - UnitViewModel(Platform::String ^ unit, Platform::String ^ abbr) : m_Name(unit), m_Abbreviation(abbr) + UnitViewModel(Platform::String ^ unit, Platform::String ^ abbr) + : m_Name(unit) + , m_Abbreviation(abbr) { } @@ -53,7 +59,8 @@ namespace Numbers ref class UnitConverterSupplementaryResultViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged { public: - UnitConverterSupplementaryResultViewModel(Platform::String ^ value, Platform::String ^ unit, Platform::String ^ abbr) : m_Value(value) + UnitConverterSupplementaryResultViewModel(Platform::String ^ value, Platform::String ^ unit, Platform::String ^ abbr) + : m_Value(value) { m_Unit = ref new UnitViewModel(unit, abbr); } @@ -68,7 +75,11 @@ namespace Numbers ref class UnitConverterViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged { public: - UnitConverterViewModel() : m_Value1("Åy24"), m_Value2("Åy183"), m_Value1Active(true), m_Value2Active(false) + UnitConverterViewModel() + : m_Value1("Åy24") + , m_Value2("Åy183") + , m_Value1Active(true) + , m_Value2Active(false) { m_SupplementaryResults = ref new Platform::Collections::Vector(); m_SupplementaryResults->Append(ref new UnitConverterSupplementaryResultViewModel("128", "Kilograms", "Kgs")); diff --git a/src/Calculator/Views/Calculator.xaml.cpp b/src/Calculator/Views/Calculator.xaml.cpp index 1a26d510..6f64b193 100644 --- a/src/Calculator/Views/Calculator.xaml.cpp +++ b/src/Calculator/Views/Calculator.xaml.cpp @@ -41,7 +41,11 @@ DEPENDENCY_PROPERTY_INITIALIZATION(Calculator, IsStandard); DEPENDENCY_PROPERTY_INITIALIZATION(Calculator, IsScientific); DEPENDENCY_PROPERTY_INITIALIZATION(Calculator, IsProgrammer); -Calculator::Calculator() : m_doAnimate(false), m_isLastAnimatedInScientific(false), m_isLastAnimatedInProgrammer(false), m_resultAnimate(false) +Calculator::Calculator() + : m_doAnimate(false) + , m_isLastAnimatedInScientific(false) + , m_isLastAnimatedInProgrammer(false) + , m_resultAnimate(false) { SetFontSizeResources(); InitializeComponent(); diff --git a/src/Calculator/Views/Calculator.xaml.h b/src/Calculator/Views/Calculator.xaml.h index ccc1adb5..3814e4ac 100644 --- a/src/Calculator/Views/Calculator.xaml.h +++ b/src/Calculator/Views/Calculator.xaml.h @@ -109,8 +109,9 @@ public bool m_IsDigit = false; Memory ^ m_memory; void HistoryFlyout_Opened(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args); - void HistoryFlyout_Closing(_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBase ^ sender, - _In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs ^ args); + void HistoryFlyout_Closing( + _In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBase ^ sender, + _In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs ^ args); void HistoryFlyout_Closed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args); void OnHideHistoryClicked(); void OnHideMemoryClicked(); @@ -121,8 +122,9 @@ public bool m_fIsHistoryFlyoutOpen; bool m_fIsMemoryFlyoutOpen; void OnMemoryFlyoutOpened(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args); - void OnMemoryFlyoutClosing(_In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBase ^ sender, - _In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs ^ args); + void OnMemoryFlyoutClosing( + _In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBase ^ sender, + _In_ Windows::UI::Xaml::Controls::Primitives::FlyoutBaseClosingEventArgs ^ args); void OnMemoryFlyoutClosed(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args); void SetChildAsMemory(); void SetChildAsHistory(); diff --git a/src/Calculator/Views/CalculatorProgrammerBitFlipPanel.xaml.cpp b/src/Calculator/Views/CalculatorProgrammerBitFlipPanel.xaml.cpp index f7c260ec..418ff336 100644 --- a/src/Calculator/Views/CalculatorProgrammerBitFlipPanel.xaml.cpp +++ b/src/Calculator/Views/CalculatorProgrammerBitFlipPanel.xaml.cpp @@ -25,7 +25,8 @@ using namespace Windows::UI::Xaml::Input; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 -CalculatorProgrammerBitFlipPanel::CalculatorProgrammerBitFlipPanel() : m_updatingCheckedStates(false) +CalculatorProgrammerBitFlipPanel::CalculatorProgrammerBitFlipPanel() + : m_updatingCheckedStates(false) { InitializeComponent(); auto booleanToVisibilityConverter = ref new Converters::BooleanToVisibilityConverter; diff --git a/src/Calculator/Views/CalculatorProgrammerBitFlipPanel.xaml.h b/src/Calculator/Views/CalculatorProgrammerBitFlipPanel.xaml.h index cfcb0e45..3ec6355d 100644 --- a/src/Calculator/Views/CalculatorProgrammerBitFlipPanel.xaml.h +++ b/src/Calculator/Views/CalculatorProgrammerBitFlipPanel.xaml.h @@ -34,8 +34,10 @@ namespace CalculatorApp void AssignFlipButtons(); - void SetVisibilityBinding(_In_ Windows::UI::Xaml::FrameworkElement ^ element, _In_ Platform::String ^ path, - _In_ Windows::UI::Xaml::Data::IValueConverter ^ converter); + void SetVisibilityBinding( + _In_ Windows::UI::Xaml::FrameworkElement ^ element, + _In_ Platform::String ^ path, + _In_ Windows::UI::Xaml::Data::IValueConverter ^ converter); void OnBitToggled(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e); void UpdateCheckedStates(); diff --git a/src/Calculator/Views/CalculatorProgrammerDisplayPanel.xaml.cpp b/src/Calculator/Views/CalculatorProgrammerDisplayPanel.xaml.cpp index 7c49b9ed..e3b600bd 100644 --- a/src/Calculator/Views/CalculatorProgrammerDisplayPanel.xaml.cpp +++ b/src/Calculator/Views/CalculatorProgrammerDisplayPanel.xaml.cpp @@ -20,7 +20,8 @@ using namespace Windows::UI::Xaml::Navigation; using namespace Windows::UI::ViewManagement; using namespace Windows::UI::Core; -CalculatorProgrammerDisplayPanel::CalculatorProgrammerDisplayPanel() : m_isErrorVisualState(false) +CalculatorProgrammerDisplayPanel::CalculatorProgrammerDisplayPanel() + : m_isErrorVisualState(false) { InitializeComponent(); } diff --git a/src/Calculator/Views/CalculatorProgrammerRadixOperators.xaml.cpp b/src/Calculator/Views/CalculatorProgrammerRadixOperators.xaml.cpp index 96e19a51..b869bf68 100644 --- a/src/Calculator/Views/CalculatorProgrammerRadixOperators.xaml.cpp +++ b/src/Calculator/Views/CalculatorProgrammerRadixOperators.xaml.cpp @@ -23,7 +23,8 @@ using namespace Windows::UI::Xaml::Data; using namespace CalculatorApp::Common; using namespace Windows::UI::Xaml::Media; -CalculatorProgrammerRadixOperators::CalculatorProgrammerRadixOperators() : m_isErrorVisualState(false) +CalculatorProgrammerRadixOperators::CalculatorProgrammerRadixOperators() + : m_isErrorVisualState(false) { InitializeComponent(); diff --git a/src/Calculator/Views/CalculatorScientificAngleButtons.xaml.cpp b/src/Calculator/Views/CalculatorScientificAngleButtons.xaml.cpp index 41da10c7..66878e3f 100644 --- a/src/Calculator/Views/CalculatorScientificAngleButtons.xaml.cpp +++ b/src/Calculator/Views/CalculatorScientificAngleButtons.xaml.cpp @@ -29,7 +29,8 @@ using namespace Windows::UI::Core; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 -CalculatorScientificAngleButtons::CalculatorScientificAngleButtons() : m_isErrorVisualState(false) +CalculatorScientificAngleButtons::CalculatorScientificAngleButtons() + : m_isErrorVisualState(false) { InitializeComponent(); } diff --git a/src/Calculator/Views/CalculatorScientificOperators.xaml.cpp b/src/Calculator/Views/CalculatorScientificOperators.xaml.cpp index 65e1d245..5ac9dab9 100644 --- a/src/Calculator/Views/CalculatorScientificOperators.xaml.cpp +++ b/src/Calculator/Views/CalculatorScientificOperators.xaml.cpp @@ -68,8 +68,9 @@ void CalculatorScientificOperators::shiftButton_Check(_In_ Platform::Object ^ /* SetOperatorRowVisibility(); } -void CalculatorScientificOperators::shiftButton_IsEnabledChanged(_In_ Platform::Object ^ /*sender*/, - _In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ /*e*/) +void CalculatorScientificOperators::shiftButton_IsEnabledChanged( + _In_ Platform::Object ^ /*sender*/, + _In_ Windows::UI::Xaml::DependencyPropertyChangedEventArgs ^ /*e*/) { SetOperatorRowVisibility(); Common::KeyboardShortcutManager::ShiftButtonChecked(ShiftButton->IsEnabled && ShiftButton->IsChecked->Value); diff --git a/src/Calculator/Views/CalculatorStandardOperators.xaml.cpp b/src/Calculator/Views/CalculatorStandardOperators.xaml.cpp index 75c91e58..7ebd5928 100644 --- a/src/Calculator/Views/CalculatorStandardOperators.xaml.cpp +++ b/src/Calculator/Views/CalculatorStandardOperators.xaml.cpp @@ -24,7 +24,8 @@ using namespace Windows::UI::Xaml::Navigation; // The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 -CalculatorStandardOperators::CalculatorStandardOperators() : m_isErrorVisualState(false) +CalculatorStandardOperators::CalculatorStandardOperators() + : m_isErrorVisualState(false) { InitializeComponent(); } diff --git a/src/Calculator/Views/DateCalculator.xaml.cpp b/src/Calculator/Views/DateCalculator.xaml.cpp index 1b825704..b3a9dcdd 100644 --- a/src/Calculator/Views/DateCalculator.xaml.cpp +++ b/src/Calculator/Views/DateCalculator.xaml.cpp @@ -79,9 +79,10 @@ DateCalculator::DateCalculator() DateDiff_ToDate->MaxDate = maxYear; // Set the PlaceHolderText for CalendarDatePicker - DateTimeFormatter ^ dateTimeFormatter = - LocalizationService::GetRegionalSettingsAwareDateTimeFormatter(L"day month year", localizationSettings.GetCalendarIdentifier(), - ClockIdentifiers::TwentyFourHour); // Clock Identifier is not used + DateTimeFormatter ^ dateTimeFormatter = LocalizationService::GetRegionalSettingsAwareDateTimeFormatter( + L"day month year", + localizationSettings.GetCalendarIdentifier(), + ClockIdentifiers::TwentyFourHour); // Clock Identifier is not used DateDiff_FromDate->DateFormat = L"day month year"; DateDiff_ToDate->DateFormat = L"day month year"; @@ -130,8 +131,8 @@ void DateCalculator::AddSubtract_DateChanged(_In_ CalendarDatePicker ^ sender, _ { auto dateCalcViewModel = safe_cast(this->DataContext); dateCalcViewModel->StartDate = e->NewDate->Value; - TraceLogger::GetInstance().LogDateAddSubtractModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), - dateCalcViewModel->IsAddMode); + TraceLogger::GetInstance().LogDateAddSubtractModeUsed( + ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode); } else { @@ -142,8 +143,8 @@ void DateCalculator::AddSubtract_DateChanged(_In_ CalendarDatePicker ^ sender, _ void CalculatorApp::DateCalculator::OffsetValue_Changed(_In_ Platform::Object ^ sender, _In_ SelectionChangedEventArgs ^ e) { auto dateCalcViewModel = safe_cast(this->DataContext); - TraceLogger::GetInstance().LogDateAddSubtractModeUsed(ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), - dateCalcViewModel->IsAddMode); + TraceLogger::GetInstance().LogDateAddSubtractModeUsed( + ApplicationView::GetApplicationViewIdForWindow(CoreWindow::GetForCurrentThread()), dateCalcViewModel->IsAddMode); } void DateCalculator::OnCopyMenuItemClicked(_In_ Object ^ sender, _In_ RoutedEventArgs ^ e) diff --git a/src/Calculator/Views/DateCalculator.xaml.h b/src/Calculator/Views/DateCalculator.xaml.h index 178add0b..e158b937 100644 --- a/src/Calculator/Views/DateCalculator.xaml.h +++ b/src/Calculator/Views/DateCalculator.xaml.h @@ -29,12 +29,15 @@ namespace CalculatorApp void SetDefaultFocus(); private: - void FromDate_DateChanged(_In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender, - _In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e); - void ToDate_DateChanged(_In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender, - _In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e); - void AddSubtract_DateChanged(_In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender, - _In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e); + void FromDate_DateChanged( + _In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender, + _In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e); + void ToDate_DateChanged( + _In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender, + _In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e); + void AddSubtract_DateChanged( + _In_ Windows::UI::Xaml::Controls::CalendarDatePicker ^ sender, + _In_ Windows::UI::Xaml::Controls::CalendarDatePickerDateChangedEventArgs ^ e); void OffsetValue_Changed(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Controls::SelectionChangedEventArgs ^ e); void OnCopyMenuItemClicked(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e); void OnLoaded(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::RoutedEventArgs ^ e); diff --git a/src/Calculator/Views/MainPage.xaml.cpp b/src/Calculator/Views/MainPage.xaml.cpp index fa304434..2119d872 100644 --- a/src/Calculator/Views/MainPage.xaml.cpp +++ b/src/Calculator/Views/MainPage.xaml.cpp @@ -63,7 +63,8 @@ namespace CalculatorApp::VisualStates } } -MainPage::MainPage() : m_model(ref new ApplicationViewModel()) +MainPage::MainPage() + : m_model(ref new ApplicationViewModel()) { InitializeComponent(); diff --git a/src/Calculator/Views/MainPage.xaml.h b/src/Calculator/Views/MainPage.xaml.h index aa9fcab8..0d77e324 100644 --- a/src/Calculator/Views/MainPage.xaml.h +++ b/src/Calculator/Views/MainPage.xaml.h @@ -49,8 +49,9 @@ public void OnNavPaneOpened(_In_ Microsoft::UI::Xaml::Controls::NavigationView ^ sender, _In_ Platform::Object ^ args); void OnNavPaneClosed(_In_ Microsoft::UI::Xaml::Controls::NavigationView ^ sender, _In_ Platform::Object ^ args); void OnNavSelectionChanged(_In_ Platform::Object ^ sender, _In_ Microsoft::UI::Xaml::Controls::NavigationViewSelectionChangedEventArgs ^ e); - void OnNavItemInvoked(Microsoft::UI::Xaml::Controls::NavigationView ^ /*sender*/, - _In_ Microsoft::UI::Xaml::Controls::NavigationViewItemInvokedEventArgs ^ e); + void OnNavItemInvoked( + Microsoft::UI::Xaml::Controls::NavigationView ^ /*sender*/, + _In_ Microsoft::UI::Xaml::Controls::NavigationViewItemInvokedEventArgs ^ e); void OnAboutButtonClick(_In_ Platform::Object ^ sender, _In_ Windows::UI::Xaml::Controls::ItemClickEventArgs ^ e); void OnAboutFlyoutOpened(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ e); diff --git a/src/Calculator/Views/Memory.xaml.cpp b/src/Calculator/Views/Memory.xaml.cpp index 1d41ec7f..a204b157 100644 --- a/src/Calculator/Views/Memory.xaml.cpp +++ b/src/Calculator/Views/Memory.xaml.cpp @@ -35,7 +35,8 @@ using namespace Windows::UI::ViewManagement; DEPENDENCY_PROPERTY_INITIALIZATION(Memory, RowHeight); -Memory::Memory() : m_isErrorVisualState(false) +Memory::Memory() + : m_isErrorVisualState(false) { InitializeComponent(); m_memoryItemFlyout = safe_cast(Resources->Lookup("MemoryContextMenu")); diff --git a/src/Calculator/Views/NumberPad.xaml.cpp b/src/Calculator/Views/NumberPad.xaml.cpp index 6145225c..9a6ca2de 100644 --- a/src/Calculator/Views/NumberPad.xaml.cpp +++ b/src/Calculator/Views/NumberPad.xaml.cpp @@ -31,7 +31,8 @@ using namespace CalculatorApp::Common; DEPENDENCY_PROPERTY_INITIALIZATION(NumberPad, ButtonStyle); -NumberPad::NumberPad() : m_isErrorVisualState(false) +NumberPad::NumberPad() + : m_isErrorVisualState(false) { InitializeComponent(); diff --git a/src/Calculator/Views/SupplementaryResults.xaml.h b/src/Calculator/Views/SupplementaryResults.xaml.h index bb31a2aa..c95721f1 100644 --- a/src/Calculator/Views/SupplementaryResults.xaml.h +++ b/src/Calculator/Views/SupplementaryResults.xaml.h @@ -26,11 +26,17 @@ public } internal : virtual Platform::Object - ^ Convert(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, - Platform::String ^ language) = Windows::UI::Xaml::Data::IValueConverter::Convert; + ^ Convert( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName targetType, + Platform::Object ^ parameter, + Platform::String ^ language) = Windows::UI::Xaml::Data::IValueConverter::Convert; virtual Platform::Object - ^ ConvertBack(Platform::Object ^ value, Windows::UI::Xaml::Interop::TypeName targetType, Platform::Object ^ parameter, - Platform::String ^ language) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack; + ^ ConvertBack( + Platform::Object ^ value, + Windows::UI::Xaml::Interop::TypeName targetType, + Platform::Object ^ parameter, + Platform::String ^ language) = Windows::UI::Xaml::Data::IValueConverter::ConvertBack; private: Windows::UI::Xaml::ResourceDictionary ^ m_delighters; diff --git a/src/Calculator/Views/TitleBar.xaml.cpp b/src/Calculator/Views/TitleBar.xaml.cpp index 1244d67d..a80868fb 100644 --- a/src/Calculator/Views/TitleBar.xaml.cpp +++ b/src/Calculator/Views/TitleBar.xaml.cpp @@ -20,7 +20,8 @@ using namespace Windows::Foundation::Collections; namespace CalculatorApp { - TitleBar::TitleBar() : m_coreTitleBar(CoreApplication::GetCurrentView()->TitleBar) + TitleBar::TitleBar() + : m_coreTitleBar(CoreApplication::GetCurrentView()->TitleBar) { m_uiSettings = ref new UISettings(); m_accessibilitySettings = ref new AccessibilitySettings(); @@ -163,7 +164,7 @@ namespace CalculatorApp void TitleBar::OnWindowActivated(_In_ Object ^ /*sender*/, _In_ WindowActivatedEventArgs ^ e) { - VisualStateManager::GoToState(this, e->WindowActivationState == CoreWindowActivationState::Deactivated ? WindowNotFocused->Name : WindowFocused->Name, - false); + VisualStateManager::GoToState( + this, e->WindowActivationState == CoreWindowActivationState::Deactivated ? WindowNotFocused->Name : WindowFocused->Name, false); } } diff --git a/src/Calculator/Views/UnitConverter.xaml.cpp b/src/Calculator/Views/UnitConverter.xaml.cpp index e2199608..a9d2e571 100644 --- a/src/Calculator/Views/UnitConverter.xaml.cpp +++ b/src/Calculator/Views/UnitConverter.xaml.cpp @@ -45,7 +45,9 @@ using namespace Windows::UI::ViewManagement; // There are 10,000 intervals in 1 ms. static const long long DURATION_500_MS = 10000 * 500; -UnitConverter::UnitConverter() : m_meteredConnectionOverride(false), m_isAnimationEnabled(false) +UnitConverter::UnitConverter() + : m_meteredConnectionOverride(false) + , m_isAnimationEnabled(false) { m_layoutDirection = LocalizationService::GetInstance()->GetFlowDirection(); m_FlowDirectionHorizontalAlignment = m_layoutDirection == ::FlowDirection::RightToLeft ? ::HorizontalAlignment::Right : ::HorizontalAlignment::Left; diff --git a/src/Calculator/WindowFrameService.h b/src/Calculator/WindowFrameService.h index 53d8181a..30cda699 100644 --- a/src/Calculator/WindowFrameService.h +++ b/src/Calculator/WindowFrameService.h @@ -43,8 +43,8 @@ public WindowFrameService(_In_ Windows::UI::Xaml::Controls::Frame ^ viewFrame, Platform::WeakReference parent); void InitializeFrameService(bool createdByUs); - void OnConsolidated(_In_ Windows::UI::ViewManagement::ApplicationView ^ sender, - _In_ Windows::UI::ViewManagement::ApplicationViewConsolidatedEventArgs ^ e); + void + OnConsolidated(_In_ Windows::UI::ViewManagement::ApplicationView ^ sender, _In_ Windows::UI::ViewManagement::ApplicationViewConsolidatedEventArgs ^ e); void OnClosed(_In_ Windows::UI::Core::CoreWindow ^ sender, _In_ Windows::UI::Core::CoreWindowEventArgs ^ args); void LogOnViewClosed(_In_ Windows::UI::Core::CoreWindow ^ coreWindow); diff --git a/src/CalculatorUnitTests/CalcEngineTests.cpp b/src/CalculatorUnitTests/CalcEngineTests.cpp index 436093c1..9d8ad32a 100644 --- a/src/CalculatorUnitTests/CalcEngineTests.cpp +++ b/src/CalculatorUnitTests/CalcEngineTests.cpp @@ -22,8 +22,8 @@ namespace CalculatorEngineTests m_resourceProvider = make_shared(); m_history = make_shared(MAX_HISTORY_SIZE); CCalcEngine::InitialOneTimeOnlySetup(*(m_resourceProvider.get())); - m_calcEngine = make_unique(false /* Respect Order of Operations */, false /* Set to Integer Mode */, m_resourceProvider.get(), nullptr, - m_history); + m_calcEngine = make_unique( + false /* Respect Order of Operations */, false /* Set to Integer Mode */, m_resourceProvider.get(), nullptr, m_history); } TEST_METHOD_CLEANUP(Cleanup) { @@ -52,8 +52,8 @@ namespace CalculatorEngineTests VERIFY_ARE_EQUAL(L"1,234,567,890", m_calcEngine->GroupDigitsPerRadix(L"1234567890", 10), L"Verify grouping in base10."); VERIFY_ARE_EQUAL(L"1,234,567.89", m_calcEngine->GroupDigitsPerRadix(L"1234567.89", 10), L"Verify grouping in base10 with decimal."); VERIFY_ARE_EQUAL(L"1,234,567e89", m_calcEngine->GroupDigitsPerRadix(L"1234567e89", 10), L"Verify grouping in base10 with exponent."); - VERIFY_ARE_EQUAL(L"1,234,567.89e5", m_calcEngine->GroupDigitsPerRadix(L"1234567.89e5", 10), - L"Verify grouping in base10 with decimal and exponent."); + VERIFY_ARE_EQUAL( + L"1,234,567.89e5", m_calcEngine->GroupDigitsPerRadix(L"1234567.89e5", 10), L"Verify grouping in base10 with decimal and exponent."); VERIFY_ARE_EQUAL(L"-123,456,789", m_calcEngine->GroupDigitsPerRadix(L"-123456789", 10), L"Verify grouping in base10 with negative."); } @@ -118,18 +118,29 @@ namespace CalculatorEngineTests // Regex matching (descriptions taken from CalcUtils.cpp) // Use 100 for exp/mantissa length as they are tested above vector validDecStrs{ // Start with an optional + or - - L"+1", L"-1", L"1", + L"+1", + L"-1", + L"1", // Followed by zero or more digits - L"-", L"", L"1234567890", + L"-", + L"", + L"1234567890", // Followed by an optional decimal point - L"1.0", L"-.", L"1.", + L"1.0", + L"-.", + L"1.", // Followed by zero or more digits - L"0.0", L"0.123456", + L"0.0", + L"0.123456", // Followed by an optional exponent ('e') - L"1e", L"1.e", L"-e", + L"1e", + L"1.e", + L"-e", // If there's an exponent, its optionally followed by + or - // and followed by zero or more digits - L"1e+12345", L"1e-12345", L"1e123", + L"1e+12345", + L"1e-12345", + L"1e123", // All together L"-123.456e+789" }; @@ -204,16 +215,18 @@ namespace CalculatorEngineTests VERIFY_ARE_EQUAL(result, m_calcEngine->GroupDigits(L",", { 3, 0, 0 }, L"1234567890123456", false), L"Verify expanded form non-repeating grouping."); result = L"12,34,56,78,901,23456"; - VERIFY_ARE_EQUAL(result, m_calcEngine->GroupDigits(L",", { 5, 3, 2, 0 }, L"1234567890123456", false), - L"Verify multigroup with repeating grouping."); + VERIFY_ARE_EQUAL( + result, m_calcEngine->GroupDigits(L",", { 5, 3, 2, 0 }, L"1234567890123456", false), L"Verify multigroup with repeating grouping."); result = L"1234,5678,9012,3456"; VERIFY_ARE_EQUAL(result, m_calcEngine->GroupDigits(L",", { 4, 0 }, L"1234567890123456", false), L"Verify repeating non-standard grouping."); result = L"123456,78,901,23456"; VERIFY_ARE_EQUAL(result, m_calcEngine->GroupDigits(L",", { 5, 3, 2 }, L"1234567890123456", false), L"Verify multigroup non-repeating grouping."); - VERIFY_ARE_EQUAL(result, m_calcEngine->GroupDigits(L",", { 5, 3, 2, 0, 0 }, L"1234567890123456", false), - L"Verify expanded form multigroup non-repeating grouping."); + VERIFY_ARE_EQUAL( + result, + m_calcEngine->GroupDigits(L",", { 5, 3, 2, 0, 0 }, L"1234567890123456", false), + L"Verify expanded form multigroup non-repeating grouping."); } private: diff --git a/src/CalculatorUnitTests/CalcInputTest.cpp b/src/CalculatorUnitTests/CalcInputTest.cpp index 1fe0db98..f817594e 100644 --- a/src/CalculatorUnitTests/CalcInputTest.cpp +++ b/src/CalculatorUnitTests/CalcInputTest.cpp @@ -173,8 +173,8 @@ namespace CalculatorEngineTests m_calcInput.Backspace(); m_calcInput.TryToggleSign(true, L"127"); VERIFY_IS_FALSE(m_calcInput.TryAddDigit(9, 10, true, L"127", 8, 2), L"Negative value: verify we cannot add a digit if digit exceeds max value."); - VERIFY_IS_TRUE(m_calcInput.TryAddDigit(8, 10, true, L"127", 8, 2), - L"Negative value: verify we can add a digit if digit does not exceed max value."); + VERIFY_IS_TRUE( + m_calcInput.TryAddDigit(8, 10, true, L"127", 8, 2), L"Negative value: verify we can add a digit if digit does not exceed max value."); } TEST_METHOD(TryAddDecimalPtEmpty) diff --git a/src/CalculatorUnitTests/CalculatorManagerTest.cpp b/src/CalculatorUnitTests/CalculatorManagerTest.cpp index 3ac4e1c0..809fe919 100644 --- a/src/CalculatorUnitTests/CalculatorManagerTest.cpp +++ b/src/CalculatorUnitTests/CalculatorManagerTest.cpp @@ -40,8 +40,9 @@ namespace CalculatorManagerTest { m_isError = isError; } - void SetExpressionDisplay(_Inout_ std::shared_ptr>> const& tokens, - _Inout_ std::shared_ptr>> const& /*commands*/) + void SetExpressionDisplay( + _Inout_ std::shared_ptr>> const& tokens, + _Inout_ std::shared_ptr>> const& /*commands*/) { m_expression.clear(); unsigned int nTokens = 0; diff --git a/src/CalculatorUnitTests/CopyPasteManagerTest.cpp b/src/CalculatorUnitTests/CopyPasteManagerTest.cpp index 3e5715b8..b079f3cc 100644 --- a/src/CalculatorUnitTests/CopyPasteManagerTest.cpp +++ b/src/CalculatorUnitTests/CopyPasteManagerTest.cpp @@ -60,20 +60,28 @@ namespace CalculatorUnitTests } VERIFY_ARE_EQUAL( m_CopyPasteManager.ValidatePasteExpression(StringReference(exp_TooLong.c_str()), ViewMode::Standard, CategoryGroupType::Calculator, -1, -1), - StringReference(exp_TooLong.c_str()), L"Verify ValidatePasteExpression handles expressions up to max length"); + StringReference(exp_TooLong.c_str()), + L"Verify ValidatePasteExpression handles expressions up to max length"); exp_TooLong += L"1"; VERIFY_ARE_EQUAL( m_CopyPasteManager.ValidatePasteExpression(StringReference(exp_TooLong.c_str()), ViewMode::Standard, CategoryGroupType::Calculator, -1, -1), - StringReference(L"NoOp"), L"Verify ValidatePasteExpression returns NoOp for strings over max length"); + StringReference(L"NoOp"), + L"Verify ValidatePasteExpression returns NoOp for strings over max length"); - VERIFY_ARE_EQUAL(m_CopyPasteManager.ValidatePasteExpression(StringReference(L""), ViewMode::Standard, CategoryGroupType::Calculator, -1, -1), - StringReference(L"NoOp"), L"Verify empty string is invalid"); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.ValidatePasteExpression(StringReference(L""), ViewMode::Standard, CategoryGroupType::Calculator, -1, -1), + StringReference(L"NoOp"), + L"Verify empty string is invalid"); - VERIFY_ARE_EQUAL(m_CopyPasteManager.ValidatePasteExpression(StringReference(L"123e456"), ViewMode::Standard, CategoryGroupType::Calculator, -1, -1), - StringReference(L"NoOp"), L"Verify pasting unsupported strings for the current mode is invalid"); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.ValidatePasteExpression(StringReference(L"123e456"), ViewMode::Standard, CategoryGroupType::Calculator, -1, -1), + StringReference(L"NoOp"), + L"Verify pasting unsupported strings for the current mode is invalid"); - VERIFY_ARE_EQUAL(m_CopyPasteManager.ValidatePasteExpression(StringReference(L"123"), ViewMode::None, CategoryGroupType::None, -1, -1), - StringReference(L"NoOp"), L"Verify pasting without a ViewMode or Category is invalid"); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.ValidatePasteExpression(StringReference(L"123"), ViewMode::None, CategoryGroupType::None, -1, -1), + StringReference(L"NoOp"), + L"Verify pasting without a ViewMode or Category is invalid"); }; TEST_METHOD(ValidateExtractOperands) @@ -107,54 +115,70 @@ namespace CalculatorUnitTests { exp_OperandLimit += L"+1"; } - VERIFY_ARE_EQUAL(m_CopyPasteManager.ExtractOperands(exp_OperandLimit, ViewMode::Standard).size(), 100, - L"Verify ExtractOperands handles up to MaxOperandCount operands"); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.ExtractOperands(exp_OperandLimit, ViewMode::Standard).size(), + 100, + L"Verify ExtractOperands handles up to MaxOperandCount operands"); exp_OperandLimit += L"+1"; - VERIFY_ARE_EQUAL(m_CopyPasteManager.ExtractOperands(exp_OperandLimit, ViewMode::Standard).size(), 0, - L"Verify ExtractOperands returns empty vector on too many operands"); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.ExtractOperands(exp_OperandLimit, ViewMode::Standard).size(), + 0, + L"Verify ExtractOperands returns empty vector on too many operands"); - VERIFY_ARE_EQUAL(m_CopyPasteManager.ExtractOperands(L"12e9999", ViewMode::Standard).size(), 1, - L"Verify ExtractOperands handles up to 4 digit exponents"); - VERIFY_ARE_EQUAL(m_CopyPasteManager.ExtractOperands(L"12e10000", ViewMode::Standard).size(), 0, - L"Verify ExtractOperands returns empty vector when the exponent is too long"); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.ExtractOperands(L"12e9999", ViewMode::Standard).size(), 1, L"Verify ExtractOperands handles up to 4 digit exponents"); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.ExtractOperands(L"12e10000", ViewMode::Standard).size(), + 0, + L"Verify ExtractOperands returns empty vector when the exponent is too long"); }; TEST_METHOD(ValidateExpressionRegExMatch) { - VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector{}, ViewMode::Standard, CategoryGroupType::Calculator, -1, -1), - L"Verify empty list of operands returns false."); - VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector{ L"123" }, ViewMode::None, CategoryGroupType::Calculator, -1, -1), - L"Verify invalid ViewMode/CategoryGroups return false."); - VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector{ L"123" }, ViewMode::Currency, CategoryGroupType::None, -1, -1), - L"Verify invalid ViewMode/CategoryGroups return false."); + VERIFY_IS_FALSE( + m_CopyPasteManager.ExpressionRegExMatch(vector{}, ViewMode::Standard, CategoryGroupType::Calculator, -1, -1), + L"Verify empty list of operands returns false."); + VERIFY_IS_FALSE( + m_CopyPasteManager.ExpressionRegExMatch(vector{ L"123" }, ViewMode::None, CategoryGroupType::Calculator, -1, -1), + L"Verify invalid ViewMode/CategoryGroups return false."); + VERIFY_IS_FALSE( + m_CopyPasteManager.ExpressionRegExMatch(vector{ L"123" }, ViewMode::Currency, CategoryGroupType::None, -1, -1), + L"Verify invalid ViewMode/CategoryGroups return false."); Logger::WriteMessage(L"Verify operand lengths > max return false."); VERIFY_IS_FALSE( m_CopyPasteManager.ExpressionRegExMatch(vector{ L"12345678901234567" }, ViewMode::Standard, CategoryGroupType::Calculator, -1, -1)); - VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector{ L"123456789012345678901234567890123" }, ViewMode::Scientific, - CategoryGroupType::Calculator, -1, -1)); + VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch( + vector{ L"123456789012345678901234567890123" }, ViewMode::Scientific, CategoryGroupType::Calculator, -1, -1)); VERIFY_IS_FALSE( m_CopyPasteManager.ExpressionRegExMatch(vector{ L"12345678901234567" }, ViewMode::None, CategoryGroupType::Converter, -1, -1)); - VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector{ L"11111111111111111" }, ViewMode::Programmer, - CategoryGroupType::Calculator, HexBase, QwordType)); - VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector{ L"12345678901234567890" }, ViewMode::Programmer, - CategoryGroupType::Calculator, DecBase, QwordType)); - VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector{ L"11111111111111111111111" }, ViewMode::Programmer, - CategoryGroupType::Calculator, OctBase, QwordType)); - VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector{ L"10000000000000000000000000000000000000000000000000000000000000000" }, - ViewMode::Programmer, CategoryGroupType::Calculator, BinBase, QwordType)); + VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch( + vector{ L"11111111111111111" }, ViewMode::Programmer, CategoryGroupType::Calculator, HexBase, QwordType)); + VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch( + vector{ L"12345678901234567890" }, ViewMode::Programmer, CategoryGroupType::Calculator, DecBase, QwordType)); + VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch( + vector{ L"11111111111111111111111" }, ViewMode::Programmer, CategoryGroupType::Calculator, OctBase, QwordType)); + VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch( + vector{ L"10000000000000000000000000000000000000000000000000000000000000000" }, + ViewMode::Programmer, + CategoryGroupType::Calculator, + BinBase, + QwordType)); - VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector{ L"9223372036854775808" }, ViewMode::Programmer, - CategoryGroupType::Calculator, DecBase, QwordType), - L"Verify operand values > max return false."); + VERIFY_IS_FALSE( + m_CopyPasteManager.ExpressionRegExMatch( + vector{ L"9223372036854775808" }, ViewMode::Programmer, CategoryGroupType::Calculator, DecBase, QwordType), + L"Verify operand values > max return false."); - VERIFY_IS_TRUE(m_CopyPasteManager.ExpressionRegExMatch(vector{ L"((((((((((((((((((((123))))))))))))))))))))" }, ViewMode::Scientific, - CategoryGroupType::Calculator, -1, -1), - L"Verify sanitized operand is detected as within max length."); - VERIFY_IS_TRUE(m_CopyPasteManager.ExpressionRegExMatch(vector{ L"9223372036854775807" }, ViewMode::Programmer, - CategoryGroupType::Calculator, DecBase, QwordType), - L"Verify operand values == max return true."); + VERIFY_IS_TRUE( + m_CopyPasteManager.ExpressionRegExMatch( + vector{ L"((((((((((((((((((((123))))))))))))))))))))" }, ViewMode::Scientific, CategoryGroupType::Calculator, -1, -1), + L"Verify sanitized operand is detected as within max length."); + VERIFY_IS_TRUE( + m_CopyPasteManager.ExpressionRegExMatch( + vector{ L"9223372036854775807" }, ViewMode::Programmer, CategoryGroupType::Calculator, DecBase, QwordType), + L"Verify operand values == max return true."); Logger::WriteMessage(L"Verify all operands must match patterns."); VERIFY_IS_TRUE( @@ -166,12 +190,14 @@ namespace CalculatorUnitTests m_CopyPasteManager.ExpressionRegExMatch(vector{ L"1.23e+456" }, ViewMode::Scientific, CategoryGroupType::Calculator, -1, -1), L"Verify operand only needs to match one pattern."); - VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector{ L"123", L"12345678901234567" }, ViewMode::Standard, - CategoryGroupType::Calculator, -1, -1), - L"Verify all operands must be within maxlength"); - VERIFY_IS_FALSE(m_CopyPasteManager.ExpressionRegExMatch(vector{ L"123", L"9223372036854775808" }, ViewMode::Programmer, - CategoryGroupType::Calculator, DecBase, QwordType), - L"Verify all operand must be within max value."); + VERIFY_IS_FALSE( + m_CopyPasteManager.ExpressionRegExMatch( + vector{ L"123", L"12345678901234567" }, ViewMode::Standard, CategoryGroupType::Calculator, -1, -1), + L"Verify all operands must be within maxlength"); + VERIFY_IS_FALSE( + m_CopyPasteManager.ExpressionRegExMatch( + vector{ L"123", L"9223372036854775808" }, ViewMode::Programmer, CategoryGroupType::Calculator, DecBase, QwordType), + L"Verify all operand must be within max value."); }; TEST_METHOD(ValidateGetMaxOperandLengthAndValue) @@ -179,56 +205,78 @@ namespace CalculatorUnitTests pair standardModeMaximums = make_pair(m_CopyPasteManager.MaxStandardOperandLength, 0); pair scientificModeMaximums = make_pair(m_CopyPasteManager.MaxScientificOperandLength, 0); pair converterModeMaximums = make_pair(m_CopyPasteManager.MaxConverterInputLength, 0); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Standard, CategoryGroupType::None, -1, -1), standardModeMaximums, - L"Verify Standard mode maximum values"); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Scientific, CategoryGroupType::None, -1, -1), scientificModeMaximums, - L"Verify Scientific mode maximum values"); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::None, CategoryGroupType::Converter, -1, -1), converterModeMaximums, - L"Verify Converter mode maximum values"); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Standard, CategoryGroupType::None, -1, -1), + standardModeMaximums, + L"Verify Standard mode maximum values"); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Scientific, CategoryGroupType::None, -1, -1), + scientificModeMaximums, + L"Verify Scientific mode maximum values"); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::None, CategoryGroupType::Converter, -1, -1), + converterModeMaximums, + L"Verify Converter mode maximum values"); unsigned long long int ullQwordMax = UINT64_MAX; unsigned long long int ullDwordMax = UINT32_MAX; unsigned long long int ullWordMax = UINT16_MAX; unsigned long long int ullByteMax = UINT8_MAX; Logger::WriteMessage(L"Verify Programmer Mode HexBase maximum values"); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, QwordType), - make_pair((size_t)16u, ullQwordMax)); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, DwordType), - make_pair((size_t)8u, ullDwordMax)); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, WordType), - make_pair((size_t)4u, ullWordMax)); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, ByteType), - make_pair((size_t)2u, ullByteMax)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, QwordType), + make_pair((size_t)16u, ullQwordMax)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, DwordType), + make_pair((size_t)8u, ullDwordMax)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, WordType), + make_pair((size_t)4u, ullWordMax)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, HexBase, ByteType), + make_pair((size_t)2u, ullByteMax)); Logger::WriteMessage(L"Verify Programmer Mode DecBase maximum values"); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, QwordType), - make_pair((size_t)19u, ullQwordMax >> 1)); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, DwordType), - make_pair((size_t)10u, ullDwordMax >> 1)); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, WordType), - make_pair((size_t)5u, ullWordMax >> 1)); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, ByteType), - make_pair((size_t)3u, ullByteMax >> 1)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, QwordType), + make_pair((size_t)19u, ullQwordMax >> 1)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, DwordType), + make_pair((size_t)10u, ullDwordMax >> 1)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, WordType), + make_pair((size_t)5u, ullWordMax >> 1)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, DecBase, ByteType), + make_pair((size_t)3u, ullByteMax >> 1)); Logger::WriteMessage(L"Verify Programmer Mode OctBase maximum values"); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, QwordType), - make_pair((size_t)22u, ullQwordMax)); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, DwordType), - make_pair((size_t)11u, ullDwordMax)); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, WordType), - make_pair((size_t)6u, ullWordMax)); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, ByteType), - make_pair((size_t)3u, ullByteMax)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, QwordType), + make_pair((size_t)22u, ullQwordMax)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, DwordType), + make_pair((size_t)11u, ullDwordMax)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, WordType), + make_pair((size_t)6u, ullWordMax)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, OctBase, ByteType), + make_pair((size_t)3u, ullByteMax)); Logger::WriteMessage(L"Verify Programmer Mode BinBase maximum values"); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, QwordType), - make_pair((size_t)64u, ullQwordMax)); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, DwordType), - make_pair((size_t)32u, ullDwordMax)); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, WordType), - make_pair((size_t)16u, ullWordMax)); - VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, ByteType), - make_pair((size_t)8u, ullByteMax)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, QwordType), + make_pair((size_t)64u, ullQwordMax)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, DwordType), + make_pair((size_t)32u, ullDwordMax)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, WordType), + make_pair((size_t)16u, ullWordMax)); + VERIFY_ARE_EQUAL( + m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::Programmer, CategoryGroupType::None, BinBase, ByteType), + make_pair((size_t)8u, ullByteMax)); Logger::WriteMessage(L"Verify invalid ViewModes/Categories return 0 for max values"); VERIFY_ARE_EQUAL(m_CopyPasteManager.GetMaxOperandLengthAndValue(ViewMode::None, CategoryGroupType::None, -1, -1), make_pair((size_t)0u, 0ull)); diff --git a/src/CalculatorUnitTests/CurrencyConverterUnitTests.cpp b/src/CalculatorUnitTests/CurrencyConverterUnitTests.cpp index 7b1688d5..b53e4209 100644 --- a/src/CalculatorUnitTests/CurrencyConverterUnitTests.cpp +++ b/src/CalculatorUnitTests/CurrencyConverterUnitTests.cpp @@ -29,7 +29,8 @@ namespace CalculatorApp { public: MockCurrencyHttpClientWithResult(String ^ staticResponse, String ^ allRatiosResponse) - : m_staticResponse(staticResponse), m_allRatiosResponse(allRatiosResponse) + : m_staticResponse(staticResponse) + , m_allRatiosResponse(allRatiosResponse) { } @@ -71,7 +72,8 @@ namespace CalculatorApp class DataLoadedCallback : public UnitConversionManager::IViewModelCurrencyCallback { public: - DataLoadedCallback(task_completion_event tce) : m_task_completion_event{ tce } + DataLoadedCallback(task_completion_event tce) + : m_task_completion_event{ tce } { } diff --git a/src/CalculatorUnitTests/DateCalculatorUnitTests.cpp b/src/CalculatorUnitTests/DateCalculatorUnitTests.cpp index 7603a3dc..e21e638f 100644 --- a/src/CalculatorUnitTests/DateCalculatorUnitTests.cpp +++ b/src/CalculatorUnitTests/DateCalculatorUnitTests.cpp @@ -343,8 +343,8 @@ TEST_METHOD(TestSubtractOob) DateTime endDate; // Subtract Duration - bool isValid = m_DateCalcEngine.SubtractDuration(DateUtils::SystemTimeToDateTime(datetimeBoundSubtract[testIndex].startDate), - datetimeBoundSubtract[testIndex].dateDiff, &endDate); + bool isValid = m_DateCalcEngine.SubtractDuration( + DateUtils::SystemTimeToDateTime(datetimeBoundSubtract[testIndex].startDate), datetimeBoundSubtract[testIndex].dateDiff, &endDate); // Assert for the result VERIFY_IS_FALSE(isValid); diff --git a/src/CalculatorUnitTests/DateUtils.h b/src/CalculatorUnitTests/DateUtils.h index fcb0807c..b21bb331 100644 --- a/src/CalculatorUnitTests/DateUtils.h +++ b/src/CalculatorUnitTests/DateUtils.h @@ -40,8 +40,10 @@ namespace DateCalculationUnitTests // Returns long date format for a date static Platform::String ^ GetLongDate(SYSTEMTIME systemTime) { auto formatter = ref new Windows::Globalization::DateTimeFormatting::DateTimeFormatter( - L"longdate", Windows::Globalization::ApplicationLanguages::Languages, - Windows::System::UserProfile::GlobalizationPreferences::HomeGeographicRegion, Windows::Globalization::CalendarIdentifiers::Gregorian, + L"longdate", + Windows::Globalization::ApplicationLanguages::Languages, + Windows::System::UserProfile::GlobalizationPreferences::HomeGeographicRegion, + Windows::Globalization::CalendarIdentifiers::Gregorian, Windows::Globalization::ClockIdentifiers::TwentyFourHour); Windows::Foundation::DateTime dateTime = SystemTimeToDateTime(systemTime); diff --git a/src/CalculatorUnitTests/HistoryTests.cpp b/src/CalculatorUnitTests/HistoryTests.cpp index 194ef6fb..f4713c12 100644 --- a/src/CalculatorUnitTests/HistoryTests.cpp +++ b/src/CalculatorUnitTests/HistoryTests.cpp @@ -221,10 +221,11 @@ namespace CalculatorFunctionalTests m_historyViewModel->SaveHistory(); m_historyViewModel->ReloadHistory(ViewMode::Scientific); auto itemAfterSerializeDeserialize = m_standardViewModel->m_standardCalculatorManager.GetHistoryItem(0); - VERIFY_IS_TRUE((itemBeforeSerializeDeserialize->historyItemVector.expression == itemAfterSerializeDeserialize->historyItemVector.expression) - && (itemBeforeSerializeDeserialize->historyItemVector.result == itemAfterSerializeDeserialize->historyItemVector.result) - && (itemBeforeSerializeDeserialize->historyItemVector.spCommands == itemAfterSerializeDeserialize->historyItemVector.spCommands) - && (itemBeforeSerializeDeserialize->historyItemVector.spTokens == itemAfterSerializeDeserialize->historyItemVector.spTokens)); + VERIFY_IS_TRUE( + (itemBeforeSerializeDeserialize->historyItemVector.expression == itemAfterSerializeDeserialize->historyItemVector.expression) + && (itemBeforeSerializeDeserialize->historyItemVector.result == itemAfterSerializeDeserialize->historyItemVector.result) + && (itemBeforeSerializeDeserialize->historyItemVector.spCommands == itemAfterSerializeDeserialize->historyItemVector.spCommands) + && (itemBeforeSerializeDeserialize->historyItemVector.spTokens == itemAfterSerializeDeserialize->historyItemVector.spTokens)); Cleanup(); } diff --git a/src/CalculatorUnitTests/Mocks/CurrencyHttpClient.cpp b/src/CalculatorUnitTests/Mocks/CurrencyHttpClient.cpp index e4a4b606..7e0b48aa 100644 --- a/src/CalculatorUnitTests/Mocks/CurrencyHttpClient.cpp +++ b/src/CalculatorUnitTests/Mocks/CurrencyHttpClient.cpp @@ -42,7 +42,8 @@ IAsyncOperationWithProgress ^ CurrencyHttpClient::GetCur return ref new MockAsyncOperationWithProgress(StringReference(ALL_RATIOS_RESPONSE)); } -MockAsyncOperationWithProgress::MockAsyncOperationWithProgress(String ^ result) : m_result(result) +MockAsyncOperationWithProgress::MockAsyncOperationWithProgress(String ^ result) + : m_result(result) { } diff --git a/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp b/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp index 54fbeb59..4c6135d0 100644 --- a/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp +++ b/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp @@ -270,7 +270,8 @@ namespace CalculatorUnitTests { NumbersAndOperatorsEnum::Five, L"7" + std::wstring(m_decimalSeparator->Data()) + L"5", L"" }, { NumbersAndOperatorsEnum::Five, L"7" + std::wstring(m_decimalSeparator->Data()) + L"55", L"" }, { NumbersAndOperatorsEnum::Five, L"7" + std::wstring(m_decimalSeparator->Data()) + L"555", L"" }, - { NumbersAndOperatorsEnum::Multiply, L"7" + std::wstring(m_decimalSeparator->Data()) + L"555", + { NumbersAndOperatorsEnum::Multiply, + L"7" + std::wstring(m_decimalSeparator->Data()) + L"555", L"7" + std::wstring(m_decimalSeparator->Data()) + L"555 * " }, { NumbersAndOperatorsEnum::Three, L"3", L"7" + std::wstring(m_decimalSeparator->Data()) + L"555 * " }, { NumbersAndOperatorsEnum::Equals, L"22" + std::wstring(m_decimalSeparator->Data()) + L"665", L"" }, @@ -549,8 +550,9 @@ namespace CalculatorUnitTests VERIFY_ARE_EQUAL(Utils::GetStringValue(m_viewModel->HexDisplayValue), StringReference(L"FFFF FFFF FFFF FFFE")); VERIFY_ARE_EQUAL(Utils::GetStringValue(m_viewModel->DecimalDisplayValue), StringReference(L"-2")); VERIFY_ARE_EQUAL(Utils::GetStringValue(m_viewModel->OctalDisplayValue), StringReference(L"1 777 777 777 777 777 777 776")); - VERIFY_ARE_EQUAL(Utils::GetStringValue(m_viewModel->BinaryDisplayValue), - StringReference(L"1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1110")); + VERIFY_ARE_EQUAL( + Utils::GetStringValue(m_viewModel->BinaryDisplayValue), + StringReference(L"1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1110")); VERIFY_ARE_EQUAL(m_viewModel->DisplayValue, StringReference(L"-2")); } diff --git a/src/CalculatorUnitTests/UnitConverterTest.cpp b/src/CalculatorUnitTests/UnitConverterTest.cpp index dbf6c380..a9cf3929 100644 --- a/src/CalculatorUnitTests/UnitConverterTest.cpp +++ b/src/CalculatorUnitTests/UnitConverterTest.cpp @@ -38,7 +38,8 @@ namespace UnitConverterUnitTests class TestUnitConverterConfigLoader : public IConverterDataLoader { public: - TestUnitConverterConfigLoader() : m_loadDataCallCount(0) + TestUnitConverterConfigLoader() + : m_loadDataCallCount(0) { Category c1, c2; SetCategoryParams(&c1, 1, L"Length", true); @@ -492,8 +493,21 @@ namespace UnitConverterUnitTests void UnitConverterTest::UnitConverterTestMaxDigitsReached() { - ExecuteCommands({ Command::One, Command::Two, Command::Three, Command::Four, Command::Five, Command::Six, Command::Seven, Command::Eight, Command::Nine, - Command::One, Command::Zero, Command::One, Command::One, Command::One, Command::Two }); + ExecuteCommands({ Command::One, + Command::Two, + Command::Three, + Command::Four, + Command::Five, + Command::Six, + Command::Seven, + Command::Eight, + Command::Nine, + Command::One, + Command::Zero, + Command::One, + Command::One, + Command::One, + Command::Two }); VERIFY_ARE_EQUAL(0, s_testVMCallback->GetMaxDigitsReachedCallCount()); @@ -504,8 +518,22 @@ namespace UnitConverterUnitTests void UnitConverterTest::UnitConverterTestMaxDigitsReached_LeadingDecimal() { - ExecuteCommands({ Command::Zero, Command::Decimal, Command::One, Command::Two, Command::Three, Command::Four, Command::Five, Command::Six, - Command::Seven, Command::Eight, Command::Nine, Command::One, Command::Zero, Command::One, Command::One, Command::One }); + ExecuteCommands({ Command::Zero, + Command::Decimal, + Command::One, + Command::Two, + Command::Three, + Command::Four, + Command::Five, + Command::Six, + Command::Seven, + Command::Eight, + Command::Nine, + Command::One, + Command::Zero, + Command::One, + Command::One, + Command::One }); VERIFY_ARE_EQUAL(0, s_testVMCallback->GetMaxDigitsReachedCallCount()); @@ -516,8 +544,22 @@ namespace UnitConverterUnitTests void UnitConverterTest::UnitConverterTestMaxDigitsReached_TrailingDecimal() { - ExecuteCommands({ Command::One, Command::Two, Command::Three, Command::Four, Command::Five, Command::Six, Command::Seven, Command::Eight, Command::Nine, - Command::One, Command::Zero, Command::One, Command::One, Command::One, Command::Two, Command::Decimal }); + ExecuteCommands({ Command::One, + Command::Two, + Command::Three, + Command::Four, + Command::Five, + Command::Six, + Command::Seven, + Command::Eight, + Command::Nine, + Command::One, + Command::Zero, + Command::One, + Command::One, + Command::One, + Command::Two, + Command::Decimal }); VERIFY_ARE_EQUAL(0, s_testVMCallback->GetMaxDigitsReachedCallCount()); @@ -528,8 +570,21 @@ namespace UnitConverterUnitTests void UnitConverterTest::UnitConverterTestMaxDigitsReached_MultipleTimes() { - ExecuteCommands({ Command::One, Command::Two, Command::Three, Command::Four, Command::Five, Command::Six, Command::Seven, Command::Eight, Command::Nine, - Command::One, Command::Zero, Command::One, Command::One, Command::One, Command::Two }); + ExecuteCommands({ Command::One, + Command::Two, + Command::Three, + Command::Four, + Command::Five, + Command::Six, + Command::Seven, + Command::Eight, + Command::Nine, + Command::One, + Command::Zero, + Command::One, + Command::One, + Command::One, + Command::Two }); VERIFY_ARE_EQUAL(0, s_testVMCallback->GetMaxDigitsReachedCallCount()); diff --git a/src/CalculatorUnitTests/UnitConverterViewModelUnitTests.cpp b/src/CalculatorUnitTests/UnitConverterViewModelUnitTests.cpp index a7c7ff82..24ac03e0 100644 --- a/src/CalculatorUnitTests/UnitConverterViewModelUnitTests.cpp +++ b/src/CalculatorUnitTests/UnitConverterViewModelUnitTests.cpp @@ -262,7 +262,8 @@ private: bool m_active; public: - MockActivatable(bool active) : m_active(active) + MockActivatable(bool active) + : m_active(active) { } From 750130c2bcf3079844f6c7d99de61e2f3f9b9939 Mon Sep 17 00:00:00 2001 From: Rudy Huyn Date: Thu, 9 May 2019 10:10:17 -0700 Subject: [PATCH 02/13] Accept exponential numbers without -/+ sign. (#270) * add exponential without sign support * Add unit tests * fix formatting * remove extra spaces * modify unit tests --- src/CalcViewModel/Common/CopyPasteManager.cpp | 2 +- .../StandardCalculatorViewModel.cpp | 17 ++++++++++++++--- .../CopyPasteManagerTest.cpp | 15 ++++++++++----- .../StandardViewModelUnitTests.cpp | 11 ++++++++++- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/CalcViewModel/Common/CopyPasteManager.cpp b/src/CalcViewModel/Common/CopyPasteManager.cpp index ffe91d1b..db2439f7 100644 --- a/src/CalcViewModel/Common/CopyPasteManager.cpp +++ b/src/CalcViewModel/Common/CopyPasteManager.cpp @@ -40,7 +40,7 @@ static const wstring c_uIntSuffixes = L"[uU]?[lL]{0,2}"; static const array standardModePatterns = { wregex(c_wspc + c_signedDecFloat + c_wspc) }; static const array scientificModePatterns = { wregex(L"(" + c_wspc + L"[-+]?)|(" + c_wspcLParenSigned + L")" + c_signedDecFloat + c_wspcRParens), - wregex(L"(" + c_wspc + L"[-+]?)|(" + c_wspcLParenSigned + L")" + c_signedDecFloat + L"[e]([+]|[-])+\\d+" + c_wspcRParens) + wregex(L"(" + c_wspc + L"[-+]?)|(" + c_wspcLParenSigned + L")" + c_signedDecFloat + L"e[+-]?\\d+" + c_wspcRParens) }; static const array, 4> programmerModePatterns = { { // Hex numbers like 5F, 4A0C, 0xa9, 0xFFull, 47CDh diff --git a/src/CalcViewModel/StandardCalculatorViewModel.cpp b/src/CalcViewModel/StandardCalculatorViewModel.cpp index 6acda106..0dc9865b 100644 --- a/src/CalcViewModel/StandardCalculatorViewModel.cpp +++ b/src/CalcViewModel/StandardCalculatorViewModel.cpp @@ -881,14 +881,25 @@ void StandardCalculatorViewModel::OnPaste(String ^ pastedString, ViewMode mode) } } - // Handle exponent and exponent sign (...e+... or ...e-...) + // Handle exponent and exponent sign (...e+... or ...e-... or ...e...) if (mappedNumOp == NumbersAndOperatorsEnum::Exp) { - ++it; - if (!(MapCharacterToButtonId(*it, canSendNegate) == NumbersAndOperatorsEnum::Add)) + //Check the following item + switch (MapCharacterToButtonId(*(it + 1), canSendNegate)) + { + case NumbersAndOperatorsEnum::Subtract: { Command cmdNegate = ConvertToOperatorsEnum(NumbersAndOperatorsEnum::Negate); m_standardCalculatorManager.SendCommand(cmdNegate); + ++it; + } + break; + case NumbersAndOperatorsEnum::Add: + { + //Nothing to do, skip to the next item + ++it; + } + break; } } diff --git a/src/CalculatorUnitTests/CopyPasteManagerTest.cpp b/src/CalculatorUnitTests/CopyPasteManagerTest.cpp index b079f3cc..3ca56f63 100644 --- a/src/CalculatorUnitTests/CopyPasteManagerTest.cpp +++ b/src/CalculatorUnitTests/CopyPasteManagerTest.cpp @@ -187,8 +187,13 @@ namespace CalculatorUnitTests m_CopyPasteManager.ExpressionRegExMatch(vector{ L"123", L"1e23" }, ViewMode::Standard, CategoryGroupType::Calculator, -1, -1)); VERIFY_IS_TRUE( - m_CopyPasteManager.ExpressionRegExMatch(vector{ L"1.23e+456" }, ViewMode::Scientific, CategoryGroupType::Calculator, -1, -1), - L"Verify operand only needs to match one pattern."); + m_CopyPasteManager.ExpressionRegExMatch( + vector{ L"1.23e+456", L"1.23e456", L".23e+456", L"123e-456", L"12e2", L"12e+2", L"12e-2", L"-12e2", L"-12e+2", L"-12e-2" }, + ViewMode::Scientific, + CategoryGroupType::Calculator, + -1, + -1), + L"Verify exponents are accepted in scientific mode."); VERIFY_IS_FALSE( m_CopyPasteManager.ExpressionRegExMatch( @@ -647,9 +652,9 @@ namespace CalculatorUnitTests "+(41213)", "-(432+3232)", "-(+(-3213)+(-2312))", - "-(-(432+3232))" }; - String ^ negativeInput[] = { L"1.2e23" /*unsigned exponent*/, - L"abcdef", + "-(-(432+3232))", + L"1.2e23"/*unsigned exponent*/ }; + String ^ negativeInput[] = { L"abcdef", L"xyz", L"ABab", L"e+234", diff --git a/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp b/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp index 4c6135d0..78493153 100644 --- a/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp +++ b/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp @@ -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" @@ -419,6 +419,12 @@ namespace CalculatorUnitTests m_viewModel->OnPaste("1.23e+10", ViewMode::Scientific); ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e+10", ""); + m_viewModel->OnPaste("1.23e10", ViewMode::Scientific); + ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e+10", ""); + + m_viewModel->OnPaste("135e10", ViewMode::Scientific); + ValidateViewModelValueAndExpression("135" + m_decimalSeparator + "e+10", ""); + //// Negative exponent m_viewModel->OnPaste("1.23e-10", ViewMode::Scientific); ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e-10", ""); @@ -426,6 +432,9 @@ namespace CalculatorUnitTests //// Uppercase E (for exponent) m_viewModel->OnPaste("1.23E-10", ViewMode::Scientific); ValidateViewModelValueAndExpression("1" + m_decimalSeparator + "23e-10", ""); + + m_viewModel->OnPaste("135E10", ViewMode::Scientific); + ValidateViewModelValueAndExpression("135" + m_decimalSeparator + "e+10", ""); } // Verify Calculator CalculationResultAutomationName is set correctly From 28888d8df1bc20b29c187c60619dfd428492a24a Mon Sep 17 00:00:00 2001 From: Rudy Huyn Date: Thu, 9 May 2019 11:01:43 -0700 Subject: [PATCH 03/13] Remove Serialize/Deserialize functions never used in StandardCalculatorViewModel, UnitConverter, UnitConverterViewModel and CalculatorManager (#392) * remove unused serializer * remove all unused serialization/deserialization from StandardCalculatorViewModel and UnitConverterViewModel * formatting --- src/CalcManager/CalculatorManager.cpp | 149 ------------- src/CalcManager/CalculatorManager.h | 10 - src/CalcManager/UnitConverter.cpp | 163 +------------- src/CalcManager/UnitConverter.h | 6 - .../StandardCalculatorViewModel.cpp | 104 --------- .../StandardCalculatorViewModel.h | 2 - src/CalcViewModel/UnitConverterViewModel.cpp | 46 ---- src/CalcViewModel/UnitConverterViewModel.h | 3 - .../CalculatorManagerTest.cpp | 210 ------------------ .../StandardViewModelUnitTests.cpp | 1 - src/CalculatorUnitTests/UnitConverterTest.cpp | 33 +-- .../UnitConverterViewModelUnitTests.cpp | 52 +---- .../UnitConverterViewModelUnitTests.h | 4 - 13 files changed, 12 insertions(+), 771 deletions(-) diff --git a/src/CalcManager/CalculatorManager.cpp b/src/CalcManager/CalculatorManager.cpp index 569e0114..d054f5b1 100644 --- a/src/CalcManager/CalculatorManager.cpp +++ b/src/CalcManager/CalculatorManager.cpp @@ -244,8 +244,6 @@ namespace CalculationManager { m_savedCommands.push_back(MapCommandForSerialize(command)); } - this->SerializePrimaryDisplay(); - this->SerializeMemory(); m_savedDegreeMode = m_currentDegreeMode; return; } @@ -330,47 +328,6 @@ namespace CalculationManager return commandToLoad; } - /// - /// Return saved degree mode which is saved when last time the expression was cleared. - /// - Command CalculatorManager::SerializeSavedDegreeMode() - { - return m_savedDegreeMode; - } - - void CalculatorManager::SerializePrimaryDisplay() - { - m_savedPrimaryValue.clear(); - m_currentCalculatorEngine->ProcessCommand(IDC_STORE); - auto memoryObject = m_currentCalculatorEngine->PersistedMemObject(); - if (memoryObject != nullptr) - { - m_savedPrimaryValue = SerializeRational(*memoryObject); - } - } - - /// - /// Return serialized primary display that is saved when the expression line was cleared. - /// - vector CalculatorManager::GetSerializedPrimaryDisplay() - { - return m_savedPrimaryValue; - } - - /// - /// DeSerialize the primary display from vector of long - /// - /// Serialized Rational of primary display - void CalculatorManager::DeSerializePrimaryDisplay(const vector& serializedPrimaryDisplay) - { - if (serializedPrimaryDisplay.empty()) - { - return; - } - m_persistedPrimaryValue = DeSerializeRational(serializedPrimaryDisplay.begin()); - this->LoadPersistedPrimaryValue(); - } - /// /// Load the persisted value that is saved in memory of CalcEngine /// @@ -380,112 +337,6 @@ namespace CalculationManager m_currentCalculatorEngine->ProcessCommand(IDC_RECALL); } - /// - /// Serialize the Memory to vector of long - /// - /// Serialized Rational of memory - void CalculatorManager::SerializeMemory() - { - m_serializedMemory.clear(); - - for (auto const& memoryItem : m_memorizedNumbers) - { - auto serialMem = SerializeRational(memoryItem); - m_serializedMemory.insert(m_serializedMemory.end(), serialMem.begin(), serialMem.end()); - } - } - - vector CalculatorManager::GetSerializedMemory() - { - return m_serializedMemory; - } - - /// - /// DeSerialize the Memory from vector of long - /// - /// Serialized Rational of memory - void CalculatorManager::DeSerializeMemory(const vector& serializedMemory) - { - vector::const_iterator itr = serializedMemory.begin(); - while (itr != serializedMemory.end()) - { - Rational memoryItem = DeSerializeRational(itr); - auto lengthMemoryItem = (2 * SERIALIZED_NUMBER_MINSIZE) + memoryItem.P().Mantissa().size() + memoryItem.Q().Mantissa().size(); - m_memorizedNumbers.push_back(memoryItem); - itr += lengthMemoryItem; - } - this->SetMemorizedNumbersString(); - } - - /// - /// Return the commands saved since the expression has been cleared. - /// - vector CalculatorManager::SerializeCommands() - { - return m_savedCommands; - } - - /// - /// Replay the serialized commands - /// - /// Serialized commands - void CalculatorManager::DeSerializeCommands(_In_ const vector& serializedData) - { - m_savedCommands.clear(); - - for (auto commandItr = serializedData.begin(); commandItr != serializedData.end(); ++commandItr) - { - if (*commandItr >= MEMORY_COMMAND_TO_UNSIGNED_CHAR(MemoryCommand::MemorizeNumber) - && *commandItr <= MEMORY_COMMAND_TO_UNSIGNED_CHAR(MemoryCommand::MemorizedNumberClearAll)) - { - // MemoryCommands(which have values above 255) are pushed on m_savedCommands upon casting to unsigned char. - // SerializeCommands uses m_savedCommands, which is then used in DeSerializeCommands. - // Hence, a simple cast to MemoryCommand is not sufficient. - MemoryCommand memoryCommand = static_cast(*commandItr + UCHAR_MAX + 1); - unsigned int indexOfMemory = 0; - switch (memoryCommand) - { - case MemoryCommand::MemorizeNumber: - this->MemorizeNumber(); - break; - case MemoryCommand::MemorizedNumberLoad: - if (commandItr + 1 == serializedData.end()) - { - throw out_of_range("Expecting index of memory, data ended prematurely"); - } - indexOfMemory = *(++commandItr); - this->MemorizedNumberLoad(indexOfMemory); - break; - case MemoryCommand::MemorizedNumberAdd: - if (commandItr + 1 == serializedData.end()) - { - throw out_of_range("Expecting index of memory, data ended prematurely"); - } - indexOfMemory = *(++commandItr); - this->MemorizedNumberAdd(indexOfMemory); - break; - case MemoryCommand::MemorizedNumberSubtract: - if (commandItr + 1 == serializedData.end()) - { - throw out_of_range("Expecting index of memory, data ended prematurely"); - } - indexOfMemory = *(++commandItr); - this->MemorizedNumberSubtract(indexOfMemory); - break; - case MemoryCommand::MemorizedNumberClearAll: - this->MemorizedNumberClearAll(); - break; - default: - break; - } - } - else - { - this->SendCommand(static_cast(MapCommandForDeSerialize(*commandItr))); - } - } - } - /// /// Memorize the current displayed value /// Notify the client with new the new memorize value vector diff --git a/src/CalcManager/CalculatorManager.h b/src/CalcManager/CalculatorManager.h index a288bdf2..37406ed4 100644 --- a/src/CalcManager/CalculatorManager.h +++ b/src/CalcManager/CalculatorManager.h @@ -63,7 +63,6 @@ namespace CalculationManager // For persistence std::vector m_savedCommands; std::vector m_savedPrimaryValue; - std::vector m_serializedMemory; std::vector m_currentSerializedMemory; Command m_currentDegreeMode; Command m_savedDegreeMode; @@ -111,15 +110,6 @@ namespace CalculationManager void SetScientificMode(); void SetProgrammerMode(); void SendCommand(_In_ Command command); - std::vector SerializeCommands(); - void DeSerializeCommands(_In_ const std::vector& serializedData); - void SerializeMemory(); - std::vector GetSerializedMemory(); - void DeSerializeMemory(const std::vector& serializedMemory); - void SerializePrimaryDisplay(); - std::vector GetSerializedPrimaryDisplay(); - void DeSerializePrimaryDisplay(const std::vector& serializedPrimaryDisplay); - Command SerializeSavedDegreeMode(); void MemorizeNumber(); void MemorizedNumberLoad(_In_ unsigned int); diff --git a/src/CalcManager/UnitConverter.cpp b/src/CalcManager/UnitConverter.cpp index 3b5490a0..57cd49bd 100644 --- a/src/CalcManager/UnitConverter.cpp +++ b/src/CalcManager/UnitConverter.cpp @@ -11,8 +11,6 @@ using namespace concurrency; using namespace std; using namespace UnitConversionManager; -static constexpr uint32_t EXPECTEDSERIALIZEDTOKENCOUNT = 7; -static constexpr uint32_t EXPECTEDSERIALIZEDCONVERSIONDATATOKENCOUNT = 3; static constexpr uint32_t EXPECTEDSERIALIZEDCATEGORYTOKENCOUNT = 3; static constexpr uint32_t EXPECTEDSERIALIZEDUNITTOKENCOUNT = 6; static constexpr uint32_t EXPECTEDSTATEDATATOKENCOUNT = 5; @@ -217,18 +215,6 @@ vector UnitConverter::StringToVector(const wstring& w, const wchar_t* d } return serializedTokens; } - -Category UnitConverter::StringToCategory(const wstring& w) -{ - vector tokenList = StringToVector(w, L";"); - assert(tokenList.size() == EXPECTEDSERIALIZEDCATEGORYTOKENCOUNT); - Category serializedCategory; - serializedCategory.id = _wtoi(Unquote(tokenList[0]).c_str()); - serializedCategory.supportsNegative = (tokenList[1].compare(L"1") == 0); - serializedCategory.name = Unquote(tokenList[2]); - return serializedCategory; -} - wstring UnitConverter::UnitToString(const Unit& u, const wchar_t* delimiter) { wstringstream out(wstringstream::out); @@ -253,150 +239,15 @@ Unit UnitConverter::StringToUnit(const wstring& w) return serializedUnit; } -ConversionData UnitConverter::StringToConversionData(const wstring& w) +Category UnitConverter::StringToCategory(const wstring& w) { vector tokenList = StringToVector(w, L";"); - assert(tokenList.size() == EXPECTEDSERIALIZEDCONVERSIONDATATOKENCOUNT); - ConversionData serializedConversionData; - serializedConversionData.ratio = stod(Unquote(tokenList[0]).c_str()); - serializedConversionData.offset = stod(Unquote(tokenList[1]).c_str()); - serializedConversionData.offsetFirst = (tokenList[2].compare(L"1") == 0); - return serializedConversionData; -} - -wstring UnitConverter::ConversionDataToString(ConversionData d, const wchar_t* delimiter) -{ - wstringstream out(wstringstream::out); - out.precision(32); - out << fixed << d.ratio; - wstring ratio = out.str(); - out.str(L""); - out << fixed << d.offset; - wstring offset = out.str(); - out.str(L""); - TrimString(ratio); - TrimString(offset); - out << Quote(ratio) << delimiter << Quote(offset) << delimiter << std::to_wstring(d.offsetFirst) << delimiter; - return out.str(); -} - -/// -/// Serializes the data in the converter and returns it as a string -/// -wstring UnitConverter::Serialize() -{ - if (!CheckLoad()) - { - return wstring(); - } - - wstringstream out(wstringstream::out); - const wchar_t* delimiter = L";"; - - out << UnitToString(m_fromType, delimiter) << "|"; - out << UnitToString(m_toType, delimiter) << "|"; - out << CategoryToString(m_currentCategory, delimiter) << "|"; - out << std::to_wstring(m_currentHasDecimal) << delimiter << std::to_wstring(m_returnHasDecimal) << delimiter << std::to_wstring(m_switchedActive) - << delimiter; - out << m_currentDisplay << delimiter << m_returnDisplay << delimiter << "|"; - wstringstream categoryString(wstringstream::out); - wstringstream categoryToUnitString(wstringstream::out); - wstringstream unitToUnitToDoubleString(wstringstream::out); - for (const Category& c : m_categories) - { - categoryString << CategoryToString(c, delimiter) << ","; - } - - for (const auto& cur : m_categoryToUnits) - { - categoryToUnitString << CategoryToString(cur.first, delimiter) << "["; - for (const Unit& u : cur.second) - { - categoryToUnitString << UnitToString(u, delimiter) << ","; - } - categoryToUnitString << "[" - << "]"; - } - - for (const auto& cur : m_ratioMap) - { - unitToUnitToDoubleString << UnitToString(cur.first, delimiter) << "["; - for (const auto& curConversion : cur.second) - { - unitToUnitToDoubleString << UnitToString(curConversion.first, delimiter) << ":"; - unitToUnitToDoubleString << ConversionDataToString(curConversion.second, delimiter) << ":,"; - } - unitToUnitToDoubleString << "[" - << "]"; - } - - out << categoryString.str() << "|"; - out << categoryToUnitString.str() << "|"; - out << unitToUnitToDoubleString.str() << "|"; - wstring test = out.str(); - return test; -} - -/// -/// De-Serializes the data in the converter from a string -/// -/// wstring holding the serialized data. If it does not have expected number of parameters, we will ignore it -void UnitConverter::DeSerialize(const wstring& serializedData) -{ - ClearValues(); - ResetCategoriesAndRatios(); - - if (serializedData.empty()) - { - return; - } - - vector outerTokens = StringToVector(serializedData, L"|"); - assert(outerTokens.size() == EXPECTEDSERIALIZEDTOKENCOUNT); - m_fromType = StringToUnit(outerTokens[0]); - m_toType = StringToUnit(outerTokens[1]); - m_currentCategory = StringToCategory(outerTokens[2]); - vector stateDataTokens = StringToVector(outerTokens[3], L";"); - assert(stateDataTokens.size() == EXPECTEDSTATEDATATOKENCOUNT); - m_currentHasDecimal = (stateDataTokens[0].compare(L"1") == 0); - m_returnHasDecimal = (stateDataTokens[1].compare(L"1") == 0); - m_switchedActive = (stateDataTokens[2].compare(L"1") == 0); - m_currentDisplay = stateDataTokens[3]; - m_returnDisplay = stateDataTokens[4]; - vector categoryListTokens = StringToVector(outerTokens[4], L","); - for (wstring token : categoryListTokens) - { - m_categories.push_back(StringToCategory(token)); - } - vector unitVectorTokens = StringToVector(outerTokens[5], L"]"); - for (wstring unitVector : unitVectorTokens) - { - vector mapcomponents = StringToVector(unitVector, L"["); - assert(mapcomponents.size() == EXPECTEDMAPCOMPONENTTOKENCOUNT); - Category key = StringToCategory(mapcomponents[0]); - vector units = StringToVector(mapcomponents[1], L","); - for (wstring unit : units) - { - m_categoryToUnits[key].push_back(StringToUnit(unit)); - } - } - vector ratioMapTokens = StringToVector(outerTokens[6], L"]"); - for (wstring token : ratioMapTokens) - { - vector ratioMapComponentTokens = StringToVector(token, L"["); - assert(ratioMapComponentTokens.size() == EXPECTEDMAPCOMPONENTTOKENCOUNT); - Unit key = StringToUnit(ratioMapComponentTokens[0]); - vector ratioMapList = StringToVector(ratioMapComponentTokens[1], L","); - for (wstring subtoken : ratioMapList) - { - vector ratioMapSubComponentTokens = StringToVector(subtoken, L":"); - assert(ratioMapSubComponentTokens.size() == EXPECTEDMAPCOMPONENTTOKENCOUNT); - Unit subkey = StringToUnit(ratioMapSubComponentTokens[0]); - ConversionData conversion = StringToConversionData(ratioMapSubComponentTokens[1]); - m_ratioMap[key][subkey] = conversion; - } - } - UpdateViewModel(); + assert(tokenList.size() == EXPECTEDSERIALIZEDCATEGORYTOKENCOUNT); + Category serializedCategory; + serializedCategory.id = _wtoi(Unquote(tokenList[0]).c_str()); + serializedCategory.supportsNegative = (tokenList[1].compare(L"1") == 0); + serializedCategory.name = Unquote(tokenList[2]); + return serializedCategory; } /// diff --git a/src/CalcManager/UnitConverter.h b/src/CalcManager/UnitConverter.h index b111ee79..19582245 100644 --- a/src/CalcManager/UnitConverter.h +++ b/src/CalcManager/UnitConverter.h @@ -237,8 +237,6 @@ namespace UnitConversionManager virtual Category GetCurrentCategory() = 0; virtual void SetCurrentUnitTypes(const Unit& fromType, const Unit& toType) = 0; virtual void SwitchActive(const std::wstring& newValue) = 0; - virtual std::wstring Serialize() = 0; - virtual void DeSerialize(const std::wstring& serializedData) = 0; virtual std::wstring SaveUserPreferences() = 0; virtual void RestoreUserPreferences(_In_ const std::wstring& userPreferences) = 0; virtual void SendCommand(Command command) = 0; @@ -262,8 +260,6 @@ namespace UnitConversionManager Category GetCurrentCategory() override; void SetCurrentUnitTypes(const Unit& fromType, const Unit& toType) override; void SwitchActive(const std::wstring& newValue) override; - std::wstring Serialize() override; - void DeSerialize(const std::wstring& serializedData) override; std::wstring SaveUserPreferences() override; void RestoreUserPreferences(const std::wstring& userPreference) override; void SendCommand(Command command) override; @@ -290,8 +286,6 @@ namespace UnitConversionManager std::wstring CategoryToString(const Category& c, const wchar_t* delimiter); std::wstring UnitToString(const Unit& u, const wchar_t* delimiter); Unit StringToUnit(const std::wstring& w); - ConversionData StringToConversionData(const std::wstring& w); - std::wstring ConversionDataToString(ConversionData d, const wchar_t* delimiter); void UpdateCurrencySymbols(); void UpdateViewModel(); bool AnyUnitIsEmpty(); diff --git a/src/CalcViewModel/StandardCalculatorViewModel.cpp b/src/CalcViewModel/StandardCalculatorViewModel.cpp index 0dc9865b..acda9bad 100644 --- a/src/CalcViewModel/StandardCalculatorViewModel.cpp +++ b/src/CalcViewModel/StandardCalculatorViewModel.cpp @@ -1163,110 +1163,6 @@ void StandardCalculatorViewModel::OnMemoryClear(_In_ Object ^ memoryItemPosition } } -Array ^ StandardCalculatorViewModel::Serialize() -{ - DataWriter ^ writer = ref new DataWriter(); - writer->WriteUInt32(static_cast(m_CurrentAngleType)); - writer->WriteBoolean(IsFToEChecked); - writer->WriteBoolean(IsCurrentViewPinned); - writer->WriteUInt32(static_cast(m_standardCalculatorManager.SerializeSavedDegreeMode())); - - // Serialize Memory - vector serializedMemory; - serializedMemory = m_standardCalculatorManager.GetSerializedMemory(); - size_t lengthOfSerializedMemory = serializedMemory.size(); - writer->WriteUInt32(static_cast(lengthOfSerializedMemory)); - for (auto data : serializedMemory) - { - writer->WriteInt32(data); - } - - // Serialize Primary Display - vector serializedPrimaryDisplay = m_standardCalculatorManager.GetSerializedPrimaryDisplay(); - writer->WriteUInt32(static_cast(serializedPrimaryDisplay.size())); - for (auto data : serializedPrimaryDisplay) - { - writer->WriteInt32(data); - } - - // For ProgrammerMode - writer->WriteUInt32(static_cast(CurrentRadixType)); - - // Serialize commands of calculator manager - vector serializedCommand = m_standardCalculatorManager.SerializeCommands(); - writer->WriteUInt32(static_cast(serializedCommand.size())); - writer->WriteBytes(ref new Array(serializedCommand.data(), static_cast(serializedCommand.size()))); - - if (IsInError) - { - Utils::SerializeCommandsAndTokens(m_tokens, m_commands, writer); - } - - // Convert viewmodel data in writer to bytes - IBuffer ^ buffer = writer->DetachBuffer(); - DataReader ^ reader = DataReader::FromBuffer(buffer); - Platform::Array ^ viewModelDataAsBytes = ref new Array(buffer->Length); - reader->ReadBytes(viewModelDataAsBytes); - - // Return byte array - return viewModelDataAsBytes; -} - -void StandardCalculatorViewModel::Deserialize(Array ^ state) -{ - // Read byte array into a buffer - DataWriter ^ writer = ref new DataWriter(); - writer->WriteBytes(state); - IBuffer ^ buffer = writer->DetachBuffer(); - - // Read view model data - if (buffer->Length != 0) - { - DataReader ^ reader = DataReader::FromBuffer(buffer); - m_CurrentAngleType = ConvertIntegerToNumbersAndOperatorsEnum(reader->ReadUInt32()); - - IsFToEChecked = reader->ReadBoolean(); - IsCurrentViewPinned = reader->ReadBoolean(); - Command serializedDegreeMode = static_cast(reader->ReadUInt32()); - - m_standardCalculatorManager.SendCommand(serializedDegreeMode); - - // Deserialize Memory - UINT32 memoryDataLength = reader->ReadUInt32(); - vector serializedMemory; - for (unsigned int i = 0; i < memoryDataLength; i++) - { - serializedMemory.push_back(reader->ReadInt32()); - } - m_standardCalculatorManager.DeSerializeMemory(serializedMemory); - - // Serialize Primary Display - UINT32 serializedPrimaryDisplayLength = reader->ReadUInt32(); - vector serializedPrimaryDisplay; - for (unsigned int i = 0; i < serializedPrimaryDisplayLength; i++) - { - serializedPrimaryDisplay.push_back(reader->ReadInt32()); - } - m_standardCalculatorManager.DeSerializePrimaryDisplay(serializedPrimaryDisplay); - - CurrentRadixType = reader->ReadUInt32(); - // Read command data and Deserialize - UINT32 modeldatalength = reader->ReadUInt32(); - Array ^ modelDataAsBytes = ref new Array(modeldatalength); - reader->ReadBytes(modelDataAsBytes); - m_standardCalculatorManager.DeSerializeCommands(vector(modelDataAsBytes->begin(), modelDataAsBytes->end())); - - // After recalculation. If there is an error then - // IsInError should be set synchronously. - if (IsInError) - { - shared_ptr>> commandVector = Utils::DeserializeCommands(reader); - shared_ptr>> tokenVector = Utils::DeserializeTokens(reader); - SetExpressionDisplay(tokenVector, commandVector); - } - } -} - void StandardCalculatorViewModel::OnPropertyChanged(String ^ propertyname) { if (propertyname == IsScientificPropertyName) diff --git a/src/CalcViewModel/StandardCalculatorViewModel.h b/src/CalcViewModel/StandardCalculatorViewModel.h index 5a1a4dea..59dbbcb1 100644 --- a/src/CalcViewModel/StandardCalculatorViewModel.h +++ b/src/CalcViewModel/StandardCalculatorViewModel.h @@ -348,8 +348,6 @@ namespace CalculatorApp void OnBinaryOperatorReceived(); void OnMemoryItemChanged(unsigned int indexOfMemory); - Platform::Array ^ Serialize(); - void Deserialize(Platform::Array ^ state); Platform::String ^ GetLocalizedStringFormat(Platform::String ^ format, Platform::String ^ displayValue); void OnPropertyChanged(Platform::String ^ propertyname); diff --git a/src/CalcViewModel/UnitConverterViewModel.cpp b/src/CalcViewModel/UnitConverterViewModel.cpp index 7c48e7c4..dea918e9 100644 --- a/src/CalcViewModel/UnitConverterViewModel.cpp +++ b/src/CalcViewModel/UnitConverterViewModel.cpp @@ -612,52 +612,6 @@ void UnitConverterViewModel::OnPropertyChanged(Platform::String ^ prop) } } -String ^ UnitConverterViewModel::Serialize() -{ - wstringstream out(wstringstream::out); - const wchar_t* delimiter = L"[;;;]"; - out << std::to_wstring(m_resettingTimer) << delimiter; - out << std::to_wstring(static_cast(m_value1cp)) << delimiter; - out << m_Value1Active << delimiter << m_Value2Active << delimiter; - out << m_Value1->Data() << delimiter << m_Value2->Data() << delimiter; - out << m_valueFromUnlocalized << delimiter << m_valueToUnlocalized << delimiter << L"[###]"; - wstring unitConverterSerializedData = m_model->Serialize(); - - if (!unitConverterSerializedData.empty()) - { - out << m_model->Serialize() << L"[###]"; - String ^ serializedData = ref new String(wstring(out.str()).c_str()); - return serializedData; - } - - return nullptr; -} - -void UnitConverterViewModel::Deserialize(Platform::String ^ state) -{ - wstring serializedData = wstring(state->Data()); - vector tokens = UCM::UnitConverter::StringToVector(serializedData, L"[###]"); - assert(tokens.size() >= 2); - vector viewModelData = UCM::UnitConverter::StringToVector(tokens[0], L"[;;;]"); - assert(viewModelData.size() == EXPECTEDVIEWMODELDATATOKENS); - m_resettingTimer = (viewModelData[0].compare(L"1") == 0); - m_value1cp = (ConversionParameter)_wtoi(viewModelData[1].c_str()); - m_Value1Active = (viewModelData[2].compare(L"1") == 0); - m_Value2Active = (viewModelData[3].compare(L"1") == 0); - m_Value1 = ref new String(viewModelData[4].c_str()); - m_Value2 = ref new String(viewModelData[5].c_str()); - m_valueFromUnlocalized = viewModelData[6]; - m_valueToUnlocalized = viewModelData[7]; - wstringstream modelData(wstringstream::out); - for (unsigned int i = 1; i < tokens.size(); i++) - { - modelData << tokens[i] << L"[###]"; - } - m_model->DeSerialize(modelData.str()); - InitializeView(); - RaisePropertyChanged(nullptr); // Update since all props have been updated. -} - // Saving User Preferences of Category and Associated-Units across Sessions. void UnitConverterViewModel::SaveUserPreferences() { diff --git a/src/CalcViewModel/UnitConverterViewModel.h b/src/CalcViewModel/UnitConverterViewModel.h index 1fb67ee8..b0cc0241 100644 --- a/src/CalcViewModel/UnitConverterViewModel.h +++ b/src/CalcViewModel/UnitConverterViewModel.h @@ -219,9 +219,6 @@ namespace CalculatorApp _In_ Platform::String ^ toUnit); void UpdateValue1AutomationName(); void UpdateValue2AutomationName(); - Platform::String ^ Serialize(); - void Deserialize(Platform::String ^ state); - void ResetCategoriesAndRatio(); // Saving And Restoring User Preferences of Category and Associated-Units across Sessions. void SaveUserPreferences(); diff --git a/src/CalculatorUnitTests/CalculatorManagerTest.cpp b/src/CalculatorUnitTests/CalculatorManagerTest.cpp index 809fe919..a2ed8127 100644 --- a/src/CalculatorUnitTests/CalculatorManagerTest.cpp +++ b/src/CalculatorUnitTests/CalculatorManagerTest.cpp @@ -181,12 +181,6 @@ namespace CalculatorManagerTest TEST_METHOD(CalculatorManagerTestMemory); - TEST_METHOD(CalculatorManagerTestSerialize); - TEST_METHOD(CalculatorManagerTestSerializePrecision); - TEST_METHOD(CalculatorManagerTestSerializeMultiple); - TEST_METHOD(CalculatorManagerTestSerializeDegreeMode); - TEST_METHOD(CalculatorManagerTestSerializeMemory); - TEST_METHOD(CalculatorManagerTestMaxDigitsReached); TEST_METHOD(CalculatorManagerTestMaxDigitsReached_LeadingDecimal); TEST_METHOD(CalculatorManagerTestMaxDigitsReached_TrailingDecimal); @@ -263,35 +257,6 @@ namespace CalculatorManagerTest // MaxDigitsReached should have been called once VERIFY_IS_LESS_THAN(0, pCalculatorDisplay->GetMaxDigitsCalledCount()); } - - void SerializeAndDeSerialize() - { - auto serializedCommands = m_calculatorManager->SerializeCommands(); - auto serializedMemory = m_calculatorManager->GetSerializedMemory(); - auto serializedDisplay = m_calculatorManager->GetSerializedPrimaryDisplay(); - - Cleanup(); - - m_calculatorManager->DeSerializePrimaryDisplay(serializedDisplay); - m_calculatorManager->DeSerializeMemory(serializedMemory); - m_calculatorManager->DeSerializeCommands(serializedCommands); - } - - void VerifyPersistence() - { - auto savedPrimary = m_calculatorDisplayTester->GetPrimaryDisplay(); - auto savedExpression = m_calculatorDisplayTester->GetExpression(); - auto savedMemory = m_calculatorDisplayTester->GetMemorizedNumbers(); - SerializeAndDeSerialize(); - VERIFY_ARE_EQUAL(savedPrimary, m_calculatorDisplayTester->GetPrimaryDisplay()); - VERIFY_ARE_EQUAL(savedExpression, m_calculatorDisplayTester->GetExpression()); - auto loadedMemory = m_calculatorDisplayTester->GetMemorizedNumbers(); - VERIFY_ARE_EQUAL(savedMemory.size(), loadedMemory.size()); - for (unsigned int i = 0; i < savedMemory.size(); i++) - { - VERIFY_ARE_EQUAL(savedMemory.at(i), loadedMemory.at(i)); - } - } }; std::shared_ptr CalculatorManagerTest::m_calculatorManager; @@ -826,181 +791,6 @@ namespace CalculatorManagerTest m_calculatorManager->MemorizeNumber(); } - void CalculatorManagerTest::CalculatorManagerTestSerializeMemory() - { - Cleanup(); - - Command commands[] = { Command::Command1, Command::CommandNULL }; - ExecuteCommands(commands); - - for (int i = 0; i < 110; i++) - { - m_calculatorManager->MemorizeNumber(); - } - - VerifyPersistence(); - } - - void CalculatorManagerTest::CalculatorManagerTestSerializeDegreeMode() - { - Cleanup(); - - Command commands[] = { Command::Command1, Command::CommandRAD, Command::CommandSIN, Command::CommandADD, Command::Command1, - Command::CommandGRAD, Command::CommandCOS, Command::CommandADD, Command::Command1, Command::CommandDEG, - Command::CommandTAN, Command::CommandADD, Command::CommandNULL }; - ExecuteCommands(commands); - - VerifyPersistence(); - } - - // 1 + 2 then serialize and deserialize 3 times - // Check if the values are persisted correctly - void CalculatorManagerTest::CalculatorManagerTestSerializeMultiple() - { - Cleanup(); - - Command commands[] = { Command::Command1, Command::CommandADD, Command::Command2, Command::CommandNULL }; - ExecuteCommands(commands); - - VerifyPersistence(); - VerifyPersistence(); - VerifyPersistence(); - } - - // Calculate 1/3 then serialize and deserialize - // Multiply by 3 and check if the result is 1 not 0.999999999999999999... - void CalculatorManagerTest::CalculatorManagerTestSerializePrecision() - { - CalculatorManagerDisplayTester* pCalculatorDisplay = (CalculatorManagerDisplayTester*)m_calculatorDisplayTester.get(); - wstring resultPrimary = L""; - wstring resultExpression = L""; - Cleanup(); - - Command commands[] = { Command::Command1, Command::CommandDIV, Command::Command3, Command::CommandEQU, Command::CommandNULL }; - ExecuteCommands(commands); - - SerializeAndDeSerialize(); - - Command commands2[] = { Command::CommandMUL, Command::Command3, Command::CommandEQU, Command::CommandNULL }; - ExecuteCommands(commands2); - - VERIFY_ARE_EQUAL(StringReference(L"1"), ref new String(pCalculatorDisplay->GetPrimaryDisplay().c_str())); - } - - void CalculatorManagerTest::CalculatorManagerTestSerialize() - { - CalculatorManagerDisplayTester* pCalculatorDisplay = (CalculatorManagerDisplayTester*)m_calculatorDisplayTester.get(); - wstring resultPrimary = L""; - wstring resultExpression = L""; - Cleanup(); - - m_calculatorManager->SendCommand(Command::ModeScientific); - m_calculatorManager->SendCommand(Command::Command1); - m_calculatorManager->SendCommand(Command::CommandADD); - m_calculatorManager->SendCommand(Command::Command2); - m_calculatorManager->SendCommand(Command::CommandMUL); - m_calculatorManager->SendCommand(Command::Command2); - m_calculatorManager->MemorizeNumber(); - m_calculatorManager->SendCommand(Command::CommandEQU); - m_calculatorManager->MemorizeNumber(); - - vector memorizedNumbers = pCalculatorDisplay->GetMemorizedNumbers(); - wstring primaryDisplay = pCalculatorDisplay->GetPrimaryDisplay(); - wstring expressionDisplay = pCalculatorDisplay->GetExpression(); - - SerializeAndDeSerialize(); - - vector memorizedNumbersAfterDeSerialize = pCalculatorDisplay->GetMemorizedNumbers(); - wstring primaryDisplayAfterDeSerialize = pCalculatorDisplay->GetPrimaryDisplay(); - wstring expressionDisplayAfterDeSerialize = pCalculatorDisplay->GetExpression(); - - VERIFY_ARE_EQUAL(primaryDisplay, primaryDisplayAfterDeSerialize); - VERIFY_ARE_EQUAL(expressionDisplay, expressionDisplayAfterDeSerialize); - - bool isEqual = false; - - if (memorizedNumbers.size() < memorizedNumbersAfterDeSerialize.size()) - { - isEqual = std::equal(memorizedNumbers.begin(), memorizedNumbers.end(), memorizedNumbersAfterDeSerialize.begin()); - } - else - { - isEqual = std::equal(memorizedNumbersAfterDeSerialize.begin(), memorizedNumbersAfterDeSerialize.end(), memorizedNumbers.begin()); - } - VERIFY_IS_TRUE(isEqual); - - m_calculatorManager->SendCommand(Command::CommandGRAD); - m_calculatorManager->SendCommand(Command::Command5); - m_calculatorManager->SendCommand(Command::Command0); - m_calculatorManager->SendCommand(Command::CommandSIGN); - m_calculatorManager->SendCommand(Command::CommandMUL); - - memorizedNumbers = pCalculatorDisplay->GetMemorizedNumbers(); - primaryDisplay = pCalculatorDisplay->GetPrimaryDisplay(); - expressionDisplay = pCalculatorDisplay->GetExpression(); - - SerializeAndDeSerialize(); - - memorizedNumbersAfterDeSerialize = pCalculatorDisplay->GetMemorizedNumbers(); - primaryDisplayAfterDeSerialize = pCalculatorDisplay->GetPrimaryDisplay(); - expressionDisplayAfterDeSerialize = pCalculatorDisplay->GetExpression(); - - VERIFY_ARE_EQUAL(primaryDisplay, primaryDisplayAfterDeSerialize); - VERIFY_ARE_EQUAL(expressionDisplay, expressionDisplayAfterDeSerialize); - - isEqual = false; - if (memorizedNumbers.size() < memorizedNumbersAfterDeSerialize.size()) - { - isEqual = std::equal(memorizedNumbers.begin(), memorizedNumbers.end(), memorizedNumbersAfterDeSerialize.begin()); - } - else - { - isEqual = std::equal(memorizedNumbersAfterDeSerialize.begin(), memorizedNumbersAfterDeSerialize.end(), memorizedNumbers.begin()); - } - VERIFY_IS_TRUE(isEqual); - - m_calculatorManager->SendCommand(Command::Command1); - m_calculatorManager->SendCommand(Command::Command2); - m_calculatorManager->SendCommand(Command::Command3); - m_calculatorManager->SendCommand(Command::CommandPNT); - m_calculatorManager->SendCommand(Command::Command8); - m_calculatorManager->SendCommand(Command::CommandSIGN); - m_calculatorManager->MemorizeNumber(); - m_calculatorManager->SendCommand(Command::Command2); - m_calculatorManager->SendCommand(Command::Command3); - m_calculatorManager->MemorizedNumberAdd(0); - m_calculatorManager->SendCommand(Command::CommandCENTR); - m_calculatorManager->SendCommand(Command::Command3); - m_calculatorManager->SendCommand(Command::Command1); - m_calculatorManager->SendCommand(Command::CommandSIN); - m_calculatorManager->MemorizedNumberSubtract(2); - m_calculatorManager->MemorizedNumberLoad(2); - - memorizedNumbers = pCalculatorDisplay->GetMemorizedNumbers(); - primaryDisplay = pCalculatorDisplay->GetPrimaryDisplay(); - expressionDisplay = pCalculatorDisplay->GetExpression(); - - SerializeAndDeSerialize(); - - memorizedNumbersAfterDeSerialize = pCalculatorDisplay->GetMemorizedNumbers(); - primaryDisplayAfterDeSerialize = pCalculatorDisplay->GetPrimaryDisplay(); - expressionDisplayAfterDeSerialize = pCalculatorDisplay->GetExpression(); - - VERIFY_ARE_EQUAL(primaryDisplay, primaryDisplayAfterDeSerialize); - VERIFY_ARE_EQUAL(expressionDisplay, expressionDisplayAfterDeSerialize); - - isEqual = false; - if (memorizedNumbers.size() < memorizedNumbersAfterDeSerialize.size()) - { - isEqual = std::equal(memorizedNumbers.begin(), memorizedNumbers.end(), memorizedNumbersAfterDeSerialize.begin()); - } - else - { - isEqual = std::equal(memorizedNumbersAfterDeSerialize.begin(), memorizedNumbersAfterDeSerialize.end(), memorizedNumbers.begin()); - } - VERIFY_IS_TRUE(isEqual); - } - // Send 12345678910111213 and verify MaxDigitsReached void CalculatorManagerTest::CalculatorManagerTestMaxDigitsReached() { diff --git a/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp b/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp index 78493153..aad7e03a 100644 --- a/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp +++ b/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp @@ -75,7 +75,6 @@ namespace CalculatorUnitTests viewModel->ButtonPressed->Execute(NumbersAndOperatorsEnum::Clear); viewModel->ButtonPressed->Execute(NumbersAndOperatorsEnum::ClearEntry); viewModel->ClearMemoryCommand->Execute(nullptr); - viewModel->Deserialize(ref new Platform::Array(0)); } TESTITEM* currentItem = item; diff --git a/src/CalculatorUnitTests/UnitConverterTest.cpp b/src/CalculatorUnitTests/UnitConverterTest.cpp index a9cf3929..3f3559d2 100644 --- a/src/CalculatorUnitTests/UnitConverterTest.cpp +++ b/src/CalculatorUnitTests/UnitConverterTest.cpp @@ -199,8 +199,6 @@ namespace UnitConverterUnitTests TEST_METHOD(UnitConverterTestGetters); TEST_METHOD(UnitConverterTestGetCategory); TEST_METHOD(UnitConverterTestUnitTypeSwitching); - TEST_METHOD(UnitConverterTestSerialization); - TEST_METHOD(UnitConverterTestDeSerialization); TEST_METHOD(UnitConverterTestQuote); TEST_METHOD(UnitConverterTestUnquote); TEST_METHOD(UnitConverterTestBackspace); @@ -253,7 +251,7 @@ namespace UnitConverterUnitTests // Resets calculator state to start state after each test void UnitConverterTest::Cleanup() { - s_unitConverter->DeSerialize(wstring()); + s_unitConverter->SendCommand(Command::Reset); s_testVMCallback->Reset(); } @@ -325,22 +323,6 @@ namespace UnitConverterUnitTests VERIFY_IS_TRUE(s_testVMCallback->CheckSuggestedValues(vector>())); } - // Test serialization - void UnitConverterTest::UnitConverterTestSerialization() - { - wstring test1 = wstring(L"4;Kilograms;Kg;0;0;0;|3;Pounds;Lb;1;1;0;|2;0;Weight;|1;1;0;52.8;116.4039;|1;1;Length;,2;0;Weight;,|1;1;Length;[1;Inches;In;1;" - L"1;0;,2;Feet;Ft;0;0;0;,[]2;0;Weight;[3;Pounds;Lb;1;1;0;,4;Kilograms;Kg;0;0;0;,[]|1;Inches;In;1;1;0;[1;Inches;In;1;1;0;:1;0;0;:" - L",2;Feet;Ft;0;0;0;:0.08333333333333332870740406406185;0;0;:,[]2;Feet;Ft;0;0;0;[1;Inches;In;1;1;0;:12;0;0;:,2;Feet;Ft;0;0;0;:1;" - L"0;0;:,[]3;Pounds;Lb;1;1;0;[3;Pounds;Lb;1;1;0;:1;0;0;:,4;Kilograms;Kg;0;0;0;:0.45359199999999999519673110626172;0;0;:,[]4;" - L"Kilograms;Kg;0;0;0;[3;Pounds;Lb;1;1;0;:2.20461999999999980204279381723609;0;0;:,4;Kilograms;Kg;0;0;0;:1;0;0;:,[]|"); - s_unitConverter->SendCommand(Command::Five); - s_unitConverter->SendCommand(Command::Two); - s_unitConverter->SendCommand(Command::Decimal); - s_unitConverter->SendCommand(Command::Eight); - s_unitConverter->SetCurrentCategory(s_testWeight); - s_unitConverter->SetCurrentUnitTypes(s_testKilograms, s_testPounds); - VERIFY_IS_TRUE(s_unitConverter->Serialize().compare(test1) == 0); - } // Test input escaping void UnitConverterTest::UnitConverterTestQuote() @@ -368,19 +350,6 @@ namespace UnitConverterUnitTests VERIFY_IS_TRUE(UnitConverter::Unquote(UnitConverter::Quote(input3)) == input3); } - // Test de-serialization - void UnitConverterTest::UnitConverterTestDeSerialization() - { - wstring test1 = wstring(L"4;Kilograms;Kg;0;0;0;|3;Pounds;Lb;1;1;0;|2;0;Weight;|1;1;0;52.8;116.4039;|1;1;Length;,2;0;Weight;,|1;1;Length;[1;Inches;In;1;" - L"1;0;,2;Feet;Ft;0;0;0;,[]2;0;Weight;[3;Pounds;Lb;1;1;0;,4;Kilograms;Kg;0;0;0;,[]|1;Inches;In;1;1;0;[1;Inches;In;1;1;0;:1;0;0;:" - L",2;Feet;Ft;0;0;0;:0.08333333333333332870740406406185;0;0;:,[]2;Feet;Ft;0;0;0;[1;Inches;In;1;1;0;:12;0;0;:,2;Feet;Ft;0;0;0;:1;" - L"0;0;:,[]3;Pounds;Lb;1;1;0;[3;Pounds;Lb;1;1;0;:1;0;0;:,4;Kilograms;Kg;0;0;0;:0.45359199999999999519673110626172;0;0;:,[]4;" - L"Kilograms;Kg;0;0;0;[3;Pounds;Lb;1;1;0;:2.20461999999999980204279381723609;0;0;:,4;Kilograms;Kg;0;0;0;:1;0;0;:,[]|"); - s_unitConverter->DeSerialize(test1); - VERIFY_IS_TRUE(s_testVMCallback->CheckDisplayValues(wstring(L"52.8"), wstring(L"116.4039"))); - VERIFY_IS_TRUE(s_testVMCallback->CheckSuggestedValues(vector>())); - } - // Test backspace commands void UnitConverterTest::UnitConverterTestBackspace() { diff --git a/src/CalculatorUnitTests/UnitConverterViewModelUnitTests.cpp b/src/CalculatorUnitTests/UnitConverterViewModelUnitTests.cpp index 24ac03e0..4e91e619 100644 --- a/src/CalculatorUnitTests/UnitConverterViewModelUnitTests.cpp +++ b/src/CalculatorUnitTests/UnitConverterViewModelUnitTests.cpp @@ -129,8 +129,6 @@ UnitConverterMock::UnitConverterMock() , m_switchActiveCallCount(0) , m_sendCommandCallCount(0) , m_setVMCallbackCallCount(0) - , m_serializeCallCount(0) - , m_deSerializeCallCount(0) { } @@ -224,21 +222,10 @@ void UnitConverterMock::SwitchActive(const std::wstring& newValue) m_curValue = newValue; } -wstring UnitConverterMock::Serialize() -{ - m_serializeCallCount++; - return wstring(L""); -} - -void UnitConverterMock::DeSerialize(const wstring& /*serializedData*/) -{ - m_deSerializeCallCount++; -} - -std::wstring UnitConverterMock::SaveUserPreferences() -{ - return L"TEST"; -}; + std::wstring UnitConverterMock::SaveUserPreferences() + { + return L"TEST"; + }; void UnitConverterMock::RestoreUserPreferences(_In_ const std::wstring& /*userPreferences*/){}; @@ -858,37 +845,6 @@ TEST_METHOD(TestSupplementaryResultsWhimsicalUnits) VERIFY_IS_TRUE(vm.SupplementaryResults->GetAt(0)->Unit->GetModelUnit() == UNITWHIMSY); } -// Test deserialization -TEST_METHOD(TestUnitConverterViewModelDeserialization) -{ - String ^ serializedTest = L"0[;;;]0[;;;]0[;;;]1[;;;]1.5[;;;]25[;;;]1.5[;;;]25[;;;][###][###]"; - shared_ptr mock = make_shared(); - VM::UnitConverterViewModel vm(mock); - vm.Deserialize(serializedTest); - VERIFY_IS_TRUE(vm.Value1 == L"1.5"); - VERIFY_IS_TRUE(vm.Value2 == L"25"); - VERIFY_IS_TRUE(vm.GetValueFromUnlocalized() == L"1.5"); - VERIFY_IS_TRUE(vm.GetValueToUnlocalized() == L"25"); - VERIFY_ARE_EQUAL(vm.Value1Active, false); - VERIFY_ARE_EQUAL(vm.Value2Active, true); - VERIFY_IS_TRUE(mock->m_deSerializeCallCount == 1); -} - -// Test serialization -/*TEST_METHOD(TestUnitConverterViewModelSerialization) -{ - String ^ serializedTest = L"0[;;;]0[;;;]0[;;;]1[;;;];;;]1.5[;;;[;;;]25[###[;;;]0[;;;]0[;;;][###][###]"; - shared_ptr mock = make_shared(); - VM::UnitConverterViewModel vm(mock); - vm.Value1 = L";;;]1.5[;;;"; - vm.Value2 = L"25[###"; - vm.Value1Active = false; - vm.Value2Active = true; - String ^ test = vm.Serialize(); - VERIFY_IS_TRUE(serializedTest == test); - VERIFY_IS_TRUE(mock->m_serializeCallCount == 1); -}*/ - TEST_METHOD(TestOnPaste) { shared_ptr mock = make_shared(); diff --git a/src/CalculatorUnitTests/UnitConverterViewModelUnitTests.h b/src/CalculatorUnitTests/UnitConverterViewModelUnitTests.h index da2048f3..08c0f954 100644 --- a/src/CalculatorUnitTests/UnitConverterViewModelUnitTests.h +++ b/src/CalculatorUnitTests/UnitConverterViewModelUnitTests.h @@ -34,8 +34,6 @@ namespace CalculatorUnitTests UCM::Category GetCurrentCategory(); void SetCurrentUnitTypes(const UCM::Unit& fromType, const UCM::Unit& toType) override; void SwitchActive(const std::wstring& newValue); - std::wstring Serialize() override; - void DeSerialize(const std::wstring& serializedData) override; std::wstring SaveUserPreferences() override; void RestoreUserPreferences(_In_ const std::wstring& userPreferences) override; void SendCommand(UCM::Command command) override; @@ -61,8 +59,6 @@ namespace CalculatorUnitTests UINT m_switchActiveCallCount; UINT m_sendCommandCallCount; UINT m_setVMCallbackCallCount; - UINT m_serializeCallCount; - UINT m_deSerializeCallCount; UCM::Category m_curCategory; UCM::Unit m_curFrom; From c568ec787e81ec3e86e2bced599ddcb0114aa2b1 Mon Sep 17 00:00:00 2001 From: Matt Cooley Date: Thu, 9 May 2019 16:13:32 -0700 Subject: [PATCH 04/13] Update localized strings 2019-05-09 (#496) --- src/Calculator/Resources/af-ZA/Resources.resw | 8 ++++++++ src/Calculator/Resources/am-ET/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/ar-SA/Resources.resw | 13 ++++++++++++- .../Resources/az-Latn-AZ/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/be-BY/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/bg-BG/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/bn-BD/Resources.resw | 8 ++++++++ src/Calculator/Resources/ca-ES/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/cs-CZ/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/da-DK/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/de-DE/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/el-GR/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/en-GB/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/es-ES/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/es-MX/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/et-EE/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/eu-ES/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/fa-IR/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/fi-FI/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/fil-PH/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/fr-CA/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/fr-FR/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/gl-ES/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/he-IL/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/hi-IN/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/hr-HR/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/hu-HU/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/id-ID/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/is-IS/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/it-IT/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/ja-JP/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/kk-KZ/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/km-KH/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/kn-IN/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/ko-KR/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/lo-LA/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/lt-LT/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/lv-LV/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/mk-MK/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/ml-IN/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/ms-MY/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/nb-NO/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/nl-NL/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/pl-PL/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/pt-BR/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/pt-PT/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/ro-RO/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/ru-RU/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/sk-SK/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/sl-SI/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/sq-AL/Resources.resw | 13 ++++++++++++- .../Resources/sr-Latn-RS/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/sv-SE/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/sw-KE/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/ta-IN/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/te-IN/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/th-TH/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/tr-TR/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/uk-UA/Resources.resw | 13 ++++++++++++- .../Resources/uz-Latn-UZ/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/vi-VN/Resources.resw | 13 ++++++++++++- src/Calculator/Resources/zh-CN/Resources.resw | 15 +++++++++++++-- src/Calculator/Resources/zh-TW/Resources.resw | 13 ++++++++++++- 63 files changed, 749 insertions(+), 62 deletions(-) diff --git a/src/Calculator/Resources/af-ZA/Resources.resw b/src/Calculator/Resources/af-ZA/Resources.resw index 366e0a09..0d241a52 100644 --- a/src/Calculator/Resources/af-ZA/Resources.resw +++ b/src/Calculator/Resources/af-ZA/Resources.resw @@ -2907,4 +2907,12 @@ Microsoft-Dienste-ooreenkoms Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/am-ET/Resources.resw b/src/Calculator/Resources/am-ET/Resources.resw index 5ccff34a..b1da20b3 100644 --- a/src/Calculator/Resources/am-ET/Resources.resw +++ b/src/Calculator/Resources/am-ET/Resources.resw @@ -901,7 +901,10 @@ የግራ ቅንፍ Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + የግራ ቅንፍ፣ የክፍት ቅንፍ ቁጥር %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + የቀኝ ቅንፍ Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ የ Microsoft አገልግሎቶች ስምምነት Displayed on a link to the Microsoft Services Agreement in the about this app information + + ፒዮንግ + An abbreviation for a measurement unit of area. + + + ፒዮንግ + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/ar-SA/Resources.resw b/src/Calculator/Resources/ar-SA/Resources.resw index 90780d3c..4cc59750 100644 --- a/src/Calculator/Resources/ar-SA/Resources.resw +++ b/src/Calculator/Resources/ar-SA/Resources.resw @@ -901,7 +901,10 @@ أقواس يسرى Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + القوس الأيسر، عدد الأقواس المفتوحة %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + أقواس يمنى Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2905,4 +2908,12 @@ اتفاقية خدمات Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + بيونغ + An abbreviation for a measurement unit of area. + + + بيونغ + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/az-Latn-AZ/Resources.resw b/src/Calculator/Resources/az-Latn-AZ/Resources.resw index e5941d65..31b19cc3 100644 --- a/src/Calculator/Resources/az-Latn-AZ/Resources.resw +++ b/src/Calculator/Resources/az-Latn-AZ/Resources.resw @@ -901,7 +901,10 @@ Sol mötərizə Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Sol mötərizə, açıq mötərizənin sayı %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Sağ mötərizə Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft Xidmət Müqaviləsi Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/be-BY/Resources.resw b/src/Calculator/Resources/be-BY/Resources.resw index 85457396..68ad1caf 100644 --- a/src/Calculator/Resources/be-BY/Resources.resw +++ b/src/Calculator/Resources/be-BY/Resources.resw @@ -901,7 +901,10 @@ Левая дужка Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Левая дужка, пачатак адліку дужак (%1) + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Правая дужка Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Пагадненне аб выкарыстанні сэрвісаў Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Пхён + An abbreviation for a measurement unit of area. + + + Пхён + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/bg-BG/Resources.resw b/src/Calculator/Resources/bg-BG/Resources.resw index 9737c537..dd7a7dee 100644 --- a/src/Calculator/Resources/bg-BG/Resources.resw +++ b/src/Calculator/Resources/bg-BG/Resources.resw @@ -901,7 +901,10 @@ Лява скоба Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Лява скоба, брой на отваряща скоба %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Дясна скоба Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Споразумение за услуги на Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/bn-BD/Resources.resw b/src/Calculator/Resources/bn-BD/Resources.resw index f4a13742..62a827e4 100644 --- a/src/Calculator/Resources/bn-BD/Resources.resw +++ b/src/Calculator/Resources/bn-BD/Resources.resw @@ -2907,4 +2907,12 @@ Microsoft পরিষেবা চুক্তি Displayed on a link to the Microsoft Services Agreement in the about this app information + + পিয়ং + An abbreviation for a measurement unit of area. + + + পিয়ং + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/ca-ES/Resources.resw b/src/Calculator/Resources/ca-ES/Resources.resw index 28177726..7f69f9e7 100644 --- a/src/Calculator/Resources/ca-ES/Resources.resw +++ b/src/Calculator/Resources/ca-ES/Resources.resw @@ -901,7 +901,10 @@ Parèntesi d'obertura Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Parèntesi d'obertura, recompte de parèntesis d'obertura %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Parèntesi de tancament Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Contracte de serveis de Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/cs-CZ/Resources.resw b/src/Calculator/Resources/cs-CZ/Resources.resw index db9a320e..6f0048b6 100644 --- a/src/Calculator/Resources/cs-CZ/Resources.resw +++ b/src/Calculator/Resources/cs-CZ/Resources.resw @@ -901,7 +901,10 @@ Levá závorka Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Levá závorka, počet otevřených závorek %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Pravá závorka Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Smlouva o poskytování služeb společnosti Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyong + An abbreviation for a measurement unit of area. + + + Pyong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/da-DK/Resources.resw b/src/Calculator/Resources/da-DK/Resources.resw index 96c16947..b4c77b36 100644 --- a/src/Calculator/Resources/da-DK/Resources.resw +++ b/src/Calculator/Resources/da-DK/Resources.resw @@ -901,7 +901,10 @@ Venstreparentes Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Venstre parentes, åben parentes antal %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Højreparentes Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft-serviceaftale Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/de-DE/Resources.resw b/src/Calculator/Resources/de-DE/Resources.resw index 2c76b451..c3121743 100644 --- a/src/Calculator/Resources/de-DE/Resources.resw +++ b/src/Calculator/Resources/de-DE/Resources.resw @@ -901,7 +901,10 @@ Öffnende Klammer Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Runde Klammer links, Anzahl der öffnenden Klammern: %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Schließende Klammer Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft-Servicevertrag Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/el-GR/Resources.resw b/src/Calculator/Resources/el-GR/Resources.resw index cc791405..aede8bf1 100644 --- a/src/Calculator/Resources/el-GR/Resources.resw +++ b/src/Calculator/Resources/el-GR/Resources.resw @@ -901,7 +901,10 @@ Αριστερή παρένθεση Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Αριστερή παρένθεση, πλήθος ανοιχτών παρενθέσεων %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Δεξιά παρένθεση Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Σύμβαση παροχής υπηρεσιών της Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/en-GB/Resources.resw b/src/Calculator/Resources/en-GB/Resources.resw index b8077985..7a69bd9f 100644 --- a/src/Calculator/Resources/en-GB/Resources.resw +++ b/src/Calculator/Resources/en-GB/Resources.resw @@ -901,7 +901,10 @@ Left parenthesis Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Left parenthesis, open parenthesis count %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Right parenthesis Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft Services Agreement Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/es-ES/Resources.resw b/src/Calculator/Resources/es-ES/Resources.resw index 34cc2c94..3ad73bcc 100644 --- a/src/Calculator/Resources/es-ES/Resources.resw +++ b/src/Calculator/Resources/es-ES/Resources.resw @@ -901,7 +901,10 @@ Paréntesis de apertura Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Paréntesis de apertura, número de paréntesis abiertos %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Paréntesis de cierre Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Contrato de servicios de Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/es-MX/Resources.resw b/src/Calculator/Resources/es-MX/Resources.resw index 44151b87..5ac2b8b6 100644 --- a/src/Calculator/Resources/es-MX/Resources.resw +++ b/src/Calculator/Resources/es-MX/Resources.resw @@ -901,7 +901,10 @@ Paréntesis de apertura Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Abrir paréntesis, recuento de paréntesis abiertos %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Paréntesis de cierre Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Contrato de servicios de Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/et-EE/Resources.resw b/src/Calculator/Resources/et-EE/Resources.resw index 41060649..9995f98c 100644 --- a/src/Calculator/Resources/et-EE/Resources.resw +++ b/src/Calculator/Resources/et-EE/Resources.resw @@ -901,7 +901,10 @@ Vasaksulg Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Vasaksulg, avavate sulgude arv %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Paremsulg Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsofti teenuselepe Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/eu-ES/Resources.resw b/src/Calculator/Resources/eu-ES/Resources.resw index 98264063..b053b264 100644 --- a/src/Calculator/Resources/eu-ES/Resources.resw +++ b/src/Calculator/Resources/eu-ES/Resources.resw @@ -901,7 +901,10 @@ Ezkerreko parentesia Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Ezkerreko parentesia, ireki %1. parentesia + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Eskuineko parentesia Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft-en zerbitzu-hitzarmena Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/fa-IR/Resources.resw b/src/Calculator/Resources/fa-IR/Resources.resw index edd9e34b..b487b465 100644 --- a/src/Calculator/Resources/fa-IR/Resources.resw +++ b/src/Calculator/Resources/fa-IR/Resources.resw @@ -901,7 +901,10 @@ پرانتز سمت چپ Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + پرانتز چپ، تعداد پرانتزهای باز %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + پرانتز سمت راست Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ توافق‌نامه سرویس‌های Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + پیونگ + An abbreviation for a measurement unit of area. + + + پیونگ + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/fi-FI/Resources.resw b/src/Calculator/Resources/fi-FI/Resources.resw index b2a92d88..639007d8 100644 --- a/src/Calculator/Resources/fi-FI/Resources.resw +++ b/src/Calculator/Resources/fi-FI/Resources.resw @@ -901,7 +901,10 @@ Vasen sulje Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Vasen sulje, avaavien sulkeiden määrä %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Oikea sulje Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoftin palvelusopimus Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/fil-PH/Resources.resw b/src/Calculator/Resources/fil-PH/Resources.resw index 1409ce52..35b5b122 100644 --- a/src/Calculator/Resources/fil-PH/Resources.resw +++ b/src/Calculator/Resources/fil-PH/Resources.resw @@ -901,7 +901,10 @@ Kaliwang parenthesis Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Bilang ng kaliwang panaklong, pambukas na panaklong %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Kanang parenthesis Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Kasunduan sa Mga Serbisyo ng Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/fr-CA/Resources.resw b/src/Calculator/Resources/fr-CA/Resources.resw index 895689d9..7d77af03 100644 --- a/src/Calculator/Resources/fr-CA/Resources.resw +++ b/src/Calculator/Resources/fr-CA/Resources.resw @@ -901,7 +901,10 @@ Parenthèse gauche Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + %1 parenthèses gauches ouvrantes + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Parenthèse droite Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Contrat de services Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/fr-FR/Resources.resw b/src/Calculator/Resources/fr-FR/Resources.resw index c5f0a6c4..0c1cfa6a 100644 --- a/src/Calculator/Resources/fr-FR/Resources.resw +++ b/src/Calculator/Resources/fr-FR/Resources.resw @@ -901,7 +901,10 @@ Parenthèse gauche Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Parenthèse gauche, nombre de parenthèses ouvertes %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Parenthèse droite Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Contrat de services Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/gl-ES/Resources.resw b/src/Calculator/Resources/gl-ES/Resources.resw index 21aac3cd..befce135 100644 --- a/src/Calculator/Resources/gl-ES/Resources.resw +++ b/src/Calculator/Resources/gl-ES/Resources.resw @@ -901,7 +901,10 @@ Paréntese esquerda Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Paréntese de apertura, total de parénteses abertos %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Paréntese dereita Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Contrato de servizos de Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/he-IL/Resources.resw b/src/Calculator/Resources/he-IL/Resources.resw index 2a86f3ff..617b82a8 100644 --- a/src/Calculator/Resources/he-IL/Resources.resw +++ b/src/Calculator/Resources/he-IL/Resources.resw @@ -901,7 +901,10 @@ סוגר שמאלי Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + סוגריים ימניים, פתח ספירת סוגריים %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + סוגר ימני Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ הסכם השירותים של Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + פיונג + An abbreviation for a measurement unit of area. + + + פיונג + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/hi-IN/Resources.resw b/src/Calculator/Resources/hi-IN/Resources.resw index 9a4ce3f5..303dd08b 100644 --- a/src/Calculator/Resources/hi-IN/Resources.resw +++ b/src/Calculator/Resources/hi-IN/Resources.resw @@ -901,7 +901,10 @@ बायाँ कोष्ठक Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + बायाँ कोष्ठक, खुले कोष्ठक की संख्या %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + दायाँ कोष्ठक Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft सेवा अनुबंध Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/hr-HR/Resources.resw b/src/Calculator/Resources/hr-HR/Resources.resw index 4039f357..4a4bdf87 100644 --- a/src/Calculator/Resources/hr-HR/Resources.resw +++ b/src/Calculator/Resources/hr-HR/Resources.resw @@ -901,7 +901,10 @@ Lijeva zagrada Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Lijeva zagrada, broj otvorenih zagrada %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Desna zagrada Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoftov ugovor o pružanju usluga Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/hu-HU/Resources.resw b/src/Calculator/Resources/hu-HU/Resources.resw index 3afa8a62..a53de915 100644 --- a/src/Calculator/Resources/hu-HU/Resources.resw +++ b/src/Calculator/Resources/hu-HU/Resources.resw @@ -901,7 +901,10 @@ Nyitó zárójel Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Bal oldali vagy nyitó zárójelek száma: %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Berekesztő zárójel Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ A Microsoft szolgáltatási szerződése Displayed on a link to the Microsoft Services Agreement in the about this app information + + pyeong + An abbreviation for a measurement unit of area. + + + pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/id-ID/Resources.resw b/src/Calculator/Resources/id-ID/Resources.resw index dc8fc070..428609e5 100644 --- a/src/Calculator/Resources/id-ID/Resources.resw +++ b/src/Calculator/Resources/id-ID/Resources.resw @@ -901,7 +901,10 @@ Tanda kurung tutup Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Tanda kurung kiri, tanda kurung terbuka berjumlah %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Tanda kurung buka Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Perjanjian Layanan Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/is-IS/Resources.resw b/src/Calculator/Resources/is-IS/Resources.resw index 32c1df20..65a54651 100644 --- a/src/Calculator/Resources/is-IS/Resources.resw +++ b/src/Calculator/Resources/is-IS/Resources.resw @@ -901,7 +901,10 @@ Vinstri svigi Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Vinstri svigi, opnir svigar telja %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Hægri svigi Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Þjónustusamningur Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/it-IT/Resources.resw b/src/Calculator/Resources/it-IT/Resources.resw index 21abf33e..9f1f9cd9 100644 --- a/src/Calculator/Resources/it-IT/Resources.resw +++ b/src/Calculator/Resources/it-IT/Resources.resw @@ -901,7 +901,10 @@ Parentesi sinistra Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Conteggio parentesi sinistra, parentesi aperta %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Parentesi destra Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Contratto di Servizi Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/ja-JP/Resources.resw b/src/Calculator/Resources/ja-JP/Resources.resw index 805294a3..c9a9b020 100644 --- a/src/Calculator/Resources/ja-JP/Resources.resw +++ b/src/Calculator/Resources/ja-JP/Resources.resw @@ -901,7 +901,10 @@ 始め丸かっこ Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + 左かっこ、開きかっこの数 %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + 終わり丸かっこ Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft サービス規約 Displayed on a link to the Microsoft Services Agreement in the about this app information + + + An abbreviation for a measurement unit of area. + + + + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/kk-KZ/Resources.resw b/src/Calculator/Resources/kk-KZ/Resources.resw index 9cae015a..3f3da80d 100644 --- a/src/Calculator/Resources/kk-KZ/Resources.resw +++ b/src/Calculator/Resources/kk-KZ/Resources.resw @@ -901,7 +901,10 @@ Сол жақ жақша Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Сол жақ жақша, ашық жақша саны: %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Оң жақ жақша Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft қызметтер келісімі Displayed on a link to the Microsoft Services Agreement in the about this app information + + Пен + An abbreviation for a measurement unit of area. + + + Пен + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/km-KH/Resources.resw b/src/Calculator/Resources/km-KH/Resources.resw index 001536c3..9fce92a0 100644 --- a/src/Calculator/Resources/km-KH/Resources.resw +++ b/src/Calculator/Resources/km-KH/Resources.resw @@ -901,7 +901,10 @@ វង់ក្រចកឆ្វេង Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + វង់​ក្រចក​ឆ្វេង បើក​ការ​រាប់​វង់​ក្រចក %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + វង់ក្រចកស្តាំ Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ កិច្ចព្រមព្រៀងសេវាកម្ម​ Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/kn-IN/Resources.resw b/src/Calculator/Resources/kn-IN/Resources.resw index f7205b98..9f75db32 100644 --- a/src/Calculator/Resources/kn-IN/Resources.resw +++ b/src/Calculator/Resources/kn-IN/Resources.resw @@ -901,7 +901,10 @@ ಎಡ ಆವರಣ ಚಿಹ್ನೆ Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + ಎಡ ಆವರಣ, ಬಲ ಆವರಣ ಎಣಿಕೆ %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + ಬಲ ಆವರಣ ಚಿಹ್ನೆ Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft ಸೇವೆಗಳ ಒಪ್ಪಂದ Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/ko-KR/Resources.resw b/src/Calculator/Resources/ko-KR/Resources.resw index 636cd7fa..de9cbde8 100644 --- a/src/Calculator/Resources/ko-KR/Resources.resw +++ b/src/Calculator/Resources/ko-KR/Resources.resw @@ -901,7 +901,10 @@ 여는 괄호 Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + 왼쪽 괄호 또는 여는 괄호 수 %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + 닫는 괄호 Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft 서비스 계약 Displayed on a link to the Microsoft Services Agreement in the about this app information + + + An abbreviation for a measurement unit of area. + + + + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/lo-LA/Resources.resw b/src/Calculator/Resources/lo-LA/Resources.resw index 668cbcfd..50f31dee 100644 --- a/src/Calculator/Resources/lo-LA/Resources.resw +++ b/src/Calculator/Resources/lo-LA/Resources.resw @@ -901,7 +901,10 @@ ວົງເລັບຊ້າຍ Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + <mrk mtype="seg" mid="55">ວົງເລັບຊ້າຍ, ເປີດຍອດລວມວົງເລັບ %1</mrk> + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + ວົງເລັບຂວາ Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ ຂໍ້ຕົກລົງ ການບໍລິການ Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/lt-LT/Resources.resw b/src/Calculator/Resources/lt-LT/Resources.resw index 6fe0cdb0..170126e6 100644 --- a/src/Calculator/Resources/lt-LT/Resources.resw +++ b/src/Calculator/Resources/lt-LT/Resources.resw @@ -901,7 +901,10 @@ Kairysis lenktinis skliaustas Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Kairysis skliaustas, atidarančio skliausto skaičius %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Dešinysis lenktinis skliaustas Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ „Microsoft“ paslaugų teikimo sutartis Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/lv-LV/Resources.resw b/src/Calculator/Resources/lv-LV/Resources.resw index fd0aa0d3..333e85f3 100644 --- a/src/Calculator/Resources/lv-LV/Resources.resw +++ b/src/Calculator/Resources/lv-LV/Resources.resw @@ -901,7 +901,10 @@ Kreisās puses apaļā iekava Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Kreisā iekava, atvērto iekavu skaits: %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Labās puses apaļā iekava Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft pakalpojumu līgums Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/mk-MK/Resources.resw b/src/Calculator/Resources/mk-MK/Resources.resw index ae662665..8600319c 100644 --- a/src/Calculator/Resources/mk-MK/Resources.resw +++ b/src/Calculator/Resources/mk-MK/Resources.resw @@ -901,7 +901,10 @@ Лева заграда Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Лева заграда, отворена заграда пресметува %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Десна заграда Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Договор за услуги на Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Пјеонг + An abbreviation for a measurement unit of area. + + + Пјеонг + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/ml-IN/Resources.resw b/src/Calculator/Resources/ml-IN/Resources.resw index dfd4f85c..4240803d 100644 --- a/src/Calculator/Resources/ml-IN/Resources.resw +++ b/src/Calculator/Resources/ml-IN/Resources.resw @@ -901,7 +901,10 @@ ഇടത് ആവരണചിഹ്നം Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + ഇടത് പാരന്തെസിസ്, പാരന്തെസിസ് കൗണ്ട് %1 തുറക്കുക + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + വലത് ബ്രാക്കറ്റ് Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft സേവന കരാർ Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/ms-MY/Resources.resw b/src/Calculator/Resources/ms-MY/Resources.resw index f92fb352..5849b006 100644 --- a/src/Calculator/Resources/ms-MY/Resources.resw +++ b/src/Calculator/Resources/ms-MY/Resources.resw @@ -901,7 +901,10 @@ Tanda kurungan kiri Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Tanda kurung kiri, buka kiraan tanda kurung %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Tanda kurungan kanan Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Perjanjian Perkhidmatan Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/nb-NO/Resources.resw b/src/Calculator/Resources/nb-NO/Resources.resw index 7bdbe851..e2b0232f 100644 --- a/src/Calculator/Resources/nb-NO/Resources.resw +++ b/src/Calculator/Resources/nb-NO/Resources.resw @@ -901,7 +901,10 @@ Venstreparentes Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Venstreparentes, åpen parentes teller %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Høyreparentes Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsofts tjenesteavtale Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/nl-NL/Resources.resw b/src/Calculator/Resources/nl-NL/Resources.resw index da027ca9..a06ab9f1 100644 --- a/src/Calculator/Resources/nl-NL/Resources.resw +++ b/src/Calculator/Resources/nl-NL/Resources.resw @@ -901,7 +901,10 @@ Haakje openen Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Haakje openen, aantal haakjes openen %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Haakje sluiten Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2906,4 +2909,12 @@ Microsoft-servicesovereenkomst Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/pl-PL/Resources.resw b/src/Calculator/Resources/pl-PL/Resources.resw index 6f168924..dc20c6f5 100644 --- a/src/Calculator/Resources/pl-PL/Resources.resw +++ b/src/Calculator/Resources/pl-PL/Resources.resw @@ -901,7 +901,10 @@ Lewy nawias Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Lewy nawias, liczba otwartych nawiasów: %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Prawy nawias Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Umowa o świadczenie usług firmy Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/pt-BR/Resources.resw b/src/Calculator/Resources/pt-BR/Resources.resw index 9caeb8d7..733812bf 100644 --- a/src/Calculator/Resources/pt-BR/Resources.resw +++ b/src/Calculator/Resources/pt-BR/Resources.resw @@ -901,7 +901,10 @@ Parêntese esquerdo Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Parêntese esquerdo, contagem de parêntese de abertura %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Parêntese direito Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Contrato de Serviços Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/pt-PT/Resources.resw b/src/Calculator/Resources/pt-PT/Resources.resw index 3a120893..2388a1e4 100644 --- a/src/Calculator/Resources/pt-PT/Resources.resw +++ b/src/Calculator/Resources/pt-PT/Resources.resw @@ -901,7 +901,10 @@ Parêntese à esquerda Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Parêntese à esquerda, abrir contagem de parênteses %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Parêntese à direita Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Contrato de Serviços Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/ro-RO/Resources.resw b/src/Calculator/Resources/ro-RO/Resources.resw index 02a518d5..b3c037ae 100644 --- a/src/Calculator/Resources/ro-RO/Resources.resw +++ b/src/Calculator/Resources/ro-RO/Resources.resw @@ -901,7 +901,10 @@ Paranteză stânga Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Contor paranteze stânga, paranteze deschise %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Paranteză dreapta Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Contractul de furnizare a serviciilor Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/ru-RU/Resources.resw b/src/Calculator/Resources/ru-RU/Resources.resw index 9c46030e..cea4710e 100644 --- a/src/Calculator/Resources/ru-RU/Resources.resw +++ b/src/Calculator/Resources/ru-RU/Resources.resw @@ -901,7 +901,10 @@ Открывающая круглая скобка Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Левая круглая скобка, количество открывающих круглых скобок — %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Закрывающая круглая скобка Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Соглашение об использовании служб Майкрософт Displayed on a link to the Microsoft Services Agreement in the about this app information + + Пхен + An abbreviation for a measurement unit of area. + + + Пхен + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/sk-SK/Resources.resw b/src/Calculator/Resources/sk-SK/Resources.resw index 48c4aeb6..6614f577 100644 --- a/src/Calculator/Resources/sk-SK/Resources.resw +++ b/src/Calculator/Resources/sk-SK/Resources.resw @@ -901,7 +901,10 @@ Ľavá zátvorka Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Ľavá zátvorka, počet ľavých zátvoriek je %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Pravá zátvorka Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Zmluva o poskytovaní služieb spoločnosti Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/sl-SI/Resources.resw b/src/Calculator/Resources/sl-SI/Resources.resw index e2ef8cdc..b716838b 100644 --- a/src/Calculator/Resources/sl-SI/Resources.resw +++ b/src/Calculator/Resources/sl-SI/Resources.resw @@ -901,7 +901,10 @@ Levi oklepaj Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Levi oklepaj, število oklepajev %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Desni oklepaj Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Pogodba o Microsoftovih storitvah Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/sq-AL/Resources.resw b/src/Calculator/Resources/sq-AL/Resources.resw index 10165d09..72de56e6 100644 --- a/src/Calculator/Resources/sq-AL/Resources.resw +++ b/src/Calculator/Resources/sq-AL/Resources.resw @@ -901,7 +901,10 @@ Kllapa e majtë Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Kllapa e majtë, numri i kllapave hapëse %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Kllapa e djathtë Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Marrëveshja e shërbimeve të Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/sr-Latn-RS/Resources.resw b/src/Calculator/Resources/sr-Latn-RS/Resources.resw index d4545c5b..12799c74 100644 --- a/src/Calculator/Resources/sr-Latn-RS/Resources.resw +++ b/src/Calculator/Resources/sr-Latn-RS/Resources.resw @@ -901,7 +901,10 @@ Leva zagrada Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Otvorena zagrada, broj otvorenih zagrada %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Desna zagrada Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft ugovor o pružanju usluga Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pjeong + An abbreviation for a measurement unit of area. + + + Pjeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/sv-SE/Resources.resw b/src/Calculator/Resources/sv-SE/Resources.resw index 4e5afb85..b3d5673a 100644 --- a/src/Calculator/Resources/sv-SE/Resources.resw +++ b/src/Calculator/Resources/sv-SE/Resources.resw @@ -901,7 +901,10 @@ Vänster parentes Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Vänster parentes, antal inledande parenteser är %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Höger parentes Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Villkor för Microsoft-tjänster Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/sw-KE/Resources.resw b/src/Calculator/Resources/sw-KE/Resources.resw index 15a1cfc8..d439f456 100644 --- a/src/Calculator/Resources/sw-KE/Resources.resw +++ b/src/Calculator/Resources/sw-KE/Resources.resw @@ -901,7 +901,10 @@ Mabano ya kushoto Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Mabano ya kushoto, fungua idadi ya mabano %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Mabano ya kulia Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Makubaliano ya Huduma za Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/ta-IN/Resources.resw b/src/Calculator/Resources/ta-IN/Resources.resw index 7bbfc867..520e7b64 100644 --- a/src/Calculator/Resources/ta-IN/Resources.resw +++ b/src/Calculator/Resources/ta-IN/Resources.resw @@ -901,7 +901,10 @@ இடது அடைப்புக்குறி Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + இடது அடைப்புக்குறி, திறப்பு அடைப்புக்குறி கணக்கு %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + வலது அடைப்புக்குறி Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft சேவைகள் ஒப்பந்தம் Displayed on a link to the Microsoft Services Agreement in the about this app information + + ப்யியாங் + An abbreviation for a measurement unit of area. + + + ப்யியாங் + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/te-IN/Resources.resw b/src/Calculator/Resources/te-IN/Resources.resw index 40f55346..0587f978 100644 --- a/src/Calculator/Resources/te-IN/Resources.resw +++ b/src/Calculator/Resources/te-IN/Resources.resw @@ -901,7 +901,10 @@ ఎడమ కుండలీకరణం Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + ఎడమ కుండలీకరణం, కుండలీకరణ గణనను %1 తెరవు + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + కుడి కుండలీకరణం Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft సర్వీసెస్ అగ్రిమెంట్. Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/th-TH/Resources.resw b/src/Calculator/Resources/th-TH/Resources.resw index a3cbf576..4a756eb6 100644 --- a/src/Calculator/Resources/th-TH/Resources.resw +++ b/src/Calculator/Resources/th-TH/Resources.resw @@ -901,7 +901,10 @@ วงเล็บเปิด Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + วงเล็บเปิด จำนวนวงเล็บเปิด %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + วงเล็บปิด Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ ข้อตกลงการใช้บริการของ Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + พยอง + An abbreviation for a measurement unit of area. + + + พยอง + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/tr-TR/Resources.resw b/src/Calculator/Resources/tr-TR/Resources.resw index 08403c8c..14e50d1d 100644 --- a/src/Calculator/Resources/tr-TR/Resources.resw +++ b/src/Calculator/Resources/tr-TR/Resources.resw @@ -901,7 +901,10 @@ Sol parantez Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Sol parantez, parantez sayımını aç %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Sağ parantez Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2905,4 +2908,12 @@ Microsoft Hizmet Sözleşmesi Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/uk-UA/Resources.resw b/src/Calculator/Resources/uk-UA/Resources.resw index 66d44cb7..292201e7 100644 --- a/src/Calculator/Resources/uk-UA/Resources.resw +++ b/src/Calculator/Resources/uk-UA/Resources.resw @@ -901,7 +901,10 @@ Ліва кругла дужка Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Ліва кругла дужка, кількість відкривних круглих дужок – %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Права кругла дужка Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Угода про використання служб Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Пхен + An abbreviation for a measurement unit of area. + + + Пхен + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/uz-Latn-UZ/Resources.resw b/src/Calculator/Resources/uz-Latn-UZ/Resources.resw index 257528d1..9430e7d5 100644 --- a/src/Calculator/Resources/uz-Latn-UZ/Resources.resw +++ b/src/Calculator/Resources/uz-Latn-UZ/Resources.resw @@ -901,7 +901,10 @@ Chap qavs Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Chap qavs, ochiq qavslar soni - %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + O‘ng qavs Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft xizmatlaridan foydalanish shartnomasi Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyon + An abbreviation for a measurement unit of area. + + + Pyon + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/vi-VN/Resources.resw b/src/Calculator/Resources/vi-VN/Resources.resw index 606eba80..bd31daa1 100644 --- a/src/Calculator/Resources/vi-VN/Resources.resw +++ b/src/Calculator/Resources/vi-VN/Resources.resw @@ -901,7 +901,10 @@ Dấu ngoặc đơn trái Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + Ngoặc trái, tính ngoặc mở %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + Dấu ngoặc đơn phải Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Thỏa thuận Dịch vụ của Microsoft Displayed on a link to the Microsoft Services Agreement in the about this app information + + Pyeong + An abbreviation for a measurement unit of area. + + + Pyeong + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/zh-CN/Resources.resw b/src/Calculator/Resources/zh-CN/Resources.resw index 786d6f7d..09016495 100644 --- a/src/Calculator/Resources/zh-CN/Resources.resw +++ b/src/Calculator/Resources/zh-CN/Resources.resw @@ -901,7 +901,10 @@ 左括号 Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + 左括号,左开式括号计数 %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + 右括号 Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -1107,7 +1110,7 @@ Unit conversion category name called Time - 音量 + 体积 Unit conversion category name called Volume (eg. cups, teaspoons, milliliters) @@ -2904,4 +2907,12 @@ Microsoft 服务协议 Displayed on a link to the Microsoft Services Agreement in the about this app information + + + An abbreviation for a measurement unit of area. + + + + A measurement unit for area. + \ No newline at end of file diff --git a/src/Calculator/Resources/zh-TW/Resources.resw b/src/Calculator/Resources/zh-TW/Resources.resw index ac0798ad..f4e1569e 100644 --- a/src/Calculator/Resources/zh-TW/Resources.resw +++ b/src/Calculator/Resources/zh-TW/Resources.resw @@ -901,7 +901,10 @@ 左括弧 Screen reader prompt for the Calculator "(" button on the scientific operator keypad - + + 左括弧,左括弧計數 %1 + {Locked="%1"} Screen reader prompt for the Calculator "(" button on the scientific operator keypad. %1 is the localized count of open parenthesis, e.g. "2". + 右括弧 Screen reader prompt for the Calculator ")" button on the scientific operator keypad @@ -2904,4 +2907,12 @@ Microsoft 服務合約 Displayed on a link to the Microsoft Services Agreement in the about this app information + + + An abbreviation for a measurement unit of area. + + + + A measurement unit for area. + \ No newline at end of file From b82f5717747acb8c2970ca4f936a47914747ec9d Mon Sep 17 00:00:00 2001 From: Matt Cooley Date: Fri, 10 May 2019 11:17:43 -0700 Subject: [PATCH 05/13] Updating version of release builds to 1905 (#500) --- build/pipelines/azure-pipelines.release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/pipelines/azure-pipelines.release.yaml b/build/pipelines/azure-pipelines.release.yaml index f687ec4a..6647e907 100644 --- a/build/pipelines/azure-pipelines.release.yaml +++ b/build/pipelines/azure-pipelines.release.yaml @@ -9,8 +9,8 @@ pr: none variables: versionMajor: 10 - versionMinor: 1904 - versionBuild: $[counter('10.1904.*', 0)] + versionMinor: 1905 + versionBuild: $[counter('10.1905.*', 0)] versionPatch: 0 name: '$(versionMajor).$(versionMinor).$(versionBuild).$(versionPatch)' From dcc731f111f6dc03da949cbab87fe05d5c083315 Mon Sep 17 00:00:00 2001 From: Lucas Larson Date: Fri, 10 May 2019 22:20:21 -0400 Subject: [PATCH 06/13] Repair empty link in ApplicationArchitecture.md (#502) Link to the same infinite-precision-arithmetic article on Wikipedia as in README.md Fixes Existing output in the ApplicationArchitecture.md is a literal [infinite precision][Infinite Precision]. It should be a link to https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic. Description of the changes: This patch assumes the author intended to link to the same Wikipedia article linked to in README.md --- docs/ApplicationArchitecture.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/ApplicationArchitecture.md b/docs/ApplicationArchitecture.md index dff02965..235af889 100644 --- a/docs/ApplicationArchitecture.md +++ b/docs/ApplicationArchitecture.md @@ -201,4 +201,5 @@ instead of regular floating point arithmetic). The interface to this layer is de [CalcManager folder]: ../src/CalcManager [CalculatorManager.h]: ../src/CalcManager/CalculatorManager.h [CalcEngine.h]: ../src/CalcManager/Header Files/CalcEngine.h +[Infinite Precision]: https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic [ratpak.h]: ../src/CalcManager/Ratpack/ratpak.h From d8cb5c82a8e0e7831847aa5ccb7605826d1d5b65 Mon Sep 17 00:00:00 2001 From: Rudy Huyn Date: Fri, 10 May 2019 19:55:15 -0700 Subject: [PATCH 07/13] Keep spaces when users copy an error message (#430) Verify if the StandardCalculatorViewModel::DisplayValue isn't an error message before removing group separators (including space character). How changes were validated: Tested in english and french Tested with "Cannot divide by zero" and "Result is undefined" Fixes #420 --- .../StandardCalculatorViewModel.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/CalcViewModel/StandardCalculatorViewModel.cpp b/src/CalcViewModel/StandardCalculatorViewModel.cpp index acda9bad..dd0283da 100644 --- a/src/CalcViewModel/StandardCalculatorViewModel.cpp +++ b/src/CalcViewModel/StandardCalculatorViewModel.cpp @@ -1223,13 +1223,18 @@ void StandardCalculatorViewModel::SetCalculatorType(ViewMode targetState) } } -Platform::String ^ StandardCalculatorViewModel::GetRawDisplayValue() +String^ StandardCalculatorViewModel::GetRawDisplayValue() { - wstring rawValue; - - LocalizationSettings::GetInstance().RemoveGroupSeparators(DisplayValue->Data(), DisplayValue->Length(), &rawValue); - - return ref new Platform::String(rawValue.c_str()); + if (IsInError) + { + return DisplayValue; + } + else + { + wstring rawValue; + LocalizationSettings::GetInstance().RemoveGroupSeparators(DisplayValue->Data(), DisplayValue->Length(), &rawValue); + return ref new String(rawValue.c_str()); + } } // Given a format string, returns a string with the input display value inserted. From 860d6d3eb2bcbc5a764fca61a9389cd5ccfd430a Mon Sep 17 00:00:00 2001 From: Mahdi Ghiasi Date: Tue, 14 May 2019 04:31:28 +0430 Subject: [PATCH 08/13] Removed GroupName from JumpList so items can't be pinened or removed by user. (#499) https://stackoverflow.com/a/39436591/942659 --- src/Calculator/App.xaml.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Calculator/App.xaml.cpp b/src/Calculator/App.xaml.cpp index 29b39115..c8b29dd1 100644 --- a/src/Calculator/App.xaml.cpp +++ b/src/Calculator/App.xaml.cpp @@ -180,7 +180,6 @@ task App::SetupJumpList() ViewMode mode = option->Mode; auto item = JumpListItem::CreateWithArguments(((int)mode).ToString(), L"ms-resource:///Resources/" + NavCategory::GetNameResourceKey(mode)); item->Description = L"ms-resource:///Resources/" + NavCategory::GetNameResourceKey(mode); - item->GroupName = L"ms-resource:///Resources/" + NavCategoryGroup::GetHeaderResourceKey(calculatorOptions->GroupType); item->Logo = ref new Uri("ms-appx:///Assets/" + mode.ToString() + ".png"); jumpList->Items->Append(item); From 9f47fe3fc853c85bddf5057f8fb51b377d6b381a Mon Sep 17 00:00:00 2001 From: Rudy Huyn Date: Tue, 14 May 2019 09:57:58 -0700 Subject: [PATCH 09/13] Fix unit tests to run on non-english devices (#289) * Force en-US for unit tests * fix some spacing issues after merge * remove default argument of LocalizationService to fix compilation issue in Release mode --- .../Common/LocalizationService.cpp | 50 ++++++++++++++----- .../Common/LocalizationService.h | 42 ++++++++-------- .../Common/LocalizationSettings.h | 10 ++-- .../DataLoaders/CurrencyDataLoader.cpp | 22 ++++++-- .../DataLoaders/CurrencyDataLoader.h | 2 +- src/CalcViewModel/DateCalculatorViewModel.cpp | 2 +- src/CalcViewModel/UnitConverterViewModel.cpp | 5 +- src/Calculator/Views/Calculator.xaml.cpp | 2 +- src/Calculator/Views/DateCalculator.xaml.cpp | 2 +- .../CurrencyConverterUnitTests.cpp | 33 ++++++------ src/CalculatorUnitTests/UnitTestApp.xaml.cpp | 4 ++ 11 files changed, 106 insertions(+), 68 deletions(-) diff --git a/src/CalcViewModel/Common/LocalizationService.cpp b/src/CalcViewModel/Common/LocalizationService.cpp index 848360ee..24354e4b 100644 --- a/src/CalcViewModel/Common/LocalizationService.cpp +++ b/src/CalcViewModel/Common/LocalizationService.cpp @@ -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" @@ -49,17 +49,34 @@ LocalizationService ^ LocalizationService::GetInstance() if (s_singletonInstance == nullptr) { - s_singletonInstance = ref new LocalizationService(); + s_singletonInstance = ref new LocalizationService(nullptr); } } return s_singletonInstance; } -LocalizationService::LocalizationService() +/// +/// Replace (or create) the single instance of this singleton class by one with the language passed as parameter +/// +/// RFC-5646 identifier of the language to use +/// +/// Should only be used for test purpose +/// +void LocalizationService::OverrideWithLanguage(_In_ const wchar_t * const language) { - m_language = ApplicationLanguages::Languages->GetAt(0); - m_flowDirection = - ResourceContext::GetForCurrentView()->QualifierValues->Lookup(L"LayoutDirection") != L"LTR" ? FlowDirection::RightToLeft : FlowDirection::LeftToRight; + s_singletonInstance = ref new LocalizationService(language); +} + +/// +/// Constructor +/// +/// RFC-5646 identifier of the language to use, if null, will use the current language of the system +LocalizationService::LocalizationService(_In_ const wchar_t * const overridedLanguage) +{ + m_isLanguageOverrided = overridedLanguage != nullptr; + m_language = m_isLanguageOverrided ? ref new Platform::String(overridedLanguage) : ApplicationLanguages::Languages->GetAt(0); + m_flowDirection = ResourceContext::GetForCurrentView()->QualifierValues->Lookup(L"LayoutDirection") + != L"LTR" ? FlowDirection::RightToLeft : FlowDirection::LeftToRight; auto resourceLoader = AppResourceProvider::GetInstance(); m_fontFamilyOverride = resourceLoader.GetResourceString(L"LocalizedFontFamilyOverride"); @@ -339,7 +356,7 @@ void LocalizationService::UpdateFontFamilyAndSize(DependencyObject ^ target) // If successful, returns a formatter that respects the user's regional format settings, // as configured by running intl.cpl. -DecimalFormatter ^ LocalizationService::GetRegionalSettingsAwareDecimalFormatter() +DecimalFormatter ^ LocalizationService::GetRegionalSettingsAwareDecimalFormatter() const { IIterable ^ languageIdentifiers = LocalizationService::GetLanguageIdentifiers(); if (languageIdentifiers != nullptr) @@ -354,7 +371,7 @@ DecimalFormatter ^ LocalizationService::GetRegionalSettingsAwareDecimalFormatter // as configured by running intl.cpl. // // This helper function creates a DateTimeFormatter with a TwentyFour hour clock -DateTimeFormatter ^ LocalizationService::GetRegionalSettingsAwareDateTimeFormatter(_In_ String ^ format) +DateTimeFormatter ^ LocalizationService::GetRegionalSettingsAwareDateTimeFormatter(_In_ String^ format) const { IIterable ^ languageIdentifiers = LocalizationService::GetLanguageIdentifiers(); if (languageIdentifiers == nullptr) @@ -367,8 +384,7 @@ DateTimeFormatter ^ LocalizationService::GetRegionalSettingsAwareDateTimeFormatt // If successful, returns a formatter that respects the user's regional format settings, // as configured by running intl.cpl. -DateTimeFormatter - ^ LocalizationService::GetRegionalSettingsAwareDateTimeFormatter(_In_ String ^ format, _In_ String ^ calendarIdentifier, _In_ String ^ clockIdentifier) +DateTimeFormatter^ LocalizationService::GetRegionalSettingsAwareDateTimeFormatter(_In_ String ^ format, _In_ String ^ calendarIdentifier, _In_ String ^ clockIdentifier) const { IIterable ^ languageIdentifiers = LocalizationService::GetLanguageIdentifiers(); if (languageIdentifiers == nullptr) @@ -379,12 +395,12 @@ DateTimeFormatter return ref new DateTimeFormatter(format, languageIdentifiers, GlobalizationPreferences::HomeGeographicRegion, calendarIdentifier, clockIdentifier); } -CurrencyFormatter ^ LocalizationService::GetRegionalSettingsAwareCurrencyFormatter() +CurrencyFormatter ^ LocalizationService::GetRegionalSettingsAwareCurrencyFormatter() const { String ^ userCurrency = (GlobalizationPreferences::Currencies->Size > 0) ? GlobalizationPreferences::Currencies->GetAt(0) : StringReference(DefaultCurrencyCode.data()); - IIterable ^ languageIdentifiers = LocalizationService::GetLanguageIdentifiers(); + IIterable ^ languageIdentifiers = GetLanguageIdentifiers(); if (languageIdentifiers == nullptr) { languageIdentifiers = ApplicationLanguages::Languages; @@ -398,10 +414,18 @@ CurrencyFormatter ^ LocalizationService::GetRegionalSettingsAwareCurrencyFormatt return currencyFormatter; } -IIterable ^ LocalizationService::GetLanguageIdentifiers() +IIterable ^ LocalizationService::GetLanguageIdentifiers() const { WCHAR currentLocale[LOCALE_NAME_MAX_LENGTH] = {}; int result = GetUserDefaultLocaleName(currentLocale, LOCALE_NAME_MAX_LENGTH); + + if (m_isLanguageOverrided) + { + auto overridedLanguageList = ref new Vector(); + overridedLanguageList->Append(m_language); + return overridedLanguageList; + } + if (result != 0) { // GetUserDefaultLocaleName may return an invalid bcp47 language tag with trailing non-BCP47 friendly characters, diff --git a/src/CalcViewModel/Common/LocalizationService.h b/src/CalcViewModel/Common/LocalizationService.h index 73b088b5..736d5647 100644 --- a/src/CalcViewModel/Common/LocalizationService.h +++ b/src/CalcViewModel/Common/LocalizationService.h @@ -30,7 +30,9 @@ namespace CalculatorApp DEPENDENCY_PROPERTY_ATTACHED_WITH_DEFAULT_AND_CALLBACK(LanguageFontType, FontType, LanguageFontType::UIText); DEPENDENCY_PROPERTY_ATTACHED_WITH_CALLBACK(double, FontSize); - internal : static LocalizationService ^ GetInstance(); + internal: + static LocalizationService^ GetInstance(); + static void OverrideWithLanguage(_In_ const wchar_t * const language); Windows::UI::Xaml::FlowDirection GetFlowDirection(); bool IsRtlLayout(); @@ -41,24 +43,24 @@ namespace CalculatorApp Windows::UI::Text::FontWeight GetFontWeightOverride(); double GetFontScaleFactorOverride(LanguageFontType fontType); - static Windows::Globalization::NumberFormatting::DecimalFormatter ^ GetRegionalSettingsAwareDecimalFormatter(); - static Windows::Globalization::DateTimeFormatting::DateTimeFormatter ^ GetRegionalSettingsAwareDateTimeFormatter(_In_ Platform::String ^ format); - static Windows::Globalization::DateTimeFormatting::DateTimeFormatter - ^ GetRegionalSettingsAwareDateTimeFormatter( - _In_ Platform::String ^ format, - _In_ Platform::String ^ calendarIdentifier, - _In_ Platform::String ^ clockIdentifier); + Windows::Globalization::NumberFormatting::DecimalFormatter ^ GetRegionalSettingsAwareDecimalFormatter() const; + Windows::Globalization::DateTimeFormatting::DateTimeFormatter ^ GetRegionalSettingsAwareDateTimeFormatter(_In_ Platform::String ^ format) const; + Windows::Globalization::DateTimeFormatting::DateTimeFormatter ^ GetRegionalSettingsAwareDateTimeFormatter( + _In_ Platform::String ^ format, + _In_ Platform::String ^ calendarIdentifier, + _In_ Platform::String ^ clockIdentifier) const; - static Windows::Globalization::NumberFormatting::CurrencyFormatter ^ GetRegionalSettingsAwareCurrencyFormatter(); + Windows::Globalization::NumberFormatting::CurrencyFormatter ^ GetRegionalSettingsAwareCurrencyFormatter() const; static Platform::String ^ GetNarratorReadableToken(Platform::String ^ rawToken); static Platform::String ^ GetNarratorReadableString(Platform::String ^ rawString); private: + LocalizationService(_In_ const wchar_t* const overridedLanguage); Windows::Globalization::Fonts::LanguageFont ^ GetLanguageFont(LanguageFontType fontType); Windows::UI::Text::FontWeight ParseFontWeight(Platform::String ^ fontWeight); - static Windows::Foundation::Collections::IIterable ^ GetLanguageIdentifiers(); + Windows::Foundation::Collections::IIterable ^ GetLanguageIdentifiers() const; // Attached property callbacks static void OnFontTypePropertyChanged(Windows::UI::Xaml::DependencyObject ^ target, LanguageFontType oldValue, LanguageFontType newValue); @@ -72,19 +74,17 @@ namespace CalculatorApp static std::unordered_map GetTokenToReadableNameMap(); - private: - LocalizationService(); - static LocalizationService ^ s_singletonInstance; - Windows::Globalization::Fonts::LanguageFontGroup ^ m_fontGroup; - Platform::String ^ m_language; - Windows::UI::Xaml::FlowDirection m_flowDirection; - bool m_overrideFontApiValues; - Platform::String ^ m_fontFamilyOverride; - Windows::UI::Text::FontWeight m_fontWeightOverride; - double m_uiTextFontScaleFactorOverride; - double m_uiCaptionFontScaleFactorOverride; + Windows::Globalization::Fonts::LanguageFontGroup ^ m_fontGroup; + Platform::String ^ m_language; + Windows::UI::Xaml::FlowDirection m_flowDirection; + bool m_overrideFontApiValues; + Platform::String ^ m_fontFamilyOverride; + bool m_isLanguageOverrided; + Windows::UI::Text::FontWeight m_fontWeightOverride; + double m_uiTextFontScaleFactorOverride; + double m_uiCaptionFontScaleFactorOverride; }; } diff --git a/src/CalcViewModel/Common/LocalizationSettings.h b/src/CalcViewModel/Common/LocalizationSettings.h index 1b350154..addc0c39 100644 --- a/src/CalcViewModel/Common/LocalizationSettings.h +++ b/src/CalcViewModel/Common/LocalizationSettings.h @@ -19,7 +19,7 @@ namespace CalculatorApp // Use DecimalFormatter as it respects the locale and the user setting Windows::Globalization::NumberFormatting::DecimalFormatter ^ formatter; - formatter = CalculatorApp::Common::LocalizationService::GetRegionalSettingsAwareDecimalFormatter(); + formatter = LocalizationService::GetInstance()->GetRegionalSettingsAwareDecimalFormatter(); formatter->FractionDigits = 0; formatter->IsDecimalPointAlwaysDisplayed = false; @@ -61,7 +61,7 @@ namespace CalculatorApp // Get locale info for List Separator, eg. comma is used in many locales wchar_t listSeparatorString[4] = L""; result = ::GetLocaleInfoEx( - LOCALE_NAME_USER_DEFAULT, + m_resolvedName.c_str(), LOCALE_SLIST, listSeparatorString, static_cast(std::size(listSeparatorString))); // Max length of the expected return value is 4 @@ -85,7 +85,7 @@ namespace CalculatorApp // A value of 0 indicates the symbol follows the currency value. int currencySymbolPrecedence = 1; result = GetLocaleInfoEx( - LOCALE_NAME_USER_DEFAULT, + m_resolvedName.c_str(), LOCALE_IPOSSYMPRECEDES | LOCALE_RETURN_NUMBER, (LPWSTR)¤cySymbolPrecedence, sizeof(currencySymbolPrecedence) / sizeof(WCHAR)); @@ -104,14 +104,14 @@ namespace CalculatorApp // Note: This function returns 0 on failure. // We'll ignore the failure in that case and the CalendarIdentifier would get set to GregorianCalendar. CALID calId; - ::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_ICALENDARTYPE | LOCALE_RETURN_NUMBER, reinterpret_cast(&calId), sizeof(calId)); + ::GetLocaleInfoEx(m_resolvedName.c_str(), LOCALE_ICALENDARTYPE | LOCALE_RETURN_NUMBER, reinterpret_cast(&calId), sizeof(calId)); m_calendarIdentifier = GetCalendarIdentifierFromCalid(calId); // Get FirstDayOfWeek Date and Time setting wchar_t day[80] = L""; ::GetLocaleInfoEx( - LOCALE_NAME_USER_DEFAULT, + m_resolvedName.c_str(), LOCALE_IFIRSTDAYOFWEEK, // The first day in a week reinterpret_cast(day), // Argument is of type PWSTR static_cast(std::size(day))); // Max return size are 80 characters diff --git a/src/CalcViewModel/DataLoaders/CurrencyDataLoader.cpp b/src/CalcViewModel/DataLoaders/CurrencyDataLoader.cpp index b2c68dcf..2fb8f0a6 100644 --- a/src/CalcViewModel/DataLoaders/CurrencyDataLoader.cpp +++ b/src/CalcViewModel/DataLoaders/CurrencyDataLoader.cpp @@ -87,7 +87,7 @@ namespace CalculatorApp } } -CurrencyDataLoader::CurrencyDataLoader(_In_ unique_ptr client) +CurrencyDataLoader::CurrencyDataLoader(_In_ unique_ptr client, const wchar_t * forcedResponseLanguage) : m_client(move(client)) , m_loadStatus(CurrencyLoadStatus::NotLoaded) , m_responseLanguage(L"en-US") @@ -96,9 +96,20 @@ CurrencyDataLoader::CurrencyDataLoader(_In_ unique_ptr clie , m_networkManager(ref new NetworkManager()) , m_meteredOverrideSet(false) { - if (GlobalizationPreferences::Languages->Size > 0) + if (forcedResponseLanguage != nullptr) { - m_responseLanguage = GlobalizationPreferences::Languages->GetAt(0); + m_responseLanguage = ref new Platform::String(forcedResponseLanguage); + } + else + { + if (GlobalizationPreferences::Languages->Size > 0) + { + m_responseLanguage = GlobalizationPreferences::Languages->GetAt(0); + } + else + { + m_responseLanguage = L"en-US"; + } } if (m_client != nullptr) @@ -107,13 +118,14 @@ CurrencyDataLoader::CurrencyDataLoader(_In_ unique_ptr clie m_client->SetResponseLanguage(m_responseLanguage); } + auto localizationService = LocalizationService::GetInstance(); if (CoreWindow::GetForCurrentThread() != nullptr) { // Must have a CoreWindow to access the resource context. - m_isRtlLanguage = LocalizationService::GetInstance()->IsRtlLayout(); + m_isRtlLanguage = localizationService->IsRtlLayout(); } - m_ratioFormatter = LocalizationService::GetRegionalSettingsAwareDecimalFormatter(); + m_ratioFormatter = localizationService->GetRegionalSettingsAwareDecimalFormatter(); m_ratioFormatter->IsGrouped = true; m_ratioFormatter->IsDecimalPointAlwaysDisplayed = true; m_ratioFormatter->FractionDigits = FORMATTER_DIGIT_COUNT; diff --git a/src/CalcViewModel/DataLoaders/CurrencyDataLoader.h b/src/CalcViewModel/DataLoaders/CurrencyDataLoader.h index 5221373a..1ec031d1 100644 --- a/src/CalcViewModel/DataLoaders/CurrencyDataLoader.h +++ b/src/CalcViewModel/DataLoaders/CurrencyDataLoader.h @@ -54,7 +54,7 @@ namespace CalculatorApp class CurrencyDataLoader : public UCM::IConverterDataLoader, public UCM::ICurrencyConverterDataLoader { public: - CurrencyDataLoader(_In_ std::unique_ptr client); + CurrencyDataLoader(_In_ std::unique_ptr client, const wchar_t* overrideLanguage = nullptr); ~CurrencyDataLoader(); bool LoadFinished(); diff --git a/src/CalcViewModel/DateCalculatorViewModel.cpp b/src/CalcViewModel/DateCalculatorViewModel.cpp index 164a9281..d81cd3b5 100644 --- a/src/CalcViewModel/DateCalculatorViewModel.cpp +++ b/src/CalcViewModel/DateCalculatorViewModel.cpp @@ -217,7 +217,7 @@ void DateCalculatorViewModel::UpdateStrDateResultAutomationName() void DateCalculatorViewModel::InitializeDateOutputFormats(_In_ String ^ calendarIdentifier) { // Format for Add/Subtract days - m_dateTimeFormatter = LocalizationService::GetRegionalSettingsAwareDateTimeFormatter( + m_dateTimeFormatter = LocalizationService::GetInstance()->GetRegionalSettingsAwareDateTimeFormatter( L"longdate", calendarIdentifier, ClockIdentifiers::TwentyFourHour); // Clock Identifier is not used diff --git a/src/CalcViewModel/UnitConverterViewModel.cpp b/src/CalcViewModel/UnitConverterViewModel.cpp index dea918e9..72d31464 100644 --- a/src/CalcViewModel/UnitConverterViewModel.cpp +++ b/src/CalcViewModel/UnitConverterViewModel.cpp @@ -122,14 +122,15 @@ UnitConverterViewModel::UnitConverterViewModel(const shared_ptrSetViewModelCallback(make_shared(this)); m_model->SetViewModelCurrencyCallback(make_shared(this)); - m_decimalFormatter = LocalizationService::GetRegionalSettingsAwareDecimalFormatter(); + m_decimalFormatter = localizationService->GetRegionalSettingsAwareDecimalFormatter(); m_decimalFormatter->FractionDigits = 0; m_decimalFormatter->IsGrouped = true; m_decimalSeparator = LocalizationSettings::GetInstance().GetDecimalSeparator(); - m_currencyFormatter = LocalizationService::GetRegionalSettingsAwareCurrencyFormatter(); + m_currencyFormatter = localizationService->GetRegionalSettingsAwareCurrencyFormatter(); m_currencyFormatter->IsGrouped = true; m_currencyFormatter->Mode = CurrencyFormatterMode::UseCurrencyCode; m_currencyFormatter->ApplyRoundingForCurrency(RoundingAlgorithm::RoundHalfDown); diff --git a/src/Calculator/Views/Calculator.xaml.cpp b/src/Calculator/Views/Calculator.xaml.cpp index 6f64b193..3a64988f 100644 --- a/src/Calculator/Views/Calculator.xaml.cpp +++ b/src/Calculator/Views/Calculator.xaml.cpp @@ -97,7 +97,7 @@ void Calculator::SetFontSizeResources() { L"Tibt", 104, 29.333, 20, 40, 56, 40, 56 }, { L"Default", 104, 29.333, 23, 40, 56, 40, 56 } }; - DecimalFormatter ^ formatter = LocalizationService::GetRegionalSettingsAwareDecimalFormatter(); + DecimalFormatter^ formatter = LocalizationService::GetInstance()->GetRegionalSettingsAwareDecimalFormatter(); const FontTable* currentItem = fontTables; while (currentItem->numericSystem.compare(std::wstring(L"Default")) != 0 && currentItem->numericSystem.compare(formatter->NumeralSystem->Data()) != 0) diff --git a/src/Calculator/Views/DateCalculator.xaml.cpp b/src/Calculator/Views/DateCalculator.xaml.cpp index b3a9dcdd..33ed3dc3 100644 --- a/src/Calculator/Views/DateCalculator.xaml.cpp +++ b/src/Calculator/Views/DateCalculator.xaml.cpp @@ -79,7 +79,7 @@ DateCalculator::DateCalculator() DateDiff_ToDate->MaxDate = maxYear; // Set the PlaceHolderText for CalendarDatePicker - DateTimeFormatter ^ dateTimeFormatter = LocalizationService::GetRegionalSettingsAwareDateTimeFormatter( + DateTimeFormatter^ dateTimeFormatter = LocalizationService::GetInstance()->GetRegionalSettingsAwareDateTimeFormatter( L"day month year", localizationSettings.GetCalendarIdentifier(), ClockIdentifiers::TwentyFourHour); // Clock Identifier is not used diff --git a/src/CalculatorUnitTests/CurrencyConverterUnitTests.cpp b/src/CalculatorUnitTests/CurrencyConverterUnitTests.cpp index b53e4209..9b20184a 100644 --- a/src/CalculatorUnitTests/CurrencyConverterUnitTests.cpp +++ b/src/CalculatorUnitTests/CurrencyConverterUnitTests.cpp @@ -205,8 +205,7 @@ namespace CalculatorUnitTests TEST_METHOD(LoadFromCache_Fail_NoCacheKey) { RemoveFromLocalSettings(CurrencyDataLoaderConstants::CacheTimestampKey); - - CurrencyDataLoader loader{ nullptr }; + CurrencyDataLoader loader(nullptr, L"en-US"); bool didLoad = loader.TryLoadDataFromCacheAsync().get(); @@ -224,7 +223,7 @@ TEST_METHOD(LoadFromCache_Fail_OlderThanADay) dayOld.UniversalTime = now.UniversalTime - CurrencyDataLoaderConstants::DayDuration - 1; InsertToLocalSettings(CurrencyDataLoaderConstants::CacheTimestampKey, dayOld); - CurrencyDataLoader loader{ nullptr }; + CurrencyDataLoader loader(nullptr, L"en-US"); bool didLoad = loader.TryLoadDataFromCacheAsync().get(); @@ -243,7 +242,7 @@ TEST_METHOD(LoadFromCache_Fail_StaticDataFileDoesNotExist) VERIFY_IS_TRUE(DeleteFileFromLocalCacheFolder(CurrencyDataLoaderConstants::StaticDataFilename)); VERIFY_IS_TRUE(WriteToFileInLocalCacheFolder(CurrencyDataLoaderConstants::AllRatiosDataFilename, CurrencyHttpClient::GetRawAllRatiosDataResponse())); - CurrencyDataLoader loader{ nullptr }; + CurrencyDataLoader loader(nullptr, L"en-US"); bool didLoad = loader.TryLoadDataFromCacheAsync().get(); @@ -262,7 +261,7 @@ TEST_METHOD(LoadFromCache_Fail_AllRatiosDataFileDoesNotExist) VERIFY_IS_TRUE(WriteToFileInLocalCacheFolder(CurrencyDataLoaderConstants::StaticDataFilename, CurrencyHttpClient::GetRawStaticDataResponse())); VERIFY_IS_TRUE(DeleteFileFromLocalCacheFolder(CurrencyDataLoaderConstants::AllRatiosDataFilename)); - CurrencyDataLoader loader{ nullptr }; + CurrencyDataLoader loader(nullptr, L"en-US"); bool didLoad = loader.TryLoadDataFromCacheAsync().get(); @@ -282,7 +281,7 @@ TEST_METHOD(LoadFromCache_Fail_ResponseLanguageChanged) VERIFY_IS_TRUE(WriteToFileInLocalCacheFolder(CurrencyDataLoaderConstants::StaticDataFilename, CurrencyHttpClient::GetRawStaticDataResponse())); VERIFY_IS_TRUE(DeleteFileFromLocalCacheFolder(CurrencyDataLoaderConstants::AllRatiosDataFilename)); - CurrencyDataLoader loader{ nullptr }; + CurrencyDataLoader loader(nullptr, L"en-US"); bool didLoad = loader.TryLoadDataFromCacheAsync().get(); @@ -295,7 +294,7 @@ TEST_METHOD(LoadFromCache_Success) { StandardCacheSetup(); - CurrencyDataLoader loader{ nullptr }; + CurrencyDataLoader loader(nullptr, L"en-US"); bool didLoad = loader.TryLoadDataFromCacheAsync().get(); @@ -306,7 +305,7 @@ TEST_METHOD(LoadFromCache_Success) TEST_METHOD(LoadFromWeb_Fail_ClientIsNullptr) { - CurrencyDataLoader loader{ nullptr }; + CurrencyDataLoader loader(nullptr, L"en-US"); bool didLoad = loader.TryLoadDataFromWebAsync().get(); @@ -317,7 +316,7 @@ TEST_METHOD(LoadFromWeb_Fail_ClientIsNullptr) TEST_METHOD(LoadFromWeb_Fail_WebException) { - CurrencyDataLoader loader{ make_unique() }; + CurrencyDataLoader loader(make_unique(), L"en-US"); bool didLoad = loader.TryLoadDataFromWebAsync().get(); @@ -342,8 +341,7 @@ TEST_METHOD(LoadFromWeb_Success) TEST_METHOD(Load_Success_LoadedFromCache) { StandardCacheSetup(); - - CurrencyDataLoader loader{ nullptr }; + CurrencyDataLoader loader(nullptr, L"en-US"); auto data_loaded_event = task_completion_event(); loader.SetViewModelCallback(make_shared(data_loaded_event)); @@ -391,8 +389,7 @@ TEST_CLASS(CurrencyConverterUnitTests){ const UCM::Unit GetUnit(const vector(); loader.SetViewModelCallback(make_shared(data_loaded_event)); @@ -422,7 +419,7 @@ TEST_METHOD(Loaded_LoadOrderedRatios) { StandardCacheSetup(); - CurrencyDataLoader loader{ nullptr }; + CurrencyDataLoader loader(nullptr, L"en-US"); auto data_loaded_event = task_completion_event(); loader.SetViewModelCallback(make_shared(data_loaded_event)); @@ -455,7 +452,7 @@ TEST_METHOD(Loaded_GetCurrencySymbols_Valid) { StandardCacheSetup(); - CurrencyDataLoader loader{ nullptr }; + CurrencyDataLoader loader(nullptr, L"en-US"); auto data_loaded_event = task_completion_event(); loader.SetViewModelCallback(make_shared(data_loaded_event)); @@ -484,7 +481,7 @@ TEST_METHOD(Loaded_GetCurrencySymbols_Invalid) { StandardCacheSetup(); - CurrencyDataLoader loader{ nullptr }; + CurrencyDataLoader loader(nullptr, L"en-US"); auto data_loaded_event = task_completion_event(); loader.SetViewModelCallback(make_shared(data_loaded_event)); @@ -527,7 +524,7 @@ TEST_METHOD(Loaded_GetCurrencyRatioEquality_Valid) { StandardCacheSetup(); - CurrencyDataLoader loader{ nullptr }; + CurrencyDataLoader loader(nullptr, L"en-US"); auto data_loaded_event = task_completion_event(); loader.SetViewModelCallback(make_shared(data_loaded_event)); @@ -556,7 +553,7 @@ TEST_METHOD(Loaded_GetCurrencyRatioEquality_Invalid) { StandardCacheSetup(); - CurrencyDataLoader loader{ nullptr }; + CurrencyDataLoader loader(nullptr, L"en-US"); auto data_loaded_event = task_completion_event(); loader.SetViewModelCallback(make_shared(data_loaded_event)); diff --git a/src/CalculatorUnitTests/UnitTestApp.xaml.cpp b/src/CalculatorUnitTests/UnitTestApp.xaml.cpp index e5b4eb67..8dbd5903 100644 --- a/src/CalculatorUnitTests/UnitTestApp.xaml.cpp +++ b/src/CalculatorUnitTests/UnitTestApp.xaml.cpp @@ -8,6 +8,7 @@ #include "pch.h" #include "UnitTestApp.xaml.h" +#include "Common/LocalizationService.h" using namespace CalculatorUnitTests; @@ -79,6 +80,9 @@ void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEvent Window::Current->Activate(); + // Override the current locale to use English (US) to be compatible with all tests based on formatting + CalculatorApp::Common::LocalizationService::OverrideWithLanguage(L"en-US"); + Microsoft::VisualStudio::TestPlatform::TestExecutor::WinRTCore::UnitTestClient::Run(e->Arguments); } From 9b920f0d8696fdc8e668aee9b52a3913bc8a6a50 Mon Sep 17 00:00:00 2001 From: Mahdi Ghiasi Date: Fri, 17 May 2019 22:40:28 +0430 Subject: [PATCH 10/13] Removed entrance transition for about button in NavigationView (#506) --- src/Calculator/Views/MainPage.xaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Calculator/Views/MainPage.xaml b/src/Calculator/Views/MainPage.xaml index 967c8e69..bcf2908d 100644 --- a/src/Calculator/Views/MainPage.xaml +++ b/src/Calculator/Views/MainPage.xaml @@ -110,6 +110,10 @@ x:Load="False" IsItemClickEnabled="True" ItemClick="OnAboutButtonClick"> + + + + Date: Fri, 17 May 2019 11:52:02 -0700 Subject: [PATCH 11/13] Updating terminology in new feature development process for clarity (#509) --- docs/NewFeatureProcess.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/NewFeatureProcess.md b/docs/NewFeatureProcess.md index 2a84aa27..6f514d00 100644 --- a/docs/NewFeatureProcess.md +++ b/docs/NewFeatureProcess.md @@ -29,26 +29,26 @@ idea until it is ready for review. We review pitches regularly, and will approve or close issues based on whether they broadly align with the [Calculator roadmap](https://github.com/Microsoft/calculator/blob/master/docs/Roadmap.md). Approved pitches are moved -into [pre-production](https://github.com/Microsoft/calculator/projects/1) on the feature tracking board. +into [planning](https://github.com/Microsoft/calculator/projects/1) on the feature tracking board. -## Step 2: Pre-production +## Step 2: Planning For most features, the output of this phase is a specification which describes how the feature will work, supported by design renderings and code prototypes as needed. The original issue will continue to track the overall progress of the feature, but we will create and iterate on spec documentation in the [Calculator Spec repo](https://github.com/Microsoft/calculator-specs). Sometimes we'll learn new things about a feature -proposal during pre-production, and we'll edit or close the original pitch. +proposal during planning, and we'll edit or close the original pitch. -We welcome community participation throughout pre-production. The best ideas often come from trying many ideas during -the pre-production phase. To enable rapid +We welcome community participation throughout planning. The best ideas often come from trying many ideas during +the planning phase. To enable rapid experimentation, we encourage developing and sharing rough ideas—maybe even with pencil and paper—before making designs pixel-perfect or making code robust and maintainable. After the [spec review](https://github.com/Microsoft/calculator-specs#spec-review) is completed, we will move the issue -into [production](https://github.com/Microsoft/calculator/projects/1) on the feature tracking board. In _some_ cases, +into [implementation](https://github.com/Microsoft/calculator/projects/1) on the feature tracking board. In _some_ cases, all of the details of an idea can be captured concisely in original feature pitch. When that happens, we may move ideas -directly into production. +directly into implementation. -## Step 3: Production +## Step 3: Implementation A feature can be implemented by the original submitter, a Microsoft team member, or by other community members. Code contributions and testing help are greatly appreciated. Please let everyone know if you're actively working on a feature to help avoid duplicated efforts from others. From 00f0f25dfc66e0c6eb9d07a72dce9de183723168 Mon Sep 17 00:00:00 2001 From: MelulekiDube Date: Sat, 18 May 2019 00:54:34 +0200 Subject: [PATCH 12/13] Added the name property for CalculationResult right/left scroll buttons on screen (#503) * Added the property name to be shown on the Scrollable links to solve issue 482 * Added the x:uid tag for the buttons and also added the automationID * Added two new uids keys for the left and right scroll buttons for the calculation result. --- src/Calculator/App.xaml | 7 +++++-- src/Calculator/Resources/en-US/Resources.resw | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Calculator/App.xaml b/src/Calculator/App.xaml index 918034c0..910a5856 100644 --- a/src/Calculator/App.xaml +++ b/src/Calculator/App.xaml @@ -353,8 +353,7 @@ -