Aspose.Tasks for C++
ICalendar.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="ICalendar.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2025 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/object.h>
9 
10 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
11 
12 namespace Aspose
13 {
14 namespace Tasks
15 {
16 class Duration;
17 class Task;
18 class WorkingTimeCollection;
19 class WorkUnit;
20 } // namespace Tasks
21 } // namespace Aspose
22 namespace System
23 {
24 class DateTime;
25 class TimeSpan;
26 } // namespace System
27 
28 namespace Aspose {
29 
30 namespace Tasks {
31 
32 /// <summary>
33 /// Represents a calendar abstraction which can be used for various calculations of dates and durations.
34 /// </summary>
35 class ASPOSE_TASKS_SHARED_CLASS ICalendar : public virtual System::Object
36 {
37  typedef ICalendar ThisType;
38  typedef System::Object BaseType;
39 
40  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
41  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
42 
43 public:
44 
45  /// <summary>
46  /// Returns start date based on the specified finish date and duration.
47  /// </summary>
48  /// <param name="finish">The specified finish date.</param>
49  /// <param name="duration">The specified duration.</param>
50  /// <returns>Calculated start date.</returns>
51  virtual System::DateTime GetStartDateFromFinishAndDuration(System::DateTime finish, Duration duration) = 0;
52  /// <summary>
53  /// Returns start date based on specified finish date and duration.
54  /// </summary>
55  /// <param name="finish">The specified finish date.</param>
56  /// <param name="duration">The specified duration.</param>
57  /// <returns>Calculated start date.</returns>
58  virtual System::DateTime GetStartDateFromFinishAndDuration(System::DateTime finish, System::TimeSpan duration) = 0;
59  /// <summary>
60  /// Determines whether the specified day is a working day according to the calendar.
61  /// </summary>
62  /// <param name="dt">The date to check whether the day is working.</param>
63  /// <returns>True if the day is a working day.</returns>
64  virtual bool IsDayWorking(System::DateTime dt) = 0;
65  /// <summary>
66  /// Returns WorkUnit - Start, Finish and Duration of working hours for the specified date time interval.
67  /// </summary>
68  /// <param name="start">Start date of the interval.</param>
69  /// <param name="finish">Finish date of the interval.</param>
70  /// <returns>Instance of <see cref="WorkUnit"></see> class containing Start, Finish and Duration of working hours.</returns>
71  virtual System::SharedPtr<WorkUnit> GetWorkingHours(System::DateTime start, System::DateTime finish) = 0;
72  /// <summary>
73  /// Returns the amount of working hours at the specified date.
74  /// </summary>
75  /// <param name="dt">The date to get working hours for.</param>
76  /// <returns>Working hours at the specified date.</returns>
77  virtual System::TimeSpan GetWorkingHours(System::DateTime dt) = 0;
78  /// <summary>
79  /// Returns amount of working hours between the specified dates.
80  /// </summary>
81  /// <param name="start">Start date of the interval.</param>
82  /// <param name="finish">Finish date of the interval.</param>
83  /// <returns>Amount of working hours according to the calendar instance.</returns>
84  virtual System::TimeSpan GetWorkingHoursTimeSpan(System::DateTime start, System::DateTime finish) = 0;
85  /// <summary>
86  /// Calculates the date when the specified amount of work time will pass according to the calendar.
87  /// </summary>
88  /// <param name="start">Start date.</param>
89  /// <param name="work">Work duration.</param>
90  /// <returns>Finish date.</returns>
91  virtual System::DateTime GetFinishDateByStartAndWork(System::DateTime start, Duration work) = 0;
92  /// <summary>
93  /// Calculates the date when the specified amount of work time will pass according to the calendar.
94  /// </summary>
95  /// <param name="start">Start date.</param>
96  /// <param name="work">Work duration.</param>
97  /// <returns>Finish date.</returns>
98  virtual System::DateTime GetFinishDateByStartAndWork(System::DateTime start, System::TimeSpan work) = 0;
99  /// <summary>
100  /// Calculates the task finish date and time from its start date, split parts and the work duration.
101  /// </summary>
102  /// <param name="task">The task to calculate finish date for.</param>
103  /// <param name="duration">The duration to calculate.</param>
104  /// <returns>Task's finish date for the given start date and duration.</returns>
105  /// <remarks>Returns DateTime.MinValue if task is summary, null or its start date is not set.</remarks>
106  virtual System::DateTime GetTaskFinishDateFromDuration(System::SharedPtr<Task> task, System::TimeSpan duration) = 0;
107  /// <summary>
108  /// Returns <see cref="WorkingTimeCollection"></see> of working times for the specified date.
109  /// </summary>
110  /// <param name="dt">The date to get working times for.</param>
111  /// <returns>Collection of <see cref="WorkingTime"></see> instances.</returns>
112  virtual System::SharedPtr<WorkingTimeCollection> GetWorkingTimes(System::DateTime dt) = 0;
113  /// <summary>
114  /// Calculates the end of the previous working date from the specified date.
115  /// </summary>
116  /// <param name="date">the date to calculate the previous working day end.</param>
117  /// <returns>The end of the previous working day end</returns>
118  virtual System::DateTime GetPreviousWorkingDayEnd(System::DateTime date) = 0;
119  /// <summary>
120  /// Calculates next working day start for the specified date.
121  /// </summary>
122  /// <param name="date">The date to get next working day start for.</param>
123  /// <returns>Next working day start <see cref="System::DateTime"></see>.</returns>
124  virtual System::DateTime GetNextWorkingDayStart(System::DateTime date) = 0;
125  /// <summary>
126  /// Calculates next working time start beginning from the specified date and time.
127  /// </summary>
128  /// <param name="date">The date and time.</param>
129  /// <returns>The nearest working time start.</returns>
130  virtual System::DateTime GetWorkStart(System::DateTime date) = 0;
131  /// <summary>
132  /// Returns whether the calendar doesn't have working hours defined.
133  /// </summary>
134  virtual bool IsEmpty() = 0;
135 
136 };
137 
138 } // namespace Tasks
139 } // namespace Aspose
140 
141 
Definition: Asn.h:12
Represents duration in a project.
Definition: Duration.h:161
Represents a calendar abstraction which can be used for various calculations of dates and durations.
Definition: ICalendar.h:35