Aspose.Tasks for C++
CalendarCollection.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="CalendarCollection.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2024 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/collections/ilist.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 Calendar;
19 namespace Connectivity
20 {
21 class MpdReader;
22 class MspDbReader;
23 class PrimaveraDbReader;
24 } // namespace Connectivity
25 class IdGenerator;
26 namespace IO
27 {
28 namespace Html
29 {
30 class HtmlCalendarTableReader;
31 } // namespace Html
32 namespace Mpx
33 {
34 class MpxReader;
35 } // namespace Mpx
36 namespace MSProject
37 {
38 class Mpp12CalendarWriter;
39 class MPP12Reader;
40 class MPP14Reader;
41 class Mpp9CalendarWriter;
42 class MPP9Reader;
43 class MPPProjectPropsReader;
44 class MPPReader;
45 } // namespace MSProject
46 namespace PrimaveraXml
47 {
48 class PrimaveraReader;
49 } // namespace PrimaveraXml
50 namespace Pwa
51 {
52 namespace InternalApi
53 {
54 namespace Mapping
55 {
56 class CalendarToRawValuesMapper;
57 class ProjectCalendarsMapper;
58 class ProjectResourcesMapper;
59 class ProjectRootMapper;
60 } // namespace Mapping
61 } // namespace InternalApi
62 } // namespace Pwa
63 namespace Xer
64 {
65 class XerPrimaveraReader;
66 class XerProjectNormalizer;
67 } // namespace Xer
68 namespace Xml
69 {
70 class XmlReader;
71 } // namespace Xml
72 } // namespace IO
73 class Project;
74 } // namespace Tasks
75 } // namespace Aspose
76 namespace System
77 {
78 namespace Collections
79 {
80 namespace Generic
81 {
82 template <typename, typename> class IDictionary;
83 template <typename> class IEnumerable;
84 template <typename> class IEnumerator;
85 template <typename> class List;
86 } // namespace Generic
87 } // namespace Collections
88 } // namespace System
89 
90 namespace Aspose {
91 
92 namespace Tasks {
93 
94 /// <summary>
95 /// Represents a collection of <see cref="Calendar"></see> objects.
96 /// </summary>
97 class ASPOSE_TASKS_SHARED_CLASS CalendarCollection : public System::Collections::Generic::IList<System::SharedPtr<Aspose::Tasks::Calendar>>
98 {
100  typedef System::Collections::Generic::IList<System::SharedPtr<Aspose::Tasks::Calendar>> BaseType;
101 
102  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
103  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
104 
105  friend class Aspose::Tasks::IO::PrimaveraXml::PrimaveraReader;
106  friend class Aspose::Tasks::Project;
107  friend class Aspose::Tasks::IO::Pwa::InternalApi::Mapping::CalendarToRawValuesMapper;
108  friend class Aspose::Tasks::IO::Pwa::InternalApi::Mapping::ProjectRootMapper;
109  friend class Aspose::Tasks::Connectivity::MpdReader;
110  friend class Aspose::Tasks::Connectivity::MspDbReader;
111  friend class Aspose::Tasks::Connectivity::PrimaveraDbReader;
112  friend class Aspose::Tasks::IO::Html::HtmlCalendarTableReader;
113  friend class Aspose::Tasks::IO::MSProject::MPP12Reader;
114  friend class Aspose::Tasks::IO::MSProject::MPPReader;
115  friend class Aspose::Tasks::IO::MSProject::MPP14Reader;
116  friend class Aspose::Tasks::IO::MSProject::MPP9Reader;
117  friend class Aspose::Tasks::IO::MSProject::MPPProjectPropsReader;
118  friend class Aspose::Tasks::IO::MSProject::Mpp12CalendarWriter;
119  friend class Aspose::Tasks::IO::MSProject::Mpp9CalendarWriter;
120  friend class Aspose::Tasks::IO::Mpx::MpxReader;
121  friend class Aspose::Tasks::IO::Xer::XerPrimaveraReader;
122  friend class Aspose::Tasks::IO::Xer::XerProjectNormalizer;
123  friend class Aspose::Tasks::IO::Pwa::InternalApi::Mapping::ProjectCalendarsMapper;
124  friend class Aspose::Tasks::IO::Pwa::InternalApi::Mapping::ProjectResourcesMapper;
125  friend class Aspose::Tasks::IO::Xml::XmlReader;
126 
127 public:
128 
129  /// <summary>
130  /// Gets the number of objects contained in this <see cref="CalendarCollection"></see> object.
131  /// </summary>
132  ASPOSE_TASKS_SHARED_API int32_t get_Count() const override;
133 
134  /// <summary>
135  /// Returns an enumerator for this collection.
136  /// </summary>
137  /// <returns>an enumerator for this collection.</returns>
138  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<Calendar>>> GetEnumerator() override;
139  /// <summary>
140  /// Adds a new base calendar to this CalendarCollection object and returns added calendar.
141  /// </summary>
142  /// <param name="name">Calendar name.</param>
143  /// <returns>Added <see cref="Calendar"></see> object.</returns>
144  /// <exception cref="ArgumentException">Thrown when calendar name is null.</exception>
145  ASPOSE_TASKS_SHARED_API System::SharedPtr<Calendar> Add(const System::String& name);
146  /// <summary>
147  /// Adds a new calendar with specified base calendar to this CalendarCollection object and returns added calendar.
148  /// </summary>
149  /// <param name="name">Specified name.</param>
150  /// <param name="baseCalendar">Specified base calendar.</param>
151  /// <returns>Added <see cref="Calendar"></see> object.</returns>
152  ASPOSE_TASKS_SHARED_API System::SharedPtr<Calendar> Add(const System::String& name, const System::SharedPtr<Calendar>& baseCalendar);
153  /// <summary>
154  /// Converts the CalendarCollection object to a list of <see cref="Calendar"></see> objects.
155  /// </summary>
156  /// <returns>List of <see cref="Calendar"></see> objects.</returns>
157  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<Calendar>>> ToList();
158  /// <summary>
159  /// Returns a calendar with the specified UID.
160  /// </summary>
161  /// <param name="uid">UID of a calendar.</param>
162  /// <returns>Calendar with a specified UID.</returns>
163  ASPOSE_TASKS_SHARED_API System::SharedPtr<Calendar> GetByUid(int32_t uid);
164  /// <summary>
165  /// Returns a calendar with the specified name.
166  /// </summary>
167  /// <param name="name">Name of a calendar.</param>
168  /// <returns>If found returns calendar with a specified name else returns null.</returns>
169  ASPOSE_TASKS_SHARED_API System::SharedPtr<Calendar> GetByName(const System::String& name);
170  /// <summary>
171  /// Removes Calendar from Project CalendarCollection.
172  /// </summary>
173  /// <param name="item">The calendar to remove.</param>
174  /// <exception cref="InvalidOperationException">Thrown when calendar cannot be removed.</exception>
175  /// <returns>If removed returns true, else returns false.</returns>
176  ASPOSE_TASKS_SHARED_API bool Remove(const System::SharedPtr<Calendar>& item) override;
177 
178 protected:
179 
180  ASPOSE_TASKS_SHARED_API const System::SharedPtr<Project>& get_ParentProject() const;
181 
182  ASPOSE_TASKS_SHARED_API CalendarCollection(const System::SharedPtr<Project>& parentProject);
183 
184  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(CalendarCollection, CODEPORTING_ARGS(const System::SharedPtr<Project>& parentProject));
185 
186  ASPOSE_TASKS_SHARED_API CalendarCollection(const System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<Calendar>>>& calendars, const System::SharedPtr<Project>& parentProject);
187 
188  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(CalendarCollection, CODEPORTING_ARGS(const System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<Calendar>>>& calendars, const System::SharedPtr<Project>& parentProject));
189  /// <summary>
190  /// Returns a calendar with the specified <see cref="System::Guid"></see>.
191  /// </summary>
192  /// <param name="calendarGuid">The globally unique identifier of a calendar.</param>
193  /// <returns>Calendar with a specified globally unique identifier.</returns>
194  ASPOSE_TASKS_SHARED_API System::SharedPtr<Calendar> GetByGuid(const System::String& calendarGuid);
195  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::IDictionary<int32_t, System::SharedPtr<Calendar>>> AsDictionary();
196  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<Calendar>>> GetCalendarsToWrite();
197  ASPOSE_TASKS_SHARED_API void AddInternal(const System::SharedPtr<Calendar>& calendar);
198 
199  virtual ASPOSE_TASKS_SHARED_API ~CalendarCollection();
200 
201  #ifdef ASPOSE_GET_SHARED_MEMBERS
202  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
203  #endif
204 
205 
206 private:
207 
208  System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<Calendar>>> calendars;
209  System::SharedPtr<IdGenerator> uidGenerator;
210  System::SharedPtr<Calendar> zeroResourceCalendar;
211  System::WeakPtr<Project> pr_ParentProject;
212 
213  ASPOSE_TASKS_SHARED_API void set_ParentProject(const System::SharedPtr<Project>& value);
214  bool get_IsReadOnly() const override;
215 
216  System::SharedPtr<Calendar> idx_get(int32_t index) const override;
217  void idx_set(int32_t index, System::SharedPtr<Calendar> value) override;
218 
219  void Add(const System::SharedPtr<Calendar>& item) override;
220  void Insert(int32_t index, const System::SharedPtr<Calendar>& item) override;
221  void Clear() override;
222  bool Contains(const System::SharedPtr<Calendar>& item) const override;
223  void CopyTo(System::ArrayPtr<System::SharedPtr<Calendar>> array, int32_t arrayIndex) override;
224  int32_t IndexOf(const System::SharedPtr<Calendar>& item) const override;
225  void RemoveAt(int32_t index) override;
226  int32_t OrderByUid(const System::SharedPtr<Calendar>& x, const System::SharedPtr<Calendar>& y);
227  void SetCalendars(const System::SharedPtr<System::Collections::Generic::IEnumerable<System::SharedPtr<Calendar>>>& list, const System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<Calendar>>>& innerCollection);
228  void Init(const System::SharedPtr<System::Collections::Generic::IEnumerable<System::SharedPtr<Calendar>>>& list, const System::SharedPtr<Project>& inParentProject);
229  void PrepareToRemove(const System::SharedPtr<Calendar>& item);
230  System::SharedPtr<Calendar> ValidateItem(const System::SharedPtr<Calendar>& item);
231 
232 };
233 
234 } // namespace Tasks
235 } // namespace Aspose
236 
237 
Represents a collection of Calendar objects.
Definition: CalendarCollection.h:98
System::SharedPtr< Calendar > Add(const System::String &name, const System::SharedPtr< Calendar > &baseCalendar)
Adds a new calendar with specified base calendar to this CalendarCollection object and returns added ...
System::SharedPtr< Calendar > Add(const System::String &name)
Adds a new base calendar to this CalendarCollection object and returns added calendar.
bool Remove(const System::SharedPtr< Calendar > &item) override
Removes Calendar from Project CalendarCollection.
System::SharedPtr< Calendar > GetByName(const System::String &name)
Returns a calendar with the specified name.
System::SharedPtr< System::Collections::Generic::List< System::SharedPtr< Calendar > > > ToList()
Converts the CalendarCollection object to a list of Calendar objects.
System::SharedPtr< System::Collections::Generic::IEnumerator< System::SharedPtr< Calendar > > > GetEnumerator() override
Returns an enumerator for this collection.
int32_t get_Count() const override
Gets the number of objects contained in this CalendarCollection object.
System::SharedPtr< Calendar > GetByUid(int32_t uid)
Returns a calendar with the specified UID.
Represents a project.
Definition: Project.h:552
Definition: Asn.h:13