Aspose.Tasks for C++
WeekDay.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="WeekDay.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2024 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/date_time.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 enum class DayType;
20 namespace IO
21 {
22 namespace Html
23 {
24 class HtmlCalendarTableReader;
25 } // namespace Html
26 namespace Xer
27 {
28 class XerCalendarReader;
29 } // namespace Xer
30 } // namespace IO
31 class WeekDayCollection;
32 class WorkingTime;
33 class WorkingTimeCollection;
34 } // namespace Tasks
35 } // namespace Aspose
36 namespace System
37 {
38 namespace Collections
39 {
40 namespace Generic
41 {
42 template <typename> class IEnumerable;
43 } // namespace Generic
44 } // namespace Collections
45 enum class DayOfWeek;
46 class EventArgs;
47 namespace Text
48 {
49 class StringBuilder;
50 } // namespace Text
51 class TimeSpan;
52 } // namespace System
53 
54 namespace Aspose {
55 
56 namespace Tasks {
57 
58 /// <summary>
59 /// Represents a weekday which either defines regular days of a week or exception days in a calendar.
60 /// </summary>
61 class ASPOSE_TASKS_SHARED_CLASS WeekDay : public System::Object
62 {
63  typedef WeekDay ThisType;
64  typedef System::Object BaseType;
65 
66  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
67  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
68 
69  friend class Aspose::Tasks::Calendar;
70  friend class Aspose::Tasks::IO::Xer::XerCalendarReader;
72  friend class Aspose::Tasks::IO::Html::HtmlCalendarTableReader;
73 
74 public:
75 
76  /// <summary>
77  /// Gets the type of a day.
78  /// </summary>
79  ASPOSE_TASKS_SHARED_API Aspose::Tasks::DayType get_DayType() const;
80  /// <summary>
81  /// Gets a value indicating whether the specified date or day type is working.
82  /// </summary>
83  ASPOSE_TASKS_SHARED_API bool get_DayWorking() const;
84  /// <summary>
85  /// Sets a value indicating whether the specified date or day type is working.
86  /// </summary>
87  ASPOSE_TASKS_SHARED_API void set_DayWorking(bool value);
88  /// <summary>
89  /// Gets the beginning of an exception time.
90  /// </summary>
91  ASPOSE_TASKS_SHARED_API System::DateTime get_FromDate() const;
92  /// <summary>
93  /// Sets the beginning of an exception time.
94  /// </summary>
95  ASPOSE_TASKS_SHARED_API void set_FromDate(System::DateTime value);
96  /// <summary>
97  /// Gets the end of an exception time.
98  /// </summary>
99  ASPOSE_TASKS_SHARED_API System::DateTime get_ToDate() const;
100  /// <summary>
101  /// Sets the end of an exception time.
102  /// </summary>
103  ASPOSE_TASKS_SHARED_API void set_ToDate(System::DateTime value);
104  /// <summary>
105  /// Gets WorkingTimeCollection for this WeekDay instance.
106  /// The collection of working times that define the time worked on the weekday.
107  /// </summary>
108  ASPOSE_TASKS_SHARED_API System::SharedPtr<WorkingTimeCollection> get_WorkingTimes() const;
109 
110  /// <summary>
111  /// Initializes a new instance of the <see cref="WeekDay"></see> class with the specified day type.
112  /// </summary>
113  /// <param name="dayType">The specified day type.</param>
114  ASPOSE_TASKS_SHARED_API WeekDay(Aspose::Tasks::DayType dayType);
115  /// <summary>
116  /// Initializes a new instance of the <see cref="WeekDay"></see> class with the specified day type and list of working time periods.
117  /// </summary>
118  /// <param name="dayType">The specified day type.</param>
119  /// <param name="workingTimes">List of working time periods.</param>
120  ASPOSE_TASKS_SHARED_API WeekDay(Aspose::Tasks::DayType dayType, const System::SharedPtr<System::Collections::Generic::IEnumerable<System::SharedPtr<WorkingTime>>>& workingTimes);
121  /// <summary>
122  /// Initializes a new instance of the <see cref="WeekDay"></see> class with the specified day type and working time periods.
123  /// </summary>
124  /// <param name="dayType">The specified day type.</param>
125  /// <param name="workingTimes">Array of working time periods.</param>
126  ASPOSE_TASKS_SHARED_API WeekDay(Aspose::Tasks::DayType dayType, const System::ArrayPtr<System::SharedPtr<WorkingTime>>& workingTimes);
127  /// <summary>
128  /// Initializes a new instance of the <see cref="WeekDay"></see> class.
129  /// </summary>
130  ASPOSE_TASKS_SHARED_API WeekDay();
131 
132  /// <summary>
133  /// Creates default working day.
134  /// </summary>
135  /// <param name="dayType">The day type to create default working day from.</param>
136  /// <returns>A default working day with working times 8-12 and 13-17.</returns>
137  static ASPOSE_TASKS_SHARED_API System::SharedPtr<WeekDay> CreateDefaultWorkingDay(Aspose::Tasks::DayType dayType);
138  /// <summary>
139  /// Casts .Net's <see cref="DayOfWeek"></see> to <see cref="DayType"></see>.
140  /// </summary>
141  /// <param name="dw">The day of week to cast from.</param>
142  /// <returns>A cast day type.</returns>
143  static ASPOSE_TASKS_SHARED_API Aspose::Tasks::DayType CastToDayType(System::DayOfWeek dw);
144  /// <summary>
145  /// Sets default time periods for the specified week day.
146  /// </summary>
147  /// <param name="day">The week day to set default working day on.</param>
148  static ASPOSE_TASKS_SHARED_API void SetDefaultWorkingTime(const System::SharedPtr<WeekDay>& day);
149  /// <summary>
150  /// Returns the working time for a week day.
151  /// </summary>
152  /// <returns>Working time.</returns>
153  ASPOSE_TASKS_SHARED_API System::TimeSpan GetWorkingTime();
154  /// <summary>
155  /// Returns a deep copy of the week day.
156  /// </summary>
157  /// <returns>Returns the deep copy of the week day.</returns>
158  ASPOSE_TASKS_SHARED_API System::SharedPtr<WeekDay> Clone();
159  /// <summary>
160  /// Returns a value indicating whether this instance is equal to a specified object.
161  /// </summary>
162  /// <param name="obj">The object to compare with this instance.</param>
163  /// <returns><b>True</b> if the specified object is a WeekDay that has the same FromDate, ToDate values and WorkingTimes as this instance; otherwise, <b>false</b>.</returns>
164  ASPOSE_TASKS_SHARED_API bool Equals(System::SharedPtr<System::Object> obj) override;
165  /// <summary>
166  /// Returns a hash code value for the instance of the <see cref="WeekDay"></see> class.
167  /// </summary>
168  /// <returns>returns a hash code value for this object.</returns>
169  ASPOSE_TASKS_SHARED_API int32_t GetHashCode() const override;
170 
171 protected:
172 
173  ASPOSE_TASKS_SHARED_API double get_WorkingMinsCount();
174 
175  ASPOSE_TASKS_SHARED_API WeekDay(int32_t dayType);
176 
177  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(WeekDay, CODEPORTING_ARGS(int32_t dayType));
178  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Text::StringBuilder> Dump(const System::SharedPtr<System::Text::StringBuilder>& sb);
179  #ifdef ASPOSE_GET_SHARED_MEMBERS
180  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
181  #endif
182 
183 
184 private:
185 
186  System::SharedPtr<WorkingTimeCollection> workingTimes;
187  bool dayWorking;
188  Aspose::Tasks::DayType pr_DayType;
189 
190  /// <summary>
191  /// Gets the type of a day.
192  /// </summary>
193  ASPOSE_TASKS_SHARED_API void set_DayType(Aspose::Tasks::DayType value);
194 
195  System::DateTime pr_FromDate;
196  System::DateTime pr_ToDate;
197 
198  System::String get_DebuggerDisplay();
199 
200  void WorkingTimesOnCollectionChanged(const System::SharedPtr<System::Object>& sender, const System::SharedPtr<System::EventArgs>& e);
201 
202 };
203 
204 } // namespace Tasks
205 } // namespace Aspose
206 
207 
Represents a collection of WeekDay objects.
Definition: WeekDayCollection.h:75
Represents a weekday which either defines regular days of a week or exception days in a calendar...
Definition: WeekDay.h:61
Represents a calendar used in a project.
Definition: Calendar.h:297