PDate.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PObject.h>
17 #include <PString.h>
18 
19 PAPILLON_BEGIN_NAMESPACE
20 
27 class PAPILLON_API_CORE PDate : public PObject
28 {
29 public:
35  PDate();
36 
40  PDate(const PDate& other);
41 
47  explicit PDate(papillon::int32 y, papillon::int32 m, papillon::int32 d);
48 
57  explicit PDate(const PString& ISOdate);
58 
62  virtual ~PDate();
63 
67  PDate& operator=(const PDate& other);
68 
72  static PDate Current();
73 
78  papillon::int32 GetDay() const;
79 
85  papillon::int32 GetMonth() const;
86 
92  papillon::int32 GetYear() const;
93 
98  void GetDate(papillon::int32* year, papillon::int32* month, papillon::int32* day);
99 
103  bool IsValid() const;
104 
111  PDate AddDays(papillon::int32 ndays) const;
112 
119  PDate AddMonths(papillon::int32 nmonths) const;
120 
127  PDate AddYears(papillon::int32 nyears) const;
128 
134  papillon::int32 GetDaysTo(const PDate& d) const;
135 
141  papillon::int32 Compare(const PDate& other) const;
142 
146  bool operator!=(const PDate& d) const;
147 
151  bool operator<(const PDate& d) const;
152 
156  bool operator<=(const PDate& d) const;
157 
161  bool operator==(const PDate& d) const;
162 
166  bool operator>(const PDate& d) const;
167 
171  bool operator>=(const PDate& d) const;
172 
198  PString ToString(const PString& format = PString("yyyy-MM-dd")) const;
199 
208  PString ToStringISO() const;
209 };
210 
211 PAPILLON_END_NAMESPACE
212 
The PString class provides an Unicode character strings.
Definition: PString.h:37
The PDate class provides a calendar date (year, month, and day numbers) in the Gregorian calendar; PD...
Definition: PDate.h:27
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
Class PString: an unicode character strings (use copy-on-write idiom).
PString ToString() const
Returns a string representation of this object.
Class PObject: the root class of all Papillon classes.
PObject & operator=(const PObject &obj)
Performs a shared copy of other to this object.
Definition: PObject.h:45