8 #include <system/exceptions.h>
9 #include <system/details/pointer_collection_helpers.h>
10 #include <system/collections/list.h>
11 #include <system/collections/ilist.h>
12 #include <system/collections/ienumerator.h>
13 #include <system/array.h>
22 class VbaProjectReader;
23 class VbaProjectReferencesReader;
25 class VbaModuleAttributeCollection;
26 class VbaModuleCollection;
27 class VbaReferenceCollection;
43 typedef System::Collections::Generic::IList<T> BaseType;
45 typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
46 RTTI_INFO_TEMPLATE_CLASS(
ThisType, ThisTypeBaseTypesInfo);
48 friend class Aspose::Tasks::Vba::VbaProjectReader;
49 friend class Aspose::Tasks::Vba::VbaProjectReferencesReader;
62 return this->items->get_Count();
72 return this->items->idx_get(index);
80 void idx_set(int32_t index, T value)
override
82 throw System::NotSupportedException(u
"Collection is read-only.");
89 System::SharedPtr<System::Collections::Generic::IEnumerator<T>>
GetEnumerator()
override
91 return this->items->GetEnumerator();
98 void Add(
const T& item)
override
101 throw System::NotSupportedException(u
"Collection is read-only.");
108 System::SharedPtr<System::Collections::Generic::List<T>>
ToList()
110 return System::MakeObject<System::Collections::Generic::List<T>>(this->items);
113 void SetTemplateWeakPtr(uint32_t argument)
override
118 System::Details::CollectionHelpers::SetWeakPointer(0, items);
126 ReadOnlyCollectionBase() : items(System::MakeObject<System::Collections::Generic::List<T>>())
130 ReadOnlyCollectionBase(
const System::SharedPtr<System::Collections::Generic::IList<T>>& items)
131 : items(System::MakeObject<System::Collections::Generic::List<T>>())
136 void AddInternal(T attribute)
138 this->items->Add(attribute);
141 virtual ~ReadOnlyCollectionBase()
145 #ifdef ASPOSE_GET_SHARED_MEMBERS
146 void GetSharedMembers(System::Object::shared_members_type& result)
const override
148 System::Object::GetSharedMembers(result);
150 result.Add(
"Aspose::Tasks::ReadOnlyCollectionBase::items", this->items);
158 System::SharedPtr<System::Collections::Generic::IList<T>> items;
160 bool get_IsReadOnly()
const override
165 int32_t IndexOf(
const T& item)
const override
167 return this->items->IndexOf(item);
170 void CopyTo(System::ArrayPtr<T> array, int32_t arrayIndex)
override
172 this->items->CopyTo(array, arrayIndex);
175 bool Contains(
const T& item)
const override
177 return this->items->Contains(item);
180 void Insert(int32_t index,
const T& item)
override
182 ASPOSE_UNUSED(index);
184 throw System::NotSupportedException(u
"Collection is read-only.");
187 bool Remove(
const T& item)
override
190 throw System::NotSupportedException(u
"Collection is read-only.");
193 void RemoveAt(int32_t index)
override
195 ASPOSE_UNUSED(index);
196 throw System::NotSupportedException(u
"Collection is read-only.");
199 void Clear()
override
201 throw System::NotSupportedException(u
"Collection is read-only.");
Represents a read-only collection of objects.
Definition: ReadOnlyCollectionBase.h:41
int32_t get_Count() const override
Gets the number of objects contained in the object.
Definition: ReadOnlyCollectionBase.h:60
T idx_get(int32_t index) const override
Returns the element at the specified index.
Definition: ReadOnlyCollectionBase.h:70
System::SharedPtr< System::Collections::Generic::IEnumerator< T > > GetEnumerator() override
Returns an enumerator for this collection.
Definition: ReadOnlyCollectionBase.h:89
void Add(const T &item) override
This is the stub implementation of ICollection's Add method, that only throws NotSupportedException
Definition: ReadOnlyCollectionBase.h:98
void idx_set(int32_t index, T value) override
Returns the element at the specified index.
Definition: ReadOnlyCollectionBase.h:80
System::SharedPtr< System::Collections::Generic::List< T > > ToList()
Converts the collection object to a list of VbaModule objects.
Definition: ReadOnlyCollectionBase.h:108
Represents a collection of VbaModuleAttribute objects.
Definition: VbaModuleAttributeCollection.h:42
Represents a collection of VbaModule objects.
Definition: VbaModuleCollection.h:38
Represents a collection of VbaReference objects.
Definition: VbaReferenceCollection.h:38