Qt 4.8
Enumerations | Functions
qmetaobject.cpp File Reference
#include "qmetaobject.h"
#include "qmetatype.h"
#include "qobject.h"
#include <qcoreapplication.h>
#include <qcoreevent.h>
#include <qdatastream.h>
#include <qstringlist.h>
#include <qthread.h>
#include <qvarlengtharray.h>
#include <qvariant.h>
#include <qhash.h>
#include <qdebug.h>
#include <qsemaphore.h>
#include "private/qobject_p.h"
#include "private/qmetaobject_p.h"
#include <ctype.h>

Go to the source code of this file.

Enumerations

enum  { MaximumParamCount = 11 }
 

Functions

template<int MethodType>
static int indexOfMethodRelative (const QMetaObject **baseObject, const char *method, bool normalizeStringData)
 
static const QMetaObjectPrivatepriv (const uint *data)
 
static const QMetaObjectQMetaObject_findMetaObject (const QMetaObject *self, const char *name)
 
static char * qNormalizeType (char *d, int &templdepth, QByteArray &result)
 
static void qRemoveWhitespace (const char *s, char *d)
 
static QByteArray qualifiedName (const QMetaEnum &e)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MaximumParamCount 

Definition at line 1088 of file qmetaobject.cpp.

1088 { MaximumParamCount = 11 }; // up to 10 arguments + 1 return value

Function Documentation

◆ indexOfMethodRelative()

template<int MethodType>
static int indexOfMethodRelative ( const QMetaObject **  baseObject,
const char *  method,
bool  normalizeStringData 
)
inlinestatic
Warning
This function is not part of the public interface. helper function for indexOf{Method,Slot,Signal}, returns the relative index of the method within the baseObject MethodType might be MethodSignal or MethodSlot, or 0 to match everything. normalizeStringData set to true if we should do a second pass for old moc generated files normalizing all the symbols.

Definition at line 537 of file qmetaobject.cpp.

540 {
541  for (const QMetaObject *m = *baseObject; m; m = m->d.superdata) {
542  int i = (MethodType == MethodSignal && priv(m->d.data)->revision >= 4)
543  ? (priv(m->d.data)->signalCount - 1) : (priv(m->d.data)->methodCount - 1);
544  const int end = (MethodType == MethodSlot && priv(m->d.data)->revision >= 4)
545  ? (priv(m->d.data)->signalCount) : 0;
546  if (!normalizeStringData) {
547  for (; i >= end; --i) {
548  const char *stringdata = m->d.stringdata + m->d.data[priv(m->d.data)->methodData + 5*i];
549  if (method[0] == stringdata[0] && strcmp(method + 1, stringdata + 1) == 0) {
550  *baseObject = m;
551  return i;
552  }
553  }
554  } else if (priv(m->d.data)->revision < 5) {
555  for (; i >= end; --i) {
556  const char *stringdata = (m->d.stringdata + m->d.data[priv(m->d.data)->methodData + 5 * i]);
557  const QByteArray normalizedSignature = QMetaObject::normalizedSignature(stringdata);
558  if (normalizedSignature == method) {
559  *baseObject = m;
560  return i;
561  }
562  }
563  }
564  }
565  return -1;
566 }
The QMetaObject class contains meta-information about Qt objects.
Definition: qobjectdefs.h:304
static QByteArray normalizedSignature(const char *method)
Normalizes the signature of the given method.
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
const QMetaObject * superdata
Definition: qobjectdefs.h:469
static const QMetaObjectPrivate * priv(const uint *data)
struct QMetaObject::@38 d
static const KeyPair *const end

◆ priv()

static const QMetaObjectPrivate* priv ( const uint data)
inlinestatic

Definition at line 149 of file qmetaobject.cpp.

