Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
ETag.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_IO_Network_HTTP_ETag_h_
5#define _Stroika_Foundation_IO_Network_HTTP_ETag_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
10
11/**
12 */
13
15
16 using Characters::String;
17
18 /**
19 * ETag is formatted with surrounding quotes (@see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag)
20 */
21 struct ETag {
22
23 ETag (const String& value, bool weak = false);
24
25 /**
26 * If ill-format or missing, return nullopt, no exception.
27 */
28 static optional<ETag> Parse (const String& wireFormat);
29
30 String fValue;
31 bool fWeak{false};
32
33 /**
34 * This As<> encodes the ETag as specified in HTTP SPEC (URL)
35 *
36 * T can be among these:
37 * o String
38 */
39 template <typename T>
40 T As () const;
41
42 /**
43 * @see Characters::ToString ();
44 */
45 nonvirtual String ToString () const;
46
47 /**
48 */
49 nonvirtual strong_ordering operator<=> (const ETag& rhs) const = default;
50 };
51
52}
53
54/*
55 ********************************************************************************
56 ***************************** Implementation Details ***************************
57 ********************************************************************************
58 */
59#include "ETag.inl"
60
61#endif /*_Stroika_Foundation_IO_Network_HTTP_ETag_h_*/
String is like std::u32string, except it is much easier to use, often much more space efficient,...
Definition String.h:201
nonvirtual String ToString() const
Definition ETag.inl:35
static optional< ETag > Parse(const String &wireFormat)
Definition ETag.inl:17