~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to src/libs/utils/hostosinfo.h

  • Committer: Timo Jyrinki
  • Date: 2013-11-15 12:25:23 UTC
  • mfrom: (1.1.28)
  • Revision ID: timo.jyrinki@canonical.com-20131115122523-i2kyamsu4gs2mu1m
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
#include "utils_global.h"
34
34
 
 
35
#include "osspecificaspects.h"
 
36
 
35
37
#include <QString>
36
38
 
37
39
#ifdef Q_OS_WIN
38
 
#define QTC_HOST_EXE_SUFFIX ".exe"
 
40
#define QTC_HOST_EXE_SUFFIX QTC_WIN_EXE_SUFFIX
39
41
#else
40
42
#define QTC_HOST_EXE_SUFFIX ""
41
43
#endif // Q_OS_WIN
45
47
class QTCREATOR_UTILS_EXPORT HostOsInfo
46
48
{
47
49
public:
48
 
    // Add more as needed.
49
 
    enum HostOs { HostOsWindows, HostOsLinux, HostOsMac, HostOsOtherUnix, HostOsOther };
50
 
    static inline HostOs hostOs();
 
50
    static inline OsType hostOs();
51
51
 
52
52
    enum HostArchitecture { HostArchitectureX86, HostArchitectureAMD64, HostArchitectureItanium,
53
53
                            HostArchitectureArm, HostArchitectureUnknown };
54
54
    static HostArchitecture hostArchitecture();
55
55
 
56
 
    static bool isWindowsHost() { return hostOs() == HostOsWindows; }
57
 
    static bool isLinuxHost() { return hostOs() == HostOsLinux; }
58
 
    static bool isMacHost() { return hostOs() == HostOsMac; }
 
56
    static bool isWindowsHost() { return hostOs() == OsTypeWindows; }
 
57
    static bool isLinuxHost() { return hostOs() == OsTypeLinux; }
 
58
    static bool isMacHost() { return hostOs() == OsTypeMac; }
59
59
    static inline bool isAnyUnixHost();
60
60
 
61
61
    static QString withExecutableSuffix(const QString &executable)
62
62
    {
63
 
        QString finalName = executable;
64
 
        if (isWindowsHost())
65
 
            finalName += QLatin1String(QTC_HOST_EXE_SUFFIX);
66
 
        return finalName;
 
63
        return hostOsAspects().withExecutableSuffix(executable);
67
64
    }
68
65
 
69
66
    static Qt::CaseSensitivity fileNameCaseSensitivity()
70
67
    {
71
 
        return isWindowsHost() ? Qt::CaseInsensitive: Qt::CaseSensitive;
 
68
        return hostOsAspects().fileNameCaseSensitivity();
72
69
    }
73
70
 
74
71
    static QChar pathListSeparator()
75
72
    {
76
 
        return isWindowsHost() ? QLatin1Char(';') : QLatin1Char(':');
 
73
        return hostOsAspects().pathListSeparator();
77
74
    }
78
75
 
79
76
    static Qt::KeyboardModifier controlModifier()
80
77
    {
81
 
        return isMacHost() ? Qt::MetaModifier : Qt::ControlModifier;
 
78
        return hostOsAspects().controlModifier();
82
79
    }
 
80
 
 
81
private:
 
82
    static OsSpecificAspects hostOsAspects() { return OsSpecificAspects(hostOs()); }
83
83
};
84
84
 
85
 
HostOsInfo::HostOs HostOsInfo::hostOs()
 
85
 
 
86
OsType HostOsInfo::hostOs()
86
87
{
87
88
#if defined(Q_OS_WIN)
88
 
    return HostOsWindows;
 
89
    return OsTypeWindows;
89
90
#elif defined(Q_OS_LINUX)
90
 
    return HostOsLinux;
 
91
    return OsTypeLinux;
91
92
#elif defined(Q_OS_MAC)
92
 
    return HostOsMac;
 
93
    return OsTypeMac;
93
94
#elif defined(Q_OS_UNIX)
94
 
    return HostOsOtherUnix;
 
95
    return OsTypeOtherUnix;
95
96
#else
96
 
    return HostOsOther;
 
97
    return OsTypeOther;
97
98
#endif
98
99
}
99
100