KTextEditor

katemodemanager.h
1/*
2 SPDX-FileCopyrightText: 2001-2010 Christoph Cullmann <cullmann@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KATE_MODEMANAGER_H
8#define KATE_MODEMANAGER_H
9
10#include "ktexteditor_export.h"
11
12#include <QHash>
13#include <QPointer>
14#include <QStringList>
15
16#include <KLocalizedString>
17
18namespace KTextEditor
19{
20class Document;
21}
22
23class KateFileType
24{
25public:
26 QString name;
27 QString section;
28 QStringList wildcards;
29 QStringList mimetypes;
30 int priority = 0;
31 QString varLine;
32 QString hl;
33 bool hlGenerated = false;
34 QString version;
35 QString indenter;
36
37 QString translatedName;
38 QString translatedSection;
39
40 QString nameTranslated() const
41 {
42 return translatedName.isEmpty() ? name : translatedName;
43 }
44
45 QString sectionTranslated() const
46 {
47 return translatedSection.isEmpty() ? section : translatedSection;
48 }
49
50 KateFileType()
51
52 {
53 }
54};
55
56class KateModeManager
57{
58public:
59 KateModeManager();
60 ~KateModeManager();
61
62 KateModeManager(const KateModeManager &) = delete;
63 KateModeManager &operator=(const KateModeManager &) = delete;
64
65 /**
66 * File Type Config changed, update all docs (which will take care of views/renderers)
67 */
68 void update();
69
70 void save(const QList<KateFileType *> &v);
71
72 /**
73 * @return the right KateFileType name for the given document or an empty string if none found
74 */
75 QString fileType(KTextEditor::Document *doc, const QString &fileToReadFrom);
76
77 /**
78 * Don't store the pointer somewhere longer times, won't be valid after the next update()
79 */
80 const KateFileType &fileType(const QString &name) const;
81
82 /**
83 * Don't modify
84 */
85 const QList<KateFileType *> &list() const
86 {
87 return m_types;
88 }
89
90private:
91 friend class KateModeManagerTest;
92 friend class KateModeManagerBenchmark;
93
94 KTEXTEDITOR_EXPORT QString wildcardsFind(const QString &fileName) const; // exported for testing
95 KTEXTEDITOR_EXPORT QString mimeTypesFind(const QString &mimeTypeName) const; // exported for testing
96
99};
100
101#endif
A KParts derived class representing a text document.
Definition document.h:284
QString name(StandardAction id)
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:27 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.