Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > ed1483a4d9709d82850bb84cf25535e7 > files > 53

sfml-1.5-1mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>SFML - Simple and Fast Multimedia Library</title>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="tabs.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <div id="logo">
            <img src="./logo.jpg" width="770" height="200" title="SFML home" alt="SFML logo" />
        </div>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.htm"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.htm"><span>Namespaces</span></a></li>
      <li><a href="annotated.htm"><span>Classes</span></a></li>
      <li class="current"><a href="files.htm"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.htm"><span>File&nbsp;List</span></a></li>
    </ul>
  </div>
<h1>Http.hpp</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">// SFML - Simple and Fast Multimedia Library</span>
<a name="l00004"></a>00004 <span class="comment">// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)</span>
<a name="l00005"></a>00005 <span class="comment">//</span>
<a name="l00006"></a>00006 <span class="comment">// This software is provided 'as-is', without any express or implied warranty.</span>
<a name="l00007"></a>00007 <span class="comment">// In no event will the authors be held liable for any damages arising from the use of this software.</span>
<a name="l00008"></a>00008 <span class="comment">//</span>
<a name="l00009"></a>00009 <span class="comment">// Permission is granted to anyone to use this software for any purpose,</span>
<a name="l00010"></a>00010 <span class="comment">// including commercial applications, and to alter it and redistribute it freely,</span>
<a name="l00011"></a>00011 <span class="comment">// subject to the following restrictions:</span>
<a name="l00012"></a>00012 <span class="comment">//</span>
<a name="l00013"></a>00013 <span class="comment">// 1. The origin of this software must not be misrepresented;</span>
<a name="l00014"></a>00014 <span class="comment">//    you must not claim that you wrote the original software.</span>
<a name="l00015"></a>00015 <span class="comment">//    If you use this software in a product, an acknowledgment</span>
<a name="l00016"></a>00016 <span class="comment">//    in the product documentation would be appreciated but is not required.</span>
<a name="l00017"></a>00017 <span class="comment">//</span>
<a name="l00018"></a>00018 <span class="comment">// 2. Altered source versions must be plainly marked as such,</span>
<a name="l00019"></a>00019 <span class="comment">//    and must not be misrepresented as being the original software.</span>
<a name="l00020"></a>00020 <span class="comment">//</span>
<a name="l00021"></a>00021 <span class="comment">// 3. This notice may not be removed or altered from any source distribution.</span>
<a name="l00022"></a>00022 <span class="comment">//</span>
<a name="l00024"></a>00024 <span class="comment"></span>
<a name="l00025"></a>00025 <span class="preprocessor">#ifndef SFML_HTTP_HPP</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span><span class="preprocessor">#define SFML_HTTP_HPP</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span>
<a name="l00029"></a>00029 <span class="comment">// Headers</span>
<a name="l00031"></a>00031 <span class="comment"></span><span class="preprocessor">#include &lt;SFML/System/NonCopyable.hpp&gt;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &lt;SFML/Network/IPAddress.hpp&gt;</span>
<a name="l00033"></a>00033 <span class="preprocessor">#include &lt;SFML/Network/SocketTCP.hpp&gt;</span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;map&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00036"></a>00036 
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 <span class="keyword">namespace </span>sf
<a name="l00039"></a>00039 {
<a name="l00045"></a><a class="code" href="classsf_1_1Http.htm">00045</a> <span class="keyword">class </span>SFML_API <a class="code" href="classsf_1_1Http.htm" title="This class provides methods for manipulating the HTTP protocol (described in RFC...">Http</a> : <a class="code" href="structsf_1_1NonCopyable.htm" title="Utility base class to easily declare non-copyable classes.">NonCopyable</a>
<a name="l00046"></a>00046 {
<a name="l00047"></a>00047 <span class="keyword">public</span> :
<a name="l00048"></a>00048 
<a name="l00054"></a><a class="code" href="classsf_1_1Http_1_1Request.htm">00054</a>     <span class="keyword">class </span>SFML_API <a class="code" href="classsf_1_1Http_1_1Request.htm" title="This class wraps an HTTP request, which is basically :a header with a method, a target...">Request</a>
<a name="l00055"></a>00055     {
<a name="l00056"></a>00056     <span class="keyword">public</span> :
<a name="l00057"></a>00057 
<a name="l00061"></a><a class="code" href="classsf_1_1Http_1_1Request.htm#620f8bff6f43e1378f321bf53fbf5598">00061</a>         <span class="keyword">enum</span> <a class="code" href="classsf_1_1Http_1_1Request.htm#620f8bff6f43e1378f321bf53fbf5598" title="Enumerate the available HTTP methods for a request.">Method</a>
<a name="l00062"></a>00062         {
<a name="l00063"></a><a class="code" href="classsf_1_1Http_1_1Request.htm#620f8bff6f43e1378f321bf53fbf5598f6c1b04e35501cd5f5a85207c2b37f00">00063</a>             Get,  
<a name="l00064"></a><a class="code" href="classsf_1_1Http_1_1Request.htm#620f8bff6f43e1378f321bf53fbf559887aa7a9c6147016f57c5ff1c5cac6138">00064</a>             Post, 
<a name="l00065"></a><a class="code" href="classsf_1_1Http_1_1Request.htm#620f8bff6f43e1378f321bf53fbf5598d1642aed133fbd3cb4fcff0f558e6ee5">00065</a>             Head  
<a name="l00066"></a>00066         };
<a name="l00067"></a>00067 
<a name="l00076"></a>00076         <a class="code" href="classsf_1_1Http_1_1Request.htm" title="This class wraps an HTTP request, which is basically :a header with a method, a target...">Request</a>(Method RequestMethod = Get, <span class="keyword">const</span> std::string&amp; URI = <span class="stringliteral">"/"</span>, <span class="keyword">const</span> std::string&amp; Body = <span class="stringliteral">""</span>);
<a name="l00077"></a>00077 
<a name="l00085"></a>00085         <span class="keywordtype">void</span> SetField(<span class="keyword">const</span> std::string&amp; Field, <span class="keyword">const</span> std::string&amp; Value);
<a name="l00086"></a>00086 
<a name="l00094"></a>00094         <span class="keywordtype">void</span> SetMethod(Method RequestMethod);
<a name="l00095"></a>00095 
<a name="l00103"></a>00103         <span class="keywordtype">void</span> SetURI(<span class="keyword">const</span> std::string&amp; URI);
<a name="l00104"></a>00104 
<a name="l00113"></a>00113         <span class="keywordtype">void</span> SetHttpVersion(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Major, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> Minor);
<a name="l00114"></a>00114 
<a name="l00123"></a>00123         <span class="keywordtype">void</span> SetBody(<span class="keyword">const</span> std::string&amp; Body);
<a name="l00124"></a>00124 
<a name="l00125"></a>00125     <span class="keyword">private</span> :
<a name="l00126"></a>00126 
<a name="l00127"></a>00127         <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classsf_1_1Http.htm" title="This class provides methods for manipulating the HTTP protocol (described in RFC...">Http</a>;
<a name="l00128"></a>00128 
<a name="l00135"></a>00135         std::string ToString() <span class="keyword">const</span>;
<a name="l00136"></a>00136 
<a name="l00145"></a>00145         <span class="keywordtype">bool</span> HasField(<span class="keyword">const</span> std::string&amp; Field) <span class="keyword">const</span>;
<a name="l00146"></a>00146 
<a name="l00148"></a>00148         <span class="comment">// Types</span>
<a name="l00150"></a>00150 <span class="comment"></span>        <span class="keyword">typedef</span> std::map&lt;std::string, std::string&gt; FieldTable;
<a name="l00151"></a>00151 
<a name="l00153"></a>00153         <span class="comment">// Member data</span>
<a name="l00155"></a>00155 <span class="comment"></span>        FieldTable   myFields;       
<a name="l00156"></a>00156         Method       myMethod;       
<a name="l00157"></a>00157         std::string  myURI;          
<a name="l00158"></a>00158         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> myMajorVersion; 
<a name="l00159"></a>00159         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> myMinorVersion; 
<a name="l00160"></a>00160         std::string  myBody;         
<a name="l00161"></a>00161     };
<a name="l00162"></a>00162 
<a name="l00168"></a><a class="code" href="classsf_1_1Http_1_1Response.htm">00168</a>     <span class="keyword">class </span>SFML_API <a class="code" href="classsf_1_1Http_1_1Response.htm" title="This class wraps an HTTP response, which is basically :a header with a status code...">Response</a>
<a name="l00169"></a>00169     {
<a name="l00170"></a>00170     <span class="keyword">public</span> :
<a name="l00171"></a>00171 
<a name="l00176"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d8">00176</a>         <span class="keyword">enum</span> <a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d8" title="Enumerate all the valid status codes returned in a HTTP response.">Status</a>
<a name="l00177"></a>00177         {
<a name="l00178"></a>00178             <span class="comment">// 2xx: success</span>
<a name="l00179"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d851b3f82163c2a9da6d0b59861438a6e5">00179</a>             Ok        = 200, 
<a name="l00180"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d8b81740668f9aaaeac28ad29e770e0ac0">00180</a>             Created   = 201, 
<a name="l00181"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d85f1413adbb3239ffc1106698da8eaaae">00181</a>             Accepted  = 202, 
<a name="l00182"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d871242772df8d6c5c007fc5515b193ca3">00182</a>             NoContent = 204, 
<a name="l00183"></a>00183 
<a name="l00184"></a>00184             <span class="comment">// 3xx: redirection</span>
<a name="l00185"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d873852d5b7aae546a393b52ed617765d2">00185</a>             MultipleChoices  = 300, 
<a name="l00186"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d8959223a6657a518f8fac7988ee37d9f0">00186</a>             MovedPermanently = 301, 
<a name="l00187"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d8c0d40f800acc7b2fbfb308db7076c015">00187</a>             MovedTemporarily = 302, 
<a name="l00188"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d8c1869be5ad599bce333ec31e338aad56">00188</a>             NotModified      = 304, 
<a name="l00189"></a>00189 
<a name="l00190"></a>00190             <span class="comment">// 4xx: client error</span>
<a name="l00191"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d80d8bd04dc52e2682b2c1a16e791f8caa">00191</a>             BadRequest   = 400, 
<a name="l00192"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d815420ced21fd9d1e5164b3d497db328e">00192</a>             Unauthorized = 401, 
<a name="l00193"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d8c6741fac3c5ae4ee2edabc47713abdcf">00193</a>             Forbidden    = 403, 
<a name="l00194"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d8ba6a54a26a9fe3d52ab0dd6930b73e41">00194</a>             NotFound     = 404, 
<a name="l00195"></a>00195 
<a name="l00196"></a>00196             <span class="comment">// 5xx: server error</span>
<a name="l00197"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d832fc48d61841e3647702775eed2edb3a">00197</a>             InternalServerError = 500, 
<a name="l00198"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d8195621707d16bfa766a5bfe88519f1cf">00198</a>             NotImplemented      = 501, 
<a name="l00199"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d835e1dac1fed604a1b79266b69beccde9">00199</a>             BadGateway          = 502, 
<a name="l00200"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d8ca3d7619d3532ee3f09af857e1e45b8c">00200</a>             ServiceNotAvailable = 503, 
<a name="l00201"></a>00201 
<a name="l00202"></a>00202             <span class="comment">// 10xx: SFML custom codes</span>
<a name="l00203"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d8acd062103f0975b1c2078bea0d91d5a8">00203</a>             InvalidResponse  = 1000, 
<a name="l00204"></a><a class="code" href="classsf_1_1Http_1_1Response.htm#663e071978e30fbbeb20ed045be874d85c8ef4342e03b4d2325521ea40f035fa">00204</a>             ConnectionFailed = 1001  
<a name="l00205"></a>00205         };
<a name="l00206"></a>00206 
<a name="l00211"></a>00211         <a class="code" href="classsf_1_1Http_1_1Response.htm" title="This class wraps an HTTP response, which is basically :a header with a status code...">Response</a>();
<a name="l00212"></a>00212 
<a name="l00221"></a>00221         <span class="keyword">const</span> std::string&amp; GetField(<span class="keyword">const</span> std::string&amp; Field) <span class="keyword">const</span>;
<a name="l00222"></a>00222 
<a name="l00229"></a>00229         Status GetStatus() <span class="keyword">const</span>;
<a name="l00230"></a>00230 
<a name="l00237"></a>00237         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetMajorHttpVersion() <span class="keyword">const</span>;
<a name="l00238"></a>00238 
<a name="l00245"></a>00245         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetMinorHttpVersion() <span class="keyword">const</span>;
<a name="l00246"></a>00246 
<a name="l00257"></a>00257         <span class="keyword">const</span> std::string&amp; GetBody() <span class="keyword">const</span>;
<a name="l00258"></a>00258 
<a name="l00259"></a>00259     <span class="keyword">private</span> :
<a name="l00260"></a>00260 
<a name="l00261"></a>00261         <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classsf_1_1Http.htm" title="This class provides methods for manipulating the HTTP protocol (described in RFC...">Http</a>;
<a name="l00262"></a>00262 
<a name="l00269"></a>00269         <span class="keywordtype">void</span> FromString(<span class="keyword">const</span> std::string&amp; Data);
<a name="l00270"></a>00270 
<a name="l00272"></a>00272         <span class="comment">// Types</span>
<a name="l00274"></a>00274 <span class="comment"></span>        <span class="keyword">typedef</span> std::map&lt;std::string, std::string&gt; FieldTable;
<a name="l00275"></a>00275 
<a name="l00277"></a>00277         <span class="comment">// Member data</span>
<a name="l00279"></a>00279 <span class="comment"></span>        FieldTable   myFields;       
<a name="l00280"></a>00280         Status       myStatus;       
<a name="l00281"></a>00281         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> myMajorVersion; 
<a name="l00282"></a>00282         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> myMinorVersion; 
<a name="l00283"></a>00283         std::string  myBody;         
<a name="l00284"></a>00284     };
<a name="l00285"></a>00285 
<a name="l00290"></a>00290     <a class="code" href="classsf_1_1Http.htm" title="This class provides methods for manipulating the HTTP protocol (described in RFC...">Http</a>();
<a name="l00291"></a>00291 
<a name="l00299"></a>00299     <a class="code" href="classsf_1_1Http.htm" title="This class provides methods for manipulating the HTTP protocol (described in RFC...">Http</a>(<span class="keyword">const</span> std::string&amp; Host, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> Port = 0);
<a name="l00300"></a>00300 
<a name="l00308"></a>00308     <span class="keywordtype">void</span> SetHost(<span class="keyword">const</span> std::string&amp; Host, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> Port = 0);
<a name="l00309"></a>00309 
<a name="l00324"></a>00324     Response SendRequest(<span class="keyword">const</span> Request&amp; Req, <span class="keywordtype">float</span> Timeout = 0.f);
<a name="l00325"></a>00325 
<a name="l00326"></a>00326 <span class="keyword">private</span> :
<a name="l00327"></a>00327 
<a name="l00329"></a>00329     <span class="comment">// Member data</span>
<a name="l00331"></a>00331 <span class="comment"></span>    <a class="code" href="classsf_1_1SocketTCP.htm" title="SocketTCP wraps a socket using TCP protocol to send data safely (but a bit slower)...">SocketTCP</a>      myConnection; 
<a name="l00332"></a>00332     <a class="code" href="classsf_1_1IPAddress.htm" title="IPAddress provides easy manipulation of IP v4 addresses.">IPAddress</a>      myHost;       
<a name="l00333"></a>00333     std::string    myHostName;   
<a name="l00334"></a>00334     <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> myPort;       
<a name="l00335"></a>00335 };
<a name="l00336"></a>00336 
<a name="l00337"></a>00337 } <span class="comment">// namespace sf</span>
<a name="l00338"></a>00338 
<a name="l00339"></a>00339 
<a name="l00340"></a>00340 <span class="preprocessor">#endif // SFML_HTTP_HPP</span>
</pre></div></div>

        <p id="footer">
            &nbsp;::&nbsp; Copyright &copy; 2007-2008 Laurent Gomila, all rights reserved &nbsp;::&nbsp;
            Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.5.2</a> &nbsp;::&nbsp;
        </p>

    </body>
</html>