CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
compare_info.h
1
2#pragma once
3
4#include <system/globalization/compare_options.h>
5#include <system/globalization/sort_key.h>
6#include <system/globalization/sort_version.h>
7#include <system/globalization/details/culture_data_ptr.h>
8#include <system/reflection/assembly.h>
9#include <system/details/lazy.h>
10
11namespace System { namespace Globalization {
12
13class CompareInfo;
16
21class ASPOSECPP_SHARED_CLASS CompareInfo
22 : public virtual Object
23 //, public IDeserializationCallback
24{
26 RTTI_INFO(System::Globalization::CompareInfo, ::System::BaseTypesInfo<System::Object>)
27
28public:
29 CompareInfo(const CompareInfo&) = delete;
31
33 virtual ASPOSECPP_SHARED_API String get_Name() const;
35 ASPOSECPP_SHARED_API int get_LCID() const;
37 ASPOSECPP_SHARED_API SortVersionPtr get_Version() const;
38
43 static ASPOSECPP_SHARED_API CompareInfoPtr GetCompareInfo(int culture, const SharedPtr<Reflection::Assembly>& assembly);
48 static ASPOSECPP_SHARED_API CompareInfoPtr GetCompareInfo(const String& name, const SharedPtr<Reflection::Assembly>& assembly);
52 static ASPOSECPP_SHARED_API CompareInfoPtr GetCompareInfo(int culture);
56 static ASPOSECPP_SHARED_API CompareInfoPtr GetCompareInfo(const String& name);
60 static ASPOSECPP_SHARED_API bool IsSortable(char16_t ch);
64 static ASPOSECPP_SHARED_API bool IsSortable(const String& text);
65
70 virtual ASPOSECPP_SHARED_API int Compare(const String& string1, const String& string2) const;
76 virtual ASPOSECPP_SHARED_API int Compare(const String& a, const String& b, CompareOptions options) const;
85 virtual ASPOSECPP_SHARED_API int Compare(const String& string1, int offset1, int length1, const String& string2, int offset2, int length2) const;
93 virtual ASPOSECPP_SHARED_API int Compare(const String& string1, int offset1, const String& string2, int offset2, CompareOptions options) const;
100 virtual ASPOSECPP_SHARED_API int Compare(const String& string1, int offset1, const String& string2, int offset2) const;
110 virtual ASPOSECPP_SHARED_API int Compare(const String& string1, int offset1, int length1, const String& string2, int offset2, int length2, CompareOptions options) const;
111
116 virtual ASPOSECPP_SHARED_API SortKeyPtr GetSortKey(const String& value, CompareOptions options) const;
120 virtual ASPOSECPP_SHARED_API SortKeyPtr GetSortKey(const String& value) const;
121
128 virtual ASPOSECPP_SHARED_API int IndexOf(const String& source, const String& value, int start_index, int count) const;
135 virtual ASPOSECPP_SHARED_API int IndexOf(const String& source, const String& value, int start_index, CompareOptions options) const;
143 virtual ASPOSECPP_SHARED_API int IndexOf(const String& source, const String& value, int start_index, int count, CompareOptions options) const;
151 virtual ASPOSECPP_SHARED_API int IndexOf(const String& source, char16_t value, int start_index, int count, CompareOptions options) const;
157 virtual ASPOSECPP_SHARED_API int IndexOf(const String& source, const String& value, int start_index) const;
162 virtual ASPOSECPP_SHARED_API int IndexOf(const String& source, char16_t value) const;
167 virtual ASPOSECPP_SHARED_API int IndexOf(const String& source, const String& value) const;
174 virtual ASPOSECPP_SHARED_API int IndexOf(const String& source, char16_t value, int start_index, CompareOptions options) const;
181 virtual ASPOSECPP_SHARED_API int IndexOf(const String& source, char16_t value, int start_index, int count) const;
187 virtual ASPOSECPP_SHARED_API int IndexOf(const String& source, char16_t value, int start_index) const;
193 virtual ASPOSECPP_SHARED_API int IndexOf(const String& source, const String& value, CompareOptions options) const;
199 virtual ASPOSECPP_SHARED_API int IndexOf(const String& source, char16_t value, CompareOptions options) const;
200
206 virtual ASPOSECPP_SHARED_API bool IsPrefix(const String& source, const String& prefix, CompareOptions options) const;
211 virtual ASPOSECPP_SHARED_API bool IsPrefix(const String& source, const String& prefix) const;
217 virtual ASPOSECPP_SHARED_API bool IsSuffix(const String& source, const String& suffix, CompareOptions options) const;
222 virtual ASPOSECPP_SHARED_API bool IsSuffix(const String& source, const String& suffix) const;
223
228 virtual ASPOSECPP_SHARED_API int LastIndexOf(const String& source, const String& value) const;
236 virtual ASPOSECPP_SHARED_API int LastIndexOf(const String& source, const String& value, int start_index, int count, CompareOptions options) const;
244 virtual ASPOSECPP_SHARED_API int LastIndexOf(const String& source, char16_t value, int start_index, int count, CompareOptions options) const;
251 virtual ASPOSECPP_SHARED_API int LastIndexOf(const String& source, const String& value, int start_index, int count) const;
258 virtual ASPOSECPP_SHARED_API int LastIndexOf(const String& source, const String& value, int start_index, CompareOptions options) const;
265 virtual ASPOSECPP_SHARED_API int LastIndexOf(const String& source, char16_t value, int start_index, CompareOptions options) const;
271 virtual ASPOSECPP_SHARED_API int LastIndexOf(const String& source, const String& value, int start_index) const;
277 virtual ASPOSECPP_SHARED_API int LastIndexOf(const String& source, char16_t value, int start_index) const;
283 virtual ASPOSECPP_SHARED_API int LastIndexOf(const String& source, const String& value, CompareOptions options) const;
289 virtual ASPOSECPP_SHARED_API int LastIndexOf(const String& source, char16_t value, CompareOptions options) const;
294 virtual ASPOSECPP_SHARED_API int LastIndexOf(const String& source, char16_t value) const;
301 virtual ASPOSECPP_SHARED_API int LastIndexOf(const String& source, char16_t value, int start_index, int count) const;
302
307 virtual ASPOSECPP_SHARED_API int GetHashCode(const String& value, CompareOptions options) const;
308
309 // Object methods
310 ASPOSECPP_SHARED_API bool Equals(SharedPtr<Object> other) override;
311 ASPOSECPP_SHARED_API int GetHashCode() const override;
312 ASPOSECPP_SHARED_API String ToString() const override;
313
314private:
315 friend CultureInfo;
316
319 CompareInfo(const Details::CultureDataPtr& culture_data);
320 MEMBER_FUNCTION_MAKE_OBJECT(CompareInfo, CODEPORTING_ARGS(const Details::CultureDataPtr& culture_data), CODEPORTING_ARGS(culture_data));
321
323 const Details::CultureDataPtr m_culture_data;
324
326 mutable System::Details::Lazy<SortVersionPtr> m_sort_version;
327};
328
329}} // namespace System::Globalization
Makes culture-sensitive string comparison. Objects of this class should only be allocated using Syste...
Definition: compare_info.h:24
static CompareInfoPtr GetCompareInfo(int culture)
Gets CompareInfo associated with the specified culture.
virtual int GetHashCode(const String &value, CompareOptions options) const
Gets string hash code based on specified comparison options.
virtual int LastIndexOf(const String &source, char16_t value) const
Searches last occurrence of the specified character.
virtual bool IsSuffix(const String &source, const String &suffix, CompareOptions options) const
Checks if the specified string ends with the specified suffix using the specified compare options.
virtual String get_Name() const
Gets name of the culture associated with comparer.
virtual int LastIndexOf(const String &source, char16_t value, int start_index) const
Searches last occurrence of the specified character.
CompareInfo(const CompareInfo &)=delete
RTTI information.
virtual int Compare(const String &string1, int offset1, int length1, const String &string2, int offset2, int length2, CompareOptions options) const
Compares a section of one string with a section of second string using string comparison methods....
virtual int LastIndexOf(const String &source, char16_t value, int start_index, int count) const
Searches last occurrence of the specified character.
virtual int Compare(const String &string1, const String &string2) const
Compares strings. Not implemented.
virtual int LastIndexOf(const String &source, const String &value, int start_index, int count) const
Searches last occurrence of the specified string.
virtual int LastIndexOf(const String &source, const String &value, int start_index) const
Searches last occurrence of the specified string.
virtual int IndexOf(const String &source, const String &value, int start_index, int count) const
Looks for substring.
virtual int LastIndexOf(const String &source, char16_t value, CompareOptions options) const
Searches last occurrence of the specified character using the specified compare options.
String ToString() const override
Analog of C# Object.ToString() method. Enables converting custom objects to string.
virtual int IndexOf(const String &source, const String &value, CompareOptions options) const
Looks for substring. Only Ordinal mode is supported.
CompareInfo & operator=(const CompareInfo &)=delete
static bool IsSortable(const String &text)
Checks whether a specified string is sortable.
virtual SortKeyPtr GetSortKey(const String &value, CompareOptions options) const
Gets SortKey object for the specified string using specified compare options.
virtual int IndexOf(const String &source, const String &value) const
Looks for substring.
virtual int IndexOf(const String &source, char16_t value, CompareOptions options) const
Looks for the specified character. Only Ordinal mode is supported.
virtual int IndexOf(const String &source, char16_t value, int start_index, int count) const
Looks for the specified character.
virtual int IndexOf(const String &source, const String &value, int start_index, int count, CompareOptions options) const
Looks for substring. Only Ordinal mode is supported.
static CompareInfoPtr GetCompareInfo(const String &name, const SharedPtr< Reflection::Assembly > &assembly)
Gets CompareInfo associated with the specified culture and using string comparison methods in the spe...
virtual int LastIndexOf(const String &source, const String &value, int start_index, int count, CompareOptions options) const
Searches last occurrence of the specified substring using the specified compare options.
virtual int IndexOf(const String &source, char16_t value) const
Looks for the specified character.
virtual int LastIndexOf(const String &source, const String &value, int start_index, CompareOptions options) const
Searches last occurrence of the specified string using the specified compare options.
virtual int Compare(const String &string1, int offset1, const String &string2, int offset2) const
Compares the end section of one string with the end section of second string. Not implemented.
static CompareInfoPtr GetCompareInfo(const String &name)
Gets CompareInfo associated with the specified culture.
virtual int Compare(const String &string1, int offset1, int length1, const String &string2, int offset2, int length2) const
Compares a section of one string with a section of second string. Not implemented.
virtual bool IsPrefix(const String &source, const String &prefix) const
Checks if the specified string starts with the specified prefix.
virtual bool IsPrefix(const String &source, const String &prefix, CompareOptions options) const
Checks if the specified string starts with the specified prefix using the specified compare options.
virtual int Compare(const String &string1, int offset1, const String &string2, int offset2, CompareOptions options) const
Compares the end section of one string with the end section of second string using string comparison ...
virtual int LastIndexOf(const String &source, char16_t value, int start_index, int count, CompareOptions options) const
Searches last occurrence of the specified character using the specified compare options.
static CompareInfoPtr GetCompareInfo(int culture, const SharedPtr< Reflection::Assembly > &assembly)
Gets CompareInfo associated with the specified culture and using string comparison methods in the spe...
int GetHashCode() const override
Analog of C# Object.GetHashCode() method. Enables hashing of custom objects.
virtual int LastIndexOf(const String &source, const String &value, CompareOptions options) const
Searches last occurrence of the specified string using the specified compare options.
SortVersionPtr get_Version() const
Gets information about sort version.
virtual SortKeyPtr GetSortKey(const String &value) const
Gets SortKey object for the specified string.
bool Equals(SharedPtr< Object > other) override
virtual int IndexOf(const String &source, const String &value, int start_index) const
Looks for substring.
virtual int IndexOf(const String &source, char16_t value, int start_index) const
Looks for the specified character.
virtual int IndexOf(const String &source, const String &value, int start_index, CompareOptions options) const
Looks for substring. Only Ordinal mode is supported.
virtual int IndexOf(const String &source, char16_t value, int start_index, CompareOptions options) const
Looks for the specified character. Only Ordinal mode is supported.
virtual int IndexOf(const String &source, char16_t value, int start_index, int count, CompareOptions options) const
Looks for the specified character. Only Ordinal mode is supported.
virtual int Compare(const String &a, const String &b, CompareOptions options) const
Compares strings. Only Ordinal and OrdinalIgnoreCase modes are supported.
int get_LCID() const
Gets LCID of the culture associated with comparer.
virtual int LastIndexOf(const String &source, const String &value) const
Searches last occurrence of the specified substring.
virtual bool IsSuffix(const String &source, const String &suffix) const
Checks if the specified string ends with the specified suffix.
virtual int LastIndexOf(const String &source, char16_t value, int start_index, CompareOptions options) const
Searches last occurrence of the specified character using the specified compare options.
static bool IsSortable(char16_t ch)
Checks whether a specified character is sortable.
Collection of culture-specific values and algorithms. Setter operations are only enabled on non-read-...
Definition: culture_info.h:32
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
std::shared_ptr< CultureData > CultureDataPtr
Pointer to hold implementation type.
Definition: culture_data_ptr.h:12
SharedPtr< CompareInfo > CompareInfoPtr
CompareInfo pointer type.
Definition: compare_info.h:15
CompareOptions
String comparison options.
Definition: compare_options.h:12
Definition: db_command.h:9