You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4 KiB
C

1 year ago
#pragma once
#include <string>
#include "data/Data.h"
/*
*
*
*
*/
class DateTimeData : public Data
{
public:
DateTimeData();
DateTimeData(unsigned short year, unsigned char month, unsigned char day, unsigned char hour, unsigned char minute, unsigned char second);
virtual ~DateTimeData() {};
Data* clone() override;
void copy(Data* data) override;
void copy(Data& data) override;
int length() override { return 7; }
std::string toStr() override;
std::string toByteStr() override;
std::string toHexStr() override;
bool fromByteStr(std::string str = "") override;
unsigned short getYear() { return m_year; }
unsigned char getMonth() { return m_month; }
unsigned char getDay() { return m_day; }
unsigned char getHour() { return m_hour; }
unsigned char getMinute() { return m_minute; }
unsigned char getSecond() { return m_second; }
void setYear(unsigned short year) { m_year = year; }
void setMonth(unsigned char month) { m_month = month; }
void setDay(unsigned char day) { m_day = day; }
void setHour(unsigned char hour) { m_hour = hour; }
void setMinute(unsigned char minute) { m_minute = minute; }
void setSecond(unsigned char second) { m_second = second; }
private:
unsigned short m_year;
unsigned char m_month;
unsigned char m_day;
unsigned char m_hour;
unsigned char m_minute;
unsigned char m_second;
};