Samchon Framework for CPP  1.0.0
Datetime.hpp
1 #pragma once
2 #include <samchon/API.hpp>
3 
4 #include <samchon/library/Date.hpp>
5 
6 namespace samchon
7 {
8 namespace library
9 {
19  class SAMCHON_FRAMEWORK_API Datetime
20  : public Date
21  {
22  private:
23  typedef Date super;
24 
25  public:
26  /* --------------------------------------------------------------------------
27  CONSTRUCTORS
28  -------------------------------------------------------------------------- */
34  Datetime();
35 
39  Datetime(const std::chrono::system_clock::time_point&);
40 
44  Datetime(std::chrono::system_clock::time_point&&);
45 
58  Datetime(int year, int month, int date, int hour = 0, int min = 0, int sec = 0);
59 
66  Datetime(const std::string &);
67 
74  Datetime(const WeakString &);
75 
81  Datetime(long long linuxTime);
82  virtual ~Datetime() = default;
83 
90  void set(const std::string &);
91 
98  virtual void set(const WeakString &) override;
99 
103  void set(int year, int month, int date, int hours = 0, int minutes = 0, int seconds = 0);
104 
108  void set(long long linuxTime);
109 
110  /* --------------------------------------------------------------------------
111  SETTERS
112  -------------------------------------------------------------------------- */
113  //SETTERS
117  virtual void setYear(int);
118 
122  virtual void setMonth(int);
123 
127  virtual void setDate(int);
128 
135  void setHour(int);
136 
143  void setMinute(int);
150  void setSecond(int);
151 
152  //ADDERS
156  virtual void addYear(int) override;
157 
161  virtual void addMonth(int) override;
162 
166  virtual void addWeek(int) override;
167 
171  virtual void addDate(int) override;
172 
184  void addHour(int);
196  void addMinute(int);
197 
210  void addSecond(int);
211 
212  /* --------------------------------------------------------------------------
213  GETTERS
214  -------------------------------------------------------------------------- */
220  auto getHour() const -> int;
226  auto getMinute() const -> int;
232  auto getSecond() const -> int;
233 
234  /* --------------------------------------------------------------------------
235  EXPORTERS
236  -------------------------------------------------------------------------- */
242  virtual auto toString() const->std::string override;
243  };
244 };
245 };
Date (year, month, day in month)
Definition: Date.hpp:37
Top level namespace of products built from samchon.
Definition: ByteArray.hpp:7
A string class only references characeters, reference only.
Definition: WeakString.hpp:32