Aspose.Tasks for C++
ExtendedAttributeCollection.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="ExtendedAttributeCollection.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/collections/icomparer.h>
11 #include <system/array.h>
12 #include <cstdint>
13 
14 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
15 
16 namespace Aspose
17 {
18 namespace Tasks
19 {
20 class ExtendedAttribute;
21 class IExtendedAttributeParent;
22 namespace IO
23 {
24 namespace Mpx
25 {
26 class MpxUtils;
27 } // namespace Mpx
28 namespace Xml
29 {
30 class ResourceAssignmentNodeReader;
31 class ResourceAssignmentNodeWriter;
32 class ResourceNodeReader;
33 class TaskNodeReader;
34 } // namespace Xml
35 } // namespace IO
36 class Resource;
37 class ResourceAssignment;
38 namespace Rollup
39 {
40 class AverageFirstSublevelRollupCalculator;
41 class AverageRollupCalculator;
42 class MinMaxRollupCalculator;
43 template <typename> class RollupCalculatorBase;
44 } // namespace Rollup
45 class Task;
46 namespace Util
47 {
48 class CalculatedExtendedAttributeUtils;
49 class EnsureExtendedAttribute;
50 namespace Fields
51 {
52 class FieldHelperInternal;
53 } // namespace Fields
54 } // namespace Util
55 namespace Visualization
56 {
57 template <typename> class FieldToColumnText;
58 } // namespace Visualization
59 } // namespace Tasks
60 } // namespace Aspose
61 namespace System
62 {
63 namespace Collections
64 {
65 namespace Generic
66 {
67 template <typename> class IEnumerator;
68 } // namespace Generic
69 } // namespace Collections
70 } // namespace System
71 
72 namespace Aspose {
73 
74 namespace Tasks {
75 
76 /// <summary>
77 /// Represents a collection of <see cref="ExtendedAttribute"></see> objects.
78 /// </summary>
79 class ASPOSE_TASKS_SHARED_CLASS ExtendedAttributeCollection : public System::Collections::Generic::IList<System::SharedPtr<Aspose::Tasks::ExtendedAttribute>>
80 {
82  typedef System::Collections::Generic::IList<System::SharedPtr<Aspose::Tasks::ExtendedAttribute>> BaseType;
83 
84  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
85  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
86 
87  friend class Aspose::Tasks::Resource;
89  friend class Aspose::Tasks::Task;
90  friend class Aspose::Tasks::IO::Mpx::MpxUtils;
91  friend class Aspose::Tasks::IO::Xml::ResourceAssignmentNodeReader;
92  friend class Aspose::Tasks::IO::Xml::ResourceAssignmentNodeWriter;
93  friend class Aspose::Tasks::IO::Xml::ResourceNodeReader;
94  friend class Aspose::Tasks::IO::Xml::TaskNodeReader;
95  friend class Aspose::Tasks::Rollup::AverageFirstSublevelRollupCalculator;
96  friend class Aspose::Tasks::Rollup::AverageRollupCalculator;
97  template<typename FT0> friend class Aspose::Tasks::Rollup::RollupCalculatorBase;
98  friend class Aspose::Tasks::Rollup::MinMaxRollupCalculator;
99  friend class Aspose::Tasks::Util::CalculatedExtendedAttributeUtils;
100  friend class Aspose::Tasks::Util::EnsureExtendedAttribute;
101  friend class Aspose::Tasks::Util::Fields::FieldHelperInternal;
102  template<typename FT0> friend class Aspose::Tasks::Visualization::FieldToColumnText;
103 
104 public:
105  /// A collection type whose iterator types is used as iterator types in the current collection.
106  using iterator_holder_type = System::Collections::Generic::List<System::SharedPtr<ExtendedAttribute>>;
107  /// Iterator type.
108  using iterator = typename iterator_holder_type::iterator;
109  /// Const iterator type.
110  using const_iterator = typename iterator_holder_type::const_iterator;
111  /// Virtualized element type.
112  using virtualized_iterator_element = typename iterator_holder_type::virtualized_iterator_element;
113  /// Virtualized type.
114  using virtualized_iterator = typename iterator_holder_type::virtualized_iterator;
115 
116 private:
117 
118  class FieldIdComparer final : public System::Collections::Generic::IComparer<System::SharedPtr<Aspose::Tasks::ExtendedAttribute>>
119  {
120  typedef FieldIdComparer ThisType;
121  typedef System::Collections::Generic::IComparer<System::SharedPtr<Aspose::Tasks::ExtendedAttribute>> BaseType;
122 
123  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
124  RTTI_INFO_DECL();
125 
126  public:
127 
128  /// <summary>Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.</summary>
129  /// <param name="x">The first object to compare.</param>
130  /// <param name="y">The second object to compare.</param>
131  /// <returns>A signed integer that indicates the relative values of <paramref name="x" ></paramref> and <paramref name="y" ></paramref>, as shown in the following table.Value Meaning Less than zero
132  /// <paramref name="x" ></paramref> is less than <paramref name="y" ></paramref>.Zero
133  /// <paramref name="x" ></paramref> equals <paramref name="y" ></paramref>.Greater than zero
134  /// <paramref name="x" ></paramref> is greater than <paramref name="y" ></paramref>.</returns>
135  int32_t Compare(const System::SharedPtr<ExtendedAttribute>& x, const System::SharedPtr<ExtendedAttribute>& y) const override;
136 
137  };
138 
139 
140 public:
141 
142  /// <summary>
143  /// Gets the number of elements contained in this collection.
144  /// </summary>
145  ASPOSE_TASKS_SHARED_API int32_t get_Count() const override;
146  /// <summary>
147  /// Gets a value indicating whether this collection is read-only; otherwise, false.
148  /// </summary>
149  ASPOSE_TASKS_SHARED_API bool get_IsReadOnly() const override;
150 
151  /// <summary>
152  /// Gets the element at the specified index.
153  /// </summary>
154  /// <param name="index">The zero-based index of the element to get or set.</param>
155  /// <returns>the element at the specified index.</returns>
156  ASPOSE_TASKS_SHARED_API System::SharedPtr<ExtendedAttribute> idx_get(int32_t index) const override;
157  /// <summary>
158  /// Sets the element at the specified index.
159  /// </summary>
160  /// <param name="index">The zero-based index of the element to get or set.</param>
161  /// <param name="value">the element at the specified index.</param>
162  ASPOSE_TASKS_SHARED_API void idx_set(int32_t index, System::SharedPtr<ExtendedAttribute> value) override;
163 
164  /// <summary>
165  /// Returns an enumerator for this collection.
166  /// </summary>
167  /// <returns>an enumerator for this collection.</returns>
168  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<ExtendedAttribute>>> GetEnumerator() override;
169  /// <summary>
170  /// Adds the specified item to this collection.
171  /// </summary>
172  /// <param name="item">the specified item to add to this collection.</param>
173  ASPOSE_TASKS_SHARED_API void Add(const System::SharedPtr<ExtendedAttribute>& item) override;
174  /// <summary>
175  /// Removes all items from this collection.
176  /// </summary>
177  ASPOSE_TASKS_SHARED_API void Clear() override;
178  /// <summary>
179  /// Returns true if the specified item is found in this collection; otherwise, false.
180  /// </summary>
181  /// <param name="item">the specified item to find.</param>
182  /// <returns>true if the specified item is found in this collection; otherwise, false.</returns>
183  ASPOSE_TASKS_SHARED_API bool Contains(const System::SharedPtr<ExtendedAttribute>& item) const override;
184  /// <summary>
185  /// Copies the elements of this collection to the specified array, starting at the specified array index.
186  /// </summary>
187  /// <param name="array">the specified one-dimensional array to copy elements to</param>
188  /// <param name="arrayIndex">the zero-based index of the specified array at which copying begins.</param>
189  ASPOSE_TASKS_SHARED_API void CopyTo(System::ArrayPtr<System::SharedPtr<ExtendedAttribute>> array, int32_t arrayIndex) override;
190  /// <summary>
191  /// Removes the first occurrence of a specific object from this collection.
192  /// </summary>
193  /// <param name="item">the specified object to remove.</param>
194  /// <returns>true if the specified object was successfully removed from this collection; otherwise, false.</returns>
195  ASPOSE_TASKS_SHARED_API bool Remove(const System::SharedPtr<ExtendedAttribute>& item) override;
196  /// <summary>
197  /// Determines the index of the specified item in this collection.
198  /// </summary>
199  /// <param name="item">the specified item to locate in this collection.</param>
200  /// <returns>the index of the specified item if found; otherwise, -1.</returns>
201  ASPOSE_TASKS_SHARED_API int32_t IndexOf(const System::SharedPtr<ExtendedAttribute>& item) const override;
202  /// <summary>
203  /// Inserts the specified item at the specified index.
204  /// </summary>
205  /// <param name="index">the specified zero-based index at which the item should be inserted.</param>
206  /// <param name="item">the specified item to insert to this collection.</param>
207  ASPOSE_TASKS_SHARED_API void Insert(int32_t index, const System::SharedPtr<ExtendedAttribute>& item) override;
208  /// <summary>
209  /// Removes an item at the specified index.
210  /// </summary>
211  /// <param name="index">the specified zero-based index to remove an item at.</param>
212  ASPOSE_TASKS_SHARED_API void RemoveAt(int32_t index) override;
213  /// Gets iterator pointing to the first element (if any) of the collection.
214  /// @return An iterator pointing to the first element (if any) of the collection
215  ASPOSE_TASKS_SHARED_API iterator begin() noexcept;
216  /// Gets iterator pointing right after the last element (if any) of the collection.
217  /// @return An iterator pointing right after the last element (if any) of the collection
218  ASPOSE_TASKS_SHARED_API iterator end() noexcept;
219  /// Gets iterator pointing to the first element (if any) of the const-qualified instance of the collection.
220  /// @return An iterator pointing to the first element (if any) of the const-qualified instance of the collection
221  ASPOSE_TASKS_SHARED_API const_iterator begin() const noexcept;
222  /// Gets iterator pointing right after the last element (if any) of the const-qualified instance of the collection.
223  /// @return An iterator pointing right after the last element (if any) of the const-qualified instance of the collection
224  ASPOSE_TASKS_SHARED_API const_iterator end() const noexcept;
225  /// Gets iterator pointing to the first const-qualified element (if any) of the collection.
226  /// @return An iterator pointing to the first const-qualified element (if any) of the collection
227  ASPOSE_TASKS_SHARED_API const_iterator cbegin() const noexcept;
228  /// Gets iterator pointing right after the last const-qualified element (if any) of the collection.
229  /// @return An iterator pointing right after the last const-qualified element (if any) of the collection
230  ASPOSE_TASKS_SHARED_API const_iterator cend() const noexcept;
231  /// Gets iterator pointing to the first element (if any) of the collection.
232  /// @return An iterator pointing to the first element (if any) of the collection
233  /// Provides iterator implementation to container's first element.
234  /// @return Newly-created iterator object.
235  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeBeginIterator() override;
236  /// Gets iterator pointing right after the last element (if any) of the collection.
237  /// @return An iterator pointing right after the last element (if any) of the collection
238  /// Provides iterator implementation to container's end.
239  /// @return Newly-created iterator object.
240  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeEndIterator() override;
241  /// Gets iterator pointing to the first element (if any)of the const-qualified instance of the collection.
242  /// @return An iterator pointing to the first element (if any)of the const-qualified instance of the collection
243  /// Provides const iterator implementation to container's first element.
244  /// @return Newly-created iterator object.
245  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeBeginConstIterator() const override;
246  /// Gets iterator pointing right after the last element (if any)of the const-qualified instance of the collection.
247  /// @return An iterator pointing right after the last element (if any)of the const-qualified instance of the collection
248  /// Provides const iterator implementation to container's end.
249  /// @return Newly-created iterator object.
250  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeEndConstIterator() const override;
251 
252 protected:
253 
254  ASPOSE_TASKS_SHARED_API ExtendedAttributeCollection(const System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<ExtendedAttribute>>>& extendedAttributes, const System::SharedPtr<IExtendedAttributeParent>& parent);
255 
256  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(ExtendedAttributeCollection, CODEPORTING_ARGS(const System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<ExtendedAttribute>>>& extendedAttributes, const System::SharedPtr<IExtendedAttributeParent>& parent));
257 
258  ASPOSE_TASKS_SHARED_API ExtendedAttributeCollection(const System::SharedPtr<IExtendedAttributeParent>& parent);
259 
260  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(ExtendedAttributeCollection, CODEPORTING_ARGS(const System::SharedPtr<IExtendedAttributeParent>& parent));
261  ASPOSE_TASKS_SHARED_API void Sort();
262  ASPOSE_TASKS_SHARED_API System::SharedPtr<ExtendedAttribute> GetByFieldId(int32_t fieldId);
263  ASPOSE_TASKS_SHARED_API System::SharedPtr<ExtendedAttribute> GetByFieldId(const System::String& fieldId);
264  ASPOSE_TASKS_SHARED_API void SetCapacity(int32_t capacity);
265 
266  virtual ASPOSE_TASKS_SHARED_API ~ExtendedAttributeCollection();
267 
268  #ifdef ASPOSE_GET_SHARED_MEMBERS
269  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
270  #endif
271 
272 
273 private:
274 
275  System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<ExtendedAttribute>>> extendedAttributes;
276  System::WeakPtr<IExtendedAttributeParent> parent;
277 
278  void Init();
279 
280 };
281 
282 } // namespace Tasks
283 } // namespace Aspose
284 
285 
Represents a collection of ExtendedAttribute objects.
Definition: ExtendedAttributeCollection.h:80
System::SharedPtr< System::Collections::Generic::IEnumerator< System::SharedPtr< ExtendedAttribute > > > GetEnumerator() override
Returns an enumerator for this collection.
void Add(const System::SharedPtr< ExtendedAttribute > &item) override
Adds the specified item to this collection.
void Insert(int32_t index, const System::SharedPtr< ExtendedAttribute > &item) override
Inserts the specified item at the specified index.
bool get_IsReadOnly() const override
Gets a value indicating whether this collection is read-only; otherwise, false.
int32_t IndexOf(const System::SharedPtr< ExtendedAttribute > &item) const override
Determines the index of the specified item in this collection.
void idx_set(int32_t index, System::SharedPtr< ExtendedAttribute > value) override
Sets the element at the specified index.
typename iterator_holder_type::iterator iterator
Iterator type.
Definition: ExtendedAttributeCollection.h:108
typename iterator_holder_type::const_iterator const_iterator
Const iterator type.
Definition: ExtendedAttributeCollection.h:110
typename iterator_holder_type::virtualized_iterator virtualized_iterator
Virtualized type.
Definition: ExtendedAttributeCollection.h:114
void RemoveAt(int32_t index) override
Removes an item at the specified index.
System::SharedPtr< ExtendedAttribute > idx_get(int32_t index) const override
Gets the element at the specified index.
int32_t get_Count() const override
Gets the number of elements contained in this collection.
void Clear() override
Removes all items from this collection.
void CopyTo(System::ArrayPtr< System::SharedPtr< ExtendedAttribute >> array, int32_t arrayIndex) override
Copies the elements of this collection to the specified array, starting at the specified array index.
bool Remove(const System::SharedPtr< ExtendedAttribute > &item) override
Removes the first occurrence of a specific object from this collection.
typename iterator_holder_type::virtualized_iterator_element virtualized_iterator_element
Virtualized element type.
Definition: ExtendedAttributeCollection.h:112
bool Contains(const System::SharedPtr< ExtendedAttribute > &item) const override
Returns true if the specified item is found in this collection; otherwise, false.
System::Collections::Generic::List< System::SharedPtr< ExtendedAttribute > > iterator_holder_type
A collection type whose iterator types is used as iterator types in the current collection.
Definition: ExtendedAttributeCollection.h:106
Represents extended attributes.
Definition: ExtendedAttribute.h:138
Represents a resource assignment in a project.
Definition: ResourceAssignment.h:222
Represents a resource in a project.
Definition: Resource.h:207
Represents a task in a project.
Definition: Task.h:384
Definition: Asn.h:13