CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
icu_encoding.h
1
2#pragma once
3
4#include <system/text/encoding.h>
5#include <memory>
6#include <mutex>
7
8struct UConverter; // ICU converter
9
10namespace System { namespace Text {
11
16class ASPOSECPP_SHARED_CLASS ICUEncoding : public Encoding
17{
19 RTTI_INFO(System::Text::ICUEncoding, ::System::BaseTypesInfo<System::Text::Encoding>)
20
21public:
26
28 friend class ICUEncoder;
30 friend class ICUDecoder;
31
34 ICUEncoding(const Details::EncodingInfoInternal* encoding_info);
35
39 ASPOSECPP_SHARED_API bool operator==(const ICUEncoding& other) const;
40
45 ASPOSECPP_SHARED_API int GetByteCount(const char_t* chars, int count) override;
46
53 ASPOSECPP_SHARED_API int GetBytes(const char_t* chars, int char_count, uint8_t* bytes, int byte_count) override;
54
59 ASPOSECPP_SHARED_API int GetCharCount(const uint8_t* bytes, int count) override;
60
67 ASPOSECPP_SHARED_API int GetChars(const uint8_t *bytes, int byte_count, char_t *chars, int char_count) override;
68
71 ASPOSECPP_SHARED_API DecoderPtr GetDecoder() override;
72
75 ASPOSECPP_SHARED_API EncoderPtr GetEncoder() override;
76
80 ASPOSECPP_SHARED_API int GetMaxByteCount(int char_count) override;
81
85 ASPOSECPP_SHARED_API int GetMaxCharCount(int byte_count) override;
86
89 ASPOSECPP_SHARED_API ArrayPtr<uint8_t> GetPreamble() override;
90
91protected:
93 ASPOSECPP_SHARED_API ~ICUEncoding() override;
94
95private:
97 void SetICUCallbacks();
98
100 std::shared_ptr<UConverter> m_icu_converter;
101
103 std::mutex m_mutex;
104};
105
106}} // namespace System::Text
Encoding services.
Definition: encoding.h:67
virtual int GetByteCount(ArrayPtr< char_t > chars, int index, int count)
Get the number of characters needed to encode a character buffer.
virtual int GetBytes(ArrayPtr< char_t > chars, int char_index, int char_count, ArrayPtr< uint8_t > bytes, int byte_index)
Get the bytes that result from encoding a character buffer.
virtual int GetCharCount(ArrayPtr< uint8_t > bytes, int index, int count)
Get the number of characters needed to decode a byte buffer.
virtual int GetChars(ArrayPtr< uint8_t > bytes, int byte_index, int byte_count, ArrayPtr< char_t > chars, int char_index)
Get the characters that result from decoding a byte buffer.
Decoder that uses ICU for decoding. Objects of this class should only be allocated using System::Make...
Definition: icu_decoder.h:27
Encoder that uses ICU for encoding. Objects of this class should only be allocated using System::Make...
Definition: icu_encoder.h:20
ICU-based encoding implementation. FOR INTERNAL USE. Objects of this class should only be allocated u...
Definition: icu_encoding.h:17
EncoderPtr GetEncoder() override
Get an encoder that forwards requests to this object.
~ICUEncoding() override
Destructor.
int GetCharCount(const uint8_t *bytes, int count) override
Get the number of characters needed to decode a byte buffer.
DecoderPtr GetDecoder() override
Get a decoder that forwards requests to this object.
ArrayPtr< uint8_t > GetPreamble() override
Returns a sequence of bytes that denotes the encoding (e. g. BOM).
int GetChars(const uint8_t *bytes, int byte_count, char_t *chars, int char_count) override
Get the characters that result from decoding a byte buffer.
int GetBytes(const char_t *chars, int char_count, uint8_t *bytes, int byte_count) override
Get the bytes that result from encoding a character buffer.
bool operator==(const ICUEncoding &other) const
Compares encodings using codepages.
int GetMaxCharCount(int byte_count) override
Get the maximum number of characters needed to decode a specified number of bytes.
ICUEncoding(const Details::EncodingInfoInternal *encoding_info)
Constructor.
int GetMaxByteCount(int char_count) override
Get the maximum number of bytes needed to encode a specified number of characters.
int GetByteCount(const char_t *chars, int count) override
Get the number of characters needed to encode a character buffer.
@ Text
Defines color adjustment information for text.
Definition: db_command.h:9