CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
name_value_header_value.h
1
2#pragma once
3
4#include <cstdint>
5#include <system/icloneable.h>
6#include <system/object.h>
7#include <system/shared_ptr.h>
8#include <system/string.h>
9#include <system/text/string_builder.h>
10
11#include <net/http/headers/http_headers.h>
12#include <net/http/headers/object_collection.h>
13
14namespace System {
15class ObjectExt;
16}
17
18namespace System { namespace Net { namespace Http { namespace Headers {
19
24class ASPOSECPP_SHARED_CLASS NameValueHeaderValue : public virtual System::ICloneable
25{
30
32 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
34 ASPOSECPP_SHARED_RTTI_INFO_DECL();
35
36 friend class System::ObjectExt;
37
38public:
41 ASPOSECPP_SHARED_API String get_Name();
44 ASPOSECPP_SHARED_API String get_Value();
47 ASPOSECPP_SHARED_API void set_Value(String value);
48
50 ASPOSECPP_SHARED_API NameValueHeaderValue();
53 ASPOSECPP_SHARED_API NameValueHeaderValue(String name);
57 ASPOSECPP_SHARED_API NameValueHeaderValue(String name, String value);
58
60 ASPOSECPP_SHARED_API int32_t GetHashCode() const override;
62 ASPOSECPP_SHARED_API bool Equals(System::SharedPtr<Object> obj) override;
66 ASPOSECPP_SHARED_API static System::SharedPtr<NameValueHeaderValue> Parse(String input);
71 ASPOSECPP_SHARED_API static bool TryParse(String input, System::SharedPtr<NameValueHeaderValue>& parsedValue);
73 ASPOSECPP_SHARED_API String ToString() const override;
81 char16_t separator, bool leadingSeparator, System::SharedPtr<Text::StringBuilder> destination);
89 char16_t separator, bool leadingSeparator);
99 ASPOSECPP_SHARED_API static int32_t GetNameValueLength(String input, int32_t startIndex,
107 ASPOSECPP_SHARED_API static int32_t GetNameValueLength(String input, int32_t startIndex,
117 ASPOSECPP_SHARED_API static int32_t GetNameValueListLength(
118 String input, int32_t startIndex, char16_t delimiter,
124 ASPOSECPP_SHARED_API static System::SharedPtr<NameValueHeaderValue>
130 ASPOSECPP_SHARED_API static int32_t GetValueLength(String input, int32_t startIndex);
131
132protected:
136 MEMBER_FUNCTION_MAKE_OBJECT(NameValueHeaderValue, CODEPORTING_ARGS(System::SharedPtr<NameValueHeaderValue> source), CODEPORTING_ARGS(source));
137
138private:
140 static HeaderFunc<System::SharedPtr<NameValueHeaderValue>> s_defaultNameValueCreator;
142 String _name;
144 String _value;
145
147 static void CheckNameValueFormat(String name, String value);
149 static void CheckValueFormat(String value);
151 static System::SharedPtr<NameValueHeaderValue> CreateNameValue();
153 System::SharedPtr<Object> Clone() override;
154};
155
156}}}} // namespace System::Net::Http::Headers
Defies a method that enables object cloning - creating a copy of an object. Objects of this class sho...
Definition: icloneable.h:16
Represents a key/value pair to use in headers. Objects of this class should only be allocated using S...
Definition: name_value_header_value.h:25
static int32_t GetNameValueListLength(String input, int32_t startIndex, char16_t delimiter, System::SharedPtr< ObjectCollection< System::SharedPtr< NameValueHeaderValue > > > nameValueCollection)
Converts a passed string from the specified index to the collection of the NameValueHeaderValue-class...
NameValueHeaderValue(String name)
Constructs a new instance.
static int32_t GetValueLength(String input, int32_t startIndex)
Returns the length of a value from the specified index.
NameValueHeaderValue(System::SharedPtr< NameValueHeaderValue > source)
The copy constructor.
NameValueHeaderValue()
Constructs a new instance.
static void ToString(System::SharedPtr< ObjectCollection< System::SharedPtr< NameValueHeaderValue > > > values, char16_t separator, bool leadingSeparator, System::SharedPtr< Text::StringBuilder > destination)
Returns a string representation of the collection of the NameValueHeaderValue-class instances.
String get_Name()
Returns a name of the current instance.
int32_t GetHashCode() const override
Analog of C# Object.GetHashCode() method. Enables hashing of custom objects.
static bool TryParse(String input, System::SharedPtr< NameValueHeaderValue > &parsedValue)
Tries to convert a passed string to an instance of the NameValueHeaderValue class.
void set_Value(String value)
Sets a value of the current instance.
bool Equals(System::SharedPtr< Object > obj) override
Compares objects using C# Object.Equals semantics.
static String ToString(System::SharedPtr< ObjectCollection< System::SharedPtr< NameValueHeaderValue > > > values, char16_t separator, bool leadingSeparator)
Returns a string representation of the collection of the NameValueHeaderValue-class instances.
static System::SharedPtr< NameValueHeaderValue > Parse(String input)
Converts a passed string to an instance of the NameValueHeaderValue class.
NameValueHeaderValue(String name, String value)
Constructs a new instance.
String ToString() const override
Analog of C# Object.ToString() method. Enables converting custom objects to string.
static int32_t GetHashCode(System::SharedPtr< ObjectCollection< System::SharedPtr< NameValueHeaderValue > > > values)
Returns a hash code of all the collection items.
static System::SharedPtr< NameValueHeaderValue > Find(System::SharedPtr< ObjectCollection< System::SharedPtr< NameValueHeaderValue > > > values, String name)
Finds the NameValueHeaderValue-class instance in a collection by the specified name.
static int32_t GetNameValueLength(String input, int32_t startIndex, System::SharedPtr< NameValueHeaderValue > &parsedValue)
Converts a passed string from the specified index to an instance of the NameValueHeaderValue class.
static int32_t GetNameValueLength(String input, int32_t startIndex, HeaderFunc< System::SharedPtr< NameValueHeaderValue > > nameValueCreator, System::SharedPtr< NameValueHeaderValue > &parsedValue)
Converts a passed string from the specified index to an instance of the NameValueHeaderValue class.
String get_Value()
Gets a value of the current instance.
Represents the collection of the objects.
Definition: object_collection.h:23
Provides static methods that emulate C# Object methods called for non-Object C++ types (strings,...
Definition: object_ext.h:21
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
System::MulticastDelegate< TResult()> HeaderFunc
Definition: http_headers.h:24
Definition: db_command.h:9