diff options
author | Thiago Macieira <thiago@kde.org> | 2006-06-05 18:13:07 +0000 |
---|---|---|
committer | Thiago Macieira <thiago@kde.org> | 2006-06-05 18:13:07 +0000 |
commit | 517b8c2446029901e9062e858b723906cf20d7ef (patch) | |
tree | 61a02acb1f4769993c985d7a0aa91fab9c2694c7 /qt/tools/dbuscpp2xml.cpp | |
parent | 54b762aa4c692596f70892f7fb3d7e495bd8268a (diff) |
* qt/dbus: Add directory. I had forgotten to add this
yesterday after the move...
* qt/examples/Makefile.am:
* qt/examples/dbus.cpp: Moved to qt/tools/dbus.cpp.
* qt/tools/Makefile.am:
* qt/tools/dbus.cpp: Moved from qt/examples/dbus.cpp.
Added feature to get and set properties.
Added validation of service, object path and interface names.
* qt/tools/dbusidl2cpp.cpp: Two new features:
1) Allow specifying both the header and the source file names,
by separating them with a colon.
2) Don't write an interface output if the -p switch wasn't
given, but the -a was.
* qt/src/*: Fix usage of Iterators and ConstIterators.
Fix shadowing of variables by other variables (-Wshadow).
Fix keyword-cleanliness in headers.
Fix ASCII-cast (QLatin1String, QLatin1Char).
Fix validation of member names.
Add extra checking of introspection data during XML parsing.
Various bug fixes.
Diffstat (limited to 'qt/tools/dbuscpp2xml.cpp')
-rw-r--r-- | qt/tools/dbuscpp2xml.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/qt/tools/dbuscpp2xml.cpp b/qt/tools/dbuscpp2xml.cpp index dd08b5fd..42d78312 100644 --- a/qt/tools/dbuscpp2xml.cpp +++ b/qt/tools/dbuscpp2xml.cpp @@ -29,6 +29,7 @@ #include <QRegExp> #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <errno.h> #include <unistd.h> @@ -76,7 +77,7 @@ class MocParser QIODevice *input; const char *filename; - int line; + int lineNumber; public: ~MocParser(); void parse(const char *filename, QIODevice *input, int lineNumber = 0); @@ -86,13 +87,13 @@ public: void MocParser::parseError() { - fprintf(stderr, PROGRAMNAME ": error parsing input file '%s' line %d \n", filename, line); + fprintf(stderr, PROGRAMNAME ": error parsing input file '%s' line %d \n", filename, lineNumber); exit(1); } QByteArray MocParser::readLine() { - ++line; + ++lineNumber; return input->readLine(); } @@ -100,15 +101,15 @@ void MocParser::loadIntData(uint *&data) { data = 0; // initialise QVarLengthArray<uint> array; - QRegExp rx("(\\d+|0x[0-9abcdef]+)", Qt::CaseInsensitive); + QRegExp rx(QLatin1String("(\\d+|0x[0-9abcdef]+)"), Qt::CaseInsensitive); while (!input->atEnd()) { QString line = QLatin1String(readLine()); - int pos = line.indexOf("//"); + int pos = line.indexOf(QLatin1String("//")); if (pos != -1) line.truncate(pos); // drop comments - if (line == "};\n") { + if (line == QLatin1String("};\n")) { // end of data data = new uint[array.count()]; memcpy(data, array.data(), array.count() * sizeof(*data)); @@ -118,7 +119,7 @@ void MocParser::loadIntData(uint *&data) pos = 0; while ((pos = rx.indexIn(line, pos)) != -1) { QString num = rx.cap(1); - if (num.startsWith("0x")) + if (num.startsWith(QLatin1String("0x"))) array.append(num.mid(2).toUInt(0, 16)); else array.append(num.toUInt()); @@ -205,7 +206,7 @@ void MocParser::loadStringData(char *&stringdata) } } else { // octal - QRegExp octal("([0-7]+)"); + QRegExp octal(QLatin1String("([0-7]+)")); if (octal.indexIn(QLatin1String(line), start) == -1) parseError(); array.append(char(octal.cap(1).toInt(0, 8))); @@ -218,11 +219,11 @@ void MocParser::loadStringData(char *&stringdata) parseError(); } -void MocParser::parse(const char *fname, QIODevice *io, int lineNumber) +void MocParser::parse(const char *fname, QIODevice *io, int lineNum) { filename = fname; input = io; - line = lineNumber; + lineNumber = lineNum; while (!input->atEnd()) { QByteArray line = readLine(); @@ -360,7 +361,7 @@ int main(int argc, char **argv) else { // run moc on this file QProcess proc; - proc.start("moc", QStringList() << QFile::encodeName(argv[i])); + proc.start(QLatin1String("moc"), QStringList() << QFile::decodeName(argv[i])); if (!proc.waitForStarted()) { fprintf(stderr, PROGRAMNAME ": could not execute moc! Aborting.\n"); |