From 882bf3475c8926abe62ed71e6719458b024caac0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 13 Jan 2014 15:48:44 +0100 Subject: expand tabs and related whitespace fixes in *.{cpp,h,qdoc} the diff -w for this commit is empty. Started-by: Thiago Macieira Change-Id: I77bb84e71c63ce75e0709e5b94bee18e3ce6ab9e Reviewed-by: Thiago Macieira --- .../xml/sax/qxmlsimplereader/parser/parser.cpp | 284 ++++++++++----------- .../auto/xml/sax/qxmlsimplereader/parser/parser.h | 16 +- .../sax/qxmlsimplereader/tst_qxmlsimplereader.cpp | 82 +++--- 3 files changed, 191 insertions(+), 191 deletions(-) (limited to 'tests/auto/xml/sax') diff --git a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp index c00a5c7caa..3dd733f61e 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp +++ b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.cpp @@ -47,70 +47,70 @@ class ContentHandler : public QXmlDefaultHandler { - public: - ContentHandler(); - - // QXmlContentHandler methods - bool startDocument(); - bool endDocument(); - bool startElement(const QString &namespaceURI, - const QString &localName, - const QString &qName, - const QXmlAttributes & atts); - bool endElement(const QString &namespaceURI, - const QString &localName, - const QString &qName); - bool characters(const QString &ch); - void setDocumentLocator(QXmlLocator *locator); - bool startPrefixMapping (const QString &prefix, const QString & uri); - bool endPrefixMapping(const QString &prefix); - bool ignorableWhitespace (const QString & ch); - bool processingInstruction(const QString &target, const QString &data); - bool skippedEntity (const QString & name); - - // QXmlErrorHandler methods - bool warning (const QXmlParseException & exception); - bool error (const QXmlParseException & exception); - bool fatalError (const QXmlParseException & exception); - - // QXmlDTDHandler methods - bool notationDecl ( const QString & name, const QString & publicId, - const QString & systemId ); - bool unparsedEntityDecl ( const QString & name, - const QString & publicId, - const QString & systemId, - const QString & notationName ); - - // QXmlEntityResolver methods - bool resolveEntity ( const QString & publicId, - const QString & systemId, - QXmlInputSource *&); - - // QXmlLexicalHandler methods - bool startDTD ( const QString & name, const QString & publicId, const QString & systemId ); - bool endDTD (); - bool startEntity ( const QString & name ); - bool endEntity ( const QString & name ); - bool startCDATA (); - bool endCDATA (); - bool comment ( const QString & ch ); - - // QXmlDeclHandler methods - bool attributeDecl ( const QString & eName, const QString & aName, const QString & type, const QString & valueDefault, const QString & value ); - bool internalEntityDecl ( const QString & name, const QString & value ); - bool externalEntityDecl ( const QString & name, const QString & publicId, const QString & systemId ); - - - const QString &result() const { return m_result; } - const QString &errorMsg() const { return m_error_msg; } - - private: - QString nestPrefix() const { return QString().fill(' ', 3*m_nest); } - QString formatAttributes(const QXmlAttributes & atts); - QString escapeStr(const QString &s); - - unsigned m_nest; - QString m_result, m_error_msg; +public: + ContentHandler(); + + // QXmlContentHandler methods + bool startDocument(); + bool endDocument(); + bool startElement(const QString &namespaceURI, + const QString &localName, + const QString &qName, + const QXmlAttributes &atts); + bool endElement(const QString &namespaceURI, + const QString &localName, + const QString &qName); + bool characters(const QString &ch); + void setDocumentLocator(QXmlLocator *locator); + bool startPrefixMapping(const QString &prefix, const QString &uri); + bool endPrefixMapping(const QString &prefix); + bool ignorableWhitespace(const QString &ch); + bool processingInstruction(const QString &target, const QString &data); + bool skippedEntity(const QString &name); + + // QXmlErrorHandler methods + bool warning(const QXmlParseException &exception); + bool error(const QXmlParseException &exception); + bool fatalError(const QXmlParseException &exception); + + // QXmlDTDHandler methods + bool notationDecl(const QString &name, const QString &publicId, + const QString &systemId); + bool unparsedEntityDecl(const QString &name, + const QString &publicId, + const QString &systemId, + const QString ¬ationName); + + // QXmlEntityResolver methods + bool resolveEntity(const QString &publicId, + const QString &systemId, + QXmlInputSource *&); + + // QXmlLexicalHandler methods + bool startDTD (const QString &name, const QString &publicId, const QString &systemId); + bool endDTD(); + bool startEntity(const QString &name); + bool endEntity(const QString &name); + bool startCDATA(); + bool endCDATA(); + bool comment(const QString &ch); + + // QXmlDeclHandler methods + bool attributeDecl(const QString &eName, const QString &aName, const QString &type, const QString &valueDefault, const QString &value); + bool internalEntityDecl(const QString &name, const QString &value); + bool externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId); + + + const QString &result() const { return m_result; } + const QString &errorMsg() const { return m_error_msg; } + +private: + QString nestPrefix() const { return QString().fill(' ', 3*m_nest); } + QString formatAttributes(const QXmlAttributes & atts); + QString escapeStr(const QString &s); + + unsigned m_nest; + QString m_result, m_error_msg; }; ContentHandler::ContentHandler() @@ -136,15 +136,15 @@ bool ContentHandler::endDocument() } bool ContentHandler::startElement(const QString &namespaceURI, - const QString &localName, - const QString &qName, - const QXmlAttributes & atts) + const QString &localName, + const QString &qName, + const QXmlAttributes &atts) { m_result += nestPrefix(); m_result += "startElement(namespaceURI=\"" + escapeStr(namespaceURI) - + "\", localName=\"" + escapeStr(localName) - + "\", qName=\"" + escapeStr(qName) - + "\", atts=[" + formatAttributes(atts) + "])\n"; + + "\", localName=\"" + escapeStr(localName) + + "\", qName=\"" + escapeStr(qName) + + "\", atts=[" + formatAttributes(atts) + "])\n"; ++m_nest; return true; } @@ -164,25 +164,25 @@ QString ContentHandler::formatAttributes(const QXmlAttributes &atts) { QString result; for (int i = 0, cnt = atts.count(); i < cnt; ++i) { - if (i != 0) result += ", "; - result += "{localName=\"" + escapeStr(atts.localName(i)) - + "\", qName=\"" + escapeStr(atts.qName(i)) - + "\", uri=\"" + escapeStr(atts.uri(i)) - + "\", type=\"" + escapeStr(atts.type(i)) - + "\", value=\"" + escapeStr(atts.value(i)) + "\"}"; + if (i != 0) result += ", "; + result += "{localName=\"" + escapeStr(atts.localName(i)) + + "\", qName=\"" + escapeStr(atts.qName(i)) + + "\", uri=\"" + escapeStr(atts.uri(i)) + + "\", type=\"" + escapeStr(atts.type(i)) + + "\", value=\"" + escapeStr(atts.value(i)) + "\"}"; } return result; } bool ContentHandler::endElement(const QString &namespaceURI, - const QString &localName, - const QString &qName) + const QString &localName, + const QString &qName) { --m_nest; m_result += nestPrefix(); m_result += "endElement(namespaceURI=\"" + escapeStr(namespaceURI) - + "\", localName=\"" + escapeStr(localName) - + "\", qName=\"" + escapeStr(qName) + "\")\n"; + + "\", localName=\"" + escapeStr(localName) + + "\", qName=\"" + escapeStr(qName) + "\")\n"; return true; } @@ -197,16 +197,16 @@ void ContentHandler::setDocumentLocator(QXmlLocator *locator) { m_result += nestPrefix(); m_result += "setDocumentLocator(locator={columnNumber=" - + QString::number(locator->columnNumber()) - + ", lineNumber=" + QString::number(locator->lineNumber()) - + "})\n"; + + QString::number(locator->columnNumber()) + + ", lineNumber=" + QString::number(locator->lineNumber()) + + "})\n"; } bool ContentHandler::startPrefixMapping (const QString &prefix, const QString & uri) { m_result += nestPrefix(); m_result += "startPrefixMapping(prefix=\"" + escapeStr(prefix) - + "\", uri=\"" + escapeStr(uri) + "\")\n"; + + "\", uri=\"" + escapeStr(uri) + "\")\n"; ++m_nest; return true; } @@ -230,7 +230,7 @@ bool ContentHandler::processingInstruction(const QString &target, const QString { m_result += nestPrefix(); m_result += "processingInstruction(target=\"" + escapeStr(target) - + "\", data=\"" + escapeStr(data) + "\")\n"; + + "\", data=\"" + escapeStr(data) + "\")\n"; return true; } @@ -249,13 +249,13 @@ bool ContentHandler::warning(const QXmlParseException & exception) .arg(exception.message()); m_result += nestPrefix(); m_result += "warning(exception={columnNumber=" - + QString::number(exception.columnNumber()) - + ", lineNumber=" - + QString::number(exception.lineNumber()) - + ", publicId=\"" + escapeStr(exception.publicId()) - + "\", systemId=\"" + escapeStr(exception.systemId()) - + "\", message=\"" + escapeStr(exception.message()) - + "\"})\n"; + + QString::number(exception.columnNumber()) + + ", lineNumber=" + + QString::number(exception.lineNumber()) + + ", publicId=\"" + escapeStr(exception.publicId()) + + "\", systemId=\"" + escapeStr(exception.systemId()) + + "\", message=\"" + escapeStr(exception.message()) + + "\"})\n"; return true; } @@ -267,13 +267,13 @@ bool ContentHandler::error(const QXmlParseException & exception) .arg(exception.message()); m_result += nestPrefix(); m_result += "error(exception={columnNumber=" - + QString::number(exception.columnNumber()) - + ", lineNumber=" - + QString::number(exception.lineNumber()) - + ", publicId=\"" + escapeStr(exception.publicId()) - + "\", systemId=\"" + escapeStr(exception.systemId()) - + "\", message=\"" + escapeStr(exception.message()) - + "\"})\n"; + + QString::number(exception.columnNumber()) + + ", lineNumber=" + + QString::number(exception.lineNumber()) + + ", publicId=\"" + escapeStr(exception.publicId()) + + "\", systemId=\"" + escapeStr(exception.systemId()) + + "\", message=\"" + escapeStr(exception.message()) + + "\"})\n"; return true; } @@ -285,49 +285,49 @@ bool ContentHandler::fatalError(const QXmlParseException & exception) .arg(exception.message()); m_result += nestPrefix(); m_result += "fatalError(exception={columnNumber=" - + QString::number(exception.columnNumber()) - + ", lineNumber=" - + QString::number(exception.lineNumber()) - + ", publicId=\"" + escapeStr(exception.publicId()) - + "\", systemId=\"" + escapeStr(exception.systemId()) - + "\", message=\"" + escapeStr(exception.message()) - + "\"})\n"; + + QString::number(exception.columnNumber()) + + ", lineNumber=" + + QString::number(exception.lineNumber()) + + ", publicId=\"" + escapeStr(exception.publicId()) + + "\", systemId=\"" + escapeStr(exception.systemId()) + + "\", message=\"" + escapeStr(exception.message()) + + "\"})\n"; return true; } -bool ContentHandler::notationDecl ( const QString & name, - const QString & publicId, - const QString & systemId ) +bool ContentHandler::notationDecl(const QString &name, + const QString &publicId, + const QString &systemId ) { m_result += nestPrefix(); m_result += "notationDecl(name=\"" + escapeStr(name) + "\", publicId=\"" - + escapeStr(publicId) + "\", systemId=\"" - + escapeStr(systemId) + "\")\n"; + + escapeStr(publicId) + "\", systemId=\"" + + escapeStr(systemId) + "\")\n"; return true; } -bool ContentHandler::unparsedEntityDecl ( const QString & name, - const QString & publicId, - const QString & systemId, - const QString & notationName ) +bool ContentHandler::unparsedEntityDecl(const QString &name, + const QString &publicId, + const QString &systemId, + const QString ¬ationName ) { m_result += nestPrefix(); m_result += "unparsedEntityDecl(name=\"" + escapeStr(name) - + "\", publicId=\"" + escapeStr(publicId) - + "\", systemId=\"" + escapeStr(systemId) - + "\", notationName=\"" + escapeStr(notationName) - + "\")\n"; + + "\", publicId=\"" + escapeStr(publicId) + + "\", systemId=\"" + escapeStr(systemId) + + "\", notationName=\"" + escapeStr(notationName) + + "\")\n"; return true; } -bool ContentHandler::resolveEntity(const QString & publicId, - const QString & systemId, - QXmlInputSource *&) +bool ContentHandler::resolveEntity(const QString &publicId, + const QString &systemId, + QXmlInputSource *&) { m_result += nestPrefix(); m_result += "resolveEntity(publicId=\"" + escapeStr(publicId) - + "\", systemId=\"" + escapeStr(systemId) - + "\", ret={})\n"; + + "\", systemId=\"" + escapeStr(systemId) + + "\", ret={})\n"; return true; } @@ -335,8 +335,8 @@ bool ContentHandler::startDTD ( const QString & name, const QString & publicId, { m_result += nestPrefix(); m_result += "startDTD(name=\"" + escapeStr(name) - + "\", publicId=\"" + escapeStr(publicId) - + "\", systemId=\"" + escapeStr(systemId) + "\")\n"; + + "\", publicId=\"" + escapeStr(publicId) + + "\", systemId=\"" + escapeStr(systemId) + "\")\n"; ++m_nest; return true; } @@ -388,37 +388,37 @@ bool ContentHandler::comment ( const QString & ch ) return true; } -bool ContentHandler::attributeDecl ( const QString & eName, - const QString & aName, - const QString & type, - const QString & valueDefault, - const QString & value ) +bool ContentHandler::attributeDecl(const QString &eName, + const QString &aName, + const QString &type, + const QString &valueDefault, + const QString &value) { m_result += nestPrefix(); m_result += "attributeDecl(eName=\"" + escapeStr(eName) + "\", aName=\"" - + escapeStr(aName) + "\", type=\"" + escapeStr(type) - + "\", valueDefault=\"" + escapeStr(valueDefault) - + "\", value=\"" + escapeStr(value) + "\")\n"; + + escapeStr(aName) + "\", type=\"" + escapeStr(type) + + "\", valueDefault=\"" + escapeStr(valueDefault) + + "\", value=\"" + escapeStr(value) + "\")\n"; return true; } -bool ContentHandler::internalEntityDecl ( const QString & name, - const QString & value ) +bool ContentHandler::internalEntityDecl(const QString &name, + const QString &value) { m_result += nestPrefix(); m_result += "internatlEntityDecl(name=\"" + escapeStr(name) - + "\", value=\"" + escapeStr(value) + "\")\n"; + + "\", value=\"" + escapeStr(value) + "\")\n"; return true; } -bool ContentHandler::externalEntityDecl ( const QString & name, - const QString & publicId, - const QString & systemId ) +bool ContentHandler::externalEntityDecl(const QString &name, + const QString &publicId, + const QString &systemId) { m_result += nestPrefix(); m_result += "externalEntityDecl(name=\"" + escapeStr(name) - + "\", publicId=\"" + escapeStr(publicId) - + "\", systemId=\"" + escapeStr(systemId) + "\")\n"; + + "\", publicId=\"" + escapeStr(publicId) + + "\", systemId=\"" + escapeStr(systemId) + "\")\n"; return true; } diff --git a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h index b394f0f22d..e7af7b1cb5 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h +++ b/tests/auto/xml/sax/qxmlsimplereader/parser/parser.h @@ -49,16 +49,16 @@ class ContentHandler; class Parser : public QXmlSimpleReader { - public: - Parser(); - ~Parser(); +public: + Parser(); + ~Parser(); - bool parseFile(QFile *file); - QString result() const; - QString errorMsg() const; + bool parseFile(QFile *file); + QString result() const; + QString errorMsg() const; - private: - ContentHandler *handler; +private: + ContentHandler *handler; }; #endif diff --git a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp index ed909946e6..6a3bcc7a7d 100644 --- a/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp +++ b/tests/auto/xml/sax/qxmlsimplereader/tst_qxmlsimplereader.cpp @@ -137,17 +137,17 @@ class tst_QXmlSimpleReader : public QObject Q_OBJECT public: - tst_QXmlSimpleReader(); - ~tst_QXmlSimpleReader(); + tst_QXmlSimpleReader(); + ~tst_QXmlSimpleReader(); private slots: void initTestCase(); - void testGoodXmlFile(); - void testGoodXmlFile_data(); - void testBadXmlFile(); - void testBadXmlFile_data(); - void testIncrementalParsing(); - void testIncrementalParsing_data(); + void testGoodXmlFile(); + void testGoodXmlFile_data(); + void testBadXmlFile(); + void testBadXmlFile_data(); + void testIncrementalParsing(); + void testIncrementalParsing_data(); void setDataQString(); void inputFromQIODevice(); void inputFromString(); @@ -278,8 +278,8 @@ static QStringList findXmlFiles(QString dir_name) QFileInfoList::const_iterator it = file_list.begin(); for (; it != file_list.end(); ++it) { - const QFileInfo &file_info = *it; - result.append(file_info.filePath()); + const QFileInfo &file_info = *it; + result.append(file_info.filePath()); } return result; @@ -289,21 +289,21 @@ static QStringList findXmlFiles(QString dir_name) void tst_QXmlSimpleReader::testGoodXmlFile_data() { const char * const good_data_dirs[] = { - "xmldocs/valid/sa", - "xmldocs/valid/not-sa", - "xmldocs/valid/ext-sa", - 0 + "xmldocs/valid/sa", + "xmldocs/valid/not-sa", + "xmldocs/valid/ext-sa", + 0 }; const char * const *d = good_data_dirs; QStringList good_file_list; for (; *d != 0; ++d) - good_file_list += findXmlFiles(*d); + good_file_list += findXmlFiles(*d); QTest::addColumn("file_name"); QStringList::const_iterator it = good_file_list.begin(); for (; it != good_file_list.end(); ++it) - QTest::newRow((*it).toLatin1()) << *it; + QTest::newRow((*it).toLatin1()) << *it; } void tst_QXmlSimpleReader::testGoodXmlFile() @@ -331,19 +331,19 @@ void tst_QXmlSimpleReader::testGoodXmlFile() void tst_QXmlSimpleReader::testBadXmlFile_data() { const char * const bad_data_dirs[] = { - "xmldocs/not-wf/sa", - 0 + "xmldocs/not-wf/sa", + 0 }; const char * const *d = bad_data_dirs; QStringList bad_file_list; for (; *d != 0; ++d) - bad_file_list += findXmlFiles(*d); + bad_file_list += findXmlFiles(*d); QTest::addColumn("file_name"); QStringList::const_iterator it = bad_file_list.begin(); for (; it != bad_file_list.end(); ++it) - QTest::newRow((*it).toLatin1()) << *it; + QTest::newRow((*it).toLatin1()) << *it; } void tst_QXmlSimpleReader::testBadXmlFile() @@ -413,31 +413,31 @@ void tst_QXmlSimpleReader::testIncrementalParsing_data() QTest::addColumn("chunkSize"); const char * const good_data_dirs[] = { - "xmldocs/valid/sa", - "xmldocs/valid/not-sa", - "xmldocs/valid/ext-sa", - 0 + "xmldocs/valid/sa", + "xmldocs/valid/not-sa", + "xmldocs/valid/ext-sa", + 0 }; const char * const *d = good_data_dirs; QStringList good_file_list; for (; *d != 0; ++d) - good_file_list += findXmlFiles(*d); + good_file_list += findXmlFiles(*d); for (int i=1; i<10; ++i) { - QStringList::const_iterator it = good_file_list.begin(); - for (; it != good_file_list.end(); ++it) { - if ( *it == "xmldocs/valid/sa/089.xml" ) - continue;// TODO: fails at the moment -- don't bother - if ( i==1 && ( - *it == "xmldocs/valid/sa/049.xml" || - *it == "xmldocs/valid/sa/050.xml" || - *it == "xmldocs/valid/sa/051.xml" || - *it == "xmldocs/valid/sa/052.xml" ) ) { - continue; // TODO: fails at the moment -- don't bother - } - QTest::newRow(QString("%1 %2").arg(*it).arg(i).toLatin1()) << *it << i; - } + QStringList::const_iterator it = good_file_list.begin(); + for (; it != good_file_list.end(); ++it) { + if ( *it == "xmldocs/valid/sa/089.xml" ) + continue;// TODO: fails at the moment -- don't bother + if ( i==1 && ( + *it == "xmldocs/valid/sa/049.xml" || + *it == "xmldocs/valid/sa/050.xml" || + *it == "xmldocs/valid/sa/051.xml" || + *it == "xmldocs/valid/sa/052.xml" ) ) { + continue; // TODO: fails at the moment -- don't bother + } + QTest::newRow(QString("%1 %2").arg(*it).arg(i).toLatin1()) << *it << i; + } } } @@ -459,7 +459,7 @@ void tst_QXmlSimpleReader::testIncrementalParsing() first = false; } else { QVERIFY(parser.parseContinue()); - } + } } // detect end of document QVERIFY(parser.parseContinue()); @@ -573,8 +573,8 @@ void tst_QXmlSimpleReader::inputFromSocket() const bool connectionSuccess = sock.waitForConnected(); if(!connectionSuccess) { - QTextStream out(stderr); - out << "QTcpSocket::errorString()" << sock.errorString(); + QTextStream out(stderr); + out << "QTcpSocket::errorString()" << sock.errorString(); } QVERIFY(connectionSuccess); -- cgit v1.2.3