Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
TransferEncoding.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_IO_Network_HTTP_TransferEncoding_h_
5#define _Stroika_Foundation_IO_Network_HTTP_TransferEncoding_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
10#include "Stroika/Foundation/Containers/Sequence.h"
12
13/**
14 */
15
17
18 using Characters::String;
19 using Containers::Sequence;
20
21 /**
22 * \brief Transfer-Encoding is a hop-by-hop header, that is applied to a message between two nodes, not to a resource itself. Each segment of a multi-node connection can use different Transfer-Encoding values. If you want to compress data over the whole connection, use the end-to-end Content-Encoding header instead
23 *
24 * TransferEncoding is typically identity (in which case omitted) or chucked (@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding)
25 *
26 * This is (probably mostly) obsoleted in HTTP 2.0(@todo read up); and we don't currently intend to support compress etc here
27 * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
28 */
30 public:
31 /**
32 */
34
35 public:
36 /**
37 */
39 template <Characters::IConvertibleToString STRING_LIKE>
40 TransferEncoding (STRING_LIKE&& name);
41
42 public:
43 nonvirtual bool operator== (const TransferEncoding& rhs) const = default;
44
45 public:
46 /**
47 * \note - though three way comparable, ordering is NOT alphabetical
48 */
49 nonvirtual auto operator<=> (const TransferEncoding& rhs) const = default;
50
51 public:
52 /**
53 * @see Characters::ToString ();
54 */
55 nonvirtual String ToString () const;
56
57 public:
58 /**
59 * identity The default (identity) encoding; the use of no transformation whatsoever. This content-coding is used only in the Accept- Encoding header, and SHOULD NOT be used in the Content-Encoding header.
60 */
62
63 /**
64 * compress The encoding format produced by the common UNIX file compression program "compress". This format is an adaptive Lempel-Ziv-Welch coding (LZW).
65 */
67
68 /**
69 * deflate The "zlib" format defined in RFC 1950 [31] in combination with the "deflate" compression mechanism described in RFC 1951 [29].
70 */
72
73 /**
74 * gzip An encoding format produced by the file compression program "gzip" (GNU zip) as described in RFC 1952 [25]. This format is a Lempel-Ziv coding (LZ77) with a 32 bit CRC
75 */
76 static const TransferEncoding kGZip;
77
78 /**
79 * identity The default (identity) encoding; the use of no transformation whatsoever. This content-coding is used only in the Accept- Encoding header, and SHOULD NOT be used in the Content-Encoding header.
80 */
82
83 private:
84 AtomType fRep_;
85 };
86
87 /**
88 */
89 class TransferEncodings : public Sequence<TransferEncoding> {
90 public:
91 TransferEncodings (const Traversal::Iterable<TransferEncoding>& src);
92 TransferEncodings (TransferEncoding tc);
93
94 public:
95 nonvirtual TransferEncodings& operator= (const TransferEncodings& rhs) = default;
96
97 public:
98 /**
99 */
100 template <typename T>
101 nonvirtual String As () const;
102
103 public:
104 /**
105 */
106 static TransferEncodings Parse (const String& headerValue);
107 };
108 template <>
109 String TransferEncodings::As<String> () const;
110
111}
112
113/*
114 ********************************************************************************
115 ***************************** Implementation Details ***************************
116 ********************************************************************************
117 */
118#include "TransferEncoding.inl"
119
120#endif /*_Stroika_Foundation_IO_Network_HTTP_TransferEncoding_h_*/
String is like std::u32string, except it is much easier to use, often much more space efficient,...
Definition String.h:201
A generalization of a vector: a container whose elements are keyed by the natural numbers.
Definition Sequence.h:187
Iterable<T> is a base class for containers which easily produce an Iterator<T> to traverse them.
Definition Iterable.h:237
Transfer-Encoding is a hop-by-hop header, that is applied to a message between two nodes,...
nonvirtual auto operator<=>(const TransferEncoding &rhs) const =default