OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / classview / classviewutils.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2010 Denis Mingulov.
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 CLASSVIEWUTILS_H
34 #define CLASSVIEWUTILS_H
35
36 #include "classviewsymbollocation.h"
37 #include "classviewsymbolinformation.h"
38 #include <QtCore/QVariant>
39 #include <QtCore/QList>
40 #include <QtCore/QSet>
41
42 QT_FORWARD_DECLARE_CLASS(QStandardItem)
43
44 namespace ClassView {
45 namespace Internal {
46
47 /*!
48    \class Utils
49    \brief Some common utils
50  */
51
52 class Utils
53 {
54     //! Private constructor
55     Utils();
56 public:
57
58     /*!
59        \brief convert internal location container to QVariant compatible
60        \param locations Set of SymbolLocations
61        \return List of variant locations (can be added to an item's data)
62      */
63     static QList<QVariant> locationsToRole(const QSet<SymbolLocation> &locations);
64
65     /*!
66        \brief convert QVariant location container to internal
67        \param locations List of variant locations (from an item's data)
68        \return Set of SymbolLocations
69      */
70     static QSet<SymbolLocation> roleToLocations(const QList<QVariant> &locations);
71
72     /*!
73        \brief Returns sort order value for the icon type
74        \param iconType Icon type
75        \return Sort order value for the provided icon type
76      */
77     static int iconTypeSortOrder(int iconType);
78
79     /*!
80        \brief Get symbol information for the \a QStandardItem
81        \param item Item
82        \return Filled symbol information.
83      */
84     static SymbolInformation symbolInformationFromItem(const QStandardItem *item);
85
86     /*!
87        \brief Set symbol information to the \a QStandardItem
88        \param information
89        \param item Item
90        \return Filled item
91      */
92     static QStandardItem *setSymbolInformationToItem(const SymbolInformation &information,
93                                                      QStandardItem *item);
94
95     /*!
96        \brief Update an item to the target. (sorted, for fetching)
97        \param item Source item
98        \param target Target item
99      */
100     static void fetchItemToTarget(QStandardItem *item, const QStandardItem *target);
101
102     /*!
103        \brief Move an item to the target. (sorted)
104        \param item Source item
105        \param target Target item
106      */
107     static void moveItemToTarget(QStandardItem *item, const QStandardItem *target);
108 };
109
110 } // namespace Internal
111 } // namespace ClassView
112
113 #endif // CLASSVIEWUTILS_H