summaryrefslogtreecommitdiff
path: root/src/plugins/clangformat/clangformatsettings.h
blob: c2ce53f4c767ace87e5815e48b2ec338c33ee0e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include <QString>

namespace ClangFormat {

class ClangFormatSettings
{
public:
    static ClangFormatSettings &instance();

    ClangFormatSettings();
    void write() const;

    void setOverrideDefaultFile(bool enable);
    bool overrideDefaultFile() const;

    enum Mode {
        Indenting = 0,
        Formatting,
        Disable
    };

    void setMode(Mode mode);
    Mode mode() const;

    void setFormatWhileTyping(bool enable);
    bool formatWhileTyping() const;

    void setFormatOnSave(bool enable);
    bool formatOnSave() const;

private:
    Mode m_mode;
    bool m_overrideDefaultFile = false;
    bool m_formatWhileTyping = false;
    bool m_formatOnSave = false;
};

} // namespace ClangFormat