CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
ienumerator_impl.h
1#pragma once
2
3#include <system/object.h>
4#include <system/object_ext.h>
5#include <system/shared_ptr.h>
6#include <defines.h>
7#include <system/exceptions.h>
8#include <system/idisposable.h>
9#include <system/collections/ienumerator_ng.h>
10
11namespace System { namespace Collections { namespace Generic {
12 template <typename T>
13 class IEnumerator;
14}}}
15
16namespace System {
17namespace Collections {
18
22template <typename T>
23class ASPOSECPP_SHARED_CLASS IEnumeratorImplRefType : public System::Collections::IEnumerator
24{
25public:
28
29 // There no need to define an empty virtual dtor, virtual dtor for inheritance already defined in the Object class
32 virtual const SharedPtr<System::Object>& get_Current() const override
33 {
34 return m_current;
35 }
39 virtual bool MoveNext() override
40 {
41 if (m_enum->MoveNext())
42 {
43 m_current = m_enum->get_Current();
44 return true;
45 }
46 m_current = System::Default<System::SharedPtr<System::Object>>();
47 return false;
48 }
49
50private:
53};
54
58template <typename T>
60{
61public:
64
65 // There no need to define an empty virtual dtor, virtual dtor for inheritance already defined in the Object class
68 virtual const SharedPtr<System::Object>& get_Current() const override
69 {
70 return m_current;
71 }
75 virtual bool MoveNext() override
76 {
77 if (m_enum->MoveNext())
78 {
79 m_current = ObjectExt::Box(m_enum->get_Current());
80 return true;
81 }
82 m_current = System::Default<System::SharedPtr<System::Object>>();
83 return false;
84 }
85
86private:
89};
90
91} // namespace Collections
92} // namespace System
Interface of enumerator which can be used to iterate through some elements. Objects of this class sho...
Definition: ienumerator.h:63
Interface of enumerator which can be used to iterate through some elements. Objects of this class sho...
Definition: ienumerator_ng.h:18
Wrapper the creates non generic IEnumerator implementation over the generic Iterator IEnumeratorImplR...
Definition: ienumerator_impl.h:24
virtual bool MoveNext() override
Moves enumerator to the next element. If no element was referenced before, sets reference to the firs...
Definition: ienumerator_impl.h:39
virtual const SharedPtr< System::Object > & get_Current() const override
Gets current element.
Definition: ienumerator_impl.h:32
IEnumeratorImplRefType(System::SharedPtr< System::Collections::Generic::IEnumerator< System::SharedPtr< T > > > enumerator)
wrapper constructor
Definition: ienumerator_impl.h:27
Wrapper the creates non generic IEnumerator implementation over the generic Iterator IEnumeratorImplR...
Definition: ienumerator_impl.h:60
virtual const SharedPtr< System::Object > & get_Current() const override
Gets current element.
Definition: ienumerator_impl.h:68
IEnumeratorImplValueType(System::SharedPtr< System::Collections::Generic::IEnumerator< T > > enumerator)
wrapper constructor
Definition: ienumerator_impl.h:63
virtual bool MoveNext() override
Moves enumerator to the next element. If no element was referenced before, sets reference to the firs...
Definition: ienumerator_impl.h:75
static std::enable_if< std::is_enum< T >::value, System::SmartPtr< System::Object > >::type Box(const T &value)
Boxes value types for converting to Object. Implementation for enum types.
Definition: object_ext.h:198
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
Definition: db_command.h:9