CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
text_element_enumerator.h
1
2#pragma once
3
4#include <system/string.h>
5#include <system/details/icu_namespace.h>
6
7#include <memory>
8
10ASPOSECPP_3RD_PARTY_ICU_NAMESPACE_START {
12 ASPOSECPP_3RD_PARTY_CLASS(BreakIterator);
13}
14
15namespace System { namespace Globalization {
16
17class TextElementEnumerator;
20
25class ASPOSECPP_SHARED_CLASS TextElementEnumerator
26 : public virtual Object
27 // , public Collections::IEnumerator (Not implemented)
28{
30 RTTI_INFO(System::Globalization::TextElementEnumerator, ::System::BaseTypesInfo<System::Object>)
31
32 friend class StringInfo;
33
38 ASPOSECPP_SHARED_API TextElementEnumerator(const String& str, int start_index = 0, bool use_string_aliasing = false);
39 MEMBER_FUNCTION_MAKE_OBJECT(TextElementEnumerator, CODEPORTING_ARGS(const String& str, int start_index = 0, bool use_string_aliasing = false), CODEPORTING_ARGS(str, start_index, use_string_aliasing));
40
41public:
43 TextElementEnumerator& operator=(const TextElementEnumerator&) = delete;
44
47 ASPOSECPP_SHARED_API SharedPtr<Object> get_Current() const;
50 ASPOSECPP_SHARED_API int get_ElementIndex() const;
51
54 ASPOSECPP_SHARED_API bool MoveNext();
57 ASPOSECPP_SHARED_API String GetTextElement() const;
59 ASPOSECPP_SHARED_API void Reset();
60
61private:
63 enum class State
64 {
66 None = 0,
68 Started,
70 Finished
71 };
72
74 String m_string;
76 const int m_start_index;
78 String m_string_slice;
80 std::unique_ptr<codeporting_icu::BreakIterator> m_break_iterator;
82 State m_state;
84 int m_element_position;
85
87 int CurrentIteratorPosition() const;
88
90 static void CreateStringAlias(const String& str, String& alias, int start_index);
91};
92
93}} // System::Globalization
Splitter to iterate through string parts. Objects of this class should only be allocated using System...
Definition: string_info.h:18
Enumerator to iterate through string elements (characters). Objects of this class should only be allo...
Definition: text_element_enumerator.h:28
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
SharedPtr< TextElementEnumerator > TextElementEnumeratorPtr
TextElementEnumerator pointer type.
Definition: text_element_enumerator.h:19
Definition: db_command.h:9