diff --git a/docs/ApplicationArchitecture.md b/docs/ApplicationArchitecture.md index 4f71b10e..0d7c2ff3 100644 --- a/docs/ApplicationArchitecture.md +++ b/docs/ApplicationArchitecture.md @@ -87,7 +87,7 @@ The ViewModel layer is contained in the [CalcViewModel][CalcViewModel folder] pr data for the UI to bind against and act as the intermediary separating pure business logic from UI components that should not care about the model's implementation. Just as the View layer consists of a hierarchy of XAML files, the ViewModel consists of a hierarchy of ViewModel files. The relationship between XAML and ViewModel files is often 1:1. -Here are the noteable ViewModel files to start exploring with: +Here are the notable ViewModel files to start exploring with: * [ApplicationViewModel.h][ApplicationViewModel.h]: The ViewModel for [MainPage.xaml][MainPage.xaml]. This ViewModel is the root of the other mode-specific ViewModels. The application changes between modes by updating the `Mode` property @@ -199,4 +199,4 @@ The RatPack (short for Rational Pack) is the core of the Calculator model and co [CalcManager folder]: ../src/CalcManager [CalculatorManager.h]: ../src/CalcManager/CalculatorManager.h [CalcEngine.h]: ../src/CalcManager/Header Files/CalcEngine.h -[ratpak.h]: ../src/CalcManager/Ratpack/ratpak.h \ No newline at end of file +[ratpak.h]: ../src/CalcManager/Ratpack/ratpak.h diff --git a/docs/ManualTests.md b/docs/ManualTests.md index deb8111a..6fbc6716 100644 --- a/docs/ManualTests.md +++ b/docs/ManualTests.md @@ -11,7 +11,7 @@ These manual tests are run before every release of the Calculator app. Steps: 1. From the Standard Calculator page, input “3”, “+”, “3”, “Enter” on the keyboard Expected: “6” shows up in the display -2. Input “4”, “-“, “2”, “=” using the in-app buttons +2. Input “4”, “-”, “2”, “=” using the in-app buttons *Expected: “2” shows up in the display* **Test 2** @@ -31,7 +31,7 @@ Steps: **Test 2** Steps: -1. Input “5”, “n!“, “=” using the in-app buttons +1. Input “5”, “n!”, “=” using the in-app buttons *Expected: “120” shows up in the display* ### Math in Programmer Calculator diff --git a/src/CalcManager/CEngine/History.cpp b/src/CalcManager/CEngine/History.cpp index 5724af2b..3520b974 100644 --- a/src/CalcManager/CEngine/History.cpp +++ b/src/CalcManager/CEngine/History.cpp @@ -35,8 +35,8 @@ void CHistoryCollector::ReinitHistory() CHistoryCollector::CHistoryCollector(ICalcDisplay *pCalcDisplay, std::shared_ptr pHistoryDisplay, wchar_t decimalSymbol) : m_pHistoryDisplay(pHistoryDisplay), m_pCalcDisplay(pCalcDisplay), - m_decimalSymbol(decimalSymbol), - m_iCurLineHistStart(-1) + m_iCurLineHistStart(-1), + m_decimalSymbol(decimalSymbol) { ReinitHistory(); } @@ -161,7 +161,7 @@ void CHistoryCollector::PopLastOpndStart() void CHistoryCollector::AddOpenBraceToHistory() { - int iCommandEnd = AddCommand(std::make_shared(IDC_OPENP)); + AddCommand(std::make_shared(IDC_OPENP)); int ichOpndStart = IchAddSzToEquationSz(CCalcEngine::OpCodeToString(IDC_OPENP), -1); PushLastOpndStart(ichOpndStart); @@ -171,7 +171,7 @@ void CHistoryCollector::AddOpenBraceToHistory() void CHistoryCollector::AddCloseBraceToHistory() { - int iCommandEnd = AddCommand(std::make_shared(IDC_CLOSEP)); + AddCommand(std::make_shared(IDC_CLOSEP)); IchAddSzToEquationSz(CCalcEngine::OpCodeToString(IDC_CLOSEP), -1); SetExpressionDisplay(); PopLastOpndStart(); @@ -450,20 +450,16 @@ std::shared_ptr> CHistoryCollector::GetOperandCommandsFrom std::shared_ptr> commands = std::make_shared>(); // Check for negate bool fNegative = (numStr[0] == L'-'); - bool fSciFmt = false; - bool fDecimal = false; for (size_t i = (fNegative ? 1 : 0); i < numStr.length(); i++) { if (numStr[i] == m_decimalSymbol) { IFT(commands->Append(IDC_PNT)); - fDecimal = true; } else if (numStr[i] == L'e') { IFT(commands->Append(IDC_EXP)); - fSciFmt = true; } else if (numStr[i] == L'-') { diff --git a/src/CalcManager/CEngine/calc.cpp b/src/CalcManager/CEngine/calc.cpp index 7142dffc..17aa7847 100644 --- a/src/CalcManager/CEngine/calc.cpp +++ b/src/CalcManager/CEngine/calc.cpp @@ -55,42 +55,42 @@ void CCalcEngine::InitialOneTimeOnlySetup(CalculationManager::IResourceProvider& // ////////////////////////////////////////////////// CCalcEngine::CCalcEngine(bool fPrecedence, bool fIntegerMode, CalculationManager::IResourceProvider* const pResourceProvider, __in_opt ICalcDisplay *pCalcDisplay, __in_opt shared_ptr pHistoryDisplay) : - m_HistoryCollector(pCalcDisplay, pHistoryDisplay, DEFAULT_DEC_SEPARATOR), - m_resourceProvider(pResourceProvider), - m_bSetCalcState(false), m_fPrecedence(fPrecedence), m_fIntegerMode(fIntegerMode), m_pCalcDisplay(pCalcDisplay), - m_input(DEFAULT_DEC_SEPARATOR), + m_resourceProvider(pResourceProvider), m_nOpCode(0), m_nPrevOpCode(0), - m_openParenCount(0), - m_precedenceOpCount(0), - m_nTempCom(0), - m_nLastCom(0), - m_parenVals{}, - m_precedenceVals{}, m_bChangeOp(false), m_bRecord(false), - m_bError(false), - m_bInv(false), + m_bSetCalcState(false), + m_input(DEFAULT_DEC_SEPARATOR), m_nFE(FMT_FLOAT), m_nAE(AUTOFMT_DISABLED), + m_memoryValue{ make_unique() }, + m_holdVal{}, + m_currentVal{}, + m_lastVal{}, + m_parenVals{}, + m_precedenceVals{}, + m_bError(false), + m_bInv(false), m_bNoPrevEqu(true), - m_numwidth(QWORD_WIDTH), - m_angletype(ANGLE_DEG), m_radix(DEFAULT_RADIX), m_precision(DEFAULT_PRECISION), m_cIntDigitsSav(DEFAULT_MAX_DIGITS), m_decGrouping(), - m_groupSeparator(DEFAULT_GRP_SEPARATOR), m_numberString(DEFAULT_NUMBER_STR), + m_nTempCom(0), + m_openParenCount(0), m_nOp(), m_nPrecOp(), - m_memoryValue{ make_unique() }, - m_holdVal{}, - m_currentVal{}, - m_lastVal{} + m_precedenceOpCount(0), + m_nLastCom(0), + m_angletype(ANGLE_DEG), + m_numwidth(QWORD_WIDTH), + m_HistoryCollector(pCalcDisplay, pHistoryDisplay, DEFAULT_DEC_SEPARATOR), + m_groupSeparator(DEFAULT_GRP_SEPARATOR) { InitChopNumbers(); diff --git a/src/CalcManager/CEngine/scifunc.cpp b/src/CalcManager/CEngine/scifunc.cpp index eb513ea8..75fbbfcf 100644 --- a/src/CalcManager/CEngine/scifunc.cpp +++ b/src/CalcManager/CEngine/scifunc.cpp @@ -173,6 +173,7 @@ CalcEngine::Rational CCalcEngine::SciCalcFunctions(CalcEngine::Rational const& r // the degrees functionality was achieved as 'Inv' of 'dms' operation, // so setting the IDC_INV command first and then performing 'dms' operation as global variables m_bInv, m_bRecord // are set properly through ProcessCommand(IDC_INV) + [[fallthrough]]; case IDC_DMS: { if (!m_fIntegerMode) diff --git a/src/CalcManager/Header Files/CalcInput.h b/src/CalcManager/Header Files/CalcInput.h index 22b2b563..0f86f4f5 100644 --- a/src/CalcManager/Header Files/CalcInput.h +++ b/src/CalcManager/Header Files/CalcInput.h @@ -14,8 +14,8 @@ namespace CalcEngine { public: CalcNumSec() : - m_isNegative(false), - value() + value(), + m_isNegative(false) {} void Clear(); @@ -37,12 +37,12 @@ namespace CalcEngine {} CalcInput(wchar_t decSymbol) : - m_base(), - m_exponent(), m_hasExponent(false), m_hasDecimal(false), m_decPtIndex(0), - m_decSymbol(decSymbol) + m_decSymbol(decSymbol), + m_base(), + m_exponent() {} void Clear(); diff --git a/src/CalcManager/Ratpack/exp.cpp b/src/CalcManager/Ratpack/exp.cpp index ec87204a..97d02c6b 100644 --- a/src/CalcManager/Ratpack/exp.cpp +++ b/src/CalcManager/Ratpack/exp.cpp @@ -235,7 +235,7 @@ void log10rat( PRAT *px, int32_t precision) } // -// return if the given x is even number. The assumption here is its numerator is 1 and we are testing the numerator is +// return if the given x is even number. The assumption here is its denominator is 1 and we are testing the numerator is // even or not bool IsEven(PRAT x, uint32_t radix, int32_t precision) { diff --git a/src/CalcManager/UnitConverter.cpp b/src/CalcManager/UnitConverter.cpp index 587a311c..07f75d33 100644 --- a/src/CalcManager/UnitConverter.cpp +++ b/src/CalcManager/UnitConverter.cpp @@ -903,7 +903,7 @@ shared_ptr UnitConverter::GetDataLoaderForCategory(const C } /// -/// Sets the intial values for m_fromType and m_toType. +/// Sets the initial values for m_fromType and m_toType. /// This is an internal helper method as opposed to SetCurrentUnits /// which is for external use by clients. /// If we fail to set units, we will fallback to the EMPTY_UNIT. diff --git a/src/CalcViewModel/Common/KeyboardShortcutManager.cpp b/src/CalcViewModel/Common/KeyboardShortcutManager.cpp index d8c40f49..248f65cc 100644 --- a/src/CalcViewModel/Common/KeyboardShortcutManager.cpp +++ b/src/CalcViewModel/Common/KeyboardShortcutManager.cpp @@ -441,8 +441,8 @@ void KeyboardShortcutManager::OnVirtualKeyControlInverseChordPropertyChanged( } } -// In the three event handlers bellow we will not mark the event as handled -// because this is a sumplemental operation and we don't want to interfere with +// In the three event handlers below we will not mark the event as handled +// because this is a supplemental operation and we don't want to interfere with // the normal keyboard handling. void KeyboardShortcutManager::OnCharacterReceivedHandler(CoreWindow^ sender, CharacterReceivedEventArgs^ args) { diff --git a/src/CalcViewModel/Common/Utils.h b/src/CalcViewModel/Common/Utils.h index 949ba0f0..d682a76a 100644 --- a/src/CalcViewModel/Common/Utils.h +++ b/src/CalcViewModel/Common/Utils.h @@ -398,7 +398,7 @@ namespace Utils static void On##name##PropertyChangedImpl(Windows::UI::Xaml::DependencyObject^ sender, Windows::UI::Xaml::DependencyPropertyChangedEventArgs^ args) {\ On##name##PropertyChanged(sender, safe_cast(args->OldValue), safe_cast(args->NewValue)); } public: -// This goes into the cpp to initalize the static variable +// This goes into the cpp to initialize the static variable #define DEPENDENCY_PROPERTY_INITIALIZATION(owner, name)\ Windows::UI::Xaml::DependencyProperty^ owner::s_##name##Property =\ owner::Initialize##name##Property(); diff --git a/src/Calculator/Views/SupplementaryResults.xaml.cpp b/src/Calculator/Views/SupplementaryResults.xaml.cpp index e8149936..e5d10494 100644 --- a/src/Calculator/Views/SupplementaryResults.xaml.cpp +++ b/src/Calculator/Views/SupplementaryResults.xaml.cpp @@ -103,13 +103,13 @@ void SupplementaryResults::OnConverterPropertyChanged(Object^ /*sender*/, Proper void SupplementaryResults::OnWindowSizeChanged(Platform::Object^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ e) { - // to reload supplementary results everytime the window is resized + // to reload supplementary results every time the window is resized RefreshData(); } void SupplementaryResults::OnSupplementaryValuesLayoutUpdated(Platform::Object^ sender, Platform::Object^ e) { - // This means we overflowed and are cutting off, or in a very rare case we fit exactly. Unforunately + // This means we overflowed and are cutting off, or in a very rare case we fit exactly. Unfortunately // the fitting exactly case will still have an item removed, as there is no other way for us to // detect that we need to trim. Grid^ parentGrid = dynamic_cast(VisualTreeHelper::GetParent(this)); diff --git a/src/CalculatorUnitTests/MultiWindowUnitTests.cpp b/src/CalculatorUnitTests/MultiWindowUnitTests.cpp index 7e14a11d..15817303 100644 --- a/src/CalculatorUnitTests/MultiWindowUnitTests.cpp +++ b/src/CalculatorUnitTests/MultiWindowUnitTests.cpp @@ -101,7 +101,7 @@ namespace CalculatorUnitTests } } - // Perform calculations on diferent calculator modes and verify that they work independently + // Perform calculations on different calculator modes and verify that they work independently TEST_METHOD(MultipleModesCalculationTest) { std::vector viewModels(3); diff --git a/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp b/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp index 640f163c..214c612f 100644 --- a/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp +++ b/src/CalculatorUnitTests/StandardViewModelUnitTests.cpp @@ -509,7 +509,7 @@ namespace CalculatorUnitTests } // Switch Calculator Mode and verify if mode switch is happening as expected. - // Test precendence to check if mode switch is happening + // Test precedence to check if mode switch is happening // Standard mode 1+2*3 = 9; Scientific mode 1+2*3 = 7 // Intermediate value is also different. after 1 + 2 * , standard shows 3, scientific shows 2 TEST_METHOD(ButtonPressedCalculatorModeSwitch)