|
QGIS API Documentation
master-6227475
|
00001 /*************************************************************************** 00002 qgsnetworkreplyparser.h - Multipart QNetworkReply parser 00003 ------------------- 00004 begin : 4 January, 2013 00005 copyright : (C) 2013 by Radim Blazek 00006 email : radim dot blazek at gmail.com 00007 00008 ***************************************************************************/ 00009 00010 /*************************************************************************** 00011 * * 00012 * This program is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU General Public License as published by * 00014 * the Free Software Foundation; either version 2 of the License, or * 00015 * (at your option) any later version. * 00016 * * 00017 ***************************************************************************/ 00018 00019 #ifndef QGSNETWORKREPLYPARSER_H 00020 #define QGSNETWORKREPLYPARSER_H 00021 00022 #include <QNetworkReply> 00023 00033 class CORE_EXPORT QgsNetworkReplyParser : public QObject 00034 { 00035 Q_OBJECT 00036 00037 public: 00038 typedef QMap<QByteArray, QByteArray> RawHeaderMap; 00039 00042 QgsNetworkReplyParser( QNetworkReply *reply ); 00043 00046 bool isValid() const { return mValid; } 00047 00050 int parts() const { return mHeaders.size(); } 00051 00056 QByteArray rawHeader( int part, const QByteArray & headerName ) const { return mHeaders.value( part ).value( headerName ); } 00057 00059 QList< RawHeaderMap > headers() const { return mHeaders; } 00060 00064 QByteArray body( int part ) const { return mBodies.value( part ); } 00065 00067 QList<QByteArray> bodies() const { return mBodies; } 00068 00070 QString error() const { return mError; } 00071 00074 static bool isMultipart( QNetworkReply *reply ); 00075 00076 private: 00077 QNetworkReply *mReply; 00078 00079 bool mValid; 00080 00081 QString mError; 00082 00083 /* List of header maps */ 00084 QList< RawHeaderMap > mHeaders; 00085 00086 /* List of part bodies */ 00087 QList<QByteArray> mBodies; 00088 }; 00089 00090 #endif