You.i Engine
YiHTTPHeader.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_HTTP_HEADER_H_
3 #define _YI_HTTP_HEADER_H_
4 
5 #include <utility/YiString.h>
6 
18 {
19 public:
27  static const CYIString FIELD_PRAGMA;
28 
33  {
34  int32_t maxAge{-1}; // Value is -1 if not found or invalid
35  int32_t maxStale{-1}; // Value is -1 if not found or invalid
36  int32_t minFresh{-1}; // Value is -1 if not found or invalid
37  bool hasPublic{false};
38  bool hasPrivate{false};
39  bool hasNoStore{false};
40  bool hasNoCache{false};
41  bool hasMustRevalidate{false};
42  };
43 
44  CYIHTTPHeader(const CYIString &name, const CYIString &value);
45 
49  const CYIString &GetName() const;
53  const CYIString &GetValue() const;
54 
55 private:
56  CYIString m_name;
57  CYIString m_value;
58 };
59 
60 inline bool operator==(const CYIHTTPHeader &lhs, const CYIHTTPHeader &rhs)
61 {
62  return lhs.GetValue() == rhs.GetValue() &&
63  lhs.GetName() == rhs.GetName();
64 }
65 inline bool operator!=(const CYIHTTPHeader &lhs, const CYIHTTPHeader &rhs)
66 {
67  return !operator==(lhs, rhs);
68 }
69 
71 {
72  return std::tie(lhs.maxAge, lhs.maxStale, lhs.minFresh, lhs.hasPublic, lhs.hasPrivate, lhs.hasNoStore, lhs.hasNoCache, lhs.hasMustRevalidate) ==
73  std::tie(rhs.maxAge, rhs.maxStale, rhs.minFresh, rhs.hasPublic, rhs.hasPrivate, rhs.hasNoStore, rhs.hasNoCache, rhs.hasMustRevalidate);
74 }
76 {
77  return !operator==(lhs, rhs);
78 }
79 
84 #endif
bool hasPrivate
Definition: YiHTTPHeader.h:38
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:36
bool operator==(const CYIHTTPHeader &lhs, const CYIHTTPHeader &rhs)
Definition: YiHTTPHeader.h:60
int32_t maxAge
Definition: YiHTTPHeader.h:34
A class respresenting an HTTP Header Field with a field-name and field-value as specified in https://...
Definition: YiHTTPHeader.h:17
const CYIString & GetName() const
int32_t maxStale
Definition: YiHTTPHeader.h:35
Definition: YiHTTPHeader.h:32
const CYIString & GetValue() const
bool hasPublic
Definition: YiHTTPHeader.h:37
bool hasNoCache
Definition: YiHTTPHeader.h:40
static const CYIString FIELD_PRAGMA
Definition: YiHTTPHeader.h:27
int32_t minFresh
Definition: YiHTTPHeader.h:36
bool operator!=(const CYIHTTPHeader &lhs, const CYIHTTPHeader &rhs)
Definition: YiHTTPHeader.h:65
bool hasMustRevalidate
Definition: YiHTTPHeader.h:41
static const CYIString FIELD_CACHE_CONTROL
Definition: YiHTTPHeader.h:23
CYIHTTPHeader(const CYIString &name, const CYIString &value)
bool hasNoStore
Definition: YiHTTPHeader.h:39