Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqmljsloadergenerator.cpp File Reference

(ba64b7a70eedf6a2023ef86eda542cad6f4b21be)

#include "qqmljsloadergenerator_p.h"
#include <QByteArray>
#include <QRegularExpression>
#include <QString>
#include <QStringList>
#include <QTextStream>
#include <QVector>
#include <QtEndian>
#include <QStack>
#include <QFileInfo>
#include <QSaveFile>
#include <algorithm>
+ Include dependency graph for qqmljsloadergenerator.cpp:

Go to the source code of this file.

Functions

QT_BEGIN_NAMESPACE QString mangledIdentifier (const QString &str)
 
QString qQmlJSSymbolNamespaceForPath (const QString &relativePath)
 
static QString qtResourceNameForFile (const QString &fileName)
 
bool qQmlJSGenerateLoader (const QStringList &compiledFiles, const QString &outputFileName, const QStringList &resourceFileMappings, QString *errorString)
 

Function Documentation

◆ mangledIdentifier()

QT_BEGIN_NAMESPACE QString mangledIdentifier ( const QString & str)

Mangles str to be a unique C++ identifier. Characters that are invalid for C++ identifiers are replaced by the pattern _0x<hex>_ where <hex> is the hexadecimal unicode representation of the character. As identifiers with leading underscores followed by either another underscore or a capital letter are reserved in C++, we also escape those, by escaping the first underscore, using the above method.

Note
Although C++11 allows for non-ascii (unicode) characters to be used in identifiers, many compilers forgot to read the spec and do not implement this. Some also do not implement C99 identifiers, because that is {at the implementation's discretion}. So, we are stuck with plain old boring identifiers.

Definition at line 35 of file qqmljsloadergenerator.cpp.

References QString::at(), ch, i, QString::isEmpty(), QString::number(), Q_ASSERT, QString::reserve(), QString::size(), QString::startsWith(), and str.

Referenced by qQmlJSSymbolNamespaceForPath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qQmlJSGenerateLoader()

bool qQmlJSGenerateLoader ( const QStringList & compiledFiles,
const QString & outputFileName,
const QStringList & resourceFileMappings,
QString * errorString )

Definition at line 93 of file qqmljsloadergenerator.cpp.

References QString::at(), i, QString::indexOf(), qQmlJSSymbolNamespaceForPath(), QStringLiteral, qtResourceNameForFile(), QIODeviceBase::Truncate, and QIODeviceBase::WriteOnly.

+ Here is the call graph for this function:

◆ qQmlJSSymbolNamespaceForPath()

QString qQmlJSSymbolNamespaceForPath ( const QString & relativePath)

Definition at line 67 of file qqmljsloadergenerator.cpp.

References QString::clear(), mangledIdentifier(), QString::replace(), QString::size(), and QString::startsWith().

Referenced by qQmlJSGenerateLoader(), and qSaveQmlJSUnitAsCpp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qtResourceNameForFile()

static QString qtResourceNameForFile ( const QString & fileName)
static

Definition at line 83 of file qqmljsloadergenerator.cpp.

References fileName, and QString::replace().

Referenced by qQmlJSGenerateLoader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: