TreeFrogFramework  2.8
tinternetmessageheader.h
Go to the documentation of this file.
1 #pragma once
2 #include <QByteArray>
3 #include <QDateTime>
4 #include <QList>
5 #include <QPair>
6 #include <TGlobal>
7 
8 
10 public:
13  TInternetMessageHeader(const QByteArray &str);
15 
16  bool hasRawHeader(const QByteArray &key) const;
17  QByteArray rawHeader(const QByteArray &key) const;
18  QByteArrayList rawHeaderList() const;
19  void setRawHeader(const QByteArray &key, const QByteArray &value);
20  void addRawHeader(const QByteArray &key, const QByteArray &value);
21  void removeAllRawHeaders(const QByteArray &key);
22  void removeRawHeader(const QByteArray &key);
23  bool isEmpty() const;
24  void clear();
25 
26  QByteArray contentType() const;
27  void setContentType(const QByteArray &type);
28  int64_t contentLength() const;
29  void setContentLength(int64_t len);
30  QByteArray date() const;
31  void setDate(const QByteArray &date);
32  void setDate(const QDateTime &dateTime);
33  void setCurrentDate();
34  virtual QByteArray toByteArray() const;
35  TInternetMessageHeader &operator=(const TInternetMessageHeader &other);
36 
37 protected:
38  void parse(const QByteArray &header);
39 
40  using RawHeaderPair = QPair<QByteArray, QByteArray>;
41  using RawHeaderPairList = QList<RawHeaderPair>;
43  mutable int64_t _contentLength {-1};
44 };
45 
The TInternetMessageHeader class contains internet message headers.
Definition: tinternetmessageheader.h:9
QList< RawHeaderPair > RawHeaderPairList
Definition: tinternetmessageheader.h:41
RawHeaderPairList _headerPairList
Definition: tinternetmessageheader.h:42
QPair< QByteArray, QByteArray > RawHeaderPair
Definition: tinternetmessageheader.h:40
TInternetMessageHeader()
Constructs an empty Internet message header.
Definition: tinternetmessageheader.h:11
virtual ~TInternetMessageHeader()
Definition: tinternetmessageheader.h:14
#define T_CORE_EXPORT
Definition: tdeclexport.h:28