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 3768 2009-05-13 19:07:26Z 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 class GeoIp;
00025 class QString;
00026 class QStringList;
00027 
00028 
00029 class GeoIpResponse
00030 {
00031 public:
00032   /** Constructor. Parses the response data for an HTTP header and Geo IP
00033    * information.  */
00034   GeoIpResponse(const QByteArray &response);
00035 
00036   /** Returns the HTTP status code for this response.
00037    */
00038   int statusCode() const;
00039 
00040   /** Returns the HTTP status message for this response.
00041    */
00042   QString statusMessage() const;
00043 
00044   /** Returns the Geo IP information contained in this response.
00045    */
00046   QByteArray content() const;
00047   
00048 private:
00049   /** Decodes a <b>chunked</b> transfer encoding. Returns the unchunked 
00050    * result on success, or an empty QByteArray if decoding fails. */
00051   QByteArray decodeChunked(const QByteArray &chunked);
00052   
00053   QHttpResponseHeader _header; /**< HTTP response header. */
00054   QByteArray _content; /**< Geo IP information in this response. */
00055 };
00056 
00057 #endif
00058 
Generated on Mon Aug 30 23:09:49 2010 for Vidalia by  doxygen 1.6.3