42 #include "private/qdeclarativedirparser_p.h" 44 #include <private/qdeclarativeglobal_p.h> 46 #include <QtCore/QTextStream> 47 #include <QtCore/QFile> 48 #include <QtCore/QtDebug> 135 int sectionCount = 0;
138 const int length = line.
length();
140 while (index != length) {
141 const QChar ch = line.
at(index);
145 while (index != length && line.
at(index).
isSpace());
152 const int start =
index;
155 while (index != length && !line.
at(index).
isSpace());
157 const QString lexeme = line.
mid(start, index - start);
159 if (sectionCount >= 3) {
163 sections[sectionCount++] = lexeme;
168 if (sectionCount == 0) {
172 if (sectionCount < 2) {
174 QString::fromUtf8(
"plugin directive requires 2 arguments, but %1 were provided").arg(sectionCount + 1));
179 const Plugin entry(sections[1], sections[2]);
184 if (sectionCount != 3) {
186 QString::fromUtf8(
"internal types require 2 arguments, but %1 were provided").arg(sectionCount + 1));
189 Component entry(sections[1], sections[2], -1, -1);
193 if (sectionCount != 2) {
195 QString::fromUtf8(
"typeinfo requires 1 argument, but %1 were provided").arg(sectionCount - 1));
199 TypeInfo typeInfo(sections[1]);
200 _typeInfos.append(typeInfo);
203 }
else if (sectionCount == 2) {
205 const Component entry(sections[0], sections[1], -1, -1);
207 }
else if (sectionCount == 3) {
208 const QString &version = sections[1];
211 if (dotIndex == -1) {
216 bool validVersionNumber =
false;
217 const int majorVersion = version.
left(dotIndex).
toInt(&validVersionNumber);
219 if (validVersionNumber) {
220 const int minorVersion = version.
mid(dotIndex + 1).
toInt(&validVersionNumber);
222 if (validVersionNumber) {
223 const Component entry(sections[0], sections[2], majorVersion, minorVersion);
231 QString::fromUtf8(
"a component declaration requires 3 arguments, but %1 were provided").arg(sectionCount + 1));
259 for (
int i = 0; i < errors.
size(); ++i) {
QList< Component > _components
#define QT_END_NAMESPACE
This macro expands to.
QString readLine(qint64 maxlen=0)
Reads one line of text from the stream, and returns it as a QString.
void setDescription(const QString &)
Sets the error description.
const QChar at(int i) const
Returns the character at the given index position in the string.
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
QList< QDeclarativeError > errors(const QString &uri) const
QString & replace(int i, int len, QChar after)
int length() const
Returns the number of characters in this string.
void setColumn(int)
Sets the error column number.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
The QChar class provides a 16-bit Unicode character.
bool isSpace() const
Returns true if the character is a separator character (Separator_* categories); otherwise returns fa...
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
bool QDeclarative_isFileCaseCorrect(const QString &fileName)
Returns true if the case of fileName is equivalent to the file case of fileName on disk...
void append(const T &t)
Inserts value at the end of the list.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QList< Component > components() const
void reportError(int line, int column, const QString &message)
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void prepend(const T &t)
Inserts value at the beginning of the list.
QString description() const
Returns the error description.
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString fileSource() const
void setFileSource(const QString &filePath)
The QDeclarativeError class encapsulates a QML error.
void clear()
Removes all items from the list.
void setLine(int)
Sets the error line number.
bool isNull() const
Returns true if this string is null; otherwise returns false.
QList< QDeclarativeError > _errors
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
The QFile class provides an interface for reading from and writing to files.
void setUrl(const QUrl &)
Sets the url for the file that caused this error.
The QTextStream class provides a convenient interface for reading and writing text.
int size() const
Returns the number of items in the list.
QByteArray readAll()
Reads all available data from the device, and returns it as a QByteArray.
void setSource(const QString &source)
void setUrl(const QUrl &url)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QList< Plugin > plugins() const
#define forever
This macro is provided for convenience for writing infinite loops.