Updating comments per the C++ core guidelines and removing trailing whitespace (#194)

Fixed comments that were inconsistent with the style guidelines described in C++ core guidelines and the modern C++/WinRT language projections and removed trailing whitespace.

Inserted a space after the beginning of the comment so the text wasn't touching the // on all occurrences.

Removed all occurrences of trailing whitespace
This commit is contained in:
Will 2019-03-15 02:30:07 -04:00 committed by Howard Wolosky
parent 62317fd63b
commit 1113ff4b86
82 changed files with 509 additions and 510 deletions

View File

@ -60,7 +60,7 @@ void CCalcEngine::HandleErrorCommand(WPARAM idc)
{
if (!IsGuiSettingOpCode(idc))
{
// we would have saved the prev command. Need to forget this state
// We would have saved the prev command. Need to forget this state
m_nTempCom = m_nLastCom;
}
}
@ -182,7 +182,7 @@ void CCalcEngine::ProcessCommandWorker(WPARAM wParam)
// BINARY OPERATORS:
if (IsBinOpCode(wParam))
{
/* Change the operation if last input was operation. */
// Change the operation if last input was operation.
if (IsBinOpCode(m_nLastCom))
{
INT nPrev;
@ -1027,7 +1027,7 @@ wstring CCalcEngine::GetCurrentResultForRadix(uint32_t radix, int32_t precision)
wstring numberString = GetStringForDisplay(rat, radix);
if (!numberString.empty())
{
//revert the precision to previously stored precision
// Revert the precision to previously stored precision
ChangeConstants(m_radix, m_precision);
}

View File

@ -216,4 +216,3 @@ void modrat( PRAT *pa, PRAT b )
destroyrat( tmp );
}

View File

@ -479,7 +479,7 @@ wstring UnitConverter::Unquote(const wstring& s)
}
if (cursor == s.end())
{
//badly formatted
// Badly formatted
break;
}
else

View File

@ -54,7 +54,7 @@ double Utils::GetDoubleFromWstring(wstring input)
return ::atof(inputString.c_str());
}
//returns windowId for the current view
// Returns windowId for the current view
int Utils::GetWindowId()
{
int windowId = -1;
@ -80,20 +80,20 @@ void Utils::RunOnUIThreadNonblocking(std::function<void()>&& function, _In_ Core
}
}
// returns if the last character of a wstring is the target wchar_t
// Returns if the last character of a wstring is the target wchar_t
bool Utils::IsLastCharacterTarget(_In_ wstring const &input, _In_ wchar_t target)
{
return !input.empty() && input.back() == target;
}
//return wstring after removing characters like space, comma, and double quotes
// Returns wstring after removing characters like space, comma, and double quotes
wstring Utils::RemoveUnwantedCharsFromWstring(wstring input)
{
wchar_t unWantedChars[] = { L' ', L',', L'"', 8234, 8235, 8236, 8237 };
return RemoveUnwantedCharsFromWstring(input, unWantedChars, 6);
}
//return wstring after removing characters specified by unwantedChars array
// Returns wstring after removing characters specified by unwantedChars array
wstring Utils::RemoveUnwantedCharsFromWstring(wstring input, wchar_t* unwantedChars, unsigned int size)
{
for (unsigned int i = 0; i < size; ++i)
@ -110,7 +110,7 @@ void Utils::SerializeCommandsAndTokens(_In_ shared_ptr<CalculatorVector <pair<ws
unsigned int commandsSize;
IFTPlatformException(commands->GetSize(&commandsSize));
// save the size of the commands vector
// Save the size of the commands vector
writer->WriteUInt32(commandsSize);
SerializeCommandVisitor cmdVisitor(writer);

View File

@ -1981,7 +1981,7 @@ void StandardCalculatorViewModel::UpdatecommandsInRecordingMode()
}
else
{
//reset all vars
// Reset all vars
isDecimal = false;
isNegative = false;
isExpMode = false;

View File

@ -29,9 +29,9 @@ namespace CalculatorApp
AppLifecycleLogger();
// Any new Log method should
// a) decide the level of logging. This will help us in limiting recording of events only up to a certain level. See this link for guidance https://msdn.microsoft.com/en-us/library/windows/desktop/aa363742(v=vs.85).aspx
// a) Decide the level of logging. This will help us in limiting recording of events only up to a certain level. See this link for guidance https://msdn.microsoft.com/en-us/library/windows/desktop/aa363742(v=vs.85).aspx
// We're using Verbose level for events that are called frequently and needed only for debugging or capturing perf for specific scenarios
// b) should decide whether or not to log to telemetry and pass TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY) accordingly
// b) Should decide whether or not to log to telemetry and pass TraceLoggingKeyword(MICROSOFT_KEYWORD_TELEMETRY) accordingly
// c) Should accept a variable number of additional data arguments if needed
void LogAppLifecycleEvent(winrt::hstring const& eventName, winrt::Windows::Foundation::Diagnostics::LoggingFields const& fields) const;
void PopulateAppInfo(winrt::Windows::Foundation::Diagnostics::LoggingFields& fields) const;

View File

@ -790,7 +790,7 @@ namespace CalculatorUnitTests
VERIFY_ARE_EQUAL((int)viewModel->MemorizedNumbers->Size, 2);
}
//when memory list is empty and M+ is pressed
// When memory list is empty and M+ is pressed
TEST_METHOD(OnMemoryAddWhenMemoryEmpty)
{
m_viewModel->IsStandard = true;
@ -808,7 +808,7 @@ namespace CalculatorUnitTests
}
//when memory list is empty and M- is pressed
// When memory list is empty and M- is pressed
TEST_METHOD(OnMemorySubtractWhenMemoryEmpty)
{
m_viewModel->IsStandard = true;
@ -825,7 +825,7 @@ namespace CalculatorUnitTests
VERIFY_ARE_EQUAL(Platform::StringReference(L"-1,001"), m_viewModel->DisplayValue);
}
//when negative number is saved in memory
// When negative number is saved in memory
TEST_METHOD(OnNegativeEntryInMemory)
{
ChangeMode(m_viewModel, 0/*Standard*/);
@ -851,7 +851,7 @@ namespace CalculatorUnitTests
VERIFY_ARE_EQUAL(Platform::StringReference(L"-1,001"), Utils::GetStringValue(memorySlotProgrammer->Value));
}
//when decimal number is saved in memory
// When decimal number is saved in memory
TEST_METHOD(OnDecimalEntryInMemory)
{
ChangeMode(m_viewModel, 0/*Standard*/);
@ -878,7 +878,7 @@ namespace CalculatorUnitTests
VERIFY_ARE_EQUAL(Platform::StringReference(L"1,001"), Utils::GetStringValue(memorySlotProgrammer->Value));
}
//when negative decimal number is saved in memory
// When negative decimal number is saved in memory
TEST_METHOD(OnNegativeDecimalInMemory)
{
m_viewModel->IsStandard = true;
@ -898,7 +898,7 @@ namespace CalculatorUnitTests
VERIFY_ARE_EQUAL(Platform::StringReference(L"-1,001.1"), m_viewModel->DisplayValue);
}
//when decimal number is added to the memory
// When decimal number is added to the memory
TEST_METHOD(OnDecimalAddedToMemory)
{
m_viewModel->IsStandard = true;
@ -928,7 +928,7 @@ namespace CalculatorUnitTests
VERIFY_ARE_EQUAL(Platform::StringReference(L"2,002.1"), m_viewModel->DisplayValue);
}
//when memory is saved in programmer as Hex value and then we switch to standard mode, test to see that memory gets converted to decimal
// When memory is saved in programmer as Hex value and then we switch to standard mode, test to see that memory gets converted to decimal
TEST_METHOD(OnMemorySavedInHexRadixAndSwitchedToStandardMode)
{
ChangeMode(m_viewModel, 2/*programmer*/);
@ -1014,7 +1014,7 @@ namespace CalculatorUnitTests
VERIFY_ARE_EQUAL(Platform::StringReference(L"1,001"), m_viewModel->DisplayValue);
}
// verify nothing happens if there is no memory and the memory slot pressed action is taken
// Verify nothing happens if there is no memory and the memory slot pressed action is taken
TEST_METHOD(OnMemoryItemPressedNoMemory)
{
TESTITEM items[] = {

View File

@ -302,7 +302,7 @@ namespace CalculatorUnitTests
vm->Value1Active = false;
vm->Unit2 = unitList->GetAt(j);
wstring unit2Name = vm->Unit2->Name->Data();
//change value2 as 1.
// Change value2 as 1.
vm->ButtonPressed->Execute(NumbersAndOperatorsEnum::One);
String^ expectedResult = m_resLoader->GetString(ref new String((unit1Name + L"-" + unit2Name).c_str()));
@ -315,10 +315,10 @@ namespace CalculatorUnitTests
double actualConversion = GetDoubleFromWstring(GetStringValue(vm->Value1)->Data());
double diff = abs(expectedConversion - actualConversion);
// assert for diff less than epsilonth fraction of expected conversion result
// Assert for diff less than epsilonth fraction of expected conversion result
VERIFY_IS_LESS_THAN_OR_EQUAL(diff, epsilon*expectedConversion);
}
//clearing the value1
// Clearing the value1
vm->ButtonPressed->Execute(NumbersAndOperatorsEnum::Clear);
}
}
@ -393,7 +393,7 @@ namespace CalculatorUnitTests
shared_ptr<UnitConverterMock> mock = make_shared<UnitConverterMock>();
VM::UnitConverterViewModel vm(mock);
vm.Unit1 = vm.Units->GetAt(1); // Change from u4 to u5
// count will be 2 here since it was already called once at init
// Count will be 2 here since it was already called once at init
VERIFY_ARE_EQUAL((UINT)2, mock->m_setCurUnitTypesCallCount);
VERIFY_IS_TRUE(UNIT5 == mock->m_curFrom);
VERIFY_IS_TRUE(UNIT6 == mock->m_curTo);
@ -409,7 +409,7 @@ namespace CalculatorUnitTests
shared_ptr<UnitConverterMock> mock = make_shared<UnitConverterMock>();
VM::UnitConverterViewModel vm(mock);
vm.CurrentCategory = vm.Categories->GetAt(2); // Change from cat1 to cat3
// counts will be 2 here since the first call should have happened during init
// Counts will be 2 here since the first call should have happened during init
VERIFY_IS_GREATER_THAN_OR_EQUAL(2u, mock->m_setCurrentCategoryCallCount);
VERIFY_ARE_EQUAL((UINT)3, vm.Units->Size);
VERIFY_IS_TRUE(UNIT7 == vm.Units->GetAt(0)->GetModelUnit());
@ -424,7 +424,7 @@ namespace CalculatorUnitTests
shared_ptr<UnitConverterMock> mock = make_shared<UnitConverterMock>();
VM::UnitConverterViewModel vm(mock);
vm.CurrentCategory = vm.Categories->GetAt(2); // Change from cat1 to cat3
// counts will be 2 here since the first call should have happened during init
// Counts will be 2 here since the first call should have happened during init
VERIFY_IS_GREATER_THAN_OR_EQUAL(2u, mock->m_setCurrentCategoryCallCount);
VERIFY_IS_TRUE(UNIT9 == vm.Unit1->GetModelUnit());
VERIFY_IS_TRUE(UNIT7 == vm.Unit2->GetModelUnit());