OSDN Git Service

d28597522ab0e7d5ba7557d92c649b923a0da359
[qt-creator-jp/qt-creator-jp.git] / src / plugins / projectexplorer / cesdkhandler.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef CE_SDK_HANDLER_H
35 #define CE_SDK_HANDLER_H
36
37 #include <projectexplorer/projectexplorer.h>
38
39 #include <QtCore/QStringList>
40 #include <QtCore/QDir>
41
42 #define VCINSTALL_MACRO "$(VCInstallDir)"
43 #define VSINSTALL_MACRO "$(VSInstallDir)"
44
45 namespace Utils {
46 class Environment;
47 }
48
49 namespace ProjectExplorer {
50
51 class PROJECTEXPLORER_EXPORT CeSdkInfo
52 {
53 public:
54     CeSdkInfo();
55     inline QString                  name();
56     inline QString                  binPath();
57     inline QString                  includePath();
58     inline QString                  libPath();
59     void                            addToEnvironment(Utils::Environment &env);
60     inline bool                     isValid();
61     inline int                      majorVersion();
62     inline int                      minorVersion();
63     inline bool                     isSupported();
64 private:
65     friend class                    CeSdkHandler;
66     QString                         m_name;
67     QString                         m_bin;
68     QString                         m_include;
69     QString                         m_lib;
70     int                             m_major;
71     int                             m_minor;
72 };
73
74 inline QString CeSdkInfo::name() { return m_name; }
75 inline QString CeSdkInfo::binPath() { return m_bin; }
76 inline QString CeSdkInfo::includePath() { return m_include; }
77 inline QString CeSdkInfo::libPath() { return m_lib; }
78 inline bool CeSdkInfo::isValid() { return !m_name.isEmpty() && !m_bin.isEmpty() && !m_include.isEmpty() && !m_lib.isEmpty(); }
79 inline int CeSdkInfo::majorVersion() { return m_major; }
80 inline int CeSdkInfo::minorVersion() { return m_minor; }
81 inline bool CeSdkInfo::isSupported() { return m_major >= 5; }
82
83 class PROJECTEXPLORER_EXPORT CeSdkHandler
84 {
85 public:
86                                     CeSdkHandler();
87     bool                            parse(const QString &path);
88     inline QList<CeSdkInfo>         listAll() const;
89     CeSdkInfo                       find(const QString &name);
90     static QString                  platformName(const QString &qtpath);
91 private:
92     inline QString                  fixPaths(QString path) const;
93     QList<CeSdkInfo>                m_list;
94     QString                         VCInstallDir;
95     QString                         VSInstallDir;
96 };
97
98 inline QList<CeSdkInfo> CeSdkHandler::listAll() const
99 {
100     return m_list;
101 }
102
103 inline QString CeSdkHandler::fixPaths(QString path) const
104 {
105     return QDir::toNativeSeparators(QDir::cleanPath(path.replace(VCINSTALL_MACRO, VCInstallDir).replace(VSINSTALL_MACRO, VSInstallDir).replace(QLatin1String(";$(PATH)"), QLatin1String(""))));
106 }
107
108 } // namespace Qt4ProjectManager
109
110 #endif // CE_SDK_HANDLER_H