CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
cookie_container.h
1
2#pragma once
3
4#include <system/collections/dictionary.h>
5#include <system/collections/icomparer.h>
6#include <system/collections/keyvalue_pair.h>
7#include <system/collections/sorted_list.h>
8#include <system/object.h>
9
10#include <net/cookie.h>
11#include <net/cookie_collection.h>
12
13namespace System { namespace Net {
14
19class ASPOSECPP_SHARED_CLASS HeaderVariantInfo : public System::Object
20{
25
27 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
29 ASPOSECPP_SHARED_RTTI_INFO_DECL();
30
31public:
34 ASPOSECPP_SHARED_API String get_Name();
37 ASPOSECPP_SHARED_API CookieVariant get_Variant();
38
42 ASPOSECPP_SHARED_API HeaderVariantInfo(String name, CookieVariant variant);
44 ASPOSECPP_SHARED_API HeaderVariantInfo();
45
46private:
48 String _name;
50 CookieVariant _variant;
51};
52
57class ASPOSECPP_SHARED_CLASS PathList : public System::Object
58{
60 typedef PathList ThisType;
63
65 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
67 ASPOSECPP_SHARED_RTTI_INFO_DECL();
68
69private:
71 class PathListComparer final : public System::Collections::Generic::IComparer<System::String>
72 {
74 typedef PathListComparer ThisType;
77
79 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
81 RTTI_INFO_DECL();
82
83 public:
87
88 private:
90 int32_t Compare(args_type x, args_type y) const override;
91 };
92
93public:
96 ASPOSECPP_SHARED_API int32_t get_Count() const;
99 ASPOSECPP_SHARED_API System::SharedPtr<Object> get_SyncRoot() const;
100
103 ASPOSECPP_SHARED_API static System::SharedPtr<PathList> Create();
106 ASPOSECPP_SHARED_API int32_t GetCookiesCount();
107
115 ASPOSECPP_SHARED_API void idx_set(String s, System::SharedPtr<CookieCollection> value);
116
122
123private:
126
130 MEMBER_FUNCTION_MAKE_OBJECT(PathList, CODEPORTING_ARGS(System::SharedPtr<Collections::Generic::SortedList<String, System::SharedPtr<CookieCollection>>> list), CODEPORTING_ARGS(list));
131};
132
137class ASPOSECPP_SHARED_CLASS CookieContainer : public System::Object
138{
142 typedef System::Object BaseType;
143
145 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
147 ASPOSECPP_SHARED_RTTI_INFO_DECL();
148
149public:
151 ASPOSECPP_SHARED_API static const int32_t DefaultCookieLimit;
153 ASPOSECPP_SHARED_API static const int32_t DefaultPerDomainCookieLimit;
155 ASPOSECPP_SHARED_API static const int32_t DefaultCookieLengthLimit;
156
159 ASPOSECPP_SHARED_API int32_t get_Capacity();
162 ASPOSECPP_SHARED_API void set_Capacity(int32_t value);
165 ASPOSECPP_SHARED_API int32_t get_Count();
169 ASPOSECPP_SHARED_API int32_t get_MaxCookieSize();
173 ASPOSECPP_SHARED_API void set_MaxCookieSize(int32_t value);
176 ASPOSECPP_SHARED_API int32_t get_PerDomainCapacity();
179 ASPOSECPP_SHARED_API void set_PerDomainCapacity(int32_t value);
180
182 ASPOSECPP_SHARED_API CookieContainer();
185 ASPOSECPP_SHARED_API CookieContainer(int32_t capacity);
190 ASPOSECPP_SHARED_API CookieContainer(int32_t capacity, int32_t perDomainCapacity, int32_t maxCookieSize);
191
194 ASPOSECPP_SHARED_API void Add(System::SharedPtr<Cookie> cookie);
198 ASPOSECPP_SHARED_API void Add(System::SharedPtr<Cookie> cookie, bool throwOnError);
201 ASPOSECPP_SHARED_API void Add(System::SharedPtr<CookieCollection> cookies);
205 ASPOSECPP_SHARED_API bool IsLocalDomain(String host);
209 ASPOSECPP_SHARED_API void Add(System::SharedPtr<Uri> uri, System::SharedPtr<Cookie> cookie);
213 ASPOSECPP_SHARED_API void Add(System::SharedPtr<Uri> uri, System::SharedPtr<CookieCollection> cookies);
217 String setCookieHeader, bool isThrow);
235 ASPOSECPP_SHARED_API String GetCookieHeader(System::SharedPtr<Uri> uri, String& optCookie2);
239 ASPOSECPP_SHARED_API void SetCookies(System::SharedPtr<Uri> uri, String cookieHeader);
240
241private:
243 static System::ArrayPtr<HeaderVariantInfo> s_headerInfo;
247 int32_t _maxCookieSize;
249 int32_t _maxCookies;
251 int32_t _maxCookiesPerDomain;
253 int32_t _count;
255 String _fqdnMyDomain;
256
260 bool AgeCookies(String domain);
264 int32_t ExpireCollection(System::SharedPtr<CookieCollection> cc);
272 void BuildCookieCollectionFromDomainMatches(System::SharedPtr<Uri> uri, bool isSecure, int32_t port,
275 bool matchOnlyPlainCookie);
282 void MergeUpdateCollections(System::SharedPtr<CookieCollection> destination,
283 System::SharedPtr<CookieCollection> source, int32_t port, bool isSecure,
284 bool isPlainOnly);
285
287 static struct __StaticConstructor__
288 {
289 __StaticConstructor__();
290 } s_constructor__;
291};
292
293}} // namespace System::Net
Interface that compares two objects in greater-equal-less sense. Objects of this class should only be...
Definition: icomparer.h:20
Interface of enumerator which can be used to iterate through some elements. Objects of this class sho...
Definition: ienumerator.h:63
Pair of key and value. This type should be allocated on stack and passed to functions by value or by ...
Definition: keyvalue_pair.h:20
List forward declaration.
Definition: list.h:127
Sorted list wrapping FlatMap structure. Objects of this class should only be allocated using System::...
Definition: sorted_list.h:334
Used to match the cookie name and specification. Objects of this class should only be allocated using...
Definition: cookie_container.h:20
HeaderVariantInfo()
Constructs a new instance.
String get_Name()
Returns the cookie's name.
HeaderVariantInfo(String name, CookieVariant variant)
Constructs a new instance.
CookieVariant get_Variant()
Returns the cookie's specification.
Represents the list of the CookieCollection class instances. Objects of this class should only be all...
Definition: cookie_container.h:58
int32_t GetCookiesCount()
Returns the number of cookies of all collection items.
System::SharedPtr< CookieCollection > idx_get(String s)
Gets the cookie collection by specified path.
static System::SharedPtr< PathList > Create()
Creates a new instance.
System::SharedPtr< Collections::Generic::IEnumerator< Collections::Generic::KeyValuePair< String, System::SharedPtr< CookieCollection > > > > GetEnumerator()
Returns the enumerator for the current collection.
int32_t get_Count() const
Returns the number of items.
void idx_set(String s, System::SharedPtr< CookieCollection > value)
Sets the cookie collection by specified path.
System::SharedPtr< Object > get_SyncRoot() const
Returns the object through which the collection is being synchronized.
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
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
CookieVariant
Enumerates the cookie specifications.
Definition: cookie.h:16
Definition: db_command.h:9
std::enable_if_t<!std::is_floating_point< TA >::value &&!std::is_floating_point< TB >::value, int > Compare(const TA &a, const TB &b)
Compares two values.
Definition: primitive_types.h:113