Nuria Framework - Network
Network module of the NuriaProject Framework
 All Classes Functions Typedefs Enumerations Enumerator
httppostbodyreader.hpp
1 /* Copyright (c) 2014, The Nuria Project
2  * This software is provided 'as-is', without any express or implied
3  * warranty. In no event will the authors be held liable for any damages
4  * arising from the use of this software.
5  * Permission is granted to anyone to use this software for any purpose,
6  * including commercial applications, and to alter it and redistribute it
7  * freely, subject to the following restrictions:
8  * 1. The origin of this software must not be misrepresented; you must not
9  * claim that you wrote the original software. If you use this software
10  * in a product, an acknowledgment in the product documentation would be
11  * appreciated but is not required.
12  * 2. Altered source versions must be plainly marked as such, and must not be
13  * misrepresented as being the original software.
14  * 3. This notice may not be removed or altered from any source
15  * distribution.
16  */
17 
18 #ifndef NURIA_HTTPPOSTBODYREADER_HPP
19 #define NURIA_HTTPPOSTBODYREADER_HPP
20 
21 #include "network_global.hpp"
22 #include <QStringList>
23 #include <QObject>
24 
25 class QIODevice;
26 
27 namespace Nuria {
28 
41 class NURIA_NETWORK_EXPORT HttpPostBodyReader : public QObject {
42  Q_OBJECT
43 public:
44 
46  explicit HttpPostBodyReader (QObject *parent = 0);
47 
50 
56  virtual bool isComplete () const = 0;
57 
61  virtual bool hasFailed () const = 0;
62 
67  virtual bool hasField (const QString &field) const;
68 
70  virtual QStringList fieldNames () const = 0;
71 
77  virtual QString fieldMimeType (const QString &field) const = 0;
78 
83  virtual qint64 fieldLength (const QString &field) const = 0;
84 
86  virtual qint64 fieldBytesTransferred (const QString &field) const = 0;
87 
95  virtual bool isFieldComplete (const QString &field) const;
96 
108  virtual QByteArray fieldValue (const QString &field);
109 
126  virtual QIODevice *fieldStream (const QString &field) = 0;
127 
128 signals:
129 
134  void fieldFound (const QString &fieldName);
135 
140  void fieldCompleted (const QString &fieldName);
141 
147  void completed (bool success);
148 
149 };
150 
151 }
152 
153 #endif // NURIA_HTTPPOSTBODYREADER_HPP
Abstract class for readers of the body of HTTP POST requests.
Definition: httppostbodyreader.hpp:41