Hyper API for C++ 0.0.18825
Hyper client library for C++ applications
Loading...
Searching...
No Matches
Date.hpp
Go to the documentation of this file.
1
5#ifndef TABLEAU_HYPER_DATE_HPP
6#define TABLEAU_HYPER_DATE_HPP
7
8#include <cstdint>
10#include <string>
11#include <hyperapi/hyperapi.h>
12
13namespace hyperapi {
14
18class Date final {
19 public:
23 Date() noexcept {}
24
33 Date(int32_t year, std::int16_t month, std::int16_t day) noexcept;
34
40 std::int16_t getDay() const noexcept;
41
47 std::int16_t getMonth() const noexcept;
48
54 std::int32_t getYear() const noexcept;
55
60 std::string toString() const;
66 hyper_date_t getRaw() const noexcept;
70 friend bool operator==(const Date& a, const Date& b) noexcept;
74 friend bool operator>(const Date& a, const Date& b) noexcept;
78 friend bool operator!=(const Date& a, const Date& b) noexcept { return !(a == b); }
82 friend bool operator<(const Date& a, const Date& b) noexcept { return (b > a); }
86 friend bool operator<=(const Date& a, const Date& b) noexcept { return !(a > b); }
90 friend bool operator>=(const Date& a, const Date& b) noexcept { return !(a < b); }
91
93 friend std::ostream& operator<<(std::ostream& os, const Date& obj) { return os << obj.toString(); }
94
95 private:
96 friend class Inserter;
97 friend class OffsetTimestamp;
98 friend class Timestamp;
99 friend struct std::hash<hyperapi::Date>;
100 friend class Value;
101 friend struct internal::ValueInserter;
102
103 struct raw_t {};
104
110 explicit Date(hyper_date_t rawDate, raw_t) noexcept;
111
115 hyper_date_t representation_ = 0;
116
118 hyper_date_components_t date_ = {0, 0, 0};
119};
120}
121
122#include <hyperapi/impl/Date.impl.hpp>
123
124#endif
A date data value.
Definition Date.hpp:18
friend bool operator>=(const Date &a, const Date &b) noexcept
Greater or equal operator.
Definition Date.hpp:90
Date() noexcept
Default constructor.
Definition Date.hpp:23
friend std::ostream & operator<<(std::ostream &os, const Date &obj)
Stream output operator.
Definition Date.hpp:93
std::int16_t getDay() const noexcept
Gets the day.
std::int16_t getMonth() const noexcept
Gets the month.
Date(int32_t year, std::int16_t month, std::int16_t day) noexcept
Creates a date value.
friend bool operator<=(const Date &a, const Date &b) noexcept
Less than or equal operator.
Definition Date.hpp:86
std::string toString() const
Gets a string representation for debugging.
hyper_date_t getRaw() const noexcept
Gets the raw date value (i.e., the Julian Day).
friend bool operator<(const Date &a, const Date &b) noexcept
Less than operator.
Definition Date.hpp:82
std::int32_t getYear() const noexcept
Gets the year.
An inserter.
Definition Inserter.hpp:24
A timestamp data value with an offset to UTC.
A timestamp data value.
Definition Timestamp.hpp:16
A value inside a row.
Definition Result.hpp:44
The primary namespace of the Hyper API for C++.
Definition ByteSpan.hpp:15