Referenced by QHttpPrivate::_q_slotReadyRead(), QNetworkConfigurationManager::allConfigurations(), QDBusConnection::asyncCall(), QTextFrame::begin(), QNetworkConfigurationManager::capabilities(), QRegExp::captureCount(), QRegExp::capturedTexts(), QRegExp::caseSensitivity(), QTextCursor::charFormat(), QMetaObject::classInfo(), QMetaObject::classInfoCount(), QMetaObject::classInfoOffset(), QTextDocument::clone(), QNetworkConfigurationManager::configurationFromIdentifier(), Maemo::conn_settings_notify_func(), QMetaObject::constructor(), QMetaObject::constructorCount(), QDeclarativeEngine::contextForObject(), QHttpNetworkConnectionPrivate::createAuthorization(), QDeclarativeComponentPrivate::createObject(), QNetworkAccessManager::createRequest(), QNetworkConfigurationManager::defaultConfiguration(), QDeclarativeNotifierEndpoint::disconnect(), QDeclarativeBoundSignal::disconnect(), QDeclarativeTextLayout::draw(), QTextFrame::end(), QHttpNetworkConnectionChannel::ensureConnection(), QMetaObject::enumerator(), QMetaObject::enumeratorCount(), QMetaObject::enumeratorOffset(), QRegExp::errorString(), QRegExp::exactMatch(), QTextHtmlExporter::findUrlForImage(), QDeclarativeData::get(), getEngineFromId(), QHttpNetworkConnectionPrivate::handleAuthenticateChallenge(), QMetaProperty::hasStdCppSet(), QRegExp::indexIn(), QMetaObject::indexOfClassInfo(), QMetaObject::indexOfConstructor(), QMetaObject::indexOfEnumerator(), indexOfMethodRelative(), QMetaObject::indexOfProperty(), QCocoaColorPanelDelegate::initWithColorPanel:stolenContentView:okButton:cancelButton:priv:, QCocoaFontPanelDelegate::initWithFontPanel:stolenContentView:okButton:cancelButton:priv:extraWidth:extraHeight:, QWidget::inputMethodQuery(), QMetaMethod::invoke(), QWSServerPrivate::invokeFont(), QRegExp::isEmpty(), QMetaProperty::isEnumType(), QRegExp::isMinimal(), QNetworkConfigurationManager::isOnline(), QRegExp::isValid(), QRegExp::lastIndexIn(), QRegExp::matchedLength(), QMetaObject::method(), QMetaObject::methodCount(), QMetaMethod::methodIndex(), QMetaObject::methodOffset(), QMetaProperty::name(), QMetaProperty::notifySignalIndex(), onApplicationChangedActivation(), QFileOpenEvent::openFile(), QTextFrame::iterator::operator++(), QTextFrame::iterator::operator--(), QRegExp::operator=(), QRegExp::operator==(), QPageSetupDialogPrivate::pageSetupDialogSheetDoneCallback(), QWidgetPrivate::paintBackground(), QRegExp::pattern(), QRegExp::patternSyntax(), QRegExp::pos(), QPrintDialogPrivate::printDialogSheetDoneCallback(), QDeclarativeObjectMethodScriptClass::property(), QMetaObject::property(), QMetaObject::propertyCount(), QMetaObject::propertyOffset(), QNetworkAccessManagerPrivate::proxyAuthenticationRequired(), QDirIterator::QDirIterator(), QFileOpenEvent::QFileOpenEvent(), QMetaObject_findMetaObject(), QMimeSourceWrapper::QMimeSourceWrapper(), QNetworkConfigurationManager::QNetworkConfigurationManager(), QRegExp::QRegExp(), qt_init(), rasterFallbacksMask(), QMetaProperty::read(), QMetaMethod::revision(), QMetaProperty::revision(), QScriptDebuggerPrivate::scheduleJob(), QRegExp::setCaseSensitivity(), QRegExp::setMinimal(), QRegExp::setPattern(), QRegExp::setPatternSyntax(), QHttpSocketEngine::slotSocketConnected(), QHttpSocketEngine::slotSocketReadNotification(), QNetworkSessionPrivateImpl::stateChange(), QMetaObject::static_metacall(), QRegExp::swap(), QMetaProperty::type(), QMetaProperty::typeName(), QNetworkConfigurationManager::updateConfigurations(), QMetaProperty::write(), QApplicationPrivate::~QApplicationPrivate(), QNetworkConfigurationManager::~QNetworkConfigurationManager(), and QRegExp::~QRegExp().

150 { return reinterpret_cast<const QMetaObjectPrivate*>(data); }
static const char * data(const QByteArray &arr)

◆ QMetaObject_findMetaObject()

static const QMetaObject* QMetaObject_findMetaObject ( const QMetaObject self,
const char *  name 
)
static

Definition at line 692 of file qmetaobject.cpp.

