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

@@ -3,9 +3,9 @@
#pragma once
namespace CalculatorApp { namespace Common
namespace CalculatorApp { namespace Common
{
ref class AlwaysSelectedCollectionView sealed:
ref class AlwaysSelectedCollectionView sealed:
public Windows::UI::Xaml::DependencyObject,
public Windows::UI::Xaml::Data::ICollectionView
{
@@ -14,11 +14,11 @@ namespace CalculatorApp { namespace Common
m_currentPosition(-1)
{
m_source = source;
Windows::UI::Xaml::Interop::IBindableObservableVector^ observable = dynamic_cast<Windows::UI::Xaml::Interop::IBindableObservableVector^>(source);
if (observable)
{
observable->VectorChanged +=
observable->VectorChanged +=
ref new Windows::UI::Xaml::Interop::BindableVectorChangedEventHandler(this, &AlwaysSelectedCollectionView::OnSourceBindableVectorChanged);
}
}
@@ -53,7 +53,7 @@ namespace CalculatorApp { namespace Common
return ref new Platform::Collections::Vector<Platform::Object^>();
}
}
property bool HasMoreItems
property bool HasMoreItems
{
virtual bool get() = Windows::UI::Xaml::Data::ICollectionView::HasMoreItems::get
{
@@ -77,11 +77,11 @@ namespace CalculatorApp { namespace Common
}
// The item is not in the collection
// We're going to schedule a call back later so we
// We're going to schedule a call back later so we
// restore the selection to the way we wanted it to begin with
if (m_currentPosition >= 0 && m_currentPosition < static_cast<int>(m_source->Size))
{
this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal,
this->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal,
ref new Windows::UI::Core::DispatchedHandler(
[this]()
{
@@ -161,7 +161,7 @@ namespace CalculatorApp { namespace Common
m_currentChanging -= token;
}
}
// IVector<Object^>
// Not implemented methods
virtual void Append(Platform::Object^ /*item*/) = Windows::Foundation::Collections::IVector<Platform::Object^>::Append
@@ -219,7 +219,7 @@ namespace CalculatorApp { namespace Common
return m_source->Size;
}
}
// IObservableVector<Object^>
event Windows::Foundation::Collections::VectorChangedEventHandler<Platform::Object^>^ VectorChanged
{
@@ -262,9 +262,9 @@ namespace CalculatorApp { namespace Common
private:
virtual Platform::Object^ Convert(
Platform::Object^ value,
Windows::UI::Xaml::Interop::TypeName /*targetType*/,
Platform::Object^ /*parameter*/,
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<Windows::UI::Xaml::Interop::IBindableVector^>(value);
@@ -276,9 +276,9 @@ namespace CalculatorApp { namespace Common
}
virtual Platform::Object^ ConvertBack(
Platform::Object^ /*value*/,
Windows::UI::Xaml::Interop::TypeName /*targetType*/,
Platform::Object^ /*parameter*/,
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;

View File

@@ -37,7 +37,7 @@ namespace CalculatorApp
m_appLifecycleProvider(
L"Microsoft.Windows.AppLifeCycle",
LoggingChannelOptions(GUID{ 0x4f50731a, 0x89cf, 0x4782, 0xb3, 0xe0, 0xdc, 0xe8, 0xc9, 0x4, 0x76, 0xba }), // Microsoft Telemetry group
GUID{ 0xef00584a, 0x2655, 0x462c, 0xbc, 0x24, 0xe7, 0xde, 0x63, 0xe, 0x7f, 0xbf }) //Unique provider ID {EF00584A-2655-462C-BC24-E7DE630E7FBF}
GUID{ 0xef00584a, 0x2655, 0x462c, 0xbc, 0x24, 0xe7, 0xde, 0x63, 0xe, 0x7f, 0xbf }) // Unique provider ID {EF00584A-2655-462C-BC24-E7DE630E7FBF}
{
}

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
// 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
// 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
// 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

@@ -18,17 +18,17 @@ void BindableBase::OnPropertyChanged(String^ propertyName)
PropertyChanged(this, ref new PropertyChangedEventArgs(propertyName));
}
Windows::UI::Xaml::Data::ICustomProperty^ BindableBase::GetCustomProperty(Platform::String^ name)
Windows::UI::Xaml::Data::ICustomProperty^ BindableBase::GetCustomProperty(Platform::String^ name)
{
return nullptr;
}
Windows::UI::Xaml::Data::ICustomProperty^ BindableBase::GetIndexedProperty(Platform::String^ name, Windows::UI::Xaml::Interop::TypeName type)
Windows::UI::Xaml::Data::ICustomProperty^ BindableBase::GetIndexedProperty(Platform::String^ name, Windows::UI::Xaml::Interop::TypeName type)
{
return nullptr;
}
Platform::String^ BindableBase::GetStringRepresentation()
Platform::String^ BindableBase::GetStringRepresentation()
{
return this->ToString();
return this->ToString();
}

View File

@@ -76,7 +76,7 @@ void CalculationResult::OnApplyTemplate()
if (m_textContainer)
{
m_textContainer->SizeChanged += ref new SizeChangedEventHandler(this, &CalculationResult::TextContainerSizeChanged);
// We want to know when the size of the container changes so
// We want to know when the size of the container changes so
// we can rescale the textbox
m_textContainerLayoutChangedToken = m_textContainer->LayoutUpdated += ref new EventHandler<Object^>(this, &CalculationResult::OnTextContainerLayoutUpdated);
@@ -154,15 +154,15 @@ void CalculationResult::OnIsInErrorPropertyChanged(bool /*oldValue*/, bool newVa
if (newValue)
{
// If there's an error message we need to override the normal display font
// with the font appropriate for this language. This is because the error
// with the font appropriate for this language. This is because the error
// message is localized and therefore can contain characters that are not
// available in the normal font.
// available in the normal font.
// We use UIText as the font type because this is the most common font type to use
m_textBlock->FontFamily = LocalizationService::GetInstance()->GetLanguageFontFamilyForType(LanguageFontType::UIText);
}
else
{
// The error result is no longer an error so we will restore the
// The error result is no longer an error so we will restore the
// value to FontFamily property to the value provided in the style
// for the TextBlock in the template.
m_textBlock->ClearValue(TextBlock::FontFamilyProperty);
@@ -175,7 +175,7 @@ void CalculationResult::UpdateVisualState()
{
VisualStateManager::GoToState(this, "Active", true);
}
else
else
{
VisualStateManager::GoToState(this, "Normal", true);
}
@@ -192,8 +192,8 @@ void CalculationResult::UpdateTextState()
String^ oldText = m_textBlock->Text;
String^ newText = Utils::LRO + DisplayValue + Utils::PDF;
//Initiate the scaling operation
//UpdateLayout will keep calling us until we make it through the below 2 if-statements
// Initiate the scaling operation
// UpdateLayout will keep calling us until we make it through the below 2 if-statements
if (!m_isScalingText || oldText != newText)
{
m_textBlock->Text = newText;
@@ -329,17 +329,17 @@ void CalculationResult::ShowHideScrollButtons(::Visibility vLeft, ::Visibility v
void CalculationResult::UpdateScrollButtons()
{
// When the width is smaller than the container, don't show any
if (m_textBlock->ActualWidth < m_textContainer->ActualWidth)
if (m_textBlock->ActualWidth < m_textContainer->ActualWidth)
{
ShowHideScrollButtons(::Visibility::Collapsed, ::Visibility::Collapsed);
}
// We have more number on both side. Show both arrows
else if (m_textContainer->HorizontalOffset > 0 && m_textContainer->HorizontalOffset < (m_textContainer->ExtentWidth - m_textContainer->ViewportWidth))
else if (m_textContainer->HorizontalOffset > 0 && m_textContainer->HorizontalOffset < (m_textContainer->ExtentWidth - m_textContainer->ViewportWidth))
{
ShowHideScrollButtons(::Visibility::Visible, ::Visibility::Visible);
}
// Width is larger than the container and left most part of the number is shown. Should be able to scroll left.
else if (m_textContainer->HorizontalOffset == 0)
else if (m_textContainer->HorizontalOffset == 0)
{
ShowHideScrollButtons(::Visibility::Collapsed, ::Visibility::Visible);
}

View File

@@ -54,7 +54,7 @@ void CalculatorButton::OnKeyUp(KeyRoutedEventArgs^ e)
}
void CalculatorButton::OnButtonIdPropertyChanged(
NumbersAndOperatorsEnum /*oldValue*/,
NumbersAndOperatorsEnum /*oldValue*/,
NumbersAndOperatorsEnum newValue)
{
this->CommandParameter = ref new CalculatorButtonPressedEventArgs(AuditoryFeedback, newValue);

View File

@@ -13,7 +13,7 @@ namespace CalculatorApp
public ref class CalculatorButton sealed: Windows::UI::Xaml::Controls::Button
{
public:
CalculatorButton();
DEPENDENCY_PROPERTY_OWNER(CalculatorButton);

View File

@@ -43,7 +43,7 @@ void FlipButtons::OnKeyUp(KeyRoutedEventArgs^ e)
}
void FlipButtons::OnButtonIdPropertyChanged(
NumbersAndOperatorsEnum /*oldValue*/,
NumbersAndOperatorsEnum /*oldValue*/,
NumbersAndOperatorsEnum newValue)
{
this->CommandParameter = newValue;

View File

@@ -29,7 +29,7 @@ namespace CalculatorApp
private:
void OnButtonIdPropertyChanged(
NumbersAndOperatorsEnum oldValue,
NumbersAndOperatorsEnum oldValue,
NumbersAndOperatorsEnum newValue);
};
}

View File

@@ -23,7 +23,7 @@ using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
void OperandTextBox::OnApplyTemplate()
{
{
this->IsEnabled = false;
this->IsHitTestVisible = false;
this->IsTapEnabled = false;

View File

@@ -34,22 +34,22 @@ void OverflowTextBlock::OnApplyTemplate()
m_expressionContainer = safe_cast<ScrollViewer^>(GetTemplateChild("expressionContainer"));
m_expressionContainer->ChangeView(m_expressionContainer->ExtentWidth - m_expressionContainer->ViewportWidth, nullptr, nullptr);
m_scrollLeft = safe_cast<Button^>(GetTemplateChild("scrollLeft"));
m_scrollRight = safe_cast<Button^>(GetTemplateChild("scrollRight"));
m_scrollLeftClickEventToken = m_scrollLeft->Click += ref new RoutedEventHandler(this, &OverflowTextBlock::OnScrollClick);
m_scrollRightClickEventToken = m_scrollRight->Click += ref new RoutedEventHandler(this, &OverflowTextBlock::OnScrollClick);
m_scrollingLeft = false;
m_scrollingRight = false;
auto borderContainer = safe_cast<Border^>(GetTemplateChild("expressionborder"));
m_pointerEnteredEventToken = borderContainer->PointerEntered += ref new PointerEventHandler(this, &OverflowTextBlock::OnPointerEntered);
m_pointerExitedEventToken = borderContainer->PointerExited += ref new PointerEventHandler(this, &OverflowTextBlock::OnPointerExited);
m_listView = safe_cast<ListView^>(GetTemplateChild("TokenList"));
UpdateAllState();
}

View File

@@ -12,7 +12,7 @@ namespace CalculatorApp
public ref class OverflowTextBlock sealed : public Windows::UI::Xaml::Controls::Control
{
public:
OverflowTextBlock()
OverflowTextBlock()
{
}

View File

@@ -16,7 +16,7 @@ namespace CalculatorApp
public:
static constexpr Windows::UI::Xaml::Visibility Convert(bool visibility)
{
return visibility
return visibility
? Windows::UI::Xaml::Visibility::Visible
: Windows::UI::Xaml::Visibility::Collapsed;
}

View File

@@ -51,7 +51,7 @@ UnitConverter::UnitConverter() :
{
InitializeComponent();
//adding ESC key shortcut binding to clear button
// adding ESC key shortcut binding to clear button
clearEntryButtonPos0->SetValue(Common::KeyboardShortcutManager::VirtualKeyProperty, Common::MyVirtualKey::Escape);
m_layoutDirection = LocalizationService::GetInstance()->GetFlowDirection();
@@ -278,7 +278,7 @@ void UnitConverter::AnimateConverter()
void UnitConverter::OnValueSelected(_In_ Platform::Object^ sender)
{
auto value = safe_cast<CalculationResult^>(sender);
//update the font size since the font is changed to bold
// update the font size since the font is changed to bold
value->UpdateTextState();
safe_cast<UnitConverterViewModel^>(this->DataContext)->OnValueActivated(AsActivatable(value));
}

View File

@@ -82,7 +82,7 @@ namespace CalculatorApp
assert(frame->BackStackDepth == 0);
m_frame = frame;
}
void WindowFrameService::RegisterOnWindowClosingHandler(function<void()> onWindowClosingHandler)
{
m_onWindowClosingHandlers.push_back(onWindowClosingHandler);

View File

@@ -6,7 +6,7 @@
namespace CalculatorApp
{
public ref class WindowFrameService sealed
{
public:
@@ -16,16 +16,16 @@ namespace CalculatorApp
internal:
// createdByUs means any window that we create.
// !createdByUs means the main window
static WindowFrameService^ CreateNewWindowFrameService(_In_ Windows::UI::Xaml::Controls::Frame^ viewFrame,
bool createdByUs,
static WindowFrameService^ CreateNewWindowFrameService(_In_ Windows::UI::Xaml::Controls::Frame^ viewFrame,
bool createdByUs,
Platform::WeakReference parent);
Windows::UI::Core::CoreDispatcher^ GetCoreDispatcher();
int GetViewId();
void RegisterOnWindowClosingHandler(std::function<void()> onWindowClosingHandler);
concurrency::task<void> HandleViewRelease();
// Throws InvalidArgumentException if a service is already registered with the specified id
void RegisterRuntimeWindowService(Windows::UI::Xaml::Interop::TypeName serviceId, _In_opt_ Platform::Object^ service);
@@ -53,7 +53,7 @@ namespace CalculatorApp
Platform::Agile<Windows::UI::Core::CoreWindow^> m_currentWindow;
Platform::Agile<Windows::UI::Core::CoreDispatcher^> m_coreDispatcher;
Windows::UI::Xaml::Controls::Frame^ m_frame;
int m_viewId;
int m_viewId;
Platform::WeakReference m_parent;
std::unordered_map<Platform::String^, Platform::Object^> m_runtimeServicesMap;