CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
cache_control_header_value.h
1
2#pragma once
3
4#include <cstdint>
5#include <system/action.h>
6#include <system/collections/icollection.h>
7#include <system/collections/list.h>
8#include <system/icloneable.h>
9#include <system/nullable.h>
10#include <system/object.h>
11#include <system/shared_ptr.h>
12#include <system/string.h>
13#include <system/text/string_builder.h>
14#include <system/timespan.h>
15
16#include <net/http/headers/object_collection.h>
17
18namespace System { namespace Net { namespace Http { namespace Headers {
19
20class NameValueHeaderValue;
21
26class ASPOSECPP_SHARED_CLASS CacheControlHeaderValue : public System::ICloneable
27{
32
34 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
36 ASPOSECPP_SHARED_RTTI_INFO_DECL();
37
38public:
41 ASPOSECPP_SHARED_API bool get_NoCache();
44 ASPOSECPP_SHARED_API void set_NoCache(bool value);
50 ASPOSECPP_SHARED_API bool get_NoStore();
53 ASPOSECPP_SHARED_API void set_NoStore(bool value);
56 ASPOSECPP_SHARED_API Nullable<TimeSpan> get_MaxAge();
59 ASPOSECPP_SHARED_API void set_MaxAge(Nullable<TimeSpan> value);
64 ASPOSECPP_SHARED_API Nullable<TimeSpan> get_SharedMaxAge();
68 ASPOSECPP_SHARED_API void set_SharedMaxAge(Nullable<TimeSpan> value);
71 ASPOSECPP_SHARED_API bool get_MaxStale();
74 ASPOSECPP_SHARED_API void set_MaxStale(bool value);
78 ASPOSECPP_SHARED_API Nullable<TimeSpan> get_MaxStaleLimit();
81 ASPOSECPP_SHARED_API void set_MaxStaleLimit(Nullable<TimeSpan> value);
84 ASPOSECPP_SHARED_API Nullable<TimeSpan> get_MinFresh();
87 ASPOSECPP_SHARED_API void set_MinFresh(Nullable<TimeSpan> value);
90 ASPOSECPP_SHARED_API bool get_NoTransform();
93 ASPOSECPP_SHARED_API void set_NoTransform(bool value);
96 ASPOSECPP_SHARED_API bool get_OnlyIfCached();
99 ASPOSECPP_SHARED_API void set_OnlyIfCached(bool value);
102 ASPOSECPP_SHARED_API bool get_Public();
105 ASPOSECPP_SHARED_API void set_Public(bool value);
110 ASPOSECPP_SHARED_API bool get_Private();
114 ASPOSECPP_SHARED_API void set_Private(bool value);
121 ASPOSECPP_SHARED_API bool get_MustRevalidate();
124 ASPOSECPP_SHARED_API void set_MustRevalidate(bool value);
129 ASPOSECPP_SHARED_API bool get_ProxyRevalidate();
133 ASPOSECPP_SHARED_API void set_ProxyRevalidate(bool value);
138
140 ASPOSECPP_SHARED_API CacheControlHeaderValue();
141
143 ASPOSECPP_SHARED_API String ToString() const override;
145 ASPOSECPP_SHARED_API bool Equals(System::SharedPtr<Object> obj) override;
147 ASPOSECPP_SHARED_API int32_t GetHashCode() const override;
151 ASPOSECPP_SHARED_API static System::SharedPtr<CacheControlHeaderValue> Parse(String input);
156 ASPOSECPP_SHARED_API static bool TryParse(String input, System::SharedPtr<CacheControlHeaderValue>& parsedValue);
163 ASPOSECPP_SHARED_API static int32_t GetCacheControlLength(String input, int32_t startIndex,
166
167private:
169 static const String maxAgeString;
171 static const String maxStaleString;
173 static const String minFreshString;
175 static const String mustRevalidateString;
177 static const String noCacheString;
179 static const String noStoreString;
181 static const String noTransformString;
183 static const String onlyIfCachedString;
185 static const String privateString;
187 static const String proxyRevalidateString;
189 static const String publicString;
191 static const String sharedMaxAgeString;
193 static Action<String> s_checkIsValidToken;
195 bool _noCache;
199 bool _noStore;
201 Nullable<TimeSpan> _maxAge;
203 Nullable<TimeSpan> _sharedMaxAge;
205 bool _maxStale;
207 Nullable<TimeSpan> _maxStaleLimit;
209 Nullable<TimeSpan> _minFresh;
211 bool _noTransform;
213 bool _onlyIfCached;
215 bool _publicField;
218 bool _privateField;
222 bool _mustRevalidate;
225 bool _proxyRevalidate;
228
232 MEMBER_FUNCTION_MAKE_OBJECT(CacheControlHeaderValue, CODEPORTING_ARGS(System::SharedPtr<CacheControlHeaderValue> source), CODEPORTING_ARGS(source));
233
238 static bool TrySetCacheControlValues(
246 static bool TrySetTokenOnlyValue(System::SharedPtr<NameValueHeaderValue> nameValue, bool& boolField);
253 static bool TrySetOptionalTokenList(System::SharedPtr<NameValueHeaderValue> nameValue, bool& boolField,
259 static bool TrySetTimeSpan(System::SharedPtr<NameValueHeaderValue> nameValue, Nullable<TimeSpan>& timeSpan);
264 static void AppendValueIfRequired(System::SharedPtr<Text::StringBuilder> sb, bool appendValue, String value);
268 static void AppendValueWithSeparatorIfRequired(System::SharedPtr<Text::StringBuilder> sb, String value);
272 static void AppendValues(System::SharedPtr<Text::StringBuilder> sb,
279 static void CheckIsValidToken(String item);
281 System::SharedPtr<Object> Clone() override;
282};
283
284}}}} // namespace System::Net::Http::Headers
List forward declaration.
Definition: list.h:127
Defies a method that enables object cloning - creating a copy of an object. Objects of this class sho...
Definition: icloneable.h:16
Represents a value of the 'Cache-Control' header. Objects of this class should only be allocated usin...
Definition: cache_control_header_value.h:27
Nullable< TimeSpan > get_MaxAge()
Gets the maximum age value in seconds that determines a time during which the client will accept a re...
bool get_MustRevalidate()
Gets the value that determines if the server requires revalidation of a cache entry when the it becom...
bool get_Public()
Gets the value that determines if an HTTP response can be cached by any cache.
System::SharedPtr< Collections::Generic::ICollection< String > > get_PrivateHeaders()
Gets the collection of fieldnames in the 'private' directive in the 'Cache-Control' header.
void set_NoStore(bool value)
Sets the value that determines if a cache must not store any part of an HTTP request or response.
Nullable< TimeSpan > get_MinFresh()
Gets the value that determines the freshness lifetime.
bool get_NoStore()
Gets the value that determines if a cache must not store any part of an HTTP request or response.
System::SharedPtr< Collections::Generic::ICollection< System::SharedPtr< NameValueHeaderValue > > > get_Extensions()
Returns the collection of the cache-extension tokens.
void set_NoCache(bool value)
Sets the value that determines if the client will accept a cached response.
static System::SharedPtr< CacheControlHeaderValue > Parse(String input)
Converts a passed string to an instance of the CacheControlHeaderValue class.
Nullable< TimeSpan > get_SharedMaxAge()
Gets the shared maximum age value in seconds that overrides the 'max-age' directive in the 'Cache-Con...
void set_OnlyIfCached(bool value)
Sets the value that determines if the client must use only cached entries.
bool get_Private()
Gets the value that determines if the HTTP response message or its part is intended for a single user...
System::SharedPtr< Collections::Generic::ICollection< String > > get_NoCacheHeaders()
Gets the collection of fieldnames in the 'no-cache' directive in the 'Cache-Control' header.
void set_NoTransform(bool value)
Sets the value that determines if a cache or proxy must not change any part of the entity body.
String ToString() const override
Analog of C# Object.ToString() method. Enables converting custom objects to string.
void set_SharedMaxAge(Nullable< TimeSpan > value)
Sets the shared maximum age value in seconds that overrides the 'max-age' directive in the 'Cache-Con...
int32_t GetHashCode() const override
Analog of C# Object.GetHashCode() method. Enables hashing of custom objects.
bool get_NoTransform()
Gets the value that determines if a cache or proxy must not change any part of the entity body.
bool get_ProxyRevalidate()
Gets the value that determines if the server requires revalidation of a cache entry when it becomes s...
CacheControlHeaderValue()
Constructs a new instance.
void set_MustRevalidate(bool value)
Sets the value that determines if the server requires revalidation of a cache entry when the it becom...
void set_Private(bool value)
Sets the value that determines if the HTTP response message or its part is intended for a single user...
bool get_OnlyIfCached()
Gets the value that determines if the client must use only cached entries.
static bool TryParse(String input, System::SharedPtr< CacheControlHeaderValue > &parsedValue)
Tries to convert a passed string to an instance of the CacheControlHeaderValue class.
bool get_NoCache()
Gets the value that determines if the client will accept a cached response.
Nullable< TimeSpan > get_MaxStaleLimit()
Gets the value in seconds that determines the time during which the client will accept the expired re...
void set_MaxStale(bool value)
Sets the value that determines if the client will accept the expired responses.
void set_Public(bool value)
Sets the value that determines if an HTTP response can be cached by any cache.
bool get_MaxStale()
Gets the value that determines if the client will accept the expired responses.
void set_MaxAge(Nullable< TimeSpan > value)
Sets the maximum age value in seconds that determines a time during which the client will accept a re...
void set_ProxyRevalidate(bool value)
Sets the value that determines if the server requires revalidation of a cache entry when it becomes s...
void set_MinFresh(Nullable< TimeSpan > value)
Sets the value that determines the freshness lifetime.
bool Equals(System::SharedPtr< Object > obj) override
Compares objects using C# Object.Equals semantics.
void set_MaxStaleLimit(Nullable< TimeSpan > value)
Sets the value in seconds that determines the time during which the client will accept the expired re...
static int32_t GetCacheControlLength(String input, int32_t startIndex, System::SharedPtr< CacheControlHeaderValue > storeValue, System::SharedPtr< CacheControlHeaderValue > &parsedValue)
Converts a passed string from the specified index to an instance of the CacheControlHeaderValue class...
Represents the collection of the objects.
Definition: object_collection.h:23
Forward declaration.
Definition: nullable.h:74
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
Definition: db_command.h:9
MulticastDelegate< void(Args...)> Action
Delegate type that references methods that have no return value.
Definition: action.h:40