Referenced by QMetaObject::property().

693 {
694  while (self) {
695  if (strcmp(self->d.stringdata, name) == 0)
696  return self;
697  if (self->d.extradata) {
698 #ifdef Q_NO_DATA_RELOCATION
699  const QMetaObjectAccessor *e;
700  Q_ASSERT(priv(self->d.data)->revision >= 2);
701 #else
702  const QMetaObject **e;
703  if (priv(self->d.data)->revision < 2) {
704  e = (const QMetaObject**)(self->d.extradata);
705  } else
706 #endif
707  {
708  const QMetaObjectExtraData *extra = (const QMetaObjectExtraData*)(self->d.extradata);
709  e = extra->objects;
710  }
711  if (e) {
712  while (*e) {
713 #ifdef Q_NO_DATA_RELOCATION
714  if (const QMetaObject *m =QMetaObject_findMetaObject(&((*e)()), name))
715 #else
716  if (const QMetaObject *m =QMetaObject_findMetaObject((*e), name))
717 #endif
718  return m;
719  ++e;
720  }
721  }
722  }
723  self = self->d.superdata;
724  }
725  return self;
726 }
The QMetaObject class contains meta-information about Qt objects.
Definition: qobjectdefs.h:304
const void * extradata
Definition: qobjectdefs.h:472
const char * stringdata
Definition: qobjectdefs.h:470
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
const QMetaObject &(* QMetaObjectAccessor)()
Definition: qobjectdefs.h:476
const char * name
const uint * data
Definition: qobjectdefs.h:471
static const QMetaObject * QMetaObject_findMetaObject(const QMetaObject *self, const char *name)
const QMetaObject * superdata
Definition: qobjectdefs.h:469
static const QMetaObjectPrivate * priv(const uint *data)
struct QMetaObject::@38 d
const QMetaObject ** objects
Definition: qobjectdefs.h:483

◆ qNormalizeType()

static char* qNormalizeType ( char *  d,
int &  templdepth,
QByteArray result 
)
static

Definition at line 997 of file qmetaobject.cpp.

Referenced by QMetaObject::normalizedSignature(), and QMetaObject::normalizedType().

998 {
999  const char *t = d;
1000  while (*d && (templdepth
1001  || (*d != ',' && *d != ')'))) {
1002  if (*d == '<')
1003  ++templdepth;
1004  if (*d == '>')
1005  --templdepth;
1006  ++d;
1007  }
1008  if (strncmp("void", t, d - t) != 0)
1009  result += normalizeTypeInternal(t, d);
1010 
1011  return d;
1012 }
double d
Definition: qnumeric_p.h:62
static QByteArray normalizeTypeInternal(const char *t, const char *e, bool fixScope=false, bool adjustConst=true)

◆ qRemoveWhitespace()

static void qRemoveWhitespace ( const char *  s,
char *  d 
)
static

Definition at line 979 of file qmetaobject.cpp.

Referenced by QMetaObject::normalizedSignature(), and QMetaObject::normalizedType().

980 {
981  char last = 0;
982  while (*s && is_space(*s))
983  s++;
984  while (*s) {
985  while (*s && !is_space(*s))
986  last = *d++ = *s++;
987  while (*s && is_space(*s))
988  s++;
989  if (*s && ((is_ident_char(*s) && is_ident_char(last))
990  || ((*s == ':') && (last == '<')))) {
991  last = *d++ = ' ';
992  }
993  }
994  *d = '\0';
995 }
double d
Definition: qnumeric_p.h:62
static bool is_ident_char(char s)
static bool is_space(char s)

◆ qualifiedName()

static QByteArray qualifiedName ( const QMetaEnum e)
static

Definition at line 2071 of file qmetaobject.cpp.

Referenced by QXmlStreamAttribute::operator==(), QXmlStreamAttributes::QXmlStreamAttributes(), QMetaProperty::read(), QPatternist::XsdSchemaResolver::resolveEnumerationFacetValues(), QMetaProperty::type(), QMetaProperty::userType(), and QMetaProperty::write().

2072 {
2073  return QByteArray(e.scope()) + "::" + e.name();
2074 }
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
const char * scope() const
Returns the scope this enumerator was declared in.
const char * name() const
Returns the name of the enumerator (without the scope).