blob: e0697a68a14fed358a35a9bf6045808a0136b6d8 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include <QString>
#include <QFileInfo>
namespace QmakeProjectManager {
namespace Internal {
/* Helper struct specifying how to generate file names
* from class names according to the CppEditor settings. */
struct FileNamingParameters
{
FileNamingParameters(const QString &headerSuffixIn = QString(QLatin1Char('h')),
const QString &sourceSuffixIn = QLatin1String("cpp"),
bool lowerCaseIn = true) :
headerSuffix(headerSuffixIn),
sourceSuffix(sourceSuffixIn),
lowerCase(lowerCaseIn) {}
inline QString sourceFileName(const QString &className) const {
QString rc = lowerCase ? className.toLower() : className;
rc += QLatin1Char('.');
rc += sourceSuffix;
return rc;
}
inline QString headerFileName(const QString &className) const {
QString rc = lowerCase ? className.toLower() : className;
rc += QLatin1Char('.');
rc += headerSuffix;
return rc;
}
inline QString sourceToHeaderFileName(const QString &source) const {
QString rc = QFileInfo(source).completeBaseName();
rc += QLatin1Char('.');
rc += headerSuffix;
return rc;
}
inline QString headerToSourceFileName(const QString &header) const {
QString rc = QFileInfo(header).completeBaseName();
rc += QLatin1Char('.');
rc += sourceSuffix;
return rc;
}
QString headerSuffix;
QString sourceSuffix;
bool lowerCase;
};
}
}
|