Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: xfa/src/fgas/include/fx_datetime.h

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/src/fgas/include/fx_cpg.h ('k') | xfa/src/fgas/include/fx_fnt.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef _FX_DATETIME_H_ 7 #ifndef _FX_DATETIME_H_
8 #define _FX_DATETIME_H_ 8 #define _FX_DATETIME_H_
9 class CFX_Unitime; 9 class CFX_Unitime;
10 class CFX_DateTime; 10 class CFX_DateTime;
11 typedef FX_INT64» FX_UNITIME; 11 typedef int64_t»FX_UNITIME;
12 enum FX_WEEKDAY { 12 enum FX_WEEKDAY {
13 FX_Sunday = 0, 13 FX_Sunday = 0,
14 FX_Monday , 14 FX_Monday ,
15 FX_Tuesday , 15 FX_Tuesday ,
16 FX_Wednesday , 16 FX_Wednesday ,
17 FX_Thursday , 17 FX_Thursday ,
18 FX_Friday , 18 FX_Friday ,
19 FX_Saturday , 19 FX_Saturday ,
20 }; 20 };
21 FX_BOOL»» FX_IsLeapYear(FX_INT32 iYear); 21 FX_BOOL»» FX_IsLeapYear(int32_t iYear);
22 FX_INT32» FX_DaysInYear(FX_INT32 iYear); 22 int32_t»FX_DaysInYear(int32_t iYear);
23 FX_BYTE»» FX_DaysInMonth(FX_INT32 iYear, FX_BYTE iMonth); 23 uint8_t»» FX_DaysInMonth(int32_t iYear, uint8_t iMonth);
24 class CFX_Unitime 24 class CFX_Unitime
25 { 25 {
26 public: 26 public:
27 CFX_Unitime() 27 CFX_Unitime()
28 { 28 {
29 m_iUnitime = 0; 29 m_iUnitime = 0;
30 } 30 }
31 CFX_Unitime(FX_UNITIME iUnitime) 31 CFX_Unitime(FX_UNITIME iUnitime)
32 { 32 {
33 m_iUnitime = iUnitime; 33 m_iUnitime = iUnitime;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 m_iUnitime -= t.m_iUnitime; 77 m_iUnitime -= t.m_iUnitime;
78 return *this; 78 return *this;
79 } 79 }
80 CFX_Unitime& operator -= (FX_UNITIME t) 80 CFX_Unitime& operator -= (FX_UNITIME t)
81 { 81 {
82 m_iUnitime -= t; 82 m_iUnitime -= t;
83 return *this; 83 return *this;
84 } 84 }
85 void Now(); 85 void Now();
86 void SetGMTime(); 86 void SetGMTime();
87 void» » » Set(FX_INT32 year, FX_BYTE month, FX_BYTE day, F X_BYTE hour = 0, FX_BYTE minute = 0, FX_BYTE second = 0, FX_WORD millisecond = 0 ); 87 void» » » Set(int32_t year, uint8_t month, uint8_t day, ui nt8_t hour = 0, uint8_t minute = 0, uint8_t second = 0, FX_WORD millisecond = 0) ;
88 void Set(FX_UNITIME t); 88 void Set(FX_UNITIME t);
89 FX_INT32» » GetYear() const; 89 int32_t» » GetYear() const;
90 FX_BYTE» » » GetMonth() const; 90 uint8_t» » » GetMonth() const;
91 FX_BYTE» » » GetDay() const; 91 uint8_t» » » GetDay() const;
92 FX_WEEKDAY GetDayOfWeek() const; 92 FX_WEEKDAY GetDayOfWeek() const;
93 FX_WORD GetDayOfYear() const; 93 FX_WORD GetDayOfYear() const;
94 FX_INT64» » GetDayOfAD() const; 94 int64_t» » GetDayOfAD() const;
95 FX_BYTE» » » GetHour() const; 95 uint8_t» » » GetHour() const;
96 FX_BYTE» » » GetMinute() const; 96 uint8_t» » » GetMinute() const;
97 FX_BYTE» » » GetSecond() const; 97 uint8_t» » » GetSecond() const;
98 FX_WORD GetMillisecond() const; 98 FX_WORD GetMillisecond() const;
99 FX_BOOL» » » AddYears(FX_INT32 iYears); 99 FX_BOOL» » » AddYears(int32_t iYears);
100 FX_BOOL» » » AddMonths(FX_INT32 iMonths); 100 FX_BOOL» » » AddMonths(int32_t iMonths);
101 FX_BOOL» » » AddDays(FX_INT32 iDays); 101 FX_BOOL» » » AddDays(int32_t iDays);
102 FX_BOOL» » » AddHours(FX_INT32 iHours); 102 FX_BOOL» » » AddHours(int32_t iHours);
103 FX_BOOL» » » AddMinutes(FX_INT32 iMinutes); 103 FX_BOOL» » » AddMinutes(int32_t iMinutes);
104 FX_BOOL» » » AddSeconds(FX_INT32 iSeconds); 104 FX_BOOL» » » AddSeconds(int32_t iSeconds);
105 FX_BOOL» » » AddMilliseconds(FX_INT32 iMilliseconds); 105 FX_BOOL» » » AddMilliseconds(int32_t iMilliseconds);
106 friend CFX_Unitime operator + (const CFX_Unitime &t1, const CFX_Unitime &t2 ) 106 friend CFX_Unitime operator + (const CFX_Unitime &t1, const CFX_Unitime &t2 )
107 { 107 {
108 return CFX_Unitime(t1.m_iUnitime + t2.m_iUnitime); 108 return CFX_Unitime(t1.m_iUnitime + t2.m_iUnitime);
109 } 109 }
110 friend CFX_Unitime operator + (const CFX_Unitime &t1, FX_UNITIME t2) 110 friend CFX_Unitime operator + (const CFX_Unitime &t1, FX_UNITIME t2)
111 { 111 {
112 return CFX_Unitime(t1.m_iUnitime + t2); 112 return CFX_Unitime(t1.m_iUnitime + t2);
113 } 113 }
114 friend CFX_Unitime operator + (FX_UNITIME t1, const CFX_Unitime &t2) 114 friend CFX_Unitime operator + (FX_UNITIME t1, const CFX_Unitime &t2)
115 { 115 {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 { 199 {
200 return t1 <= t2.m_iUnitime; 200 return t1 <= t2.m_iUnitime;
201 } 201 }
202 private: 202 private:
203 FX_UNITIME m_iUnitime; 203 FX_UNITIME m_iUnitime;
204 }; 204 };
205 #if _FX_OS_ != _FX_ANDROID_ 205 #if _FX_OS_ != _FX_ANDROID_
206 #pragma pack(push, 1) 206 #pragma pack(push, 1)
207 #endif 207 #endif
208 typedef struct _FX_DATE { 208 typedef struct _FX_DATE {
209 FX_INT32» year; 209 int32_t» year;
210 FX_BYTE» » month; 210 uint8_t» » month;
211 FX_BYTE» » day; 211 uint8_t» » day;
212 } FX_DATE, * FX_LPDATE; 212 } FX_DATE, * FX_LPDATE;
213 typedef FX_DATE const * FX_LPCDATE; 213 typedef FX_DATE const * FX_LPCDATE;
214 typedef struct _FX_TIME { 214 typedef struct _FX_TIME {
215 FX_BYTE» » hour; 215 uint8_t» » hour;
216 FX_BYTE» » minute; 216 uint8_t» » minute;
217 FX_BYTE» » second; 217 uint8_t» » second;
218 FX_WORD millisecond; 218 FX_WORD millisecond;
219 } FX_TIME, * FX_LPTIME; 219 } FX_TIME, * FX_LPTIME;
220 typedef FX_TIME const * FX_LPCTIME; 220 typedef FX_TIME const * FX_LPCTIME;
221 typedef struct _FX_TIMEZONE { 221 typedef struct _FX_TIMEZONE {
222 FX_INT8» » tzHour; 222 int8_t» » tzHour;
223 FX_BYTE» » tzMinute; 223 uint8_t» » tzMinute;
224 } FX_TIMEZONE, * FX_LPTIMEZONE; 224 } FX_TIMEZONE, * FX_LPTIMEZONE;
225 typedef FX_TIMEZONE const * FX_LPCTIMEZONE; 225 typedef FX_TIMEZONE const * FX_LPCTIMEZONE;
226 typedef struct _FX_DATETIME { 226 typedef struct _FX_DATETIME {
227 union { 227 union {
228 struct { 228 struct {
229 FX_INT32» year; 229 int32_t» year;
230 FX_BYTE» » month; 230 uint8_t» » month;
231 FX_BYTE» » day; 231 uint8_t» » day;
232 } sDate; 232 } sDate;
233 FX_DATE aDate; 233 FX_DATE aDate;
234 } Date; 234 } Date;
235 union { 235 union {
236 struct { 236 struct {
237 FX_BYTE» » hour; 237 uint8_t» » hour;
238 FX_BYTE» » minute; 238 uint8_t» » minute;
239 FX_BYTE» » second; 239 uint8_t» » second;
240 FX_WORD millisecond; 240 FX_WORD millisecond;
241 } sTime; 241 } sTime;
242 FX_TIME aTime; 242 FX_TIME aTime;
243 } Time; 243 } Time;
244 } FX_DATETIME, * FX_LPDATETIME; 244 } FX_DATETIME, * FX_LPDATETIME;
245 typedef FX_DATETIME const * FX_LPCDATETIME; 245 typedef FX_DATETIME const * FX_LPCDATETIME;
246 typedef struct _FX_DATETIMEZONE { 246 typedef struct _FX_DATETIMEZONE {
247 union { 247 union {
248 struct { 248 struct {
249 union { 249 union {
250 struct { 250 struct {
251 FX_INT32» year; 251 int32_t» year;
252 FX_BYTE» » month; 252 uint8_t» » month;
253 FX_BYTE» » day; 253 uint8_t» » day;
254 }; 254 };
255 FX_DATE date; 255 FX_DATE date;
256 }; 256 };
257 union { 257 union {
258 struct { 258 struct {
259 FX_BYTE» » hour; 259 uint8_t» » hour;
260 FX_BYTE» » minute; 260 uint8_t» » minute;
261 FX_BYTE» » second; 261 uint8_t» » second;
262 FX_WORD millisecond; 262 FX_WORD millisecond;
263 }; 263 };
264 FX_TIME time; 264 FX_TIME time;
265 }; 265 };
266 }; 266 };
267 FX_DATETIME dt; 267 FX_DATETIME dt;
268 }; 268 };
269 union { 269 union {
270 struct { 270 struct {
271 FX_INT8» tzHour; 271 int8_t» tzHour;
272 FX_BYTE» tzMinute; 272 uint8_t» tzMinute;
273 }; 273 };
274 FX_TIMEZONE tz; 274 FX_TIMEZONE tz;
275 }; 275 };
276 } FX_DATETIMEZONE, * FX_LPDATETIMEZONE; 276 } FX_DATETIMEZONE, * FX_LPDATETIMEZONE;
277 typedef FX_DATETIMEZONE const * FX_LPCDATETIMEZONE; 277 typedef FX_DATETIMEZONE const * FX_LPCDATETIMEZONE;
278 #if _FX_OS_ != _FX_ANDROID_ 278 #if _FX_OS_ != _FX_ANDROID_
279 #pragma pack(pop) 279 #pragma pack(pop)
280 #endif 280 #endif
281 class CFX_DateTime 281 class CFX_DateTime
282 { 282 {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 CFX_DateTime& operator -= (const CFX_DateTime &dt) 329 CFX_DateTime& operator -= (const CFX_DateTime &dt)
330 { 330 {
331 FromUnitime(ToUnitime() - dt.ToUnitime()); 331 FromUnitime(ToUnitime() - dt.ToUnitime());
332 return *this; 332 return *this;
333 } 333 }
334 CFX_DateTime& operator -= (const FX_DATETIME &dt) 334 CFX_DateTime& operator -= (const FX_DATETIME &dt)
335 { 335 {
336 FromUnitime(ToUnitime() - ((const CFX_DateTime&)dt).ToUnitime()); 336 FromUnitime(ToUnitime() - ((const CFX_DateTime&)dt).ToUnitime());
337 return *this; 337 return *this;
338 } 338 }
339 virtual FX_BOOL» » » Set(FX_INT32 year, FX_BYTE month, FX_BYT E day, FX_BYTE hour = 0, FX_BYTE minute = 0, FX_BYTE second = 0, FX_WORD millise cond = 0); 339 virtual FX_BOOL» » » Set(int32_t year, uint8_t month, uint8_t day, uint8_t hour = 0, uint8_t minute = 0, uint8_t second = 0, FX_WORD millisec ond = 0);
340 virtual FX_BOOL FromUnitime(FX_UNITIME t); 340 virtual FX_BOOL FromUnitime(FX_UNITIME t);
341 virtual FX_UNITIME ToUnitime() const; 341 virtual FX_UNITIME ToUnitime() const;
342 virtual FX_INT32» » GetYear() const; 342 virtual int32_t» » GetYear() const;
343 virtual FX_BYTE» » » GetMonth() const; 343 virtual uint8_t» » » GetMonth() const;
344 virtual FX_BYTE» » » GetDay() const; 344 virtual uint8_t» » » GetDay() const;
345 virtual FX_WEEKDAY GetDayOfWeek() const; 345 virtual FX_WEEKDAY GetDayOfWeek() const;
346 virtual FX_WORD GetDayOfYear() const; 346 virtual FX_WORD GetDayOfYear() const;
347 virtual FX_INT64» » GetDayOfAD() const; 347 virtual int64_t» » GetDayOfAD() const;
348 virtual FX_BYTE» » » GetHour() const; 348 virtual uint8_t» » » GetHour() const;
349 virtual FX_BYTE» » » GetMinute() const; 349 virtual uint8_t» » » GetMinute() const;
350 virtual FX_BYTE» » » GetSecond() const; 350 virtual uint8_t» » » GetSecond() const;
351 virtual FX_WORD GetMillisecond() const; 351 virtual FX_WORD GetMillisecond() const;
352 virtual FX_BOOL» » » AddYears(FX_INT32 iYears); 352 virtual FX_BOOL» » » AddYears(int32_t iYears);
353 virtual FX_BOOL» » » AddMonths(FX_INT32 iMonths); 353 virtual FX_BOOL» » » AddMonths(int32_t iMonths);
354 virtual FX_BOOL» » » AddDays(FX_INT32 iDays); 354 virtual FX_BOOL» » » AddDays(int32_t iDays);
355 virtual FX_BOOL» » » AddHours(FX_INT32 iHours); 355 virtual FX_BOOL» » » AddHours(int32_t iHours);
356 virtual FX_BOOL» » » AddMinutes(FX_INT32 iMinutes); 356 virtual FX_BOOL» » » AddMinutes(int32_t iMinutes);
357 virtual FX_BOOL» » » AddSeconds(FX_INT32 iSeconds); 357 virtual FX_BOOL» » » AddSeconds(int32_t iSeconds);
358 virtual FX_BOOL» » » AddMilliseconds(FX_INT32 iMilliseconds); 358 virtual FX_BOOL» » » AddMilliseconds(int32_t iMilliseconds);
359 friend CFX_DateTime operator + (const CFX_DateTime &dt1, const CFX_DateTime &dt2) 359 friend CFX_DateTime operator + (const CFX_DateTime &dt1, const CFX_DateTime &dt2)
360 { 360 {
361 CFX_DateTime dt; 361 CFX_DateTime dt;
362 dt.FromUnitime(dt1.ToUnitime() + dt2.ToUnitime()); 362 dt.FromUnitime(dt1.ToUnitime() + dt2.ToUnitime());
363 return dt; 363 return dt;
364 } 364 }
365 friend CFX_DateTime operator + (const CFX_DateTime &dt1, const FX_DATETIME & dt2) 365 friend CFX_DateTime operator + (const CFX_DateTime &dt1, const FX_DATETIME & dt2)
366 { 366 {
367 CFX_DateTime dt; 367 CFX_DateTime dt;
368 dt.FromUnitime(dt1.ToUnitime() + ((const CFX_DateTime&)dt2).ToUnitime()) ; 368 dt.FromUnitime(dt1.ToUnitime() + ((const CFX_DateTime&)dt2).ToUnitime()) ;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 return dt1.ToUnitime() <= ((const CFX_DateTime&)dt2).ToUnitime(); 461 return dt1.ToUnitime() <= ((const CFX_DateTime&)dt2).ToUnitime();
462 } 462 }
463 friend FX_BOOL operator <= (const FX_DATETIME &dt1, con st CFX_DateTime &dt2) 463 friend FX_BOOL operator <= (const FX_DATETIME &dt1, con st CFX_DateTime &dt2)
464 { 464 {
465 return ((const CFX_DateTime&)dt1).ToUnitime() <= dt2.ToUnitime(); 465 return ((const CFX_DateTime&)dt1).ToUnitime() <= dt2.ToUnitime();
466 } 466 }
467 private: 467 private:
468 FX_DATETIME m_DateTime; 468 FX_DATETIME m_DateTime;
469 }; 469 };
470 #endif 470 #endif
OLDNEW
« no previous file with comments | « xfa/src/fgas/include/fx_cpg.h ('k') | xfa/src/fgas/include/fx_fnt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698