OSDN Git Service

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