OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qmldesigner / designercore / include / abstractproperty.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 ABSTRACTROPERTY_H
34 #define ABSTRACTROPERTY_H
35
36 #include <QtCore/QVariant>
37 #include <QWeakPointer>
38 #include <QSharedPointer>
39 #include "corelib_global.h"
40
41 QT_BEGIN_NAMESPACE
42 class QTextStream;
43 QT_END_NAMESPACE
44
45 namespace QmlDesigner {
46     namespace Internal {
47         class InternalNode;
48         class InternalProperty;
49
50         typedef QSharedPointer<InternalNode> InternalNodePointer;
51         typedef QSharedPointer<InternalProperty> InternalPropertyPointer;
52         typedef QWeakPointer<InternalNode> InternalNodeWeakPointer;
53     }
54
55 class Model;
56 class ModelNode;
57 class AbstractView;
58 class CORESHARED_EXPORT VariantProperty;
59 class CORESHARED_EXPORT NodeListProperty;
60 class CORESHARED_EXPORT NodeAbstractProperty;
61 class CORESHARED_EXPORT BindingProperty;
62 class CORESHARED_EXPORT NodeProperty;
63 class QmlObjectNode;
64
65
66 namespace Internal {
67     class InternalNode;
68     class ModelPrivate;
69 }
70
71 class CORESHARED_EXPORT AbstractProperty
72 {
73     friend class QmlDesigner::ModelNode;
74     friend class QmlDesigner::Internal::ModelPrivate;
75
76     friend CORESHARED_EXPORT bool operator ==(const AbstractProperty &property1, const AbstractProperty &property2);
77     friend CORESHARED_EXPORT bool operator !=(const AbstractProperty &property1, const AbstractProperty &property2);
78     friend CORESHARED_EXPORT uint qHash(const AbstractProperty& property);
79
80 public:
81     AbstractProperty();
82     ~AbstractProperty();
83     AbstractProperty(const AbstractProperty &other);
84     AbstractProperty& operator=(const AbstractProperty &other);
85     AbstractProperty(const AbstractProperty &property, AbstractView *view);
86
87     QString name() const;
88
89     bool isValid() const;
90     ModelNode parentModelNode() const;
91     QmlObjectNode parentQmlObjectNode() const;
92
93     bool isDefaultProperty() const;
94     VariantProperty toVariantProperty() const;
95     NodeListProperty toNodeListProperty() const;
96     NodeAbstractProperty toNodeAbstractProperty() const;
97     BindingProperty toBindingProperty() const;
98     NodeProperty toNodeProperty() const;
99
100     bool isVariantProperty() const;
101     bool isNodeListProperty() const;
102     bool isNodeAbstractProperty() const;
103     bool isBindingProperty() const;
104     bool isNodeProperty() const;
105
106     bool isDynamic() const;
107     QString dynamicTypeName() const;
108
109 protected:
110     AbstractProperty(const QString &propertyName, const Internal::InternalNodePointer &internalNode, Model* model, AbstractView *view);
111     AbstractProperty(const Internal::InternalPropertyPointer &property, Model* model, AbstractView *view);
112     Internal::InternalNodePointer internalNode() const;
113     Model *model() const;
114     AbstractView *view() const;
115
116 private:
117     QString m_propertyName;
118     Internal::InternalNodePointer m_internalNode;
119     QWeakPointer<Model> m_model;
120     QWeakPointer<AbstractView> m_view;
121 };
122
123 CORESHARED_EXPORT bool operator ==(const AbstractProperty &property1, const AbstractProperty &property2);
124 CORESHARED_EXPORT bool operator !=(const AbstractProperty &property1, const AbstractProperty &property2);
125 CORESHARED_EXPORT uint qHash(const AbstractProperty& property);
126 CORESHARED_EXPORT QTextStream& operator<<(QTextStream &stream, const AbstractProperty &property);
127 CORESHARED_EXPORT QDebug operator<<(QDebug debug, const AbstractProperty &AbstractProperty);
128 }
129
130 #endif //ABSTRACTPROPERTY_H