13de75274b
- factor out common code to a shared module, and quote path to the clang-format binary, just in case. - add a new check-last-commit script that is the CI equivalent of the exiting git pre-commit hook, but this one handles lack of clang-format as an error, not as a warning. - $LODE_HOME/opt/bin is supposed to be in PATH already, so not mentioning LODE_HOME in ClangFormat::find() explicitly. - if both COMPILER_PLUGINS and LODE_HOME is set, invoke solenv/clang-format/check-last-commit as part of 'make check' To test these changes as part of CI, fix a single style violation in an already committed, non-blacklisted file. This depends on the lode.git commit 496123bcae28e06c6d6aeda39a5afd1e1fb1fd98 (utils_Linux: install clang-format in the Jenkins case, 2017-11-16), otherwise erroring out on a not installed clang-format as part of the build would be a problem. Change-Id: Ib3110826194ff78a7f1bed1c3796147e92ccb3ba Reviewed-on: https://gerrit.libreoffice.org/44939 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
|
/*
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
#ifndef INCLUDED_SVL_TYPEDWHICH_HXX
|
|
#define INCLUDED_SVL_TYPEDWHICH_HXX
|
|
|
|
#include <sal/config.h>
|
|
#include <sal/types.h>
|
|
|
|
/**
|
|
* A very thin wrapper around the sal_uInt16 WhichId whose purpose is mostly to carry type information,
|
|
* so that we Put() and Get() the right subclasses of SfxPoolItem for each WhichId.
|
|
*/
|
|
template <class T> class TypedWhichId final
|
|
{
|
|
public:
|
|
explicit constexpr TypedWhichId(sal_uInt16 nWhich)
|
|
: mnWhich(nWhich)
|
|
{
|
|
}
|
|
constexpr operator sal_uInt16() const { return mnWhich; }
|
|
|
|
private:
|
|
sal_uInt16 const mnWhich;
|
|
};
|
|
|
|
template <class T> constexpr bool operator==(sal_uInt16 lhs, TypedWhichId<T> const& rhs)
|
|
{
|
|
return lhs == sal_uInt16(rhs);
|
|
}
|
|
template <class T> constexpr bool operator!=(sal_uInt16 lhs, TypedWhichId<T> const& rhs)
|
|
{
|
|
return lhs != sal_uInt16(rhs);
|
|
}
|
|
template <class T> constexpr bool operator==(TypedWhichId<T> const& lhs, sal_uInt16 rhs)
|
|
{
|
|
return sal_uInt16(lhs) == rhs;
|
|
}
|
|
template <class T> constexpr bool operator!=(TypedWhichId<T> const& lhs, sal_uInt16 rhs)
|
|
{
|
|
return sal_uInt16(lhs) != rhs;
|
|
}
|
|
|
|
#endif // INCLUDED_SVL_TYPEDWHICH_HXX
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|