Aspose.Tasks for C++
VbaModuleCollection.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="VbaModuleCollection.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2025 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/collections/list.h>
9 #include <system/collections/icollection.h>
10 #include <system/array.h>
11 #include <cstdint>
12 
13 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
14 
15 namespace Aspose
16 {
17 namespace Tasks
18 {
19 namespace Vba
20 {
21 class VbaProjectFolderBuilder;
22 class VbaProjectWriter;
23 } // namespace Vba
24 class VbaModule;
25 class VbaProject;
26 } // namespace Tasks
27 } // namespace Aspose
28 namespace System
29 {
30 namespace Collections
31 {
32 namespace Generic
33 {
34 template <typename> class IEnumerator;
35 template <typename> class IList;
36 } // namespace Generic
37 } // namespace Collections
38 } // namespace System
39 
40 namespace Aspose {
41 
42 namespace Tasks {
43 
44 /// <summary>
45 /// Represents a collection of <see cref="VbaModule"></see> objects.
46 /// </summary>
47 class ASPOSE_TASKS_SHARED_CLASS VbaModuleCollection : public System::Collections::Generic::ICollection<System::SharedPtr<Aspose::Tasks::VbaModule>>
48 {
50  typedef System::Collections::Generic::ICollection<System::SharedPtr<Aspose::Tasks::VbaModule>> BaseType;
51 
52  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
53  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
54 
55  friend class Aspose::Tasks::Vba::VbaProjectFolderBuilder;
56  friend class Aspose::Tasks::Vba::VbaProjectWriter;
57  friend class Aspose::Tasks::VbaProject;
58 
59 public:
60  /// A collection type whose iterator types is used as iterator types in the current collection.
61  using iterator_holder_type = System::Collections::Generic::List<System::SharedPtr<VbaModule>>;
62  /// Iterator type.
63  using iterator = typename iterator_holder_type::iterator;
64  /// Const iterator type.
65  using const_iterator = typename iterator_holder_type::const_iterator;
66  /// Virtualized element type.
67  using virtualized_iterator_element = typename iterator_holder_type::virtualized_iterator_element;
68  /// Virtualized type.
69  using virtualized_iterator = typename iterator_holder_type::virtualized_iterator;
70 
71 public:
72 
73  /// <inheritdoc ></inheritdoc>
74  ASPOSE_TASKS_SHARED_API int32_t get_Count() const override;
75  /// <inheritdoc ></inheritdoc>
76  ASPOSE_TASKS_SHARED_API bool get_IsReadOnly() const override;
77 
78  /// <inheritdoc ></inheritdoc>
79  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<VbaModule>>> GetEnumerator() override;
80 
81  /// <summary>Gets the module at the specified index.</summary>
82  /// <param name="index">The zero-based index of the element to get.</param>
83  ASPOSE_TASKS_SHARED_API System::SharedPtr<VbaModule> idx_get(int32_t index);
84  /// <summary>Gets the module with the specified name.</summary>
85  /// <param name="moduleName">The name of the module to get.</param>
86  ASPOSE_TASKS_SHARED_API System::SharedPtr<VbaModule> idx_get(const System::String& moduleName);
87 
88  /// <inheritdoc ></inheritdoc>
89  ASPOSE_TASKS_SHARED_API void Add(const System::SharedPtr<VbaModule>& item) override;
90  /// <inheritdoc ></inheritdoc>
91  ASPOSE_TASKS_SHARED_API void Clear() override;
92  /// <inheritdoc ></inheritdoc>
93  ASPOSE_TASKS_SHARED_API bool Contains(const System::SharedPtr<VbaModule>& item) const override;
94  /// <inheritdoc ></inheritdoc>
95  ASPOSE_TASKS_SHARED_API void CopyTo(System::ArrayPtr<System::SharedPtr<VbaModule>> array, int32_t arrayIndex) override;
96  /// <inheritdoc ></inheritdoc>
97  ASPOSE_TASKS_SHARED_API bool Remove(const System::SharedPtr<VbaModule>& item) override;
98  /// <summary>
99  /// Converts the collection object to a list of <see cref="VbaModule"></see> objects.
100  /// </summary>
101  /// <returns>List of objects.</returns>
102  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<VbaModule>>> ToList();
103  /// Gets iterator pointing to the first element (if any) of the collection.
104  /// @return An iterator pointing to the first element (if any) of the collection
105  ASPOSE_TASKS_SHARED_API iterator begin() noexcept;
106  /// Gets iterator pointing right after the last element (if any) of the collection.
107  /// @return An iterator pointing right after the last element (if any) of the collection
108  ASPOSE_TASKS_SHARED_API iterator end() noexcept;
109  /// Gets iterator pointing to the first element (if any) of the const-qualified instance of the collection.
110  /// @return An iterator pointing to the first element (if any) of the const-qualified instance of the collection
111  ASPOSE_TASKS_SHARED_API const_iterator begin() const noexcept;
112  /// Gets iterator pointing right after the last element (if any) of the const-qualified instance of the collection.
113  /// @return An iterator pointing right after the last element (if any) of the const-qualified instance of the collection
114  ASPOSE_TASKS_SHARED_API const_iterator end() const noexcept;
115  /// Gets iterator pointing to the first const-qualified element (if any) of the collection.
116  /// @return An iterator pointing to the first const-qualified element (if any) of the collection
117  ASPOSE_TASKS_SHARED_API const_iterator cbegin() const noexcept;
118  /// Gets iterator pointing right after the last const-qualified element (if any) of the collection.
119  /// @return An iterator pointing right after the last const-qualified element (if any) of the collection
120  ASPOSE_TASKS_SHARED_API const_iterator cend() const noexcept;
121  /// Gets iterator pointing to the first element (if any) of the collection.
122  /// @return An iterator pointing to the first element (if any) of the collection
123  /// Provides iterator implementation to container's first element.
124  /// @return Newly-created iterator object.
125  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeBeginIterator() override;
126  /// Gets iterator pointing right after the last element (if any) of the collection.
127  /// @return An iterator pointing right after the last element (if any) of the collection
128  /// Provides iterator implementation to container's end.
129  /// @return Newly-created iterator object.
130  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeEndIterator() override;
131  /// Gets iterator pointing to the first element (if any)of the const-qualified instance of the collection.
132  /// @return An iterator pointing to the first element (if any)of the const-qualified instance of the collection
133  /// Provides const iterator implementation to container's first element.
134  /// @return Newly-created iterator object.
135  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeBeginConstIterator() const override;
136  /// Gets iterator pointing right after the last element (if any)of the const-qualified instance of the collection.
137  /// @return An iterator pointing right after the last element (if any)of the const-qualified instance of the collection
138  /// Provides const iterator implementation to container's end.
139  /// @return Newly-created iterator object.
140  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeEndConstIterator() const override;
141 
142 protected:
143 
144  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<VbaModule>>> get_DeletedItems() const;
145  ASPOSE_TASKS_SHARED_API bool get_HasDeletedModules();
146 
147  ASPOSE_TASKS_SHARED_API VbaModuleCollection();
148 
149  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(VbaModuleCollection, CODEPORTING_ARGS());
150 
151  ASPOSE_TASKS_SHARED_API VbaModuleCollection(const System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<VbaModule>>>& vbaModules);
152 
153  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(VbaModuleCollection, CODEPORTING_ARGS(const System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<VbaModule>>>& vbaModules));
154  ASPOSE_TASKS_SHARED_API void InsertInternal(int32_t index, const System::SharedPtr<VbaModule>& vbaModule);
155 
156  virtual ASPOSE_TASKS_SHARED_API ~VbaModuleCollection();
157 
158  #ifdef ASPOSE_GET_SHARED_MEMBERS
159  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
160  #endif
161 
162 
163 private:
164 
165  System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<VbaModule>>> items;
166  System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<VbaModule>>> deletedItems;
167 
168  void ValidateModuleBeforeAdd(const System::SharedPtr<VbaModule>& vbaModule);
169 
170 };
171 
172 } // namespace Tasks
173 } // namespace Aspose
174 
175 
typename iterator_holder_type::iterator iterator
Iterator type.
Definition: VbaModuleCollection.h:63
Represents a collection of VbaModule objects.
Definition: VbaModuleCollection.h:47
Definition: Asn.h:12
typename iterator_holder_type::const_iterator const_iterator
Const iterator type.
Definition: VbaModuleCollection.h:65
typename iterator_holder_type::virtualized_iterator virtualized_iterator
Virtualized type.
Definition: VbaModuleCollection.h:69
Represents VbaProject.
Definition: VbaProject.h:63
System::Collections::Generic::List< System::SharedPtr< VbaModule > > iterator_holder_type
A collection type whose iterator types is used as iterator types in the current collection.
Definition: VbaModuleCollection.h:61
Represents a VBA module.
Definition: VbaModule.h:40
typename iterator_holder_type::virtualized_iterator_element virtualized_iterator_element
Virtualized element type.
Definition: VbaModuleCollection.h:67