CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
list_ext.h
1#pragma once
2#include <system/collections/list.h>
3#include <system/collections/ilist_wrapper.h>
4#include <system/collections/ilist_impl.h>
5#include <system/type_info_ext.h>
6
7namespace System {
8namespace Collections {
9namespace Generic {
10
12template<typename T>
13class ASPOSECPP_SHARED_CLASS ListExt
16{
17protected:
19
20public:
23 typedef System::BaseTypesInfo<System::Object> BaseTypes;
24 typedef T ValueType;
25
27 using BaseType::BaseType;
28
29private:
31 RTTI_INFO_TEMPLATE_CLASS(System::Collections::Generic::ListExt<T>, System::BaseTypesInfo<System::Collections::Generic::List<T>>);
32
33public:
34
38 {
39 return CreateIListWrapperImpl<T>();
40 }
41
43 template<typename T1>
44 typename std::enable_if<System::IsSmartPtr<T1>::value, System::SharedPtr<System::Collections::IList>>::type
46 {
47 ThisPtr thisPtr = MakeSharedPtr(this);
48 System::SharedPtr<System::Collections::IList> wrapper = System::MakeObject<System::Collections::IListImplRefType<typename T1::Pointee_>>(thisPtr);
49 return wrapper;
50 }
51
53 template<typename T1>
54 typename std::enable_if<!System::IsSmartPtr<T1>::value && System::IsBoxable<T1>::value, System::SharedPtr<System::Collections::IList>>::type
56 {
57 ThisPtr thisPtr = MakeSharedPtr(this);
58 System::SharedPtr<System::Collections::IList> wrapper = System::MakeObject<System::Collections::IListImplValueType<T1>>(thisPtr);
59 return wrapper;
60 }
61
63 template<typename T1>
64 typename std::enable_if<!System::IsSmartPtr<T1>::value && !System::IsBoxable<T>::value, System::SharedPtr<System::Collections::IList>>::type
66 {
67 return nullptr;
68 }
69};
70
71} // namespace Generic
72} // namespace Collections
73} // namespace System
generic List class that implements IListWrapper interface
Definition: list_ext.h:16
SharedPtr< ListExt< T > > ThisPtr
Definition: list_ext.h:18
System::BaseTypesInfo< System::Object > BaseTypes
Definition: list_ext.h:23
T ValueType
Definition: list_ext.h:24
List< T > BaseType
Definition: list_ext.h:26
std::enable_if< System::IsSmartPtr< T1 >::value, System::SharedPtr< System::Collections::IList > >::type CreateIListWrapperImpl()
IListWrapper implementation helper for reference types.
Definition: list_ext.h:45
System::SharedPtr< System::Collections::IList > CreateIListWrapper() override
IListWrapper interface implementation.
Definition: list_ext.h:37
System::Collections::Generic::ListExt< T > ThisType
Definition: list_ext.h:21
std::enable_if<!System::IsSmartPtr< T1 >::value &&!System::IsBoxable< T >::value, System::SharedPtr< System::Collections::IList > >::type CreateIListWrapperImpl()
IListWrapper implementation helper for other types.
Definition: list_ext.h:65
std::enable_if<!System::IsSmartPtr< T1 >::value &&System::IsBoxable< T1 >::value, System::SharedPtr< System::Collections::IList > >::type CreateIListWrapperImpl()
IListWrapper implementation helper for value types.
Definition: list_ext.h:55
System::Collections::Generic::List< T > ListType
Definition: list_ext.h:22
List forward declaration.
Definition: list.h:127
Intrerface to support casting from generic to non-generic collection.
Definition: ilist_wrapper.h:13
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
SmartPtr< X > MakeSharedPtr(X *p)
Converts raw pointer to smart pointer.
Definition: smart_ptr.h:1650
Template predicate that checks if boxing of the specified type is supported.
Definition: boxable_traits.h:16