src/declarative/util/qdeclarativeopenmetaobject_p.h
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
child 37 758a864f9613
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    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 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    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 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QDECLARATIVEOPENMETAOBJECT_H
       
    43 #define QDECLARATIVEOPENMETAOBJECT_H
       
    44 
       
    45 #include <private/qdeclarativerefcount_p.h>
       
    46 #include <QtCore/QMetaObject>
       
    47 #include <QtCore/QObject>
       
    48 
       
    49 #include <private/qobject_p.h>
       
    50 
       
    51 QT_BEGIN_HEADER
       
    52 
       
    53 QT_BEGIN_NAMESPACE
       
    54 
       
    55 QT_MODULE(Declarative)
       
    56 
       
    57 class QDeclarativeEngine;
       
    58 class QMetaPropertyBuilder;
       
    59 class QDeclarativeOpenMetaObjectTypePrivate;
       
    60 class Q_DECLARATIVE_EXPORT QDeclarativeOpenMetaObjectType : public QDeclarativeRefCount
       
    61 {
       
    62 public:
       
    63     QDeclarativeOpenMetaObjectType(const QMetaObject *base, QDeclarativeEngine *engine);
       
    64     ~QDeclarativeOpenMetaObjectType();
       
    65 
       
    66     int createProperty(const QByteArray &name);
       
    67 
       
    68     int propertyOffset() const;
       
    69     int signalOffset() const;
       
    70 
       
    71 protected:
       
    72     virtual void propertyCreated(int, QMetaPropertyBuilder &);
       
    73 
       
    74 private:
       
    75     QDeclarativeOpenMetaObjectTypePrivate *d;
       
    76     friend class QDeclarativeOpenMetaObject;
       
    77     friend class QDeclarativeOpenMetaObjectPrivate;
       
    78 };
       
    79 
       
    80 class QDeclarativeOpenMetaObjectPrivate;
       
    81 class Q_DECLARATIVE_EXPORT QDeclarativeOpenMetaObject : public QAbstractDynamicMetaObject
       
    82 {
       
    83 public:
       
    84     QDeclarativeOpenMetaObject(QObject *, bool = true);
       
    85     QDeclarativeOpenMetaObject(QObject *, QDeclarativeOpenMetaObjectType *, bool = true);
       
    86     ~QDeclarativeOpenMetaObject();
       
    87 
       
    88     QVariant value(const QByteArray &) const;
       
    89     void setValue(const QByteArray &, const QVariant &);
       
    90     QVariant value(int) const;
       
    91     void setValue(int, const QVariant &);
       
    92     QVariant &operator[](const QByteArray &);
       
    93     QVariant &operator[](int);
       
    94 
       
    95     int count() const;
       
    96     QByteArray name(int) const;
       
    97 
       
    98     QObject *object() const;
       
    99     virtual QVariant initialValue(int);
       
   100 
       
   101     // Be careful - once setCached(true) is called createProperty() is no
       
   102     // longer automatically called for new properties.
       
   103     void setCached(bool);
       
   104 
       
   105     QDeclarativeOpenMetaObjectType *type() const;
       
   106 
       
   107 protected:
       
   108     virtual int metaCall(QMetaObject::Call _c, int _id, void **_a);
       
   109     virtual int createProperty(const char *, const char *);
       
   110 
       
   111     virtual void propertyRead(int);
       
   112     virtual void propertyWrite(int);
       
   113     virtual void propertyWritten(int);
       
   114     virtual void propertyCreated(int, QMetaPropertyBuilder &);
       
   115 
       
   116     QAbstractDynamicMetaObject *parent() const;
       
   117 
       
   118 private:
       
   119     QDeclarativeOpenMetaObjectPrivate *d;
       
   120     friend class QDeclarativeOpenMetaObjectType;
       
   121 };
       
   122 
       
   123 QT_END_NAMESPACE
       
   124 
       
   125 QT_END_HEADER
       
   126 
       
   127 #endif // QDECLARATIVEOPENMETAOBJECT_H