CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
http_utility.h
1
2#pragma once
3
4#include "fwd.h"
5#include <system/array.h>
6#include <system/text/encoding.h>
7#include <system/exceptions.h>
8#include <system/collections/list.h>
9#include <system/io/text_writer.h>
10
11namespace System { namespace Web {
12
14class ASPOSECPP_SHARED_CLASS HttpUtility : public Object
15{
16public:
20 static ASPOSECPP_SHARED_API String UrlDecode(String str);
25 static ASPOSECPP_SHARED_API String UrlDecode(String str, System::SharedPtr<Text::Encoding> e);
30 static ASPOSECPP_SHARED_API String UrlDecode(const System::ArrayPtr<uint8_t>& bytes, const System::SharedPtr<Text::Encoding>& e);
37 static ASPOSECPP_SHARED_API String UrlDecode(const System::ArrayPtr<uint8_t>& bytes, int32_t offset, int32_t count, const System::SharedPtr<Text::Encoding>& e);
41 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> UrlDecodeToBytes(const System::ArrayPtr<uint8_t>& bytes);
45 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> UrlDecodeToBytes(const String& str);
56 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> UrlDecodeToBytes(const System::ArrayPtr<uint8_t>& bytes, int32_t offset, int32_t count);
60 static ASPOSECPP_SHARED_API String HtmlDecode(const String& str);
64 static ASPOSECPP_SHARED_API void HtmlDecode(const String& str, const SharedPtr<IO::TextWriter>& output);
68 static ASPOSECPP_SHARED_API String HtmlEncode(const String& str);
72 static ASPOSECPP_SHARED_API String HtmlEncode(const SharedPtr<Object>& value);
76 static ASPOSECPP_SHARED_API void HtmlEncode(const String& str, const SharedPtr<IO::TextWriter>& output);
80 static ASPOSECPP_SHARED_API String UrlEncode(String str);
85 static ASPOSECPP_SHARED_API String UrlEncode(String str, const System::SharedPtr<Text::Encoding>& e);
89 static ASPOSECPP_SHARED_API String UrlEncode(const System::ArrayPtr<uint8_t>& bytes);
95 static ASPOSECPP_SHARED_API String UrlEncode(const System::ArrayPtr<uint8_t>& bytes, int32_t offset, int32_t count);
99 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> UrlEncodeToBytes(const String& str);
114 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> UrlEncodeToBytes(const System::ArrayPtr<uint8_t>& bytes, int32_t offset, int32_t count);
118 static ASPOSECPP_SHARED_API String UrlEncodeUnicode(const String& str);
122 static ASPOSECPP_SHARED_API System::ArrayPtr<uint8_t> UrlEncodeUnicodeToBytes(const String& str);
123
124private:
126 static void WriteCharBytes(const System::SharedPtr<System::Collections::Generic::List<uint8_t>>& buf, char16_t ch, const System::SharedPtr<Text::Encoding>& e);
127 static int32_t GetInt(uint8_t b);
128 static int32_t GetChar(const System::ArrayPtr<uint8_t>& bytes, int32_t offset, int32_t length);
129 static int32_t GetChar(const String& str, int32_t offset, int32_t length);
130};
131
132}} // System::Web
List forward declaration.
Definition: list.h:127
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
Service class that encodes and decodes URL parts to and from hex escape fragments.
Definition: http_utility.h:15
static String HtmlEncode(const SharedPtr< Object > &value)
Encodes Html fragment.
static System::ArrayPtr< uint8_t > UrlDecodeToBytes(const System::ArrayPtr< uint8_t > &bytes)
Decodes URI fragment from bytes array.
static String UrlDecode(const System::ArrayPtr< uint8_t > &bytes, const System::SharedPtr< Text::Encoding > &e)
Decodes URI fragment from bytes array.
static String UrlDecode(const System::ArrayPtr< uint8_t > &bytes, int32_t offset, int32_t count, const System::SharedPtr< Text::Encoding > &e)
Decodes URI fragment from bytes array.
static System::ArrayPtr< uint8_t > UrlEncodeUnicodeToBytes(const String &str)
Encodes URI fragment usign Unicode.
static String UrlEncodeUnicode(const String &str)
Encodes URI fragment usign Unicode.
static String UrlEncode(const System::ArrayPtr< uint8_t > &bytes)
Encodes URI fragment.
static String UrlDecode(String str)
Decodes URI fragment from string.
static String UrlEncode(String str, const System::SharedPtr< Text::Encoding > &e)
Encodes URI fragment.
static System::ArrayPtr< uint8_t > UrlDecodeToBytes(const System::ArrayPtr< uint8_t > &bytes, int32_t offset, int32_t count)
Decodes URI fragment from bytes array.
static System::ArrayPtr< uint8_t > UrlDecodeToBytes(const String &str)
Decodes URI fragment from bytes string.
static System::ArrayPtr< uint8_t > UrlDecodeToBytes(const String &str, const System::SharedPtr< Text::Encoding > &e)
Decodes URI fragment from string.
static String UrlEncode(String str)
Encodes URI fragment.
static System::ArrayPtr< uint8_t > UrlEncodeToBytes(const String &str)
Encodes URI fragment.
static void HtmlDecode(const String &str, const SharedPtr< IO::TextWriter > &output)
Decodes Html fragment.
static String UrlEncode(const System::ArrayPtr< uint8_t > &bytes, int32_t offset, int32_t count)
Encodes URI fragment.
static String UrlDecode(String str, System::SharedPtr< Text::Encoding > e)
Decodes URI fragment from string.
static System::ArrayPtr< uint8_t > UrlEncodeToBytes(const String &str, const System::SharedPtr< Text::Encoding > &e)
Encodes URI fragment.
static System::ArrayPtr< uint8_t > UrlEncodeToBytes(const System::ArrayPtr< uint8_t > &bytes, int32_t offset, int32_t count)
Encodes URI fragment.
static String HtmlEncode(const String &str)
Encodes Html fragment.
static System::ArrayPtr< uint8_t > UrlEncodeToBytes(const System::ArrayPtr< uint8_t > &bytes)
Encodes URI fragment.
static String HtmlDecode(const String &str)
Decodes Html fragment.
static void HtmlEncode(const String &str, const SharedPtr< IO::TextWriter > &output)
Encodes Html fragment.
Definition: db_command.h:9