<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- qabstractmessagehandler.cpp --> <head> <title>Qt 4.6: QAbstractMessageHandler Class Reference</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <a name="//apple_ref/cpp/cl//QAbstractMessageHandler"></a> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="functions.html"><font color="#004faf">All Functions</font></a> · <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">QAbstractMessageHandler Class Reference<br /><span class="small-subtitle">[<a href="qtxmlpatterns.html">QtXmlPatterns</a> module]</span> </h1> <p>The QAbstractMessageHandler class provides a callback interface for handling messages. <a href="#details">More...</a></p> <pre> #include <QAbstractMessageHandler></pre><p><b>This class is not part of the Qt GUI Framework Edition.</b></p> <p>Inherits <a href="qobject.html">QObject</a>.</p> <p>Inherited by </p> <p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p> <p>This class was introduced in Qt 4.4.</p> <ul> <li><a href="qabstractmessagehandler-members.html">List of all members, including inherited members</a></li> </ul> <hr /> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qabstractmessagehandler.html#QAbstractMessageHandler">QAbstractMessageHandler</a></b> ( QObject * <i>parent</i> = 0 )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><b><a href="qabstractmessagehandler.html#dtor.QAbstractMessageHandler">~QAbstractMessageHandler</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qabstractmessagehandler.html#message">message</a></b> ( QtMsgType <i>type</i>, const QString & <i>description</i>, const QUrl & <i>identifier</i> = QUrl(), const QSourceLocation & <i>sourceLocation</i> = QSourceLocation() )</td></tr> </table> <ul> <li><div bar="2" class="fn"></div>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li> </ul> <hr /> <a name="protected-functions"></a> <h2>Protected Functions</h2> <table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qabstractmessagehandler.html#handleMessage">handleMessage</a></b> ( QtMsgType <i>type</i>, const QString & <i>description</i>, const QUrl & <i>identifier</i>, const QSourceLocation & <i>sourceLocation</i> ) = 0</td></tr> </table> <ul> <li><div bar="2" class="fn"></div>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li><div class="fn"></div>1 property inherited from <a href="qobject.html#properties">QObject</a></li> <li><div class="fn"></div>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li> <li><div class="fn"></div>1 signal inherited from <a href="qobject.html#signals">QObject</a></li> <li><div class="fn"></div>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li> </ul> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QAbstractMessageHandler class provides a callback interface for handling messages.</p> <p>QAbstractMessageHandler is an abstract base class that provides a callback interface for handling messages. For example, class <a href="qxmlquery.html">QXmlQuery</a> parses and runs an XQuery. When it detects a compile or runtime error, it generates an appropriate error message, but rather than output the message itself, it passes the message to the <a href="qabstractmessagehandler.html#message">message</a>() function of its QAbstractMessageHandler. See <a href="qxmlquery.html#setMessageHandler">QXmlQuery::setMessageHandler</a>().</p> <p>You create a message handler by subclassing QAbstractMessageHandler and implementing <a href="qabstractmessagehandler.html#handleMessage">handleMessage</a>(). You then pass a pointer to an instance of your subclass to any classes that must generate messages. The messages are sent to the message handler via the <a href="qabstractmessagehandler.html#message">message</a>() function, which forwards them to your handleMessge(). The effect is to serialize the handling of all messages, which means your QAbstractMessageHandler subclass is thread safe.</p> <p>A single instance of QAbstractMessageHandler can be called on to handle messages from multiple sources. Hence, the content of a message, which is the <i>description</i> parameter passed to <a href="qabstractmessagehandler.html#message">message</a>() and <a href="qabstractmessagehandler.html#handleMessage">handleMessage</a>(), must be interpreted in light of the context that required the message to be sent. That context is specified by the <i>identifier</i> and <i>sourceLocation</i> parameters to <a href="qabstractmessagehandler.html#message">message</a>() <a href="qabstractmessagehandler.html#handleMessage">handleMessage</a>().</p> <hr /> <h2>Member Function Documentation</h2> <a name="//apple_ref/cpp/instm/QAbstractMessageHandler/QAbstractMessageHandler"></a> <h3 class="fn"><a name="QAbstractMessageHandler"></a>QAbstractMessageHandler::QAbstractMessageHandler ( <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3> <p>Constructs a <a href="qabstractmessagehandler.html">QAbstractMessageHandler</a>. The <i>parent</i> is passed to the <a href="qobject.html">QObject</a> base class constructor.</p> <a name="//apple_ref/cpp/instm/QAbstractMessageHandler/~QAbstractMessageHandler"></a> <h3 class="fn"><a name="dtor.QAbstractMessageHandler"></a>QAbstractMessageHandler::~QAbstractMessageHandler () <tt> [virtual]</tt></h3> <p>Destructs this <a href="qabstractmessagehandler.html">QAbstractMessageHandler</a>.</p> <a name="//apple_ref/cpp/instm/QAbstractMessageHandler/handleMessage"></a> <h3 class="fn"><a name="handleMessage"></a>void QAbstractMessageHandler::handleMessage ( <a href="qtglobal.html#QtMsgType-enum">QtMsgType</a> <i>type</i>, const <a href="qstring.html">QString</a> & <i>description</i>, const <a href="qurl.html">QUrl</a> & <i>identifier</i>, const <a href="qsourcelocation.html">QSourceLocation</a> & <i>sourceLocation</i> ) <tt> [pure virtual protected]</tt></h3> <p>This function must be implemented by the sub-class. <a href="qabstractmessagehandler.html#message">message</a>() will call this function, passing in its parameters, <i>type</i>, <i>description</i>, <i>identifier</i> and <i>sourceLocation</i> unmodified.</p> <a name="//apple_ref/cpp/instm/QAbstractMessageHandler/message"></a> <h3 class="fn"><a name="message"></a>void QAbstractMessageHandler::message ( <a href="qtglobal.html#QtMsgType-enum">QtMsgType</a> <i>type</i>, const <a href="qstring.html">QString</a> & <i>description</i>, const <a href="qurl.html">QUrl</a> & <i>identifier</i> = QUrl(), const <a href="qsourcelocation.html">QSourceLocation</a> & <i>sourceLocation</i> = QSourceLocation() )</h3> <p>Sends a message to this message handler. <i>type</i> is the kind of message being sent. <i>description</i> is the message content. The <i>identifier</i> is a URI that identifies the message and is the key to interpreting the other arguments.</p> <p>Typically, this class is used for reporting errors, as is the case for <a href="qxmlquery.html">QXmlQuery</a>, which uses a <a href="qabstractmessagehandler.html">QAbstractMessageHandler</a> to report compile and runtime XQuery errors. Hence, using a <a href="qurl.html">QUrl</a> as the message <i>identifier</i> is was inspired by the explanation of <a href="http://www.w3.org/TR/xquery/#errors">error handling in the XQuery language</a>. Because the <i>identifier</i> is composed of a namespace URI and a local part, identifiers with the same local part are unique. The caller is responsible for ensuring that <i>identifier</i> is either a valid <a href="qurl.html">QUrl</a> or a default constructed <a href="qurl.html">QUrl</a>.</p> <p><i>sourceLocation</i> identifies a location in a resource (i.e., file or document) where the need for reporting a message was detected.</p> <p>This function unconditionally calls <a href="qabstractmessagehandler.html#handleMessage">handleMessage</a>(), passing all its parameters unmodified.</p> <p>See also <a href="http://www.w3.org/TR/xquery/#errors">http://www.w3.org/TR/xquery/#errors</a>.</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="40%" align="left">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)</td> <td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="40%" align="right"><div align="right">Qt 4.6.3</div></td> </tr></table></div></address></body> </html>