diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index 143da043e25..166ff286dab 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -21,6 +21,7 @@ add_qtc_library(QmlDesignerUtils STATIC SOURCES_PREFIX ${CMAKE_CURRENT_LIST_DIR}/utils SOURCES asset.cpp asset.h + designeralgorithm.h filedownloader.cpp filedownloader.h multifiledownloader.cpp multifiledownloader.h fileextractor.cpp fileextractor.h diff --git a/src/plugins/qmldesigner/utils/designeralgorithm.h b/src/plugins/qmldesigner/utils/designeralgorithm.h new file mode 100644 index 00000000000..94d84c8b0be --- /dev/null +++ b/src/plugins/qmldesigner/utils/designeralgorithm.h @@ -0,0 +1,22 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#pragma once + +#include + +namespace QmlDesigner::CoreUtils { + +template +#ifdef Q_CC_MSVC +__forceinline +#else +[[gnu::always_inline]] +#endif + constexpr bool + contains(Element element, Elements... elements) +{ + return ((element == elements) || ...); +} + +} // namespace QmlDesigner::CoreUtils