Qt 4.8
Classes | Typedefs | Functions
qdeclarativeimport.cpp File Reference
#include "qdeclarativeimport_p.h"
#include <QtCore/qdebug.h>
#include <QtCore/qdir.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qpluginloader.h>
#include <QtCore/qlibraryinfo.h>
#include <QtCore/qalgorithms.h>
#include <QtDeclarative/qdeclarativeextensioninterface.h>
#include <private/qdeclarativeglobal_p.h>
#include <private/qdeclarativetypenamecache_p.h>
#include <private/qdeclarativeengine_p.h>

Go to the source code of this file.

Classes

class  QDeclarativeImportedNamespace
 
class  QDeclarativeImportsPrivate
 

Typedefs

typedef QMap< QString, QStringStringStringMap
 

Functions

static QDeclarativeTypeNameCachecacheForNamespace (QDeclarativeEngine *engine, const QDeclarativeImportedNamespace &set, QDeclarativeTypeNameCache *cache)
 
static bool greaterThan (const QString &s1, const QString &s2)
 
 Q_GLOBAL_STATIC (StringStringMap, qmlEnginePluginsWithRegisteredTypes)
 

Typedef Documentation

◆ StringStringMap

Definition at line 69 of file qdeclarativeimport.cpp.

Function Documentation

◆ cacheForNamespace()

static QDeclarativeTypeNameCache* cacheForNamespace ( QDeclarativeEngine engine,
const QDeclarativeImportedNamespace set,
QDeclarativeTypeNameCache cache 
)
static

Definition at line 173 of file qdeclarativeimport.cpp.

Referenced by QDeclarativeImports::populateCache().

175 {
176  if (!cache)
177  cache = new QDeclarativeTypeNameCache(engine);
178 
180 
181  for (int ii = 0; ii < set.uris.count(); ++ii) {
182  QByteArray base = set.uris.at(ii).toUtf8() + '/';
183  int major = set.majversions.at(ii);
184  int minor = set.minversions.at(ii);
185 
186  foreach (QDeclarativeType *type, types) {
187  if (type->qmlTypeName().startsWith(base) &&
188  type->qmlTypeName().lastIndexOf('/') == (base.length() - 1) &&
189  type->availableInVersion(major,minor))
190  {
191  QString name = QString::fromUtf8(type->qmlTypeName().mid(base.length()));
192 
193  cache->add(name, type);
194  }
195  }
196  }
197 
198  return cache;
199 }
int type
Definition: qmetatype.cpp:239
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
static QList< QDeclarativeType * > qmlTypes()
Returns the list of registered QML types.
void add(const QString &, int)
The QString class provides a Unicode character string.
Definition: qstring.h:83
bool startsWith(const QByteArray &a) const
Returns true if this byte array starts with byte array ba; otherwise returns false.
static const uint base
Definition: qurl.cpp:268
int lastIndexOf(char c, int from=-1) const
Returns the index position of the last occurrence of character ch in the byte array, searching backward from index position from.
const char * name
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
Definition: qstring.cpp:4302
QByteArray qmlTypeName() const
QByteArray mid(int index, int len=-1) const
Returns a byte array containing len bytes from this byte array, starting at position pos...
int length() const
Same as size().
Definition: qbytearray.h:356
static const struct @32 types[]
bool availableInVersion(int vmajor, int vminor) const
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ greaterThan()

static bool greaterThan ( const QString s1,
const QString s2 
)
static

◆ Q_GLOBAL_STATIC()

Q_GLOBAL_STATIC ( StringStringMap  ,
qmlEnginePluginsWithRegisteredTypes   
)