zipios  2.2.0
Zipios -- a small C++ library that provides easy access to .zip files.
dosdatetime.hpp
Go to the documentation of this file.
1 #pragma once
2 #ifndef ZIPIOS_DOSDATETIME_HPP
3 #define ZIPIOS_DOSDATETIME_HPP
4 
5 /*
6  Zipios -- a small C++ library that provides easy access to .zip files.
7 
8  Copyright (C) 2019 Made to Order Software Corporation
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 2.1 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24 
32 #include <cstdint>
33 #include <ctime>
34 
35 #include <time.h>
36 
37 
38 namespace zipios
39 {
40 
41 
42 
43 
45 {
46 public:
47  typedef uint32_t dosdatetime_t;
48 
49  static dosdatetime_t const g_min_dosdatetime = 0x00210000; // Jan 1, 1980 00:00:00
50  static dosdatetime_t const g_max_dosdatetime = 0xFF9FBF7D; // Dec 31, 2107 23:59:59
51 
52  bool isValid() const;
53  int daysInMonth() const;
54  int getSecond() const;
55  int getMinute() const;
56  int getHour() const;
57  int getMDay() const;
58  int getMonth() const;
59  int getYear() const;
60  void setSecond(int second);
61  void setMinute(int minute);
62  void setHour(int hour);
63  void setMDay(int mday);
64  void setMonth(int month);
65  void setYear(int year);
67  void setDOSDateTime(dosdatetime_t datetime);
68  void setUnixTimestamp(std::time_t unix_timestamp);
69  std::time_t getUnixTimestamp() const;
70 
71 protected:
73 };
74 
75 
76 
77 
78 } // zipios namespace
79 
80 // Local Variables:
81 // mode: cpp
82 // indent-tabs-mode: nil
83 // c-basic-offset: 4
84 // tab-width: 4
85 // End:
86 
87 // vim: ts=4 sw=4 et
88 #endif
zipios::DOSDateTime::setMonth
void setMonth(int month)
Set the month.
Definition: dosdatetime.cpp:433
zipios::DOSDateTime::getMinute
int getMinute() const
Get the minute.
Definition: dosdatetime.cpp:233
zipios::DOSDateTime::dosdatetime_t
uint32_t dosdatetime_t
Definition: dosdatetime.hpp:47
zipios::DOSDateTime::getYear
int getYear() const
Get the year.
Definition: dosdatetime.cpp:299
zipios::DOSDateTime::getUnixTimestamp
std::time_t getUnixTimestamp() const
Retrieve the DOSDateTime as a Unix timestamp.
Definition: dosdatetime.cpp:591
zipios::DOSDateTime::setMDay
void setMDay(int mday)
Set the day of the month.
Definition: dosdatetime.cpp:409
zipios::DOSDateTime
Definition: dosdatetime.hpp:45
zipios::DOSDateTime::getDOSDateTime
dosdatetime_t getDOSDateTime() const
Retrieve the DOSDateTime value as is.
Definition: dosdatetime.cpp:481
zipios::DOSDateTime::setYear
void setYear(int year)
Set the year.
Definition: dosdatetime.cpp:459
zipios::DOSDateTime::g_max_dosdatetime
static dosdatetime_t const g_max_dosdatetime
Definition: dosdatetime.hpp:50
zipios::DOSDateTime::getHour
int getHour() const
Get the hour.
Definition: dosdatetime.cpp:249
zipios::DOSDateTime::setSecond
void setSecond(int second)
Set the second.
Definition: dosdatetime.cpp:329
zipios::DOSDateTime::getMDay
int getMDay() const
Get the day of the month.
Definition: dosdatetime.cpp:267
zipios::DOSDateTime::setHour
void setHour(int hour)
Set the hour.
Definition: dosdatetime.cpp:379
zipios::DOSDateTime::isValid
bool isValid() const
Check whether this DOS Date & Date is valid.
Definition: dosdatetime.cpp:139
zipios::DOSDateTime::setMinute
void setMinute(int minute)
Set the minute.
Definition: dosdatetime.cpp:354
zipios::DOSDateTime::daysInMonth
int daysInMonth() const
Calculate the number of days in this date's month.
Definition: dosdatetime.cpp:173
zipios::DOSDateTime::m_dosdatetime
dosdatetime_t m_dosdatetime
Definition: dosdatetime.hpp:72
zipios::DOSDateTime::setDOSDateTime
void setDOSDateTime(dosdatetime_t datetime)
Set the DOSDateTime value as is.
Definition: dosdatetime.cpp:495
zipios::DOSDateTime::getMonth
int getMonth() const
Get the month.
Definition: dosdatetime.cpp:283
zipios::DOSDateTime::getSecond
int getSecond() const
Get the second.
Definition: dosdatetime.cpp:217
zipios::DOSDateTime::setUnixTimestamp
void setUnixTimestamp(std::time_t unix_timestamp)
Set the DOSDateTime value from a Unix timestamp.
Definition: dosdatetime.cpp:542
zipios
The zipios namespace includes the Zipios library definitions.
Definition: backbuffer.cpp:36
zipios::DOSDateTime::g_min_dosdatetime
static dosdatetime_t const g_min_dosdatetime
Definition: dosdatetime.hpp:49