mirror of
https://github.com/microsoft/terminal.git
synced 2026-07-08 17:56:28 +00:00
Upgrade clang-format to 15.0.7 (#15110)
Upgrading clang-format lead to a few changes in the formatting of code inside macros. Apart from the upgrade, I've also spent some time removing all options from .clang-format that are redundant with `BasedOnStyle: Microsoft`.
This commit is contained in:
@@ -1,57 +1,25 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
BasedOnStyle: Microsoft
|
||||||
AccessModifierOffset: -4
|
AccessModifierOffset: -4
|
||||||
AlignAfterOpenBracket: Align
|
|
||||||
AllowAllArgumentsOnNextLine: true
|
|
||||||
AlignConsecutiveMacros: false
|
|
||||||
AlignConsecutiveAssignments: false
|
|
||||||
AlignConsecutiveDeclarations: false
|
|
||||||
AllowAllConstructorInitializersOnNextLine: true
|
|
||||||
AlignEscapedNewlines: Left
|
AlignEscapedNewlines: Left
|
||||||
AlignOperands: true
|
|
||||||
AlignTrailingComments: false
|
AlignTrailingComments: false
|
||||||
AllowAllParametersOfDeclarationOnNextLine: false
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
AllowShortBlocksOnASingleLine: Never
|
|
||||||
AllowShortFunctionsOnASingleLine: All
|
AllowShortFunctionsOnASingleLine: All
|
||||||
AllowShortCaseLabelsOnASingleLine: false
|
|
||||||
AllowShortIfStatementsOnASingleLine: Never
|
|
||||||
#AllowShortLambdasOnASingleLine: Inline
|
|
||||||
AllowShortLoopsOnASingleLine: false
|
|
||||||
AlwaysBreakAfterReturnType: None
|
|
||||||
AlwaysBreakBeforeMultilineStrings: false
|
|
||||||
AlwaysBreakTemplateDeclarations: Yes
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
BinPackArguments: false
|
BinPackArguments: false
|
||||||
BinPackParameters: false
|
BinPackParameters: false
|
||||||
BraceWrapping:
|
BraceWrapping:
|
||||||
AfterCaseLabel: true
|
AfterCaseLabel: true
|
||||||
AfterClass: true
|
|
||||||
AfterControlStatement: true
|
|
||||||
AfterEnum: true
|
|
||||||
AfterFunction: true
|
|
||||||
AfterNamespace: true
|
|
||||||
AfterObjCDeclaration: true
|
|
||||||
AfterStruct: true
|
|
||||||
AfterUnion: true
|
AfterUnion: true
|
||||||
AfterExternBlock: false
|
AfterExternBlock: false
|
||||||
BeforeCatch: true
|
|
||||||
BeforeElse: true
|
|
||||||
IndentBraces: false
|
|
||||||
SplitEmptyFunction: true
|
|
||||||
SplitEmptyRecord: true
|
|
||||||
SplitEmptyNamespace: true
|
|
||||||
BreakBeforeBinaryOperators: None
|
|
||||||
BreakBeforeBraces: Custom
|
|
||||||
BreakBeforeTernaryOperators: false
|
BreakBeforeTernaryOperators: false
|
||||||
BreakConstructorInitializers: AfterColon
|
BreakConstructorInitializers: AfterColon
|
||||||
BreakInheritanceList: AfterColon
|
BreakInheritanceList: AfterColon
|
||||||
ColumnLimit: 0
|
ColumnLimit: 0
|
||||||
CommentPragmas: "suppress"
|
CommentPragmas: "suppress"
|
||||||
CompactNamespaces: false
|
|
||||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
ConstructorInitializerIndentWidth: 4
|
|
||||||
ContinuationIndentWidth: 4
|
|
||||||
Cpp11BracedListStyle: false
|
Cpp11BracedListStyle: false
|
||||||
DeriveLineEnding: true
|
|
||||||
DerivePointerAlignment: false
|
|
||||||
FixNamespaceComments: false
|
FixNamespaceComments: false
|
||||||
IncludeBlocks: Regroup
|
IncludeBlocks: Regroup
|
||||||
IncludeCategories:
|
IncludeCategories:
|
||||||
@@ -63,35 +31,13 @@ IncludeCategories:
|
|||||||
Priority: 2
|
Priority: 2
|
||||||
- Regex: '.*'
|
- Regex: '.*'
|
||||||
Priority: 3
|
Priority: 3
|
||||||
IndentCaseLabels: false
|
|
||||||
IndentPPDirectives: None
|
|
||||||
IndentWidth: 4
|
|
||||||
IndentWrappedFunctionNames: false
|
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
MacroBlockBegin: "BEGIN_TEST_METHOD_PROPERTIES|BEGIN_MODULE|BEGIN_TEST_CLASS|BEGIN_TEST_METHOD"
|
MacroBlockBegin: "BEGIN_TEST_METHOD_PROPERTIES|BEGIN_MODULE|BEGIN_TEST_CLASS|BEGIN_TEST_METHOD"
|
||||||
MacroBlockEnd: "END_TEST_METHOD_PROPERTIES|END_MODULE|END_TEST_CLASS|END_TEST_METHOD"
|
MacroBlockEnd: "END_TEST_METHOD_PROPERTIES|END_MODULE|END_TEST_CLASS|END_TEST_METHOD"
|
||||||
MaxEmptyLinesToKeep: 1
|
|
||||||
NamespaceIndentation: All
|
NamespaceIndentation: All
|
||||||
PointerAlignment: Left
|
PointerAlignment: Left
|
||||||
ReflowComments: false
|
ReflowComments: false
|
||||||
SortIncludes: false
|
SortIncludes: false
|
||||||
SortUsingDeclarations: true
|
|
||||||
SpaceAfterCStyleCast: false
|
|
||||||
SpaceAfterLogicalNot: false
|
|
||||||
SpaceAfterTemplateKeyword: false
|
SpaceAfterTemplateKeyword: false
|
||||||
SpaceBeforeAssignmentOperators: true
|
|
||||||
SpaceBeforeCpp11BracedList: false
|
|
||||||
SpaceBeforeCtorInitializerColon: true
|
|
||||||
SpaceBeforeInheritanceColon: true
|
|
||||||
SpaceBeforeParens: ControlStatements
|
|
||||||
SpaceBeforeRangeBasedForLoopColon: true
|
|
||||||
SpaceInEmptyParentheses: false
|
|
||||||
SpacesBeforeTrailingComments: 1
|
|
||||||
SpacesInAngles: false
|
SpacesInAngles: false
|
||||||
SpacesInCStyleCastParentheses: false
|
|
||||||
SpacesInContainerLiterals: false
|
SpacesInContainerLiterals: false
|
||||||
SpacesInParentheses: false
|
|
||||||
SpacesInSquareBrackets: false
|
|
||||||
Standard: Latest
|
|
||||||
TabWidth: 4
|
|
||||||
UseTab: Never
|
|
||||||
|
|||||||
3
.github/actions/spelling/expect/expect.txt
vendored
3
.github/actions/spelling/expect/expect.txt
vendored
@@ -177,7 +177,6 @@ CConsole
|
|||||||
CConversion
|
CConversion
|
||||||
CCRT
|
CCRT
|
||||||
cdd
|
cdd
|
||||||
CDeclaration
|
|
||||||
CEdit
|
CEdit
|
||||||
CELLSIZE
|
CELLSIZE
|
||||||
cfae
|
cfae
|
||||||
@@ -333,7 +332,7 @@ Cspace
|
|||||||
csrmsg
|
csrmsg
|
||||||
CSRSS
|
CSRSS
|
||||||
csrutil
|
csrutil
|
||||||
cstyle
|
CSTYLE
|
||||||
CSwitch
|
CSwitch
|
||||||
CTerminal
|
CTerminal
|
||||||
CText
|
CText
|
||||||
|
|||||||
@@ -32,13 +32,19 @@ namespace ControlUnitTests
|
|||||||
class ControlInteractivityTests;
|
class ControlInteractivityTests;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define RUNTIME_SETTING(type, name, setting) \
|
#define RUNTIME_SETTING(type, name, setting) \
|
||||||
private: \
|
private: \
|
||||||
std::optional<type> _runtime##name{ std::nullopt }; \
|
std::optional<type> _runtime##name{ std::nullopt }; \
|
||||||
void name(const type newValue) { _runtime##name = newValue; } \
|
void name(const type newValue) \
|
||||||
\
|
{ \
|
||||||
public: \
|
_runtime##name = newValue; \
|
||||||
type name() const { return til::coalesce_value(_runtime##name, setting); }
|
} \
|
||||||
|
\
|
||||||
|
public: \
|
||||||
|
type name() const \
|
||||||
|
{ \
|
||||||
|
return til::coalesce_value(_runtime##name, setting); \
|
||||||
|
}
|
||||||
|
|
||||||
namespace winrt::Microsoft::Terminal::Control::implementation
|
namespace winrt::Microsoft::Terminal::Control::implementation
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -65,9 +65,15 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||||||
// appearance is being used should be more careful. Fortunately, this
|
// appearance is being used should be more careful. Fortunately, this
|
||||||
// situation is generally only used when a control is first created, or
|
// situation is generally only used when a control is first created, or
|
||||||
// when calling UpdateSettings.
|
// when calling UpdateSettings.
|
||||||
#define APPEARANCE_GEN(type, name, ...) \
|
#define APPEARANCE_GEN(type, name, ...) \
|
||||||
type name() const noexcept { return _focusedAppearance->name(); } \
|
type name() const noexcept \
|
||||||
void name(const type& value) noexcept { _focusedAppearance->name(value); }
|
{ \
|
||||||
|
return _focusedAppearance->name(); \
|
||||||
|
} \
|
||||||
|
void name(const type& value) noexcept \
|
||||||
|
{ \
|
||||||
|
_focusedAppearance->name(value); \
|
||||||
|
}
|
||||||
|
|
||||||
CORE_APPEARANCE_SETTINGS(APPEARANCE_GEN)
|
CORE_APPEARANCE_SETTINGS(APPEARANCE_GEN)
|
||||||
CONTROL_APPEARANCE_SETTINGS(APPEARANCE_GEN)
|
CONTROL_APPEARANCE_SETTINGS(APPEARANCE_GEN)
|
||||||
|
|||||||
@@ -37,19 +37,25 @@ protected:
|
|||||||
winrt::event<::winrt::Windows::UI::Xaml::Data::PropertyChangedEventHandler> _propertyChangedHandlers;
|
winrt::event<::winrt::Windows::UI::Xaml::Data::PropertyChangedEventHandler> _propertyChangedHandlers;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define _BASE_OBSERVABLE_PROJECTED_SETTING(target, name) \
|
#define _BASE_OBSERVABLE_PROJECTED_SETTING(target, name) \
|
||||||
public: \
|
public: \
|
||||||
auto name() const noexcept { return target.name(); }; \
|
auto name() const noexcept \
|
||||||
template<typename T> \
|
{ \
|
||||||
void name(const T& value) \
|
return target.name(); \
|
||||||
{ \
|
}; \
|
||||||
if (name() != value) \
|
template<typename T> \
|
||||||
{ \
|
void name(const T& value) \
|
||||||
target.name(value); \
|
{ \
|
||||||
_NotifyChanges(L"Has" #name, L## #name); \
|
if (name() != value) \
|
||||||
} \
|
{ \
|
||||||
} \
|
target.name(value); \
|
||||||
bool Has##name() { return target.Has##name(); }
|
_NotifyChanges(L"Has" #name, L## #name); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
bool Has##name() \
|
||||||
|
{ \
|
||||||
|
return target.Has##name(); \
|
||||||
|
}
|
||||||
|
|
||||||
// Defines a setting that reflects another object's same-named
|
// Defines a setting that reflects another object's same-named
|
||||||
// setting.
|
// setting.
|
||||||
@@ -64,7 +70,10 @@ public: \
|
|||||||
_NotifyChanges(L"Has" #name, L## #name); \
|
_NotifyChanges(L"Has" #name, L## #name); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
auto name##OverrideSource() { return target.name##OverrideSource(); }
|
auto name##OverrideSource() \
|
||||||
|
{ \
|
||||||
|
return target.name##OverrideSource(); \
|
||||||
|
}
|
||||||
|
|
||||||
// Defines a setting that reflects another object's same-named
|
// Defines a setting that reflects another object's same-named
|
||||||
// setting, but which cannot be erased.
|
// setting, but which cannot be erased.
|
||||||
@@ -76,7 +85,10 @@ public: \
|
|||||||
// except it leverages _NotifyChanges.
|
// except it leverages _NotifyChanges.
|
||||||
#define VIEW_MODEL_OBSERVABLE_PROPERTY(type, name, ...) \
|
#define VIEW_MODEL_OBSERVABLE_PROPERTY(type, name, ...) \
|
||||||
public: \
|
public: \
|
||||||
type name() const noexcept { return _##name; }; \
|
type name() const noexcept \
|
||||||
|
{ \
|
||||||
|
return _##name; \
|
||||||
|
}; \
|
||||||
void name(const type& value) \
|
void name(const type& value) \
|
||||||
{ \
|
{ \
|
||||||
if (_##name != value) \
|
if (_##name != value) \
|
||||||
|
|||||||
@@ -9,7 +9,10 @@
|
|||||||
get; \
|
get; \
|
||||||
set; \
|
set; \
|
||||||
}; \
|
}; \
|
||||||
Boolean Has##Name { get; }
|
Boolean Has##Name \
|
||||||
|
{ \
|
||||||
|
get; \
|
||||||
|
}
|
||||||
|
|
||||||
#define OBSERVABLE_PROJECTED_SETTING(Type, Name) \
|
#define OBSERVABLE_PROJECTED_SETTING(Type, Name) \
|
||||||
_BASE_OBSERVABLE_PROJECTED_SETTING(Type, Name); \
|
_BASE_OBSERVABLE_PROJECTED_SETTING(Type, Name); \
|
||||||
|
|||||||
@@ -56,12 +56,18 @@
|
|||||||
|
|
||||||
#include "ActionArgsMagic.h"
|
#include "ActionArgsMagic.h"
|
||||||
|
|
||||||
#define ACTION_ARG(type, name, ...) \
|
#define ACTION_ARG(type, name, ...) \
|
||||||
public: \
|
public: \
|
||||||
type name() const noexcept { return _##name.has_value() ? _##name.value() : type{ __VA_ARGS__ }; } \
|
type name() const noexcept \
|
||||||
void name(const type& value) noexcept { _##name = value; } \
|
{ \
|
||||||
\
|
return _##name.has_value() ? _##name.value() : type{ __VA_ARGS__ }; \
|
||||||
private: \
|
} \
|
||||||
|
void name(const type& value) noexcept \
|
||||||
|
{ \
|
||||||
|
_##name = value; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
private: \
|
||||||
std::optional<type> _##name{ std::nullopt };
|
std::optional<type> _##name{ std::nullopt };
|
||||||
|
|
||||||
// Notes on defining ActionArgs and ActionEventArgs:
|
// Notes on defining ActionArgs and ActionEventArgs:
|
||||||
|
|||||||
@@ -9,7 +9,10 @@
|
|||||||
get; \
|
get; \
|
||||||
set; \
|
set; \
|
||||||
}; \
|
}; \
|
||||||
Boolean Has##Name { get; }; \
|
Boolean Has##Name \
|
||||||
|
{ \
|
||||||
|
get; \
|
||||||
|
}; \
|
||||||
void Clear##Name()
|
void Clear##Name()
|
||||||
|
|
||||||
#define INHERITABLE_SETTING(Type, Name) \
|
#define INHERITABLE_SETTING(Type, Name) \
|
||||||
|
|||||||
@@ -32,9 +32,15 @@ protected: \
|
|||||||
// Winrt events need a method for adding a callback to the event and removing
|
// Winrt events need a method for adding a callback to the event and removing
|
||||||
// the callback. This macro will define them both for you, because they
|
// the callback. This macro will define them both for you, because they
|
||||||
// don't really vary from event to event.
|
// don't really vary from event to event.
|
||||||
#define DEFINE_EVENT(className, name, eventHandler, args) \
|
#define DEFINE_EVENT(className, name, eventHandler, args) \
|
||||||
winrt::event_token className::name(const args& handler) { return eventHandler.add(handler); } \
|
winrt::event_token className::name(const args& handler) \
|
||||||
void className::name(const winrt::event_token& token) noexcept { eventHandler.remove(token); }
|
{ \
|
||||||
|
return eventHandler.add(handler); \
|
||||||
|
} \
|
||||||
|
void className::name(const winrt::event_token& token) noexcept \
|
||||||
|
{ \
|
||||||
|
eventHandler.remove(token); \
|
||||||
|
}
|
||||||
|
|
||||||
// This is a helper macro to make declaring events easier.
|
// This is a helper macro to make declaring events easier.
|
||||||
// This will declare the event handler and the methods for adding and removing a
|
// This will declare the event handler and the methods for adding and removing a
|
||||||
@@ -53,9 +59,15 @@ private:
|
|||||||
// the callback. This macro will define them both for you, because they
|
// the callback. This macro will define them both for you, because they
|
||||||
// don't really vary from event to event.
|
// don't really vary from event to event.
|
||||||
// Use this if you have a Windows.Foundation.TypedEventHandler
|
// Use this if you have a Windows.Foundation.TypedEventHandler
|
||||||
#define DEFINE_EVENT_WITH_TYPED_EVENT_HANDLER(className, name, eventHandler, sender, args) \
|
#define DEFINE_EVENT_WITH_TYPED_EVENT_HANDLER(className, name, eventHandler, sender, args) \
|
||||||
winrt::event_token className::name(const Windows::Foundation::TypedEventHandler<sender, args>& handler) { return eventHandler.add(handler); } \
|
winrt::event_token className::name(const Windows::Foundation::TypedEventHandler<sender, args>& handler) \
|
||||||
void className::name(const winrt::event_token& token) noexcept { eventHandler.remove(token); }
|
{ \
|
||||||
|
return eventHandler.add(handler); \
|
||||||
|
} \
|
||||||
|
void className::name(const winrt::event_token& token) noexcept \
|
||||||
|
{ \
|
||||||
|
eventHandler.remove(token); \
|
||||||
|
}
|
||||||
|
|
||||||
// This is a helper macro for both declaring the signature of an event, and
|
// This is a helper macro for both declaring the signature of an event, and
|
||||||
// defining the body. Winrt events need a method for adding a callback to the
|
// defining the body. Winrt events need a method for adding a callback to the
|
||||||
@@ -63,12 +75,18 @@ private:
|
|||||||
// signatures and define them both for you, because they don't really vary from
|
// signatures and define them both for you, because they don't really vary from
|
||||||
// event to event.
|
// event to event.
|
||||||
// Use this in a classes header if you have a Windows.Foundation.TypedEventHandler
|
// Use this in a classes header if you have a Windows.Foundation.TypedEventHandler
|
||||||
#define TYPED_EVENT(name, sender, args) \
|
#define TYPED_EVENT(name, sender, args) \
|
||||||
public: \
|
public: \
|
||||||
winrt::event_token name(const winrt::Windows::Foundation::TypedEventHandler<sender, args>& handler) { return _##name##Handlers.add(handler); } \
|
winrt::event_token name(const winrt::Windows::Foundation::TypedEventHandler<sender, args>& handler) \
|
||||||
void name(const winrt::event_token& token) { _##name##Handlers.remove(token); } \
|
{ \
|
||||||
\
|
return _##name##Handlers.add(handler); \
|
||||||
private: \
|
} \
|
||||||
|
void name(const winrt::event_token& token) \
|
||||||
|
{ \
|
||||||
|
_##name##Handlers.remove(token); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
private: \
|
||||||
winrt::event<winrt::Windows::Foundation::TypedEventHandler<sender, args>> _##name##Handlers;
|
winrt::event<winrt::Windows::Foundation::TypedEventHandler<sender, args>> _##name##Handlers;
|
||||||
|
|
||||||
// This is a helper macro for both declaring the signature of a callback (nee event) and
|
// This is a helper macro for both declaring the signature of a callback (nee event) and
|
||||||
@@ -77,12 +95,18 @@ private:
|
|||||||
// signatures and define them both for you, because they don't really vary from
|
// signatures and define them both for you, because they don't really vary from
|
||||||
// event to event.
|
// event to event.
|
||||||
// Use this in a class's header if you have a "delegate" type in your IDL.
|
// Use this in a class's header if you have a "delegate" type in your IDL.
|
||||||
#define WINRT_CALLBACK(name, args) \
|
#define WINRT_CALLBACK(name, args) \
|
||||||
public: \
|
public: \
|
||||||
winrt::event_token name(const args& handler) { return _##name##Handlers.add(handler); } \
|
winrt::event_token name(const args& handler) \
|
||||||
void name(const winrt::event_token& token) { _##name##Handlers.remove(token); } \
|
{ \
|
||||||
\
|
return _##name##Handlers.add(handler); \
|
||||||
protected: \
|
} \
|
||||||
|
void name(const winrt::event_token& token) \
|
||||||
|
{ \
|
||||||
|
_##name##Handlers.remove(token); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
protected: \
|
||||||
winrt::event<args> _##name##Handlers;
|
winrt::event<args> _##name##Handlers;
|
||||||
|
|
||||||
// This is a helper macro for both declaring the signature and body of an event
|
// This is a helper macro for both declaring the signature and body of an event
|
||||||
@@ -91,16 +115,28 @@ protected:
|
|||||||
// "proxied" to the handling type. Case in point: many of the events on App are
|
// "proxied" to the handling type. Case in point: many of the events on App are
|
||||||
// just forwarded straight to TerminalPage. This macro will both declare the
|
// just forwarded straight to TerminalPage. This macro will both declare the
|
||||||
// method signatures and define them both for you.
|
// method signatures and define them both for you.
|
||||||
#define FORWARDED_TYPED_EVENT(name, sender, args, handler, handlerName) \
|
#define FORWARDED_TYPED_EVENT(name, sender, args, handler, handlerName) \
|
||||||
public: \
|
public: \
|
||||||
winrt::event_token name(const Windows::Foundation::TypedEventHandler<sender, args>& h) { return handler->handlerName(h); } \
|
winrt::event_token name(const Windows::Foundation::TypedEventHandler<sender, args>& h) \
|
||||||
void name(const winrt::event_token& token) noexcept { handler->handlerName(token); }
|
{ \
|
||||||
|
return handler->handlerName(h); \
|
||||||
|
} \
|
||||||
|
void name(const winrt::event_token& token) noexcept \
|
||||||
|
{ \
|
||||||
|
handler->handlerName(token); \
|
||||||
|
}
|
||||||
|
|
||||||
// Same thing, but handler is a projected type, not an implementation
|
// Same thing, but handler is a projected type, not an implementation
|
||||||
#define PROJECTED_FORWARDED_TYPED_EVENT(name, sender, args, handler, handlerName) \
|
#define PROJECTED_FORWARDED_TYPED_EVENT(name, sender, args, handler, handlerName) \
|
||||||
public: \
|
public: \
|
||||||
winrt::event_token name(const Windows::Foundation::TypedEventHandler<sender, args>& h) { return handler.handlerName(h); } \
|
winrt::event_token name(const Windows::Foundation::TypedEventHandler<sender, args>& h) \
|
||||||
void name(const winrt::event_token& token) noexcept { handler.handlerName(token); }
|
{ \
|
||||||
|
return handler.handlerName(h); \
|
||||||
|
} \
|
||||||
|
void name(const winrt::event_token& token) noexcept \
|
||||||
|
{ \
|
||||||
|
handler.handlerName(token); \
|
||||||
|
}
|
||||||
|
|
||||||
// This is a bit like *FORWARDED_TYPED_EVENT. When you use a forwarded event,
|
// This is a bit like *FORWARDED_TYPED_EVENT. When you use a forwarded event,
|
||||||
// the handler gets added to the object that's raising the event. For example,
|
// the handler gets added to the object that's raising the event. For example,
|
||||||
@@ -121,17 +157,26 @@ public:
|
|||||||
// _core.TitleChanged({ get_weak(), &TermControl::_bubbleTitleChanged });
|
// _core.TitleChanged({ get_weak(), &TermControl::_bubbleTitleChanged });
|
||||||
#define BUBBLED_FORWARDED_TYPED_EVENT(name, sender, args) \
|
#define BUBBLED_FORWARDED_TYPED_EVENT(name, sender, args) \
|
||||||
TYPED_EVENT(name, sender, args) \
|
TYPED_EVENT(name, sender, args) \
|
||||||
void _bubble##name(const sender& s, const args& a) { _##name##Handlers(s, a); }
|
void _bubble##name(const sender& s, const args& a) \
|
||||||
|
{ \
|
||||||
|
_##name##Handlers(s, a); \
|
||||||
|
}
|
||||||
|
|
||||||
// Use this macro to quick implement both the getter and setter for a property.
|
// Use this macro to quick implement both the getter and setter for a property.
|
||||||
// This should only be used for simple types where there's no logic in the
|
// This should only be used for simple types where there's no logic in the
|
||||||
// getter/setter beyond just accessing/updating the value.
|
// getter/setter beyond just accessing/updating the value.
|
||||||
#define WINRT_PROPERTY(type, name, ...) \
|
#define WINRT_PROPERTY(type, name, ...) \
|
||||||
public: \
|
public: \
|
||||||
type name() const noexcept { return _##name; } \
|
type name() const noexcept \
|
||||||
void name(const type& value) noexcept { _##name = value; } \
|
{ \
|
||||||
\
|
return _##name; \
|
||||||
private: \
|
} \
|
||||||
|
void name(const type& value) noexcept \
|
||||||
|
{ \
|
||||||
|
_##name = value; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
private: \
|
||||||
type _##name{ __VA_ARGS__ };
|
type _##name{ __VA_ARGS__ };
|
||||||
|
|
||||||
// Use this macro to quickly implement both the getter and setter for an
|
// Use this macro to quickly implement both the getter and setter for an
|
||||||
@@ -143,7 +188,10 @@ private: \
|
|||||||
// (like when the class is being initialized).
|
// (like when the class is being initialized).
|
||||||
#define WINRT_OBSERVABLE_PROPERTY(type, name, event, ...) \
|
#define WINRT_OBSERVABLE_PROPERTY(type, name, event, ...) \
|
||||||
public: \
|
public: \
|
||||||
type name() const noexcept { return _##name; }; \
|
type name() const noexcept \
|
||||||
|
{ \
|
||||||
|
return _##name; \
|
||||||
|
}; \
|
||||||
void name(const type& value) \
|
void name(const type& value) \
|
||||||
{ \
|
{ \
|
||||||
if (_##name != value) \
|
if (_##name != value) \
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace til
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<ContiguousBytes Target, ContiguousView Source>
|
template<ContiguousBytes Target, ContiguousView Source>
|
||||||
requires TriviallyCopyable<typename Source::value_type>
|
requires TriviallyCopyable<typename Source::value_type>
|
||||||
constexpr void bytes_transfer(Target& target, Source& source)
|
constexpr void bytes_transfer(Target& target, Source& source)
|
||||||
{
|
{
|
||||||
using TargetType = typename Target::value_type;
|
using TargetType = typename Target::value_type;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace til::pmr
|
|||||||
{
|
{
|
||||||
if (align > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
|
if (align > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
|
||||||
{
|
{
|
||||||
return ::operator new (bytes, std::align_val_t{ align });
|
return ::operator new(bytes, std::align_val_t{ align });
|
||||||
}
|
}
|
||||||
|
|
||||||
return ::operator new(bytes);
|
return ::operator new(bytes);
|
||||||
@@ -49,7 +49,7 @@ namespace til::pmr
|
|||||||
{
|
{
|
||||||
if (align > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
|
if (align > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
|
||||||
{
|
{
|
||||||
return ::operator delete (ptr, bytes, std::align_val_t{ align });
|
return ::operator delete(ptr, bytes, std::align_val_t{ align });
|
||||||
}
|
}
|
||||||
|
|
||||||
::operator delete(ptr, bytes);
|
::operator delete(ptr, bytes);
|
||||||
|
|||||||
@@ -94,14 +94,35 @@ namespace Microsoft::Console::Render
|
|||||||
return __builtin_memcmp(this, &rhs, sizeof(rhs)) != 0; \
|
return __builtin_memcmp(this, &rhs, sizeof(rhs)) != 0; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ATLAS_FLAG_OPS(type, underlying) \
|
#define ATLAS_FLAG_OPS(type, underlying) \
|
||||||
friend constexpr type operator~(type v) noexcept { return static_cast<type>(~static_cast<underlying>(v)); } \
|
friend constexpr type operator~(type v) noexcept \
|
||||||
friend constexpr type operator|(type lhs, type rhs) noexcept { return static_cast<type>(static_cast<underlying>(lhs) | static_cast<underlying>(rhs)); } \
|
{ \
|
||||||
friend constexpr type operator&(type lhs, type rhs) noexcept { return static_cast<type>(static_cast<underlying>(lhs) & static_cast<underlying>(rhs)); } \
|
return static_cast<type>(~static_cast<underlying>(v)); \
|
||||||
friend constexpr type operator^(type lhs, type rhs) noexcept { return static_cast<type>(static_cast<underlying>(lhs) ^ static_cast<underlying>(rhs)); } \
|
} \
|
||||||
friend constexpr void operator|=(type& lhs, type rhs) noexcept { lhs = lhs | rhs; } \
|
friend constexpr type operator|(type lhs, type rhs) noexcept \
|
||||||
friend constexpr void operator&=(type& lhs, type rhs) noexcept { lhs = lhs & rhs; } \
|
{ \
|
||||||
friend constexpr void operator^=(type& lhs, type rhs) noexcept { lhs = lhs ^ rhs; }
|
return static_cast<type>(static_cast<underlying>(lhs) | static_cast<underlying>(rhs)); \
|
||||||
|
} \
|
||||||
|
friend constexpr type operator&(type lhs, type rhs) noexcept \
|
||||||
|
{ \
|
||||||
|
return static_cast<type>(static_cast<underlying>(lhs) & static_cast<underlying>(rhs)); \
|
||||||
|
} \
|
||||||
|
friend constexpr type operator^(type lhs, type rhs) noexcept \
|
||||||
|
{ \
|
||||||
|
return static_cast<type>(static_cast<underlying>(lhs) ^ static_cast<underlying>(rhs)); \
|
||||||
|
} \
|
||||||
|
friend constexpr void operator|=(type& lhs, type rhs) noexcept \
|
||||||
|
{ \
|
||||||
|
lhs = lhs | rhs; \
|
||||||
|
} \
|
||||||
|
friend constexpr void operator&=(type& lhs, type rhs) noexcept \
|
||||||
|
{ \
|
||||||
|
lhs = lhs & rhs; \
|
||||||
|
} \
|
||||||
|
friend constexpr void operator^=(type& lhs, type rhs) noexcept \
|
||||||
|
{ \
|
||||||
|
lhs = lhs ^ rhs; \
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct vec2
|
struct vec2
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="clang-format.win-x86" version="13.0.1" targetFramework="native" />
|
<package id="clang-format.win-x86" version="15.0.7" targetFramework="native" />
|
||||||
</packages>
|
</packages>
|
||||||
|
|||||||
Reference in New Issue
Block a user