2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2018 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2018-10-11 14:11:43 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-01-10 14:29:49 +01:00
|
|
|
#include "clangformatsettings.h"
|
|
|
|
|
|
2018-10-11 14:11:43 +02:00
|
|
|
#include <utils/fileutils.h>
|
2020-06-26 13:59:38 +02:00
|
|
|
#include <utils/id.h>
|
|
|
|
|
|
2018-10-11 14:11:43 +02:00
|
|
|
#include <clang/Format/Format.h>
|
|
|
|
|
|
|
|
|
|
#include <QFile>
|
|
|
|
|
|
|
|
|
|
#include <fstream>
|
|
|
|
|
|
2022-04-08 15:12:30 +02:00
|
|
|
namespace TextEditor { class ICodeStylePreferences; }
|
2023-01-10 14:29:49 +01:00
|
|
|
namespace ProjectExplorer { class Project; }
|
2018-10-11 14:11:43 +02:00
|
|
|
namespace ClangFormat {
|
|
|
|
|
|
2023-01-16 12:33:43 +01:00
|
|
|
QString projectUniqueId(ProjectExplorer::Project *project);
|
2018-11-08 10:35:23 +01:00
|
|
|
|
2023-01-10 14:29:49 +01:00
|
|
|
bool getProjectUseGlobalSettings(const ProjectExplorer::Project *project);
|
|
|
|
|
|
|
|
|
|
bool getProjectOverriddenSettings(const ProjectExplorer::Project *project);
|
|
|
|
|
bool getCurrentOverriddenSettings(const Utils::FilePath &filePath);
|
|
|
|
|
|
|
|
|
|
ClangFormatSettings::Mode getProjectIndentationOrFormattingSettings(
|
|
|
|
|
const ProjectExplorer::Project *project);
|
|
|
|
|
ClangFormatSettings::Mode getCurrentIndentationOrFormattingSettings(const Utils::FilePath &filePath);
|
|
|
|
|
|
2018-11-13 11:47:02 +01:00
|
|
|
// Is the style from the matching .clang-format file or global one if it's not found.
|
2019-05-28 13:49:26 +02:00
|
|
|
QString configForFile(Utils::FilePath fileName);
|
2023-01-16 12:33:43 +01:00
|
|
|
|
|
|
|
|
bool getProjectOverriddenSettings(const ProjectExplorer::Project *project);
|
2018-10-11 14:11:43 +02:00
|
|
|
|
2022-01-11 13:18:29 +01:00
|
|
|
void addQtcStatementMacros(clang::format::FormatStyle &style);
|
|
|
|
|
clang::format::FormatStyle qtcStyle();
|
2022-04-08 15:12:30 +02:00
|
|
|
|
|
|
|
|
Utils::FilePath filePathToCurrentSettings(const TextEditor::ICodeStylePreferences *codeStyle);
|
2018-10-11 14:11:43 +02:00
|
|
|
}
|