4#include "Stroika/Foundation/StroikaPreComp.h"
7#include "Stroika/Foundation/Characters/String2Int.h"
12#include "CacheControl.h"
19using namespace Stroika::Foundation::Traversal;
29 auto parseInt = [] (
const String& i) -> optional<uint32_t> {
31 auto v = String2Int<int32_t> (i);
32 return v < 0 ? optional<uint32_t>{} :
static_cast<uint32_t
> (v);
36 Assert (not v.empty ());
38 Assert (not vv.
empty ());
56 r.
fAge = parseInt (vv[1]);
67 m.fAmount = parseInt (vv[1]);
83 auto handleComma = [&] () {
84 if (not sb.
empty ()) {
89 sb << DefaultNames<Cacheability>{}.GetName (*fCacheability);
93 sb <<
"must-revalidate"sv;
101 sb <<
"no-transform"sv;
105 sb <<
"only-if-cached"sv;
109 sb <<
"age={}"_f(*
fAge);
113 sb <<
"max-age={}"_f(*
fMaxAge);
122 if (fMaxStale->fAmount) {
123 sb <<
"={}"_f(*fMaxStale->fAmount);
Similar to String, but intended to more efficiently construct a String. Mutable type (String is large...
nonvirtual bool empty() const noexcept
String is like std::u32string, except it is much easier to use, often much more space efficient,...
nonvirtual Containers::Sequence< String > Tokenize() const
A generalization of a vector: a container whose elements are keyed by the natural numbers.
static constexpr DiscreteRange FullRange()
nonvirtual size_t length() const
STL-ish alias for size() - really in STL only used in string, I think, but still makes sense as an al...
nonvirtual bool empty() const
Returns true iff size() == 0.
bool fImmutable
Very useful if/when true.
optional< int > fSharedMaxAge
bool fMustRevalidate
Probably not useful in most cases. Just affects behavior of cached values when expired and disconnect...
optional< uint32_t > fAge
optional< uint32_t > fMaxAge
static CacheControl Parse(const Characters::String &headerValue)
optional< int > fMinFresh