diff --git a/src/CalcManager/CEngine/CalcUtils.cpp b/src/CalcManager/CEngine/CalcUtils.cpp index 4aa8311d..fe488009 100644 --- a/src/CalcManager/CEngine/CalcUtils.cpp +++ b/src/CalcManager/CEngine/CalcUtils.cpp @@ -3,6 +3,7 @@ #include "pch.h" #include "Header Files/CalcEngine.h" +#include "Header Files/CalcUtils.h" bool IsOpInRange(WPARAM op, uint32_t x, uint32_t y) { diff --git a/src/CalcManager/CEngine/History.cpp b/src/CalcManager/CEngine/History.cpp index 860f1f60..c91bc8a5 100644 --- a/src/CalcManager/CEngine/History.cpp +++ b/src/CalcManager/CEngine/History.cpp @@ -2,18 +2,25 @@ // Licensed under the MIT License. #include "pch.h" -#pragma once #include "Header Files/CalcEngine.h" #include "Command.h" #include "CalculatorVector.h" #include "ExpressionCommand.h" -#include "CalcException.h" constexpr int ASCII_0 = 48; using namespace std; using namespace CalcEngine; +namespace { + void IFT(HRESULT hr) + { + if (FAILED(hr)) + { + throw hr; + } + } +} void CHistoryCollector::ReinitHistory() { m_lastOpStartIndex = -1; diff --git a/src/CalcManager/CEngine/scicomm.cpp b/src/CalcManager/CEngine/scicomm.cpp index f639c707..a72cce15 100644 --- a/src/CalcManager/CEngine/scicomm.cpp +++ b/src/CalcManager/CEngine/scicomm.cpp @@ -26,28 +26,30 @@ using namespace std; using namespace CalcEngine; -// NPrecedenceOfOp -// -// returns a virtual number for precedence for the operator. We expect binary operator only, otherwise the lowest number -// 0 is returned. Higher the number, higher the precedence of the operator. -INT NPrecedenceOfOp(int nopCode) -{ - static BYTE rgbPrec[] = { 0,0, IDC_OR,0, IDC_XOR,0, IDC_AND,1, - IDC_ADD,2, IDC_SUB,2, IDC_RSHF,3, IDC_LSHF,3, - IDC_MOD,3, IDC_DIV,3, IDC_MUL,3, IDC_PWR,4, IDC_ROOT, 4 }; - int iPrec; +namespace { + // NPrecedenceOfOp + // + // returns a virtual number for precedence for the operator. We expect binary operator only, otherwise the lowest number + // 0 is returned. Higher the number, higher the precedence of the operator. + INT NPrecedenceOfOp(int nopCode) + { + static BYTE rgbPrec[] = { 0,0, IDC_OR,0, IDC_XOR,0, IDC_AND,1, + IDC_ADD,2, IDC_SUB,2, IDC_RSHF,3, IDC_LSHF,3, + IDC_MOD,3, IDC_DIV,3, IDC_MUL,3, IDC_PWR,4, IDC_ROOT, 4 }; + int iPrec; - iPrec = 0; - while ((iPrec < ARRAYSIZE(rgbPrec)) && (nopCode != rgbPrec[iPrec])) - { - iPrec += 2; - } - if (iPrec >= ARRAYSIZE(rgbPrec)) - { iPrec = 0; - } - return rgbPrec[iPrec + 1]; + while ((iPrec < ARRAYSIZE(rgbPrec)) && (nopCode != rgbPrec[iPrec])) + { + iPrec += 2; + } + if (iPrec >= ARRAYSIZE(rgbPrec)) + { + iPrec = 0; + } + return rgbPrec[iPrec + 1]; + } } // HandleErrorCommand diff --git a/src/CalcManager/CalcException.h b/src/CalcManager/CalcException.h deleted file mode 100644 index e63b1837..00000000 --- a/src/CalcManager/CalcException.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -class CalcException : public std::exception -{ -public: - CalcException(HRESULT hr) - { - m_hr = hr; - } - HRESULT GetException() - { - return m_hr; - } -private: - HRESULT m_hr; -}; - -void IFT(HRESULT hr) -{ - if (FAILED(hr)) - { - CalcException exception(hr); - throw(exception); - } -} diff --git a/src/CalcManager/CalcManager.vcxproj.filters b/src/CalcManager/CalcManager.vcxproj.filters index 9be2a455..2ca11666 100644 --- a/src/CalcManager/CalcManager.vcxproj.filters +++ b/src/CalcManager/CalcManager.vcxproj.filters @@ -119,7 +119,6 @@ RatPack - Header Files @@ -162,4 +161,4 @@ Header Files - \ No newline at end of file + diff --git a/src/CalcViewModel/Common/AppResourceProvider.cpp b/src/CalcViewModel/Common/AppResourceProvider.cpp index d7982827..45d3a31c 100644 --- a/src/CalcViewModel/Common/AppResourceProvider.cpp +++ b/src/CalcViewModel/Common/AppResourceProvider.cpp @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#pragma once - #include "pch.h" #include "AppResourceProvider.h" diff --git a/src/CalcViewModel/Common/TraceLogger.cpp b/src/CalcViewModel/Common/TraceLogger.cpp index 35f11273..c83752b1 100644 --- a/src/CalcViewModel/Common/TraceLogger.cpp +++ b/src/CalcViewModel/Common/TraceLogger.cpp @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#pragma once - #include "pch.h" #include "TraceLogger.h" #include "NetworkManager.h" diff --git a/src/CalculatorUnitTests/Mocks/CurrencyHttpClient.cpp b/src/CalculatorUnitTests/Mocks/CurrencyHttpClient.cpp index 56b6fd27..85395c56 100644 --- a/src/CalculatorUnitTests/Mocks/CurrencyHttpClient.cpp +++ b/src/CalculatorUnitTests/Mocks/CurrencyHttpClient.cpp @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#pragma once - #include "pch.h" #include "CurrencyHttpClient.h"