1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qdbusreply.cpp -->
<title>Qt 4.8: QDBusReply Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtdbus.html">QtDBus</a></li>
<li>QDBusReply</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QDBusReply Class Reference</h1>
<!-- $$$QDBusReply-brief -->
<p>The QDBusReply class stores the reply for a method call to a remote object. <a href="#details">More...</a></p>
<!-- @@@QDBusReply -->
<pre class="cpp"> <span class="preprocessor">#include <QDBusReply></span></pre><p>This class was introduced in Qt 4.2.</p>
<ul>
<li><a href="qdbusreply-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qdbusreply.html#QDBusReply">QDBusReply</a></b> ( const QDBusMessage & <i>reply</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qdbusreply.html#QDBusReply-2">QDBusReply</a></b> ( const QDBusPendingCall & <i>pcall</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qdbusreply.html#QDBusReply-3">QDBusReply</a></b> ( const QDBusPendingReply<T> & <i>reply</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qdbusreply.html#QDBusReply-4">QDBusReply</a></b> ( const QDBusError & <i>error</i> = QDBusError() )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QDBusError & </td><td class="memItemRight bottomAlign"><b><a href="qdbusreply.html#error">error</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdbusreply.html#isValid">isValid</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Type </td><td class="memItemRight bottomAlign"><b><a href="qdbusreply.html#value">value</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qdbusreply.html#operator-Type">operator Type</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDBusReply & </td><td class="memItemRight bottomAlign"><b><a href="qdbusreply.html#operator-eq">operator=</a></b> ( const QDBusMessage & <i>message</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDBusReply & </td><td class="memItemRight bottomAlign"><b><a href="qdbusreply.html#operator-eq-2">operator=</a></b> ( const QDBusPendingCall & <i>pcall</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDBusReply & </td><td class="memItemRight bottomAlign"><b><a href="qdbusreply.html#operator-eq-3">operator=</a></b> ( const QDBusError & <i>error</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDBusReply & </td><td class="memItemRight bottomAlign"><b><a href="qdbusreply.html#operator-eq-4">operator=</a></b> ( const QDBusReply & <i>other</i> )</td></tr>
</table>
<a name="details"></a>
<!-- $$$QDBusReply-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QDBusReply class stores the reply for a method call to a remote object.</p>
<p>A QDBusReply object is a subset of the <a href="qdbusmessage.html">QDBusMessage</a> object that represents a method call's reply. It contains only the first output argument or the error code and is used by <a href="qdbusinterface.html">QDBusInterface</a>-derived classes to allow returning the error code as the function's return argument.</p>
<p>It can be used in the following manner:</p>
<pre class="cpp"> <span class="type">QDBusReply</span><span class="operator"><</span><span class="type"><a href="qstring.html">QString</a></span><span class="operator">></span> reply <span class="operator">=</span> interface<span class="operator">-</span><span class="operator">></span>call(<span class="string">"RemoteMethod"</span>);
<span class="keyword">if</span> (reply<span class="operator">.</span>isValid())
<span class="comment">// use the returned value</span>
useValue(reply<span class="operator">.</span>value());
<span class="keyword">else</span>
<span class="comment">// call failed. Show an error condition.</span>
showError(reply<span class="operator">.</span>error());</pre>
<p>If the remote method call cannot fail, you can skip the error checking:</p>
<pre class="cpp"> <span class="type"><a href="qstring.html">QString</a></span> reply <span class="operator">=</span> interface<span class="operator">-</span><span class="operator">></span>call(<span class="string">"RemoteMethod"</span>);</pre>
<p>However, if it does fail under those conditions, the value returned by <a href="qdbusreply.html#value">QDBusReply::value</a>() is a default-constructed value. It may be indistinguishable from a valid return value.</p>
<p>QDBusReply objects are used for remote calls that have no output arguments or return values (i.e., they have a "void" return type). Use the <a href="qdbusreply.html#isValid">isValid</a>() function to test if the reply succeeded.</p>
</div>
<p><b>See also </b><a href="qdbusmessage.html">QDBusMessage</a> and <a href="qdbusinterface.html">QDBusInterface</a>.</p>
<!-- @@@QDBusReply -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QDBusReply[overload1]$$$QDBusReplyconstQDBusMessage& -->
<h3 class="fn"><a name="QDBusReply"></a>QDBusReply::<span class="name">QDBusReply</span> ( const <span class="type"><a href="qdbusmessage.html">QDBusMessage</a></span> & <i>reply</i> )</h3>
<p>Automatically construct a <a href="qdbusreply.html">QDBusReply</a> object from the reply message <i>reply</i>, extracting the first return value from it if it is a success reply.</p>
<!-- @@@QDBusReply -->
<!-- $$$QDBusReply$$$QDBusReplyconstQDBusPendingCall& -->
<h3 class="fn"><a name="QDBusReply-2"></a>QDBusReply::<span class="name">QDBusReply</span> ( const <span class="type"><a href="qdbuspendingcall.html">QDBusPendingCall</a></span> & <i>pcall</i> )</h3>
<p>Automatically construct a <a href="qdbusreply.html">QDBusReply</a> object from the asynchronous pending call <i>pcall</i>. If the call isn't finished yet, <a href="qdbusreply.html">QDBusReply</a> will call QDBusPendingCall::waitForFinished(), which is a blocking operation.</p>
<p>If the return types patch, <a href="qdbusreply.html">QDBusReply</a> will extract the first return argument from the reply.</p>
<!-- @@@QDBusReply -->
<!-- $$$QDBusReply$$$QDBusReplyconstQDBusPendingReply<T>& -->
<h3 class="fn"><a name="QDBusReply-3"></a>QDBusReply::<span class="name">QDBusReply</span> ( const <span class="type"><a href="qdbuspendingreply.html">QDBusPendingReply</a></span><<span class="type">T</span>> & <i>reply</i> )</h3>
<p>Constructs a <a href="qdbusreply.html">QDBusReply</a> object from the pending reply message, <i>reply</i>.</p>
<!-- @@@QDBusReply -->
<!-- $$$QDBusReply$$$QDBusReplyconstQDBusError& -->
<h3 class="fn"><a name="QDBusReply-4"></a>QDBusReply::<span class="name">QDBusReply</span> ( const <span class="type"><a href="qdbuserror.html">QDBusError</a></span> & <i>error</i> = QDBusError() )</h3>
<p>Constructs an error reply from the D-Bus error code given by <i>error</i>.</p>
<!-- @@@QDBusReply -->
<!-- $$$error[overload1]$$$error -->
<h3 class="fn"><a name="error"></a>const <span class="type"><a href="qdbuserror.html">QDBusError</a></span> & QDBusReply::<span class="name">error</span> ()</h3>
<p>Returns the error code that was returned from the remote function call. If the remote call did not return an error (i.e., if it succeeded), then the <a href="qdbuserror.html">QDBusError</a> object that is returned will not be a valid error code (<a href="qdbuserror.html#isValid">QDBusError::isValid</a>() will return false).</p>
<p><b>See also </b><a href="qdbusreply.html#isValid">isValid</a>().</p>
<!-- @@@error -->
<!-- $$$isValid[overload1]$$$isValid -->
<h3 class="fn"><a name="isValid"></a><span class="type">bool</span> QDBusReply::<span class="name">isValid</span> () const</h3>
<p>Returns true if no error occurred; otherwise, returns false.</p>
<p><b>See also </b><a href="qdbusreply.html#error">error</a>().</p>
<!-- @@@isValid -->
<!-- $$$value[overload1]$$$value -->
<h3 class="fn"><a name="value"></a><span class="type">Type</span> QDBusReply::<span class="name">value</span> () const</h3>
<p>Returns the remote function's calls return value. If the remote call returned with an error, the return value of this function is undefined and may be undistinguishable from a valid return value.</p>
<p>This function is not available if the remote call returns <tt>void</tt>.</p>
<!-- @@@value -->
<!-- $$$operator Type[overload1]$$$operator Type -->
<h3 class="fn"><a name="operator-Type"></a>QDBusReply::<span class="name">operator Type</span> () const</h3>
<p>Returns the same as <a href="qdbusreply.html#value">value</a>().</p>
<p>This function is not available if the remote call returns <tt>void</tt>.</p>
<!-- @@@operator Type -->
<!-- $$$operator=[overload1]$$$operator=constQDBusMessage& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">QDBusReply</span> & QDBusReply::<span class="name">operator=</span> ( const <span class="type"><a href="qdbusmessage.html">QDBusMessage</a></span> & <i>message</i> )</h3>
<p>Makes this object contain the reply specified by message <i>message</i>. If <i>message</i> is an error message, this function will copy the error code and message into this object</p>
<p>If <i>message</i> is a standard reply message and contains at least one parameter, it will be copied into this object, as long as it is of the correct type. If it's not of the same type as this <a href="qdbuserror.html">QDBusError</a> object, this function will instead set an error code indicating a type mismatch.</p>
<!-- @@@operator= -->
<!-- $$$operator=$$$operator=constQDBusPendingCall& -->
<h3 class="fn"><a name="operator-eq-2"></a><span class="type">QDBusReply</span> & QDBusReply::<span class="name">operator=</span> ( const <span class="type"><a href="qdbuspendingcall.html">QDBusPendingCall</a></span> & <i>pcall</i> )</h3>
<p>Makes this object contain the reply specified by the pending asynchronous call <i>pcall</i>. If the call is not finished yet, this function will call QDBusPendingCall::waitForFinished() to block until the reply arrives.</p>
<p>If <i>pcall</i> finishes with an error message, this function will copy the error code and message into this object</p>
<p>If <i>pcall</i> finished with a standard reply message and contains at least one parameter, it will be copied into this object, as long as it is of the correct type. If it's not of the same type as this <a href="qdbuserror.html">QDBusError</a> object, this function will instead set an error code indicating a type mismatch.</p>
<!-- @@@operator= -->
<!-- $$$operator=$$$operator=constQDBusError& -->
<h3 class="fn"><a name="operator-eq-3"></a><span class="type">QDBusReply</span> & QDBusReply::<span class="name">operator=</span> ( const <span class="type"><a href="qdbuserror.html">QDBusError</a></span> & <i>error</i> )</h3>
<p>Sets this object to contain the error code given by <i>error</i>. You can later access it with <a href="qdbusreply.html#error">error</a>().</p>
<!-- @@@operator= -->
<!-- $$$operator=$$$operator=constQDBusReply& -->
<h3 class="fn"><a name="operator-eq-4"></a><span class="type">QDBusReply</span> & QDBusReply::<span class="name">operator=</span> ( const <span class="type">QDBusReply</span> & <i>other</i> )</h3>
<p>Makes this object be a copy of the object <i>other</i>.</p>
<!-- @@@operator= -->
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|