• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Kross

  • sources
  • kde-4.12
  • kdelibs
  • kross
  • core
metafunction.h
Go to the documentation of this file.
1 /***************************************************************************
2  * metafunction.h
3  * This file is part of the KDE project
4  * copyright (C)2005-2006 Ian Reinhart Geiser <geiseri@kde.org>
5  * copyright (C)2005-2006 Matt Broadstone <mbroadst@gmail.com>
6  * copyright (C)2005-2006 Richard J. Moore <rich@kde.org>
7  * copyright (C)2005-2006 Erik L. Bunce <kde@bunce.us>
8  * copyright (C)2005-2007 by Sebastian Sauer <mail@dipe.org>
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Library General Public License for more details.
18  * You should have received a copy of the GNU Library General Public License
19  * along with this program; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  ***************************************************************************/
23 
24 #ifndef KROSS_METAFUNCTION_H
25 #define KROSS_METAFUNCTION_H
26 
27 #include <QtCore/QObject>
28 #include <QtCore/QArgument>
29 #include <QtCore/QByteRef>
30 #include <QtCore/QPointer>
31 
32 namespace Kross {
33 
42  class MetaFunction : public QObject
43  {
44  public:
45 
54  MetaFunction(QObject* sender, const QByteArray& signal)
55  : QObject(), m_sender(sender), m_signature(QMetaObject::normalizedSignature(signal))
56  {
57  //krossdebug(QString("MetaFunction sender=\"%1\" signal=\"%2\"").arg(sender->objectName()).arg(m_signature.constData()));
58  const uint signatureSize = m_signature.size() + 1;
59 
60  // content
61  m_data[0] = 1; // revision
62  m_data[1] = 0; // classname
63  m_data[2] = 0; // classinfo
64  m_data[3] = 0; // classinfo
65  m_data[4] = 1; // methods
66  m_data[5] = 15; // methods
67  m_data[6] = 0; // properties
68  m_data[7] = 0; // properties
69  m_data[8] = 0; // enums/sets
70  m_data[9] = 0; // enums/sets
71 
72  // slots
73  m_data[15] = 15; // signature start
74  m_data[16] = 15 + signatureSize; // parameters start
75  m_data[17] = 15 + signatureSize; // type start
76  m_data[18] = 15 + signatureSize; // tag start
77  m_data[19] = 0x0a; // flags
78  m_data[20] = 0; // eod
79 
80  // data
81  m_stringData = QByteArray("ScriptFunction\0", 15);
82  m_stringData += m_signature;
83  m_stringData += QByteArray("\0\0", 2);
84 
85  // static metaobject
86  staticMetaObject.d.superdata = &QObject::staticMetaObject;
87  staticMetaObject.d.stringdata = m_stringData.data();
88  staticMetaObject.d.data = m_data;
89  staticMetaObject.d.extradata = 0;
90  }
91 
95  virtual ~MetaFunction() {}
96 
101  QMetaObject staticMetaObject;
102 
107  const QMetaObject *metaObject() const {
108  return &staticMetaObject;
109  }
110 
116  void *qt_metacast(const char *_clname) {
117  if (! _clname)
118  return 0;
119  if (! strcmp(_clname, m_stringData))
120  return static_cast<void*>( const_cast< MetaFunction* >(this) );
121  return QObject::qt_metacast(_clname);
122  }
123 
128  int qt_metacall(QMetaObject::Call _c, int _id, void **_a) = 0;
129 
130  protected:
132  QPointer<QObject> m_sender;
134  QByteArray m_signature;
136  QByteArray m_stringData;
138  uint m_data[21];
139  };
140 
141 }
142 
143 #endif
Kross::MetaFunction::staticMetaObject
QMetaObject staticMetaObject
The static QMetaObject instance that provides the QMeta-information for this QObject class...
Definition: metafunction.h:101
Kross::MetaFunction::qt_metacast
void * qt_metacast(const char *_clname)
Try to cast this QObject instance into the class with name _clname and return the casted pointer or N...
Definition: metafunction.h:116
Kross::MetaFunction::~MetaFunction
virtual ~MetaFunction()
Destructor.
Definition: metafunction.h:95
Kross::MetaFunction::m_signature
QByteArray m_signature
The signature.
Definition: metafunction.h:134
QObject
Kross::MetaFunction::m_stringData
QByteArray m_stringData
The stringdata.
Definition: metafunction.h:136
Kross::MetaFunction::m_data
uint m_data[21]
The data array.
Definition: metafunction.h:138
Kross::MetaFunction
The MetaFunction class implements a QObject to provide an adaptor between Qt signals+slots and script...
Definition: metafunction.h:42
Kross::MetaFunction::metaObject
const QMetaObject * metaObject() const
Definition: metafunction.h:107
Kross::MetaFunction::m_sender
QPointer< QObject > m_sender
The sender QObject.
Definition: metafunction.h:132
Kross::MetaFunction::qt_metacall
int qt_metacall(QMetaObject::Call _c, int _id, void **_a)=0
This method got called if a method this QObject instance defines should be invoked.
Kross::MetaFunction::MetaFunction
MetaFunction(QObject *sender, const QByteArray &signal)
Constructor.
Definition: metafunction.h:54
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:54 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kross

Skip menu "Kross"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal