<?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" /> <!-- qnetworkcookie.cpp --> <title>Qt 4.8: QNetworkCookie Class Reference</title> <link rel="stylesheet" type="text/css" href="style/style.css" /> <script src="scripts/jquery.js" type="text/javascript"></script> <script src="scripts/functions.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="style/superfish.css" /> <link rel="stylesheet" type="text/css" href="style/narrow.css" /> <!--[if IE]> <meta name="MSSmartTagsPreventParsing" content="true"> <meta http-equiv="imagetoolbar" content="no"> <![endif]--> <!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie6.css"> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie7.css"> <![endif]--> <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="style/style_ie8.css"> <![endif]--> <script src="scripts/superfish.js" type="text/javascript"></script> <script src="scripts/narrow.js" type="text/javascript"></script> </head> <body class="" onload="CheckEmptyAndLoadList();"> <div class="header" id="qtdocheader"> <div class="content"> <div id="nav-logo"> <a href="index.html">Home</a></div> <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a> <div id="narrowsearch"></div> <div id="nav-topright"> <ul> <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li> <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li> <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/"> DOC</a></li> <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li> </ul> </div> <div id="shortCut"> <ul> <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li> <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS </a></li> </ul> </div> <ul class="sf-menu" id="narrowmenu"> <li><a href="#">API Lookup</a> <ul> <li><a href="classes.html">Class index</a></li> <li><a href="functions.html">Function index</a></li> <li><a href="modules.html">Modules</a></li> <li><a href="namespaces.html">Namespaces</a></li> <li><a href="qtglobal.html">Global Declarations</a></li> <li><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </li> <li><a href="#">Qt Topics</a> <ul> <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li><a href="supported-platforms.html">Supported Platforms</a></li> <li><a href="technology-apis.html">Qt and Key Technologies</a></li> <li><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </li> <li><a href="#">Examples</a> <ul> <li><a href="all-examples.html">Examples</a></li> <li><a href="tutorials.html">Tutorials</a></li> <li><a href="demos.html">Demos</a></li> <li><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </li> </ul> </div> </div> <div class="wrapper"> <div class="hd"> <span></span> </div> <div class="bd group"> <div class="sidebar"> <div class="searchlabel"> Search index:</div> <div class="search" id="sidebarsearch"> <form id="qtdocsearch" action="" onsubmit="return false;"> <fieldset> <input type="text" name="searchstring" id="pageType" value="" /> <div id="resultdialog"> <a href="#" id="resultclose">Close</a> <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span> results:</p> <ul id="resultlist" class="all"> </ul> </div> </fieldset> </form> </div> <div class="box first bottombar" id="lookup"> <h2 title="API Lookup"><span></span> API Lookup</h2> <div id="list001" class="list"> <ul id="ul001" > <li class="defaultLink"><a href="classes.html">Class index</a></li> <li class="defaultLink"><a href="functions.html">Function index</a></li> <li class="defaultLink"><a href="modules.html">Modules</a></li> <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li> <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li> <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </div> </div> <div class="box bottombar" id="topics"> <h2 title="Qt Topics"><span></span> Qt Topics</h2> <div id="list002" class="list"> <ul id="ul002" > <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li class="defaultLink"><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li> <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </div> </div> <div class="box" id="examples"> <h2 title="Examples"><span></span> Examples</h2> <div id="list003" class="list"> <ul id="ul003"> <li class="defaultLink"><a href="all-examples.html">Examples</a></li> <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li> <li class="defaultLink"><a href="demos.html">Demos</a></li> <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </div> </div> </div> <div class="wrap"> <div class="toolbar"> <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="qtnetwork.html">QtNetwork</a></li> <li>QNetworkCookie</li> </ul> </div> <div class="toolbuttons toolblock"> <ul> <li id="smallA" class="t_button">A</li> <li id="medA" class="t_button active">A</li> <li id="bigA" class="t_button">A</li> <li id="print" class="t_button"><a href="javascript:this.print();"> <span>Print</span></a></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-types">Public Types</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#static-public-members">Static Public Members</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <h1 class="title">QNetworkCookie Class Reference</h1> <!-- $$$QNetworkCookie-brief --> <p>The QNetworkCookie class holds one network cookie. <a href="#details">More...</a></p> <!-- @@@QNetworkCookie --> <pre class="cpp"> <span class="preprocessor">#include <QNetworkCookie></span></pre><p>This class was introduced in Qt 4.4.</p> <ul> <li><a href="qnetworkcookie-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-types"></a> <h2>Public Types</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#RawForm-enum">RawForm</a></b> { NameAndValueOnly, Full }</td></tr> </table> <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="qnetworkcookie.html#QNetworkCookie">QNetworkCookie</a></b> ( const QByteArray & <i>name</i> = QByteArray(), const QByteArray & <i>value</i> = QByteArray() )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#QNetworkCookie-2">QNetworkCookie</a></b> ( const QNetworkCookie & <i>other</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#dtor.QNetworkCookie">~QNetworkCookie</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#domain">domain</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDateTime </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#expirationDate">expirationDate</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#isHttpOnly">isHttpOnly</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#isSecure">isSecure</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#isSessionCookie">isSessionCookie</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#name">name</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#pathx">path</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#setDomain">setDomain</a></b> ( const QString & <i>domain</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#setExpirationDate">setExpirationDate</a></b> ( const QDateTime & <i>date</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#setHttpOnly">setHttpOnly</a></b> ( bool <i>enable</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#setName">setName</a></b> ( const QByteArray & <i>cookieName</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#setPath">setPath</a></b> ( const QString & <i>path</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#setSecure">setSecure</a></b> ( bool <i>enable</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#setValue">setValue</a></b> ( const QByteArray & <i>value</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#toRawForm">toRawForm</a></b> ( RawForm <i>form</i> = Full ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#value">value</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#operator-not-eq">operator!=</a></b> ( const QNetworkCookie & <i>other</i> ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QNetworkCookie & </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#operator-eq">operator=</a></b> ( const QNetworkCookie & <i>other</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#operator-eq-eq">operator==</a></b> ( const QNetworkCookie & <i>other</i> ) const</td></tr> </table> <a name="static-public-members"></a> <h2>Static Public Members</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> QList<QNetworkCookie> </td><td class="memItemRight bottomAlign"><b><a href="qnetworkcookie.html#parseCookies">parseCookies</a></b> ( const QByteArray & <i>cookieString</i> )</td></tr> </table> <a name="details"></a> <!-- $$$QNetworkCookie-description --> <div class="descr"> <h2>Detailed Description</h2> <p>The QNetworkCookie class holds one network cookie.</p> <p>Cookies are small bits of information that stateless protocols like HTTP use to maintain some persistent information across requests.</p> <p>A cookie is set by a remote server when it replies to a request and it expects the same cookie to be sent back when further requests are sent.</p> <p>QNetworkCookie holds one such cookie as received from the network. A cookie has a name and a value, but those are opaque to the application (that is, the information stored in them has no meaning to the application). A cookie has an associated path name and domain, which indicate when the cookie should be sent again to the server.</p> <p>A cookie can also have an expiration date, indicating its validity. If the expiration date is not present, the cookie is considered a "session cookie" and should be discarded when the application exits (or when its concept of session is over).</p> <p>QNetworkCookie provides a way of parsing a cookie from the HTTP header format using the <a href="qnetworkcookie.html#parseCookies">QNetworkCookie::parseCookies</a>() function. However, when received in a <a href="qnetworkreply.html">QNetworkReply</a>, the cookie is already parsed.</p> <p>This class implements cookies as described by the <a href="http://cgi.netscape.com/newsref/std/cookie_spec.html">initial cookie specification by Netscape</a>, which is somewhat similar to the <a href="http://www.rfc-editor.org/rfc/rfc2109.txt">RFC 2109</a> specification, plus the <a href="http://msdn.microsoft.com/en-us/library/ms533046(VS.85).aspx">"HttpOnly" extension</a>. The more recent <a href="http://www.rfc-editor.org/rfc/rfc2965.txt">RFC 2965</a> specification (which uses the Set-Cookie2 header) is not supported.</p> </div> <p><b>See also </b><a href="qnetworkcookiejar.html">QNetworkCookieJar</a>, <a href="qnetworkrequest.html">QNetworkRequest</a>, and <a href="qnetworkreply.html">QNetworkReply</a>.</p> <!-- @@@QNetworkCookie --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$RawForm$$$NameAndValueOnly$$$Full --> <h3 class="fn"><a name="RawForm-enum"></a>enum QNetworkCookie::<span class="name">RawForm</span></h3> <p>This enum is used with the <a href="qnetworkcookie.html#toRawForm">toRawForm</a>() function to declare which form of a cookie shall be returned.</p> <table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr> <tr><td class="topAlign"><tt>QNetworkCookie::NameAndValueOnly</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">makes <a href="qnetworkcookie.html#toRawForm">toRawForm</a>() return only the "NAME=VALUE" part of the cookie, as suitable for sending back to a server in a client request's "Cookie:" header. Multiple cookies are separated by a semi-colon in the "Cookie:" header field.</td></tr> <tr><td class="topAlign"><tt>QNetworkCookie::Full</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">makes <a href="qnetworkcookie.html#toRawForm">toRawForm</a>() return the full cookie contents, as suitable for sending to a client in a server's "Set-Cookie:" header.</td></tr> </table> <p>Note that only the Full form of the cookie can be parsed back into its original contents.</p> <p><b>See also </b><a href="qnetworkcookie.html#toRawForm">toRawForm</a>() and <a href="qnetworkcookie.html#parseCookies">parseCookies</a>().</p> <!-- @@@RawForm --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QNetworkCookie[overload1]$$$QNetworkCookieconstQByteArray&constQByteArray& --> <h3 class="fn"><a name="QNetworkCookie"></a>QNetworkCookie::<span class="name">QNetworkCookie</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> & <i>name</i> = QByteArray(), const <span class="type"><a href="qbytearray.html">QByteArray</a></span> & <i>value</i> = QByteArray() )</h3> <p>Create a new <a href="qnetworkcookie.html">QNetworkCookie</a> object, initializing the cookie name to <i>name</i> and its value to <i>value</i>.</p> <p>A cookie is only valid if it has a name. However, the value is opaque to the application and being empty may have significance to the remote server.</p> <!-- @@@QNetworkCookie --> <!-- $$$QNetworkCookie$$$QNetworkCookieconstQNetworkCookie& --> <h3 class="fn"><a name="QNetworkCookie-2"></a>QNetworkCookie::<span class="name">QNetworkCookie</span> ( const <span class="type">QNetworkCookie</span> & <i>other</i> )</h3> <p>Creates a new <a href="qnetworkcookie.html">QNetworkCookie</a> object by copying the contents of <i>other</i>.</p> <!-- @@@QNetworkCookie --> <!-- $$$~QNetworkCookie[overload1]$$$~QNetworkCookie --> <h3 class="fn"><a name="dtor.QNetworkCookie"></a>QNetworkCookie::<span class="name">~QNetworkCookie</span> ()</h3> <p>Destroys this <a href="qnetworkcookie.html">QNetworkCookie</a> object.</p> <!-- @@@~QNetworkCookie --> <!-- $$$domain[overload1]$$$domain --> <h3 class="fn"><a name="domain"></a><span class="type"><a href="qstring.html">QString</a></span> QNetworkCookie::<span class="name">domain</span> () const</h3> <p>Returns the domain this cookie is associated with. This corresponds to the "domain" field of the cookie string.</p> <p>Note that the domain here may start with a dot, which is not a valid hostname. However, it means this cookie matches all hostnames ending with that domain name.</p> <p><b>See also </b><a href="qnetworkcookie.html#setDomain">setDomain</a>().</p> <!-- @@@domain --> <!-- $$$expirationDate[overload1]$$$expirationDate --> <h3 class="fn"><a name="expirationDate"></a><span class="type"><a href="qdatetime.html">QDateTime</a></span> QNetworkCookie::<span class="name">expirationDate</span> () const</h3> <p>Returns the expiration date for this cookie. If this cookie is a session cookie, the <a href="qdatetime.html">QDateTime</a> returned will not be valid. If the date is in the past, this cookie has already expired and should not be sent again back to a remote server.</p> <p>The expiration date corresponds to the parameters of the "expires" entry in the cookie string.</p> <p><b>See also </b><a href="qnetworkcookie.html#isSessionCookie">isSessionCookie</a>() and <a href="qnetworkcookie.html#setExpirationDate">setExpirationDate</a>().</p> <!-- @@@expirationDate --> <!-- $$$isHttpOnly[overload1]$$$isHttpOnly --> <h3 class="fn"><a name="isHttpOnly"></a><span class="type">bool</span> QNetworkCookie::<span class="name">isHttpOnly</span> () const</h3> <p>Returns true if the "HttpOnly" flag is enabled for this cookie.</p> <p>A cookie that is "HttpOnly" is only set and retrieved by the network requests and replies; i.e., the HTTP protocol. It is not accessible from scripts running on browsers.</p> <p>This function was introduced in Qt 4.5.</p> <p><b>See also </b><a href="qnetworkcookie.html#isSecure">isSecure</a>().</p> <!-- @@@isHttpOnly --> <!-- $$$isSecure[overload1]$$$isSecure --> <h3 class="fn"><a name="isSecure"></a><span class="type">bool</span> QNetworkCookie::<span class="name">isSecure</span> () const</h3> <p>Returns true if the "secure" option was specified in the cookie string, false otherwise.</p> <p>Secure cookies may contain private information and should not be resent over unencrypted connections.</p> <p><b>See also </b><a href="qnetworkcookie.html#setSecure">setSecure</a>().</p> <!-- @@@isSecure --> <!-- $$$isSessionCookie[overload1]$$$isSessionCookie --> <h3 class="fn"><a name="isSessionCookie"></a><span class="type">bool</span> QNetworkCookie::<span class="name">isSessionCookie</span> () const</h3> <p>Returns true if this cookie is a session cookie. A session cookie is a cookie which has no expiration date, which means it should be discarded when the application's concept of session is over (usually, when the application exits).</p> <p><b>See also </b><a href="qnetworkcookie.html#expirationDate">expirationDate</a>() and <a href="qnetworkcookie.html#setExpirationDate">setExpirationDate</a>().</p> <!-- @@@isSessionCookie --> <!-- $$$name[overload1]$$$name --> <h3 class="fn"><a name="name"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> QNetworkCookie::<span class="name">name</span> () const</h3> <p>Returns the name of this cookie. The only mandatory field of a cookie is its name, without which it is not considered valid.</p> <p><b>See also </b><a href="qnetworkcookie.html#setName">setName</a>() and <a href="qnetworkcookie.html#value">value</a>().</p> <!-- @@@name --> <!-- $$$parseCookies[overload1]$$$parseCookiesconstQByteArray& --> <h3 class="fn"><a name="parseCookies"></a><span class="type"><a href="qlist.html">QList</a></span><<span class="type">QNetworkCookie</span>> QNetworkCookie::<span class="name">parseCookies</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> & <i>cookieString</i> )<tt> [static]</tt></h3> <p>Parses the cookie string <i>cookieString</i> as received from a server response in the "Set-Cookie:" header. If there's a parsing error, this function returns an empty list.</p> <p>Since the HTTP header can set more than one cookie at the same time, this function returns a <a href="qlist.html">QList</a><<a href="qnetworkcookie.html">QNetworkCookie</a>>, one for each cookie that is parsed.</p> <p><b>See also </b><a href="qnetworkcookie.html#toRawForm">toRawForm</a>().</p> <!-- @@@parseCookies --> <!-- $$$path[overload1]$$$path --> <h3 class="fn"><a name="pathx"></a><span class="type"><a href="qstring.html">QString</a></span> QNetworkCookie::<span class="name">path</span> () const</h3> <p>Returns the path associated with this cookie. This corresponds to the "path" field of the cookie string.</p> <p><b>See also </b><a href="qnetworkcookie.html#setPath">setPath</a>().</p> <!-- @@@path --> <!-- $$$setDomain[overload1]$$$setDomainconstQString& --> <h3 class="fn"><a name="setDomain"></a><span class="type">void</span> QNetworkCookie::<span class="name">setDomain</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>domain</i> )</h3> <p>Sets the domain associated with this cookie to be <i>domain</i>.</p> <p><b>See also </b><a href="qnetworkcookie.html#domain">domain</a>().</p> <!-- @@@setDomain --> <!-- $$$setExpirationDate[overload1]$$$setExpirationDateconstQDateTime& --> <h3 class="fn"><a name="setExpirationDate"></a><span class="type">void</span> QNetworkCookie::<span class="name">setExpirationDate</span> ( const <span class="type"><a href="qdatetime.html">QDateTime</a></span> & <i>date</i> )</h3> <p>Sets the expiration date of this cookie to <i>date</i>. Setting an invalid expiration date to this cookie will mean it's a session cookie.</p> <p><b>See also </b><a href="qnetworkcookie.html#isSessionCookie">isSessionCookie</a>() and <a href="qnetworkcookie.html#expirationDate">expirationDate</a>().</p> <!-- @@@setExpirationDate --> <!-- $$$setHttpOnly[overload1]$$$setHttpOnlybool --> <h3 class="fn"><a name="setHttpOnly"></a><span class="type">void</span> QNetworkCookie::<span class="name">setHttpOnly</span> ( <span class="type">bool</span> <i>enable</i> )</h3> <p>Sets this cookie's "HttpOnly" flag to <i>enable</i>.</p> <p>This function was introduced in Qt 4.5.</p> <p><b>See also </b><a href="qnetworkcookie.html#isHttpOnly">isHttpOnly</a>().</p> <!-- @@@setHttpOnly --> <!-- $$$setName[overload1]$$$setNameconstQByteArray& --> <h3 class="fn"><a name="setName"></a><span class="type">void</span> QNetworkCookie::<span class="name">setName</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> & <i>cookieName</i> )</h3> <p>Sets the name of this cookie to be <i>cookieName</i>. Note that setting a cookie name to an empty <a href="qbytearray.html">QByteArray</a> will make this cookie invalid.</p> <p><b>See also </b><a href="qnetworkcookie.html#name">name</a>() and <a href="qnetworkcookie.html#value">value</a>().</p> <!-- @@@setName --> <!-- $$$setPath[overload1]$$$setPathconstQString& --> <h3 class="fn"><a name="setPath"></a><span class="type">void</span> QNetworkCookie::<span class="name">setPath</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>path</i> )</h3> <p>Sets the path associated with this cookie to be <i>path</i>.</p> <p><b>See also </b><a href="qnetworkcookie.html#pathx">path</a>().</p> <!-- @@@setPath --> <!-- $$$setSecure[overload1]$$$setSecurebool --> <h3 class="fn"><a name="setSecure"></a><span class="type">void</span> QNetworkCookie::<span class="name">setSecure</span> ( <span class="type">bool</span> <i>enable</i> )</h3> <p>Sets the secure flag of this cookie to <i>enable</i>.</p> <p>Secure cookies may contain private information and should not be resent over unencrypted connections.</p> <p><b>See also </b><a href="qnetworkcookie.html#isSecure">isSecure</a>().</p> <!-- @@@setSecure --> <!-- $$$setValue[overload1]$$$setValueconstQByteArray& --> <h3 class="fn"><a name="setValue"></a><span class="type">void</span> QNetworkCookie::<span class="name">setValue</span> ( const <span class="type"><a href="qbytearray.html">QByteArray</a></span> & <i>value</i> )</h3> <p>Sets the value of this cookie to be <i>value</i>.</p> <p><b>See also </b><a href="qnetworkcookie.html#value">value</a>() and <a href="qnetworkcookie.html#name">name</a>().</p> <!-- @@@setValue --> <!-- $$$toRawForm[overload1]$$$toRawFormRawForm --> <h3 class="fn"><a name="toRawForm"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> QNetworkCookie::<span class="name">toRawForm</span> ( <span class="type"><a href="qnetworkcookie.html#RawForm-enum">RawForm</a></span> <i>form</i> = Full ) const</h3> <p>Returns the raw form of this <a href="qnetworkcookie.html">QNetworkCookie</a>. The <a href="qbytearray.html">QByteArray</a> returned by this function is suitable for an HTTP header, either in a server response (the Set-Cookie header) or the client request (the Cookie header). You can choose from one of two formats, using <i>form</i>.</p> <p><b>See also </b><a href="qnetworkcookie.html#parseCookies">parseCookies</a>().</p> <!-- @@@toRawForm --> <!-- $$$value[overload1]$$$value --> <h3 class="fn"><a name="value"></a><span class="type"><a href="qbytearray.html">QByteArray</a></span> QNetworkCookie::<span class="name">value</span> () const</h3> <p>Returns this cookies value, as specified in the cookie string. Note that a cookie is still valid if its value is empty.</p> <p>Cookie name-value pairs are considered opaque to the application: that is, their values don't mean anything.</p> <p><b>See also </b><a href="qnetworkcookie.html#setValue">setValue</a>() and <a href="qnetworkcookie.html#name">name</a>().</p> <!-- @@@value --> <!-- $$$operator!=[overload1]$$$operator!=constQNetworkCookie& --> <h3 class="fn"><a name="operator-not-eq"></a><span class="type">bool</span> QNetworkCookie::<span class="name">operator!=</span> ( const <span class="type">QNetworkCookie</span> & <i>other</i> ) const</h3> <p>Returns true if this cookie is not equal to <i>other</i>.</p> <p><b>See also </b><a href="qnetworkcookie.html#operator-eq-eq">operator==</a>().</p> <!-- @@@operator!= --> <!-- $$$operator=[overload1]$$$operator=constQNetworkCookie& --> <h3 class="fn"><a name="operator-eq"></a><span class="type">QNetworkCookie</span> & QNetworkCookie::<span class="name">operator=</span> ( const <span class="type">QNetworkCookie</span> & <i>other</i> )</h3> <p>Copies the contents of the <a href="qnetworkcookie.html">QNetworkCookie</a> object <i>other</i> to this object.</p> <!-- @@@operator= --> <!-- $$$operator==[overload1]$$$operator==constQNetworkCookie& --> <h3 class="fn"><a name="operator-eq-eq"></a><span class="type">bool</span> QNetworkCookie::<span class="name">operator==</span> ( const <span class="type">QNetworkCookie</span> & <i>other</i> ) const</h3> <p>Returns true if this cookie is equal to <i>other</i>. This function only returns true if all fields of the cookie are the same.</p> <p>However, in some contexts, two cookies of the same name could be considered equal.</p> <p><b>See also </b><a href="qnetworkcookie.html#operator-not-eq">operator!=</a>().</p> <!-- @@@operator== --> </div> </div> </div> </div> <div class="ft"> <span></span> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2013 Digia Plc 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> Digia, Qt and their respective logos are trademarks of Digia Plc 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> <script src="scripts/functions.js" type="text/javascript"></script> </body> </html>