Aspose.Tasks for C++
GroupCollection.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="GroupCollection.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2025 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/collections/icollection.h>
9 #include <system/array.h>
10 #include <cstdint>
11 
12 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
13 
14 namespace Aspose
15 {
16 namespace Tasks
17 {
18 class Group;
19 namespace IO
20 {
21 namespace MSProject
22 {
23 class MppGroupWriter;
24 class MPPReader;
25 class MppViewWriter;
26 } // namespace MSProject
27 } // namespace IO
28 class Project;
29 namespace Saving
30 {
31 class TemplateProjectLoader;
32 } // namespace Saving
33 } // namespace Tasks
34 } // namespace Aspose
35 namespace System
36 {
37 namespace Collections
38 {
39 namespace Generic
40 {
41 template <typename> class IEnumerator;
42 template <typename> class List;
43 template <typename, typename> class SortedList;
44 } // namespace Generic
45 } // namespace Collections
46 } // namespace System
47 
48 namespace Aspose {
49 
50 namespace Tasks {
51 
52 /// <summary>
53 /// Contains a list of <see cref="Group"></see> objects.
54 /// Implements ICollection&lt;Group&gt; interface.
55 /// </summary>
56 class ASPOSE_TASKS_SHARED_CLASS GroupCollection : public System::Collections::Generic::ICollection<System::SharedPtr<Aspose::Tasks::Group>>
57 {
58  typedef GroupCollection ThisType;
59  typedef System::Collections::Generic::ICollection<System::SharedPtr<Aspose::Tasks::Group>> BaseType;
60 
61  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
62  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
63 
64  friend class Aspose::Tasks::IO::MSProject::MppGroupWriter;
65  friend class Aspose::Tasks::Project;
66  friend class Aspose::Tasks::Saving::TemplateProjectLoader;
67  friend class Aspose::Tasks::IO::MSProject::MPPReader;
68  friend class Aspose::Tasks::IO::MSProject::MppViewWriter;
69 
70 public:
71 
72  /// <summary>
73  /// Gets the number of elements contained in this collection.
74  /// </summary>
75  ASPOSE_TASKS_SHARED_API int32_t get_Count() const override;
76  /// <summary>
77  /// Gets a value indicating whether this collection is read-only.
78  /// </summary>
79  ASPOSE_TASKS_SHARED_API bool get_IsReadOnly() const override;
80 
81  /// <summary>
82  /// Returns an enumerator for this collection.
83  /// </summary>
84  /// <returns>an enumerator for this collection.</returns>
85  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<Group>>> GetEnumerator() override;
86  /// <summary>
87  /// Adds the specified item to this collection.
88  /// </summary>
89  /// <param name="item">the specified item to add to this collection.</param>
90  ASPOSE_TASKS_SHARED_API void Add(const System::SharedPtr<Group>& item) override;
91  /// <summary>
92  /// Removes all items from this collection.
93  /// </summary>
94  ASPOSE_TASKS_SHARED_API void Clear() override;
95  /// <summary>
96  /// Returns true if the specified item is found in this collection; otherwise, false.
97  /// </summary>
98  /// <param name="item">the specified item to find.</param>
99  /// <returns>true if the specified item is found in this collection; otherwise, false.</returns>
100  ASPOSE_TASKS_SHARED_API bool Contains(const System::SharedPtr<Group>& item) const override;
101  /// <summary>
102  /// Copies the elements of this collection to the specified array, starting at the specified array index.
103  /// </summary>
104  /// <param name="array">the specified one-dimensional array to copy elements to</param>
105  /// <param name="arrayIndex">the zero-based index of the specified array at which copying begins.</param>
106  ASPOSE_TASKS_SHARED_API void CopyTo(System::ArrayPtr<System::SharedPtr<Group>> array, int32_t arrayIndex) override;
107  /// <summary>
108  /// Removes the first occurrence of a specific object from this collection.
109  /// </summary>
110  /// <param name="item">the specified object to remove.</param>
111  /// <returns>true if the specified object was successfully removed from this collection; otherwise, false.</returns>
112  ASPOSE_TASKS_SHARED_API bool Remove(const System::SharedPtr<Group>& item) override;
113  /// <summary>
114  /// Converts a group collection to a list of <see cref="Group"></see> objects.
115  /// </summary>
116  /// <returns>Generic list of <see cref="Group"></see> objects.</returns>
117  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<Group>>> ToList();
118 
119 protected:
120 
121  /// <summary>
122  /// Initializes a new instance of the <see cref="GroupCollection"></see> class.
123  /// </summary>
124  ASPOSE_TASKS_SHARED_API GroupCollection();
125 
126  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(GroupCollection, CODEPORTING_ARGS());
127  ASPOSE_TASKS_SHARED_API void AddInternal(const System::SharedPtr<Group>& item);
128  ASPOSE_TASKS_SHARED_API System::SharedPtr<Group> GetByName(const System::String& groupName);
129  ASPOSE_TASKS_SHARED_API System::SharedPtr<Group> GetFirstOrDefault();
130  ASPOSE_TASKS_SHARED_API void RebuildIndex();
131 
132  virtual ASPOSE_TASKS_SHARED_API ~GroupCollection();
133 
134  #ifdef ASPOSE_GET_SHARED_MEMBERS
135  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
136  #endif
137 
138 
139 private:
140 
141  System::SharedPtr<System::Collections::Generic::SortedList<int32_t, System::SharedPtr<Group>>> groups;
142 
143 };
144 
145 } // namespace Tasks
146 } // namespace Aspose
147 
148 
Definition: Asn.h:12
Represents a project.
Definition: Project.h:550
Contains a list of Group objects. Implements ICollection<Group> interface.
Definition: GroupCollection.h:56