File indexing completed on 2025-01-05 04:12:11

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2011 Joshua Netterfield                               *
0004  *                   joshua.netterfield@gmail.com                          *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  ***************************************************************************/
0012 
0013 #ifndef SCRIPTINTERFACE_H
0014 #define SCRIPTINTERFACE_H
0015 
0016 #ifndef CALL_MEMBER_FN
0017 #define CALL_MEMBER_FN(object,ptrToMember)  ((object).*(ptrToMember))
0018 #endif
0019 
0020 #include <QByteArray>
0021 #include <QString>
0022 #include <QList>
0023 #include <QObject>
0024 
0025 #include "kst_export.h"
0026 #include "object.h"
0027 
0028 typedef QList<QByteArray> QByteArrayList;
0029 
0030 namespace Kst {
0031 
0032 class NamedObject;
0033 
0034 /** A script interface represents an object exposed through the scripting interface.
0035   * (ex., dialog, primitive, etc.)
0036   */
0037 class KSTCORE_EXPORT ScriptInterface : public QObject
0038 {
0039     Q_OBJECT
0040 public:
0041     virtual QString doCommand(QString)=0;
0042     virtual bool isValid()=0;
0043     virtual QByteArray endEditUpdate()=0;
0044     static QString doNamedObjectCommand(QString command, NamedObject *n);
0045     static QString doObjectCommand(QString command, ObjectPtr ob);
0046 
0047     static QStringList getArgs(const QString &command);
0048     static QString getArg(const QString &command);
0049 
0050 };
0051 
0052 }
0053 
0054 #endif // SCRIPTINTERFACE_H