geoipresponse.h

Go to the documentation of this file.
00001 /*
00002 **  This file is part of Vidalia, and is subject to the license terms in the
00003 **  LICENSE file, found in the top level directory of this distribution. If you
00004 **  did not receive the LICENSE file with this file, you may obtain it from the
00005 **  Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.vidalia-project.net/. No part of Vidalia, including this file,
00007 **  may be copied, modified, propagated, or distributed except according to the
00008 **  terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file geoipresponse.h
00013 ** \version $Id: geoipresponse.h 3956 2009-07-10 00:51:49Z edmanm $
00014 ** \brief Parses a response to a previous GeoIP request
00015 */
00016 
00017 #ifndef _GEOIPRESPONSE_H
00018 #define _GEOIPRESPONSE_H
00019 
00020 #include <QList>
00021 #include <QByteArray>
00022 #include <QHttpResponseHeader>
00023 
00024 #include "geoip.h"
00025 
00026 
00027 class GeoIpResponse
00028 {
00029 public:
00030   /** Constructor. Parses the response data for an HTTP header and Geo IP
00031    * information.  */
00032   GeoIpResponse(const QByteArray &response);
00033 
00034   /** Returns the HTTP status code for this response. */
00035   int statusCode() const { return _header.statusCode(); }
00036   /** Returns the HTTP status message for this response. */
00037   QString statusMessage() const { return _header.reasonPhrase(); }
00038   /** Returns the Geo IP information contained in this response. */
00039   QList<GeoIp> geoIps() const { return _geoips; }
00040   
00041 private:
00042   /** Decodes a <b>chunked</b> transfer encoding. Returns the unchunked 
00043    * result on success, or an empty QByteArray if decoding fails. */
00044   static QByteArray decodeChunked(const QByteArray &chunked);
00045   
00046   QHttpResponseHeader _header; /**< HTTP response header. */
00047   QList<GeoIp> _geoips;        /**< Geo IP information in this response. */
00048 };
00049 
00050 #endif
00051 

Generated on Wed Dec 23 21:11:08 2009 for Vidalia by  doxygen 1.6.1