42 #include <QtCore/QFile> 43 #include <QtCore/QTextCodec> 44 #include <QtCore/QTimer> 45 #include <QtCore/QXmlStreamReader> 47 #include <QtNetwork/QNetworkRequest> 63 , m_networkAccessDelegator(manager)
64 , m_features(features)
110 context, errorHandling);
126 networkLoop.connect(reply,
SIGNAL(finished()),
SLOT(finished()));
161 while(!reader.
atEnd())
179 const int len = nss.
size();
181 for(
int i = 0; i < len; ++i)
190 const int len = attrs.
size();
192 for(
int i = 0; i < len; ++i)
255 "This token is never expected to be received.");
344 context->error(QtXmlPatterns::tr(
"%1 is an unsupported encoding.").arg(
formatURI(encoding)),
354 const QString result(codec->
toUnicode(inData.constData(), inData.length(), &converterState));
360 context->error(QtXmlPatterns::tr(
"%1 contains octets which are disallowed in " 361 "the requested encoding %2.").arg(
formatURI(uri),
370 const int len = result.length();
372 for(
int i = 0; i < len; ++i)
378 context->error(QtXmlPatterns::tr(
"The codepoint %1, occurring in %2 using encoding %3, " 379 "is an invalid XML character.").arg(
formatData(result.at(i)),
426 if(
it.key().toString().startsWith(
QLatin1String(
"tag:trolltech.com,2007:QtXmlPatterns:QIODeviceVariable:")))
QString toString() const
Returns a copy of the string reference as a QString object.
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
The QXmlNodeModelIndex class identifies a node in an XML node model subclassed from QAbstractXmlNodeM...
bool isValid() const
Returns true if the URL is valid; otherwise returns false.
QString Q_AUTOTEST_EXPORT escape(const QString &input)
Similar to Qt::escape(), but also escapes apostrophes and quotes, such that the result is suitable as...
#define QT_END_NAMESPACE
This macro expands to.
virtual SequenceType::Ptr announceDocument(const QUrl &uri, const Usage usageHint)
May be called by the compilation framework at compile time to report that an XML document referenced ...
bool isReadable() const
Returns true if data can be read from the device; otherwise returns false.
qint64 lineNumber() const
Returns the current line number, starting with 1.
#define it(className, varName)
virtual void clear(const QUrl &uri)
Asks to unload uri from its document pool, such that a subsequent request will require a new read...
QHash< QUrl, AccelTree::Ptr > m_loadedDocuments
virtual void whitespaceOnly(const QStringRef &ch)
QXmlName allocateBinding(const QString &prefix, const QString &uri)
Allocates a namespace binding for prefix and uri.
A smart pointer very similar to std::auto_ptr.
The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.
The QByteArray class provides an array of bytes.
QString errorString() const
Returns a human-readable description of the last device error that occurred.
Builds an AccelTree from a stream of XML/Item events received through the NodeBuilder interface...
QStringRef value() const
Returns the attribute's value.
virtual Item openDocument(const QUrl &uri, const ReportContext::Ptr &context)
Calls to this function are generated by calls to the fn:document() or fn:doc() function.
NetworkError
Indicates all possible error conditions found during the processing of the request.
const NetworkAccessDelegator::Ptr m_networkAccessDelegator
static bool isChar(const QChar c)
Determines whether c is a valid instance of production [2]Char in the XML 1.0 specification.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QStringRef name() const
Returns the local name of a StartElement, EndElement, or an EntityReference.
bool atEnd() const
Returns true if the reader has read until the end of the XML document, or if an error() has occurred ...
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
QStringRef prefix() const
Returns the prefix of a StartElement or EndElement.
QNetworkAccessManager * managerFor(const QUrl &uri)
const NamePool::Ptr m_namePool
bool isRelative() const
Returns true if the URL is relative; otherwise returns false.
static AtomicString::Ptr fromValue(const QString &value)
const T value(const Key &key) const
Returns the value associated with the key.
virtual QXmlNodeModelIndex root(const QXmlNodeModelIndex &n) const
Returns the root node.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
The QXmlStreamAttribute class represents a single XML attribute.
virtual void startElement(const QXmlName &name)
virtual Item openUnparsedText(const QUrl &uri, const QString &encoding, const ReportContext::Ptr &context, const SourceLocationReflection *const where)
Calls to this function are generated by calls to the fn:unparsed-text() function. ...
AccelTreeResourceLoader(const NamePool::Ptr &np, const NetworkAccessDelegator::Ptr &networkDelegator, AccelTreeBuilder< true >::Features=AccelTreeBuilder< true >::NoneFeature)
QStringRef namespaceUri() const
Returns the namespaceUri of a StartElement or EndElement.
T * data() const
Returns a pointer to the shared data object.
TokenType tokenType() const
Returns the type of the current token.
#define QT_BEGIN_NAMESPACE
This macro expands to.
An helper class which enables QNetworkAccessManager to be used in a blocking manner.
uint qHash(const QPatternist::TargetNode &node)
virtual bool isDocumentAvailable(const QUrl &uri)
Calls to this function are generated by calls to the fn:doc-available() function. ...
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
virtual void namespaceBinding(const QXmlName &nb)
Signals the presence of the namespace declaration nb.
The namespace for the internal API of QtXmlPatterns.
virtual void processingInstruction(const QXmlName &target, const QString &data)
The QSourceLocation class identifies a location in a resource by URI, line, and column.
bool retrieveUnparsedText(const QUrl &uri, const QString &encoding, const ReportContext::Ptr &context, const SourceLocationReflection *const where)
static QTextCodec * codec(MYSQL *mysql)
QStringRef namespaceUri() const
Returns the namespaceUri.
static QTextCodec * codecForMib(int mib)
Returns the QTextCodec which matches the MIBenum mib.
QStringRef prefix() const
Returns the prefix.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
QStringRef name() const
Returns the attribute's local name.
static QString formatData(const QString &data)
QNetworkReply * get(const QNetworkRequest &request)
Posts a request to obtain the contents of the target request and returns a new QNetworkReply object o...
The QNetworkAccessManager class allows the application to send network requests and receive replies...
const T & at(int i) const
Returns the item at index position i in the vector.
TokenType readNext()
Reads the next token and returns its type.
The QXmlStreamNamespaceDeclaration class represents a namespace declaration.
static QNetworkReply * load(const QUrl &uri, QNetworkAccessManager *const networkManager, const ReportContext::Ptr &context, ErrorHandling handling=FailOnError)
Helper function that do NetworkAccessDelegator::get(), but does it blocked.
bool isNull() const
Returns true if this string is null; otherwise returns false.
QString toUnicode(const QByteArray &) const
Converts a from the encoding of this codec to Unicode, and returns the result in a QString...
virtual void comment(const QString &content)
#define Q_ASSERT_X(cond, where, what)
QHash< QPair< QUrl, QString >, QString > m_unparsedTexts
static const SequenceType::Ptr ZeroOrOneDocumentNode
Represents an item in the XPath 2.0 Data Model.
virtual void endElement()
Signals the end of the current element.
The QXmlStreamAttributes class represents a vector of QXmlStreamAttribute.
virtual void attribute(const QXmlName &name, const QStringRef &value)
virtual bool isUnparsedTextAvailable(const QUrl &uri, const QString &encoding)
Calls to this function are generated by calls to the fn:unparsed-text-available() function...
qint64 columnNumber() const
Returns the current column number, starting with 0.
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
static QTestResult::TestLocation location
virtual void characters(const QStringRef &ch)
QStringRef prefix() const
Returns the attribute's namespace prefix.
QXmlStreamNamespaceDeclarations namespaceDeclarations() const
If the state() is StartElement , this function returns the element's namespace declarations.
QXmlName allocateQName(const QString &uri, const QString &localName, const QString &prefix=QString())
static QTextCodec * codecForName(const QByteArray &name)
Searches all installed QTextCodec objects and returns the one which best matches name; the match is c...
QByteArray readAll()
Reads all available data from the device, and returns it as a QByteArray.
The QNetworkRequest class holds a request to be sent with QNetworkAccessManager.
QStringRef processingInstructionData() const
Returns the data of a ProcessingInstruction.
bool isWhitespace() const
Returns true if the reader reports characters that only consist of white-space; otherwise returns fal...
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
The QXmlStreamReader class provides a fast parser for reading well-formed XML via a simple streaming ...
QStringRef processingInstructionTarget() const
Returns the target of a ProcessingInstruction.
static QString formatURI(const NamePool::Ptr &np, const QXmlName::NamespaceCode &uri)
Formats uri, that's considered to be a URI, for display.
AccelTreeBuilder< true >::Features m_features
virtual void endDocument()
The QTextCodec class provides conversions between text encodings.
QStringRef text() const
Returns the text of Characters , Comment , DTD , or EntityReference.
QString errorString() const
Returns the error message that was set with raiseError().
The resource loader will report the error via the report context.
static const KeyPair *const end
The QIODevice class is the base interface class of all I/O devices in Qt.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
bool retrieveDocument(const QUrl &uri, const ReportContext::Ptr &context)
int size() const
Returns the number of items in the vector.
QXmlStreamAttributes attributes() const
Returns the attributes of a StartElement.
virtual QSet< QUrl > deviceURIs() const
Returns the URIs this AccelTreeResourceLoader has loaded which are for devices through variable bindi...
static bool streamToReceiver(QIODevice *const dev, AccelTreeBuilder< true > *const receiver, const NamePool::Ptr &np, const ReportContext::Ptr &context, const QUrl &uri)
virtual void startDocument()
Base class for all instances that represents something at a certain location.
QStringRef namespaceUri() const
Returns the attribute's resolved namespaceUri, or an empty string reference if the attribute does not...