Aspose.Tasks for C++
ExtendedAttributeDefinitionCollection.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="ExtendedAttributeDefinitionCollection.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2024 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/collections/list.h>
9 #include <system/collections/ilist.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 Connectivity
20 {
21 class MpdExtendedAttributeDefinitionMapper;
22 class MspDbReader;
23 } // namespace Connectivity
24 enum class ElementType;
25 class ExtendedAttributeDefinition;
26 namespace IO
27 {
28 namespace MSProject
29 {
30 class MPP14OutlineCodeDefinitionWriter;
31 } // namespace MSProject
32 namespace Pwa
33 {
34 namespace InternalApi
35 {
36 namespace Mapping
37 {
38 template <typename> class ExtendedAttributeParentEntityToRawValuesMapper;
39 } // namespace Mapping
40 } // namespace InternalApi
41 } // namespace Pwa
42 namespace Xml
43 {
44 class ExtendedAttributeNodeReader;
45 class XmlReader;
46 } // namespace Xml
47 } // namespace IO
48 class Project;
49 class TaskFieldsFormulaParser;
50 } // namespace Tasks
51 } // namespace Aspose
52 namespace System
53 {
54 namespace Collections
55 {
56 namespace Generic
57 {
58 template <typename> class HashSet;
59 template <typename> class IComparer;
60 template <typename, typename> class IDictionary;
61 template <typename> class IEnumerable;
62 template <typename> class IEnumerator;
63 } // namespace Generic
64 } // namespace Collections
65 } // namespace System
66 
67 namespace Aspose {
68 
69 namespace Tasks {
70 
71 /// <summary>
72 /// Represents a collection of <see cref="ExtendedAttributeDefinition"></see> objects.
73 /// </summary>
74 class ASPOSE_TASKS_SHARED_CLASS ExtendedAttributeDefinitionCollection : public System::Collections::Generic::IList<System::SharedPtr<Aspose::Tasks::ExtendedAttributeDefinition>>
75 {
77  typedef System::Collections::Generic::IList<System::SharedPtr<Aspose::Tasks::ExtendedAttributeDefinition>> BaseType;
78 
79  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
80  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
81 
82  friend class Aspose::Tasks::TaskFieldsFormulaParser;
83  friend class Aspose::Tasks::Project;
84  template<typename FT0> friend class Aspose::Tasks::IO::Pwa::InternalApi::Mapping::ExtendedAttributeParentEntityToRawValuesMapper;
85  friend class Aspose::Tasks::Connectivity::MpdExtendedAttributeDefinitionMapper;
86  friend class Aspose::Tasks::Connectivity::MspDbReader;
87  friend class Aspose::Tasks::IO::MSProject::MPP14OutlineCodeDefinitionWriter;
88  friend class Aspose::Tasks::IO::Xml::ExtendedAttributeNodeReader;
89  friend class Aspose::Tasks::IO::Xml::XmlReader;
90 
91 public:
92  /// A collection type whose iterator types is used as iterator types in the current collection.
93  using iterator_holder_type = System::Collections::Generic::List<System::SharedPtr<ExtendedAttributeDefinition>>;
94  /// Iterator type.
95  using iterator = typename iterator_holder_type::iterator;
96  /// Const iterator type.
97  using const_iterator = typename iterator_holder_type::const_iterator;
98  /// Virtualized element type.
99  using virtualized_iterator_element = typename iterator_holder_type::virtualized_iterator_element;
100  /// Virtualized type.
101  using virtualized_iterator = typename iterator_holder_type::virtualized_iterator;
102 
103 public:
104 
105  /// <summary>
106  /// Gets a parent project for the <see cref="ExtendedAttributeDefinitionCollection"></see> instance.
107  /// <returns>returns a parent project for this collection.</returns>
108  /// </summary>
109  ASPOSE_TASKS_SHARED_API const System::SharedPtr<Project>& get_ParentProject() const;
110  /// <summary>
111  /// Gets the number of elements contained in this collection.
112  /// </summary>
113  ASPOSE_TASKS_SHARED_API int32_t get_Count() const override;
114  /// <summary>
115  /// Gets a value indicating whether this collection is read-only.
116  /// </summary>
117  ASPOSE_TASKS_SHARED_API bool get_IsReadOnly() const override;
118 
119  /// <summary>
120  /// Returns the element at the specified index.
121  /// </summary>
122  /// <param name="index">The zero-based index of the element to get or set.</param>
123  /// <returns>the element at the specified index.</returns>
124  ASPOSE_TASKS_SHARED_API System::SharedPtr<ExtendedAttributeDefinition> idx_get(int32_t index) const override;
125  /// <summary>
126  /// Sets the element at the specified index.
127  /// </summary>
128  /// <param name="index">The zero-based index of the element to get or set.</param>
129  /// <param name="value">the element at the specified index.</param>
130  ASPOSE_TASKS_SHARED_API void idx_set(int32_t index, System::SharedPtr<ExtendedAttributeDefinition> value) override;
131 
132  /// <summary>
133  /// Returns an enumerator for this collection.
134  /// </summary>
135  /// <returns>an enumerator for this collection.</returns>
136  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<ExtendedAttributeDefinition>>> GetEnumerator() override;
137  /// <summary>
138  /// Adds the specified item to this collection.
139  /// </summary>
140  /// <param name="item">the specified item to add to this collection.</param>
141  ASPOSE_TASKS_SHARED_API void Add(const System::SharedPtr<ExtendedAttributeDefinition>& item) override;
142  /// <summary>
143  /// Removes all items from this collection.
144  /// </summary>
145  ASPOSE_TASKS_SHARED_API void Clear() override;
146  /// <summary>
147  /// Returns true if the specified item is found in this collection; otherwise, false.
148  /// </summary>
149  /// <param name="item">the specified item to find.</param>
150  /// <returns>true if the specified item is found in this collection; otherwise, false.</returns>
151  ASPOSE_TASKS_SHARED_API bool Contains(const System::SharedPtr<ExtendedAttributeDefinition>& item) const override;
152  /// <summary>
153  /// Copies the elements of this collection to the specified array, starting at the specified array index.
154  /// </summary>
155  /// <param name="array">the specified one-dimensional array to copy elements to</param>
156  /// <param name="arrayIndex">the zero-based index of the specified array at which copying begins.</param>
157  ASPOSE_TASKS_SHARED_API void CopyTo(System::ArrayPtr<System::SharedPtr<ExtendedAttributeDefinition>> array, int32_t arrayIndex) override;
158  /// <summary>
159  /// Removes the first occurrence of a specific object from this collection.
160  /// </summary>
161  /// <param name="item">the specified object to remove.</param>
162  /// <returns>true if the specified object was successfully removed from this collection; otherwise, false.</returns>
163  ASPOSE_TASKS_SHARED_API bool Remove(const System::SharedPtr<ExtendedAttributeDefinition>& item) override;
164  /// <summary>
165  /// Determines the index of the specified item in this collection.
166  /// </summary>
167  /// <param name="item">the specified item to locate in this collection.</param>
168  /// <returns>the index of the specified item if found; otherwise, -1.</returns>
169  ASPOSE_TASKS_SHARED_API int32_t IndexOf(const System::SharedPtr<ExtendedAttributeDefinition>& item) const override;
170  /// <summary>
171  /// Inserts the specified item at the specified index.
172  /// </summary>
173  /// <param name="index">the specified zero-based index at which the item should be inserted.</param>
174  /// <param name="item">the specified item to insert to this collection.</param>
175  ASPOSE_TASKS_SHARED_API void Insert(int32_t index, const System::SharedPtr<ExtendedAttributeDefinition>& item) override;
176  /// <summary>
177  /// Removes an item at the specified index.
178  /// </summary>
179  /// <param name="index">the specified zero-based index to remove an item at.</param>
180  ASPOSE_TASKS_SHARED_API void RemoveAt(int32_t index) override;
181  /// <summary>
182  /// Converts this ExtendedAttributeDefinitionCollection object to a list containing instances of the <see cref="ExtendedAttributeDefinition"></see> class.
183  /// </summary>
184  /// <returns>List containing instances of the <see cref="ExtendedAttributeDefinition"></see> class.</returns>
185  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<ExtendedAttributeDefinition>>> ToList();
186  /// <summary>
187  /// Returns an extended attribute definition by id
188  /// </summary>
189  /// <param name="id">specified id</param>
190  /// <returns>ExtendedAttributeDefinition with specified id.</returns>
191  ASPOSE_TASKS_SHARED_API System::SharedPtr<ExtendedAttributeDefinition> GetById(int32_t id);
192  /// Gets iterator pointing to the first element (if any) of the collection.
193  /// @return An iterator pointing to the first element (if any) of the collection
194  ASPOSE_TASKS_SHARED_API iterator begin() noexcept;
195  /// Gets iterator pointing right after the last element (if any) of the collection.
196  /// @return An iterator pointing right after the last element (if any) of the collection
197  ASPOSE_TASKS_SHARED_API iterator end() noexcept;
198  /// Gets iterator pointing to the first element (if any) of the const-qualified instance of the collection.
199  /// @return An iterator pointing to the first element (if any) of the const-qualified instance of the collection
200  ASPOSE_TASKS_SHARED_API const_iterator begin() const noexcept;
201  /// Gets iterator pointing right after the last element (if any) of the const-qualified instance of the collection.
202  /// @return An iterator pointing right after the last element (if any) of the const-qualified instance of the collection
203  ASPOSE_TASKS_SHARED_API const_iterator end() const noexcept;
204  /// Gets iterator pointing to the first const-qualified element (if any) of the collection.
205  /// @return An iterator pointing to the first const-qualified element (if any) of the collection
206  ASPOSE_TASKS_SHARED_API const_iterator cbegin() const noexcept;
207  /// Gets iterator pointing right after the last const-qualified element (if any) of the collection.
208  /// @return An iterator pointing right after the last const-qualified element (if any) of the collection
209  ASPOSE_TASKS_SHARED_API const_iterator cend() const noexcept;
210  /// Gets iterator pointing to the first element (if any) of the collection.
211  /// @return An iterator pointing to the first element (if any) of the collection
212  /// Provides iterator implementation to container's first element.
213  /// @return Newly-created iterator object.
214  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeBeginIterator() override;
215  /// Gets iterator pointing right after the last element (if any) of the collection.
216  /// @return An iterator pointing right after the last element (if any) of the collection
217  /// Provides iterator implementation to container's end.
218  /// @return Newly-created iterator object.
219  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeEndIterator() override;
220  /// Gets iterator pointing to the first element (if any)of the const-qualified instance of the collection.
221  /// @return An iterator pointing to the first element (if any)of the const-qualified instance of the collection
222  /// Provides const iterator implementation to container's first element.
223  /// @return Newly-created iterator object.
224  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeBeginConstIterator() const override;
225  /// Gets iterator pointing right after the last element (if any)of the const-qualified instance of the collection.
226  /// @return An iterator pointing right after the last element (if any)of the const-qualified instance of the collection
227  /// Provides const iterator implementation to container's end.
228  /// @return Newly-created iterator object.
229  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeEndConstIterator() const override;
230 
231 protected:
232 
233  ASPOSE_TASKS_SHARED_API ExtendedAttributeDefinitionCollection(const System::SharedPtr<Project>& parentProject);
234 
235  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(ExtendedAttributeDefinitionCollection, CODEPORTING_ARGS(const System::SharedPtr<Project>& parentProject));
236 
237  ASPOSE_TASKS_SHARED_API ExtendedAttributeDefinitionCollection(const System::SharedPtr<Project>& parentProject, const System::SharedPtr<System::Collections::Generic::IEnumerable<System::SharedPtr<ExtendedAttributeDefinition>>>& definitions);
238 
239  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(ExtendedAttributeDefinitionCollection, CODEPORTING_ARGS(const System::SharedPtr<Project>& parentProject, const System::SharedPtr<System::Collections::Generic::IEnumerable<System::SharedPtr<ExtendedAttributeDefinition>>>& definitions));
240  ASPOSE_TASKS_SHARED_API System::SharedPtr<ExtendedAttributeDefinition> GetById(const System::String& id);
241  ASPOSE_TASKS_SHARED_API System::SharedPtr<ExtendedAttributeDefinition> GetByKey(bool isEnterprise, ElementType elementType, System::String name);
242  ASPOSE_TASKS_SHARED_API void AddRange(const System::SharedPtr<System::Collections::Generic::IEnumerable<System::SharedPtr<ExtendedAttributeDefinition>>>& attributes);
243  ASPOSE_TASKS_SHARED_API void Sort(const System::SharedPtr<System::Collections::Generic::IComparer<System::SharedPtr<ExtendedAttributeDefinition>>>& comparer);
244 
245  virtual ASPOSE_TASKS_SHARED_API ~ExtendedAttributeDefinitionCollection();
246 
247  #ifdef ASPOSE_GET_SHARED_MEMBERS
248  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
249  #endif
250 
251 
252 private:
253 
254  System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<ExtendedAttributeDefinition>>> definitions;
255  System::SharedPtr<System::Collections::Generic::IDictionary<int32_t, System::SharedPtr<ExtendedAttributeDefinition>>> idMap;
256  System::SharedPtr<System::Collections::Generic::HashSet<int32_t>> outlineValueHashSet;
257  System::WeakPtr<Project> pr_ParentProject;
258 
259  /// <summary>
260  /// Gets a parent project for the <see cref="ExtendedAttributeDefinitionCollection"></see> instance.
261  /// <param name="value">returns a parent project for this collection.</param>
262  /// </summary>
263  ASPOSE_TASKS_SHARED_API void set_ParentProject(const System::SharedPtr<Project>& value);
264 
265  void Init(const System::SharedPtr<Project>& inParentProject, const System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<ExtendedAttributeDefinition>>>& inDefinitions);
266 
267 };
268 
269 } // namespace Tasks
270 } // namespace Aspose
271 
272 
Represents a collection of ExtendedAttributeDefinition objects.
Definition: ExtendedAttributeDefinitionCollection.h:75
System::SharedPtr< ExtendedAttributeDefinition > idx_get(int32_t index) const override
Returns the element at the specified index.
int32_t IndexOf(const System::SharedPtr< ExtendedAttributeDefinition > &item) const override
Determines the index of the specified item in this collection.
typename iterator_holder_type::const_iterator const_iterator
Const iterator type.
Definition: ExtendedAttributeDefinitionCollection.h:97
int32_t get_Count() const override
Gets the number of elements contained in this collection.
System::SharedPtr< System::Collections::Generic::List< System::SharedPtr< ExtendedAttributeDefinition > > > ToList()
Converts this ExtendedAttributeDefinitionCollection object to a list containing instances of the Exte...
bool Remove(const System::SharedPtr< ExtendedAttributeDefinition > &item) override
Removes the first occurrence of a specific object from this collection.
typename iterator_holder_type::iterator iterator
Iterator type.
Definition: ExtendedAttributeDefinitionCollection.h:95
void Add(const System::SharedPtr< ExtendedAttributeDefinition > &item) override
Adds the specified item to this collection.
const System::SharedPtr< Project > & get_ParentProject() const
Gets a parent project for the ExtendedAttributeDefinitionCollection instance. returns a parent projec...
void idx_set(int32_t index, System::SharedPtr< ExtendedAttributeDefinition > value) override
Sets the element at the specified index.
System::Collections::Generic::List< System::SharedPtr< ExtendedAttributeDefinition > > iterator_holder_type
A collection type whose iterator types is used as iterator types in the current collection.
Definition: ExtendedAttributeDefinitionCollection.h:93
void RemoveAt(int32_t index) override
Removes an item at the specified index.
bool get_IsReadOnly() const override
Gets a value indicating whether this collection is read-only.
System::SharedPtr< ExtendedAttributeDefinition > GetById(int32_t id)
Returns an extended attribute definition by id
void Clear() override
Removes all items from this collection.
bool Contains(const System::SharedPtr< ExtendedAttributeDefinition > &item) const override
Returns true if the specified item is found in this collection; otherwise, false.
void Insert(int32_t index, const System::SharedPtr< ExtendedAttributeDefinition > &item) override
Inserts the specified item at the specified index.
System::SharedPtr< System::Collections::Generic::IEnumerator< System::SharedPtr< ExtendedAttributeDefinition > > > GetEnumerator() override
Returns an enumerator for this collection.
void CopyTo(System::ArrayPtr< System::SharedPtr< ExtendedAttributeDefinition >> array, int32_t arrayIndex) override
Copies the elements of this collection to the specified array, starting at the specified array index.
typename iterator_holder_type::virtualized_iterator virtualized_iterator
Virtualized type.
Definition: ExtendedAttributeDefinitionCollection.h:101
typename iterator_holder_type::virtualized_iterator_element virtualized_iterator_element
Virtualized element type.
Definition: ExtendedAttributeDefinitionCollection.h:99
Represents an extended attribute definition associated with a project.
Definition: ExtendedAttributeDefinition.h:182
Represents a project.
Definition: Project.h:552
Definition: Asn.h:13