CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
text_info.h
1
2#pragma once
3
4#include <system/string.h>
5#include <system/icloneable.h>
6#include <system/globalization/details/culture_data_ptr.h>
7#include <system/details/lazy.h>
8#include <system/details/spin_lock.h>
9#include <system/details/synchronized_value.h>
10
11namespace System { namespace Globalization {
12
13class TextInfo;
16
22class ASPOSECPP_SHARED_CLASS TextInfo : public ICloneable
23{
25 RTTI_INFO(System::Globalization::TextInfo, ::System::BaseTypesInfo<System::Object>)
26
27public:
28 TextInfo(const TextInfo&) = delete;
29 TextInfo& operator=(const TextInfo&) = delete;
30
33 virtual ASPOSECPP_SHARED_API String get_ListSeparator() const;
36 virtual ASPOSECPP_SHARED_API void set_ListSeparator(String value);
39 virtual ASPOSECPP_SHARED_API int get_ANSICodePage() const;
42 virtual ASPOSECPP_SHARED_API int get_EBCDICCodePage() const;
45 virtual ASPOSECPP_SHARED_API int get_MacCodePage() const;
48 virtual ASPOSECPP_SHARED_API int get_OEMCodePage() const;
51 ASPOSECPP_SHARED_API int get_LCID() const;
54 ASPOSECPP_SHARED_API String get_CultureName() const;
57 ASPOSECPP_SHARED_API bool get_IsReadOnly() const;
60 ASPOSECPP_SHARED_API bool get_IsRightToLeft() const;
61
65 virtual ASPOSECPP_SHARED_API char_t ToLower(char_t c) const;
69 virtual ASPOSECPP_SHARED_API String ToLower(String str) const;
73 virtual ASPOSECPP_SHARED_API char_t ToUpper(char_t c) const;
77 virtual ASPOSECPP_SHARED_API String ToUpper(String str) const;
81 ASPOSECPP_SHARED_API String ToTitleCase(String str) const;
82
83 // Object interface
84 ASPOSECPP_SHARED_API bool Equals(SharedPtr<Object> obj) override;
85 ASPOSECPP_SHARED_API int GetHashCode() const override;
86 ASPOSECPP_SHARED_API String ToString() const override;
87
88 // ICloneable interface
89 ASPOSECPP_SHARED_API SharedPtr<Object> Clone() override;
90
94 static ASPOSECPP_SHARED_API TextInfoPtr ReadOnly(const TextInfoPtr& text_info);
95
96private:
97 template <typename T>
98 using Lazy = System::Details::ThreadSafeLazy<T>;
99
100 template <typename T>
101 using SynchronizedValue = System::Details::SynchronizedValue<T, System::Details::SpinLock>;
102
104 const Details::CultureDataPtr m_culture_data;
106 const bool m_is_read_only;
108 mutable Lazy<SynchronizedValue<String>> m_list_separator;
109
112 void VerifyWritable();
113
114private:
115 friend class CultureInfo;
116
120 TextInfo(const Details::CultureDataPtr& culture_data, bool is_read_only = false);
121 MEMBER_FUNCTION_MAKE_OBJECT(TextInfo, CODEPORTING_ARGS(const Details::CultureDataPtr& culture_data, bool is_read_only = false), CODEPORTING_ARGS(culture_data, is_read_only));
122};
123
124}} // namespace System::Globalization
Collection of culture-specific values and algorithms. Setter operations are only enabled on non-read-...
Definition: culture_info.h:32
Defines locale-specific text properties. Setter operations are only enabled on non-read-only objects....
Definition: text_info.h:23
virtual int get_OEMCodePage() const
Gets OEM codepage.
virtual int get_EBCDICCodePage() const
Gets EBCDIC codepage.
virtual String ToUpper(String str) const
Converts string to upper case.
virtual int get_ANSICodePage() const
Gets ANSI codepage.
virtual char_t ToUpper(char_t c) const
Converts character to upper case.
virtual String get_ListSeparator() const
Gets list separator.
int get_LCID() const
Gets locale ID.
bool get_IsRightToLeft() const
Checks if text is written left to right.
TextInfo(const TextInfo &)=delete
RTTI information.
static TextInfoPtr ReadOnly(const TextInfoPtr &text_info)
Gets a read only version of culture.
bool Equals(SharedPtr< Object > obj) override
virtual char_t ToLower(char_t c) const
Converts character to lower case.
SharedPtr< Object > Clone() override
Creates a copy of the current object and returns a shared pointer to it.
virtual String ToLower(String str) const
Converts string to lower case.
String ToString() const override
Analog of C# Object.ToString() method. Enables converting custom objects to string.
virtual void set_ListSeparator(String value)
Sets list separator.
bool get_IsReadOnly() const
Checks if format is read-only.
virtual int get_MacCodePage() const
Gets Macintosh codepage.
String get_CultureName() const
Gets cluture name.
TextInfo & operator=(const TextInfo &)=delete
String ToTitleCase(String str) const
Converts string to title case (except for acronyms that are in upper case already).
int GetHashCode() const override
Analog of C# Object.GetHashCode() method. Enables hashing of custom objects.
Defies a method that enables object cloning - creating a copy of an object. Objects of this class sho...
Definition: icloneable.h:16
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
std::shared_ptr< CultureData > CultureDataPtr
Pointer to hold implementation type.
Definition: culture_data_ptr.h:12
SharedPtr< TextInfo > TextInfoPtr
TextInfo pointer type.
Definition: text_info.h:15
Definition: db_command.h:9