Aspose.Tasks for C++
CalendarException.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="CalendarException.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2024 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/string.h>
9 #include <system/date_time.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 class CalendarExceptionCalculator;
20 class CalendarExceptionCollection;
21 class CalendarExceptionCollectionWithCache;
22 class CalendarExceptionDatesCalculator;
23 enum class CalendarExceptionType;
24 class DayTypeCollection;
25 namespace IO
26 {
27 namespace Html
28 {
29 class HtmlCalendarExceptionsReader;
30 } // namespace Html
31 namespace MSProject
32 {
33 class Mpp12CalendarWriter;
34 class Mpp12ExceptionReader;
35 } // namespace MSProject
36 namespace Xml
37 {
38 class ExceptionNodeReader;
39 class ExceptionNodeWriter;
40 } // namespace Xml
41 } // namespace IO
42 enum class Month;
43 enum class MonthItemType;
44 enum class MonthPosition;
45 namespace Saving
46 {
47 class HtmlCalendarExceptionTable;
48 } // namespace Saving
49 class TimeScaledExceptions;
50 class WorkingTimeCollection;
51 } // namespace Tasks
52 } // namespace Aspose
53 namespace System
54 {
55 namespace Collections
56 {
57 namespace Generic
58 {
59 template <typename> class IEnumerable;
60 } // namespace Generic
61 } // namespace Collections
62 class TimeSpan;
63 } // namespace System
64 
65 namespace Aspose {
66 
67 namespace Tasks {
68 
69 /// <summary>
70 /// Represent exceptional time periods in a calendar.
71 /// </summary>
72 class ASPOSE_TASKS_SHARED_CLASS CalendarException final : public System::Object
73 {
75  typedef System::Object BaseType;
76 
77  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
78  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
79 
80  friend class Aspose::Tasks::Calendar;
81  friend class Aspose::Tasks::CalendarExceptionCalculator;
83  friend class Aspose::Tasks::CalendarExceptionCollectionWithCache;
84  friend class Aspose::Tasks::CalendarExceptionDatesCalculator;
85  friend class Aspose::Tasks::IO::Html::HtmlCalendarExceptionsReader;
86  friend class Aspose::Tasks::IO::MSProject::Mpp12ExceptionReader;
87  friend class Aspose::Tasks::IO::MSProject::Mpp12CalendarWriter;
88  friend class Aspose::Tasks::IO::Xml::ExceptionNodeReader;
89  friend class Aspose::Tasks::IO::Xml::ExceptionNodeWriter;
90  friend class Aspose::Tasks::Saving::HtmlCalendarExceptionTable;
91  friend class Aspose::Tasks::TimeScaledExceptions;
92 
93 public:
94 
95  /// <summary>
96  /// Gets a value indicating whether the range of recurrence is defined by entering a number of occurrences.
97  /// False specifies that the range of recurrence is defined by entering a finish date.
98  /// </summary>
99  ASPOSE_TASKS_SHARED_API bool get_EnteredByOccurrences() const;
100  /// <summary>
101  /// Sets a value indicating whether the range of recurrence is defined by entering a number of occurrences.
102  /// False specifies that the range of recurrence is defined by entering a finish date.
103  /// </summary>
104  ASPOSE_TASKS_SHARED_API void set_EnteredByOccurrences(bool value);
105  /// <summary>
106  /// Gets the beginning of the exception time.
107  /// </summary>
108  ASPOSE_TASKS_SHARED_API System::DateTime get_FromDate() const;
109  /// <summary>
110  /// Sets the beginning of the exception time.
111  /// </summary>
112  ASPOSE_TASKS_SHARED_API void set_FromDate(System::DateTime value);
113  /// <summary>
114  /// Gets the end of the exception time.
115  /// </summary>
116  ASPOSE_TASKS_SHARED_API System::DateTime get_ToDate() const;
117  /// <summary>
118  /// Sets the end of the exception time.
119  /// </summary>
120  ASPOSE_TASKS_SHARED_API void set_ToDate(System::DateTime value);
121  /// <summary>
122  /// Gets the number of occurrences for which the calendar exception is valid.
123  /// </summary>
124  ASPOSE_TASKS_SHARED_API int32_t get_Occurrences() const;
125  /// <summary>
126  /// Sets the number of occurrences for which the calendar exception is valid.
127  /// </summary>
128  ASPOSE_TASKS_SHARED_API void set_Occurrences(int32_t value);
129  /// <summary>
130  /// Gets the name of the exception.
131  /// </summary>
132  ASPOSE_TASKS_SHARED_API System::String get_Name() const;
133  /// <summary>
134  /// Sets the name of the exception.
135  /// </summary>
136  ASPOSE_TASKS_SHARED_API void set_Name(const System::String& value);
137  /// <summary>
138  /// Gets the exception type.
139  /// </summary>
140  ASPOSE_TASKS_SHARED_API CalendarExceptionType get_Type() const;
141  /// <summary>
142  /// Sets the exception type.
143  /// </summary>
144  ASPOSE_TASKS_SHARED_API void set_Type(CalendarExceptionType value);
145  /// <summary>
146  /// Gets the period of recurrence for the exception.
147  /// </summary>
148  ASPOSE_TASKS_SHARED_API int32_t get_Period() const;
149  /// <summary>
150  /// Sets the period of recurrence for the exception.
151  /// </summary>
152  ASPOSE_TASKS_SHARED_API void set_Period(int32_t value);
153  /// <summary>
154  /// Gets the DayTypeCollection for this object.
155  /// The days of the week on which the exception is valid.
156  /// </summary>
157  ASPOSE_TASKS_SHARED_API const System::SharedPtr<DayTypeCollection>& get_DaysOfWeek() const;
158  /// <summary>
159  /// Gets the month item for which an exception recurrence is scheduled.
160  /// </summary>
161  ASPOSE_TASKS_SHARED_API MonthItemType get_MonthItem() const;
162  /// <summary>
163  /// Sets the month item for which an exception recurrence is scheduled.
164  /// </summary>
165  ASPOSE_TASKS_SHARED_API void set_MonthItem(MonthItemType value);
166  /// <summary>
167  /// Gets the position of a month item within a month.
168  /// </summary>
169  ASPOSE_TASKS_SHARED_API Aspose::Tasks::MonthPosition get_MonthPosition() const;
170  /// <summary>
171  /// Sets the position of a month item within a month.
172  /// </summary>
173  ASPOSE_TASKS_SHARED_API void set_MonthPosition(Aspose::Tasks::MonthPosition value);
174  /// <summary>
175  /// Gets the month for which an exception recurrence is scheduled.
176  /// </summary>
177  ASPOSE_TASKS_SHARED_API Aspose::Tasks::Month get_Month() const;
178  /// <summary>
179  /// Sets the month for which an exception recurrence is scheduled.
180  /// </summary>
181  ASPOSE_TASKS_SHARED_API void set_Month(Aspose::Tasks::Month value);
182  /// <summary>
183  /// Gets the day of a month on which an exception recurrence is scheduled.
184  /// </summary>
185  ASPOSE_TASKS_SHARED_API int32_t get_MonthDay() const;
186  /// <summary>
187  /// Sets the day of a month on which an exception recurrence is scheduled.
188  /// </summary>
189  ASPOSE_TASKS_SHARED_API void set_MonthDay(int32_t value);
190  /// <summary>
191  /// Gets a value indicating whether the specified date or day type is working.
192  /// </summary>
193  ASPOSE_TASKS_SHARED_API bool get_DayWorking() const;
194  /// <summary>
195  /// Sets a value indicating whether the specified date or day type is working.
196  /// </summary>
197  ASPOSE_TASKS_SHARED_API void set_DayWorking(bool value);
198  /// <summary>
199  /// Gets the WorkingTimeCollection object.
200  /// The collection of working times that defines the time worked on the weekday.
201  /// <remarks>
202  /// At least one working time must present, and there can't be more than five.
203  /// </remarks>
204  /// </summary>
205  ASPOSE_TASKS_SHARED_API const System::SharedPtr<WorkingTimeCollection>& get_WorkingTimes() const;
206  /// <summary>
207  /// Sets the WorkingTimeCollection object.
208  /// The collection of working times that defines the time worked on the weekday.
209  /// <remarks>
210  /// At least one working time must present, and there can't be more than five.
211  /// </remarks>
212  /// </summary>
213  ASPOSE_TASKS_SHARED_API void set_WorkingTimes(const System::SharedPtr<WorkingTimeCollection>& value);
214  /// <summary>
215  /// Gets the parent calendar for this object.
216  /// </summary>
217  ASPOSE_TASKS_SHARED_API const System::SharedPtr<Calendar>& get_ParentCalendar() const;
218 
219  /// <summary>
220  /// Initializes a new instance of the <see cref="CalendarException"></see> class.
221  /// </summary>
222  ASPOSE_TASKS_SHARED_API CalendarException();
223 
224  /// <summary>
225  /// Deletes the Exception instance from parent calendar CalendarExceptionCollection object.
226  /// </summary>
227  ASPOSE_TASKS_SHARED_API void Delete();
228  /// <summary>
229  /// Returns true if the specified instance of the <see cref="DateTime"></see> struct is the exception day.
230  /// </summary>
231  /// <param name="dt">the specified instance of the <see cref="DateTime"></see> struct.</param>
232  /// <returns> Returns true if <see cref="DateTime"></see> value is the exception day; otherwise, false.</returns>
233  ASPOSE_TASKS_SHARED_API bool CheckException(System::DateTime dt);
234  /// <summary>
235  /// Returns the working time for a calendar exception.
236  /// </summary>
237  /// <returns>Returns working time for this calendar exception.</returns>
238  ASPOSE_TASKS_SHARED_API System::TimeSpan GetWorkingTime();
239  /// <summary>
240  /// Returns dates on which the calendar exception is applicable.
241  /// </summary>
242  /// <returns> Returns a collection of exception dates the calendar exception is applicable for.</returns>
243  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::IEnumerable<System::DateTime>> GetExceptionDates();
244 
245 protected:
246 
247  /// <summary>
248  /// Gets the DayTypeCollection for this object.
249  /// The days of the week on which the exception is valid.
250  /// </summary>
251  ASPOSE_TASKS_SHARED_API void set_DaysOfWeek(const System::SharedPtr<DayTypeCollection>& value);
252  /// <summary>
253  /// Gets the parent calendar for this object.
254  /// </summary>
255  ASPOSE_TASKS_SHARED_API void set_ParentCalendar(const System::SharedPtr<Calendar>& value);
256  ASPOSE_TASKS_SHARED_API bool get_IsImplicitWorkingTimeException() const;
257  ASPOSE_TASKS_SHARED_API bool get_IsUnresolvedTimephasedIntervalException() const;
258  ASPOSE_TASKS_SHARED_API void set_IsUnresolvedTimephasedIntervalException(bool value);
259  static ASPOSE_TASKS_SHARED_API System::SharedPtr<CalendarException> get_ImplicitWorkingTimeException();
260 
261  /// <summary>
262  /// Initializes a new instance of the <see cref="CalendarException"></see> class.
263  /// </summary>
264  ASPOSE_TASKS_SHARED_API CalendarException(const System::SharedPtr<WorkingTimeCollection>& workingTimeCollection);
265 
266  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(CalendarException, CODEPORTING_ARGS(const System::SharedPtr<WorkingTimeCollection>& workingTimeCollection));
267  static ASPOSE_TASKS_SHARED_API System::SharedPtr<CalendarException> CreateTimescaledWorkingIntervalException(System::DateTime start, System::TimeSpan end);
268  /// <summary>
269  /// Returns true if the specified instance of the <see cref="DateTime"></see> struct is the exception day.
270  /// </summary>
271  /// <param name="dt">the specified instance of the <see cref="DateTime"></see> struct.</param>
272  /// <returns>Returns true if <see cref="DateTime"></see> value is the exception day; otherwise, false.</returns>
273  ASPOSE_TASKS_SHARED_API bool CheckExceptionOnDate(System::DateTime dt);
274 
275  virtual ASPOSE_TASKS_SHARED_API ~CalendarException();
276 
277  #ifdef ASPOSE_GET_SHARED_MEMBERS
278  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
279  #endif
280 
281 
282 private:
283 
284  static const int32_t MaxNameLength;
285  int32_t occurrences;
286  System::String name;
287  bool isImplicitWorkingTimeException;
288 
289  static System::SharedPtr<CalendarException>& implicitWorkingTimeExceptionInstance();
290 
291  bool pr_EnteredByOccurrences;
292  System::DateTime pr_FromDate;
293  System::DateTime pr_ToDate;
294  CalendarExceptionType pr_Type;
295  int32_t pr_Period;
296  System::SharedPtr<DayTypeCollection> pr_DaysOfWeek;
297  MonthItemType pr_MonthItem;
298  Aspose::Tasks::MonthPosition pr_MonthPosition;
299  Aspose::Tasks::Month pr_Month;
300  int32_t pr_MonthDay;
301  bool pr_DayWorking;
302  System::SharedPtr<WorkingTimeCollection> pr_WorkingTimes;
303  System::WeakPtr<Calendar> pr_ParentCalendar;
304  bool pr_IsUnresolvedTimephasedIntervalException;
305 
306 };
307 
308 } // namespace Tasks
309 } // namespace Aspose
310 
311 
Represents a collection of CalendarException objects.
Definition: CalendarExceptionCollection.h:57
Represent exceptional time periods in a calendar.
Definition: CalendarException.h:73
void set_DayWorking(bool value)
Sets a value indicating whether the specified date or day type is working.
CalendarException()
Initializes a new instance of the CalendarException class.
MonthItemType get_MonthItem() const
Gets the month item for which an exception recurrence is scheduled.
void set_Month(Aspose::Tasks::Month value)
Sets the month for which an exception recurrence is scheduled.
System::SharedPtr< System::Collections::Generic::IEnumerable< System::DateTime > > GetExceptionDates()
Returns dates on which the calendar exception is applicable.
void set_Type(CalendarExceptionType value)
Sets the exception type.
bool get_EnteredByOccurrences() const
Gets a value indicating whether the range of recurrence is defined by entering a number of occurrence...
System::String get_Name() const
Gets the name of the exception.
const System::SharedPtr< WorkingTimeCollection > & get_WorkingTimes() const
Gets the WorkingTimeCollection object. The collection of working times that defines the time worked o...
System::DateTime get_ToDate() const
Gets the end of the exception time.
Aspose::Tasks::MonthPosition get_MonthPosition() const
Gets the position of a month item within a month.
Aspose::Tasks::Month get_Month() const
Gets the month for which an exception recurrence is scheduled.
System::TimeSpan GetWorkingTime()
Returns the working time for a calendar exception.
void set_WorkingTimes(const System::SharedPtr< WorkingTimeCollection > &value)
Sets the WorkingTimeCollection object. The collection of working times that defines the time worked o...
System::DateTime get_FromDate() const
Gets the beginning of the exception time.
void set_MonthPosition(Aspose::Tasks::MonthPosition value)
Sets the position of a month item within a month.
int32_t get_Period() const
Gets the period of recurrence for the exception.
void set_Occurrences(int32_t value)
Sets the number of occurrences for which the calendar exception is valid.
void set_EnteredByOccurrences(bool value)
Sets a value indicating whether the range of recurrence is defined by entering a number of occurrence...
const System::SharedPtr< DayTypeCollection > & get_DaysOfWeek() const
Gets the DayTypeCollection for this object. The days of the week on which the exception is valid.
void set_Name(const System::String &value)
Sets the name of the exception.
bool get_DayWorking() const
Gets a value indicating whether the specified date or day type is working.
void set_ToDate(System::DateTime value)
Sets the end of the exception time.
void Delete()
Deletes the Exception instance from parent calendar CalendarExceptionCollection object.
int32_t get_MonthDay() const
Gets the day of a month on which an exception recurrence is scheduled.
void set_MonthDay(int32_t value)
Sets the day of a month on which an exception recurrence is scheduled.
bool CheckException(System::DateTime dt)
Returns true if the specified instance of the DateTime struct is the exception day.
const System::SharedPtr< Calendar > & get_ParentCalendar() const
Gets the parent calendar for this object.
int32_t get_Occurrences() const
Gets the number of occurrences for which the calendar exception is valid.
CalendarExceptionType get_Type() const
Gets the exception type.
void set_MonthItem(MonthItemType value)
Sets the month item for which an exception recurrence is scheduled.
void set_Period(int32_t value)
Sets the period of recurrence for the exception.
void set_FromDate(System::DateTime value)
Sets the beginning of the exception time.
Represents a calendar used in a project.
Definition: Calendar.h:298
Definition: Asn.h:13