Skip to content

Commit

Permalink
Formatted code with ClangFormat (#23)
Browse files Browse the repository at this point in the history
* Formatted code with ClangFormat

* Change files
  • Loading branch information
vmoroz authored Apr 1, 2020
1 parent 68f5034 commit 67119c9
Show file tree
Hide file tree
Showing 115 changed files with 17,631 additions and 17,342 deletions.
111 changes: 111 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#
# Clang formatting rules: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# The clang-format npm package (https://github.com/angular/clang-format) uses
# a pre-built clang-format.exe from http://llvm.org/builds/
#
---
# We use defaults from the Microsoft style
BasedOnStyle: Microsoft
---
Language: Cpp

AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterExternBlock: true
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
BreakAfterJavaFieldAnnotations: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
BreakStringLiterals: false
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces : true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
FixNamespaceComments: true
ForEachMacros: [ FOR_EACH_RANGE, FOR_EACH, TEST_CLASS, TEST_CLASS_EX ]
IncludeBlocks: Preserve
IncludeCategories:
- Regex: 'pch.h'
Priority: -1
- Regex: '.*\.g\..*'
Priority: 1
- Regex: '^<.*\.h(pp)?>'
Priority: 2
- Regex: '^<.*'
Priority: 3
- Regex: '.*'
Priority: 4
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Latest
TabWidth: 2
UseTab: Never
...
8 changes: 8 additions & 0 deletions change/@microsoft-mso-2020-04-01-07-47-10-Clang-format2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "patch",
"comment": "Formatted code with ClangFormat",
"packageName": "@microsoft/mso",
"email": "[email protected]",
"dependentChangeType": "patch",
"date": "2020-04-01T14:47:10.009Z"
}
48 changes: 27 additions & 21 deletions libs/comUtil/include/comUtil/qiCast.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,53 +14,59 @@
#include <comBaseApi.h>
#include <unknwn.h>

namespace Mso {
namespace ComUtil {
namespace Mso { namespace ComUtil {

template<typename T>
HRESULT HrCoCreateInstance(Mso::TCntPtr<T>& target, REFCLSID rclsid, _In_opt_ LPUNKNOWN pUnkOuter = nullptr, DWORD dwClsContext = CLSCTX_ALL) noexcept
template <typename T>
HRESULT HrCoCreateInstance(
Mso::TCntPtr<T>& target,
REFCLSID rclsid,
_In_opt_ LPUNKNOWN pUnkOuter = nullptr,
DWORD dwClsContext = CLSCTX_ALL) noexcept
{
return ::CoCreateInstance(rclsid, pUnkOuter, dwClsContext, __uuidof(T), reinterpret_cast<void**>(target.GetAddressOf()));
return ::CoCreateInstance(
rclsid, pUnkOuter, dwClsContext, __uuidof(T), reinterpret_cast<void**>(target.GetAddressOf()));
}

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
template<typename T>
HRESULT HrCoCreateInstance(Mso::TCntPtr<T>& target, _In_z_ LPCOLESTR szProgID, _In_opt_ LPUNKNOWN pUnkOuter = nullptr, DWORD dwClsContext = CLSCTX_ALL) noexcept
template <typename T>
HRESULT HrCoCreateInstance(
Mso::TCntPtr<T>& target,
_In_z_ LPCOLESTR szProgID,
_In_opt_ LPUNKNOWN pUnkOuter = nullptr,
DWORD dwClsContext = CLSCTX_ALL) noexcept
{
CLSID clsid;
HRESULT hr = ::CLSIDFromProgID(szProgID, &clsid);
return SUCCEEDED(hr) ? HrCoCreateInstance(target, clsid, pUnkOuter, dwClsContext) : hr;
CLSID clsid;
HRESULT hr = ::CLSIDFromProgID(szProgID, &clsid);
return SUCCEEDED(hr) ? HrCoCreateInstance(target, clsid, pUnkOuter, dwClsContext) : hr;
}
#endif

} // ComUtil
} // Mso
}} // namespace Mso::ComUtil

namespace Mso {

template <typename T1, typename T2>
__declspec(deprecated("Use Mso::ComUtil::AreEqualObjects")) bool AreEqualObjects(const T1* pLeft, const T2* pRight) noexcept
__declspec(
deprecated("Use Mso::ComUtil::AreEqualObjects")) bool AreEqualObjects(const T1* pLeft, const T2* pRight) noexcept
{
return Mso::ComUtil::AreEqualObjects(pLeft, pRight);
return Mso::ComUtil::AreEqualObjects(pLeft, pRight);
}

} // Mso
} // namespace Mso

#endif // MS_TARGET_WINDOWS

namespace Mso {
namespace Details {
namespace Mso { namespace Details {

// Overloaded global function to provide to IID_PPV_ARGS that support Details::TCntPtrRef
template <typename T>
void** IID_PPV_ARGS_Helper(_Inout_ TCntPtrRef<T> pp) noexcept
{
static_assert(std::is_base_of<IUnknown, T>::value, "T has to derive from IUnknown");
return pp;
static_assert(std::is_base_of<IUnknown, T>::value, "T has to derive from IUnknown");
return pp;
}

} // Details
} // Mso
}} // namespace Mso::Details

#endif // __cplusplus
#endif // LIBLET_COMUTIL_QICAST_H
Loading

0 comments on commit 67119c9

Please sign in to comment.