Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qsobjectfactory.h 1.1.5 edited 2006-02-23T15:39:57$ 00003 ** 00004 ** Copyright (C) 2001-2006 Trolltech AS. All rights reserved. 00005 ** 00006 ** This file is part of the Qt Script for Applications framework (QSA). 00007 ** 00008 ** This file may be distributed and/or modified under the terms of the 00009 ** GNU General Public License version 2 as published by the Free Software 00010 ** Foundation and appearing in the file LICENSE.GPL included in the 00011 ** packaging of this file. 00012 ** 00013 ** Licensees holding a valid Qt Script for Applications license may use 00014 ** this file in accordance with the Qt Script for Applications License 00015 ** Agreement provided with the Software. 00016 ** 00017 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00018 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00019 ** 00020 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00021 ** information about QSA Commercial License Agreements. 00022 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00023 ** 00024 ** Contact info@trolltech.com if any conditions of this licensing are 00025 ** not clear to you. 00026 ** 00027 *****************************************************************************/ 00028 00029 #ifndef QSOBJECTFACTORY_H 00030 #define QSOBJECTFACTORY_H 00031 00032 #include <qsaglobal.h> 00033 #include <qsargument.h> 00034 00035 class QObject; 00036 class QSInterpreter; 00037 class QSObjectFactoryPrivate; 00038 00039 00040 00041 class QSA_EXPORT QSObjectFactory 00042 { 00043 friend class QSInterpreter; 00044 public: 00045 QSObjectFactory(); 00046 virtual ~QSObjectFactory(); 00047 00048 virtual QObject *create( const QString &className, 00049 const QSArgumentList &arguments, 00050 QObject *context ); 00051 00052 void registerClass( const QString &className, 00053 QObject *staticInstance = 0 ); 00054 00055 void registerClass( const QString &className, 00056 const QString &cppClassName, 00057 QObject *staticInstance = 0 ); 00058 00059 QMap<QString,QObject*> staticDescriptors() const; 00060 QMap<QString,QString> instanceDescriptors() const; 00061 00062 void throwError( const QString &message ); 00063 00064 protected: 00065 QSInterpreter *interpreter() const; 00066 00067 private: 00068 void setInterpreter( QSInterpreter *ip ); 00069 00070 QSObjectFactoryPrivate *d; 00071 }; 00072 00073 #endif