Qt 4.8
Public Functions | Properties | List of all members
QPatternist::URILoader Class Reference

#include <quriloader_p.h>

Inheritance diagram for QPatternist::URILoader:
QNetworkAccessManager QObject

Public Functions

virtual QNetworkReplycreateRequest (Operation op, const QNetworkRequest &req, QIODevice *outgoingData=0)
 Returns a new QNetworkReply object to handle the operation op and request req. More...
 
 URILoader (QObject *const parent, const NamePool::Ptr &np, const VariableLoader::Ptr &variableLoader)
 
- Public Functions inherited from QNetworkAccessManager
QNetworkConfiguration activeConfiguration () const
 Returns the current active network configuration. More...
 
QAbstractNetworkCachecache () const
 Returns the cache that is used to store data obtained from the network. More...
 
QNetworkConfiguration configuration () const
 Returns the network configuration that will be used to create the QNetworkSession{network session} which will be used when processing network requests. More...
 
QNetworkCookieJarcookieJar () const
 Returns the QNetworkCookieJar that is used to store cookies obtained from the network as well as cookies that are about to be sent. More...
 
QNetworkReplydeleteResource (const QNetworkRequest &request)
 Sends a request to delete the resource identified by the URL of request. More...
 
QNetworkReplyget (const QNetworkRequest &request)
 Posts a request to obtain the contents of the target request and returns a new QNetworkReply object opened for reading which emits the readyRead() signal whenever new data arrives. More...
 
QNetworkReplyhead (const QNetworkRequest &request)
 Posts a request to obtain the network headers for request and returns a new QNetworkReply object which will contain such headers. More...
 
NetworkAccessibility networkAccessible () const
 
QNetworkReplypost (const QNetworkRequest &request, QIODevice *data)
 Sends an HTTP POST request to the destination specified by request and returns a new QNetworkReply object opened for reading that will contain the reply sent by the server. More...
 
QNetworkReplypost (const QNetworkRequest &request, const QByteArray &data)
 Sends the contents of the data byte array to the destination specified by request. More...
 
QNetworkReplypost (const QNetworkRequest &request, QHttpMultiPart *multiPart)
 Sends the contents of the multiPart message to the destination specified by request. More...
 
QNetworkProxy proxy () const
 Returns the QNetworkProxy that the requests sent using this QNetworkAccessManager object will use. More...
 
QNetworkProxyFactoryproxyFactory () const
 
QNetworkReplyput (const QNetworkRequest &request, QIODevice *data)
 Uploads the contents of data to the destination request and returnes a new QNetworkReply object that will be open for reply. More...
 
QNetworkReplyput (const QNetworkRequest &request, const QByteArray &data)
 Sends the contents of the data byte array to the destination specified by request. More...
 
QNetworkReplyput (const QNetworkRequest &request, QHttpMultiPart *multiPart)
 Sends the contents of the multiPart message to the destination specified by request. More...
 
 QNetworkAccessManager (QObject *parent=0)
 Constructs a QNetworkAccessManager object that is the center of the Network Access API and sets parent as the parent object. More...
 
QNetworkReplysendCustomRequest (const QNetworkRequest &request, const QByteArray &verb, QIODevice *data=0)
 Sends a custom request to the server identified by the URL of request. More...
 
void setCache (QAbstractNetworkCache *cache)
 Sets the manager's network cache to be the cache specified. More...
 
void setConfiguration (const QNetworkConfiguration &config)
 Sets the network configuration that will be used when creating the QNetworkSession{network session} to config. More...
 
void setCookieJar (QNetworkCookieJar *cookieJar)
 Sets the manager's cookie jar to be the cookieJar specified. More...
 
void setNetworkAccessible (NetworkAccessibility accessible)
 Overrides the reported network accessibility. More...
 
void setProxy (const QNetworkProxy &proxy)
 Sets the proxy to be used in future requests to be proxy. More...
 
void setProxyFactory (QNetworkProxyFactory *factory)
 Sets the proxy factory for this class to be factory. More...
 
 ~QNetworkAccessManager ()
 Destroys the QNetworkAccessManager object and frees up any resources. More...
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 

Properties

const NamePool::Ptr m_namePool
 
const VariableLoader::Ptr m_variableLoader
 
const QString m_variableNS
 

Additional Inherited Members

- Public Types inherited from QNetworkAccessManager
enum  NetworkAccessibility { UnknownAccessibility = -1, NotAccessible = 0, Accessible = 1 }
 Indicates whether the network is accessible via this network access manager. More...
 
enum  Operation {
  HeadOperation = 1, GetOperation, PutOperation, PostOperation,
  DeleteOperation, CustomOperation, UnknownOperation = 0
}
 Indicates the operation this reply is processing. More...
 
- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Signals inherited from QNetworkAccessManager
void authenticationRequired (QNetworkReply *reply, QAuthenticator *authenticator)
 This signal is emitted whenever a final server requests authentication before it delivers the requested contents. More...
 
void finished (QNetworkReply *reply)
 This signal is emitted whenever a pending network reply is finished. More...
 
void networkAccessibleChanged (QNetworkAccessManager::NetworkAccessibility accessible)
 This signal is emitted when the value of the networkAccessible property changes. More...
 
void networkSessionConnected ()
 This signal is emitted when the status of the network session changes into a usable (Connected) state. More...
 
void proxyAuthenticationRequired (const QNetworkProxy &proxy, QAuthenticator *authenticator)
 This signal is emitted whenever a proxy requests authentication and QNetworkAccessManager cannot find a valid, cached credential. More...
 
void sslErrors (QNetworkReply *reply, const QList< QSslError > &errors)
 This signal is emitted if the SSL/TLS session encountered errors during the set up, including certificate verification errors. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 
- Static Public Functions inherited from QObject
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 receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 65 of file quriloader_p.h.

Constructors and Destructors

◆ URILoader()

URILoader::URILoader ( QObject *const  parent,
const NamePool::Ptr np,
const VariableLoader::Ptr variableLoader 
)

Definition at line 52 of file quriloader.cpp.

54  : QNetworkAccessManager(parent)
55  , m_variableNS(QLatin1String("tag:trolltech.com,2007:QtXmlPatterns:QIODeviceVariable:"))
56  , m_namePool(np)
58 {
60 }
const NamePool::Ptr m_namePool
Definition: quriloader_p.h:78
QNetworkAccessManager(QObject *parent=0)
Constructs a QNetworkAccessManager object that is the center of the Network Access API and sets paren...
const QString m_variableNS
Definition: quriloader_p.h:77
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
const VariableLoader::Ptr m_variableLoader
Definition: quriloader_p.h:79
QFactoryLoader * l

Functions

◆ createRequest()

QNetworkReply * URILoader::createRequest ( Operation  op,
const QNetworkRequest req,
QIODevice outgoingData = 0 
)
virtual

Returns a new QNetworkReply object to handle the operation op and request req.

The device outgoingData is always 0 for Get and Head requests, but is the value passed to post() and put() in those operations (the QByteArray variants will pass a QBuffer object).

The default implementation calls QNetworkCookieJar::cookiesForUrl() on the cookie jar set with setCookieJar() to obtain the cookies to be sent to the remote server.

The returned object must be in an open state.

Reimplemented from QNetworkAccessManager.

Definition at line 62 of file quriloader.cpp.

63 {
64  const QString requestedUrl(req.url().toString());
65 
66  /* We got a QIODevice variable. */
67  const QString name(requestedUrl.right(requestedUrl.length() - m_variableNS.length()));
68 
70 
71  if(!variant.isNull() && variant.userType() == qMetaTypeId<QIODevice *>())
72  return new QIODeviceDelegate(qvariant_cast<QIODevice *>(variant));
73  else
74  {
75  /* If we're entering this code path, the variable URI identified a variable
76  * which we don't have, which means we either have a bug, or the user had
77  * crafted an invalid URI manually. */
78 
79  return QNetworkAccessManager::createRequest(op, req, outgoingData);
80  }
81 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
const NamePool::Ptr m_namePool
Definition: quriloader_p.h:78
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
Definition: qurl.cpp:5896
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
const QString m_variableNS
Definition: quriloader_p.h:77
The QString class provides a Unicode character string.
Definition: qstring.h:83
QUrl url() const
Returns the URL this network request is referring to.
const VariableLoader::Ptr m_variableLoader
Definition: quriloader_p.h:79
const char * name
QVariant valueFor(const QXmlName &name) const
QXmlName allocateQName(const QString &uri, const QString &localName, const QString &prefix=QString())
Definition: qnamepool.cpp:251
const char * variant
virtual QNetworkReply * createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData=0)
Returns a new QNetworkReply object to handle the operation op and request req.

Properties

◆ m_namePool

const NamePool::Ptr QPatternist::URILoader::m_namePool
private

Definition at line 78 of file quriloader_p.h.

Referenced by createRequest().

◆ m_variableLoader

const VariableLoader::Ptr QPatternist::URILoader::m_variableLoader
private

Definition at line 79 of file quriloader_p.h.

Referenced by createRequest(), and URILoader().

◆ m_variableNS

const QString QPatternist::URILoader::m_variableNS
private

Definition at line 77 of file quriloader_p.h.

Referenced by createRequest().


The documentation for this class was generated from the following files: