Hyper API for C++ 0.0.18825
Hyper client library for C++ applications
Loading...
Searching...
No Matches
Time.hpp
Go to the documentation of this file.
1
5#ifndef TABLEAU_HYPER_TIME_HPP
6#define TABLEAU_HYPER_TIME_HPP
7
8#include <cstdint>
10#include <string>
11#include <hyperapi/hyperapi.h>
12
13namespace hyperapi {
14
18class Time final {
19 public:
23 Time() noexcept {}
24
35 Time(int8_t hour, std::int8_t minute, std::int8_t second, std::int32_t microsecond = 0) noexcept;
36
42 std::int8_t getHour() const noexcept;
43
49 std::int8_t getMinute() const noexcept;
50
56 std::int8_t getSecond() const noexcept;
57
63 std::int32_t getMicrosecond() const noexcept;
64
69 std::string toString() const;
75 hyper_time_t getRaw() const noexcept;
79 friend bool operator==(const Time& lhs, const Time& rhs) noexcept;
83 friend bool operator>(const Time& lhs, const Time& rhs) noexcept;
87 friend bool operator!=(const Time& a, const Time& b) noexcept { return !(a == b); }
91 friend bool operator<(const Time& a, const Time& b) noexcept { return (b > a); }
95 friend bool operator<=(const Time& a, const Time& b) noexcept { return !(a > b); }
99 friend bool operator>=(const Time& a, const Time& b) noexcept { return !(a < b); }
100
102 friend std::ostream& operator<<(std::ostream& os, const Time& obj) { return os << obj.toString(); }
103
104 private:
105 friend class Inserter;
106 friend class Value;
107 friend class OffsetTimestamp;
108 friend class Timestamp;
109 friend struct std::hash<hyperapi::Time>;
110 friend struct internal::ValueInserter;
111
112 struct raw_t {};
113
119 explicit Time(hyper_time_t rawTime, raw_t) noexcept;
120
124 hyper_time_t representation_ = 0;
125
127 hyper_time_components_t time_ = {0, 0, 0, 0};
128};
129}
130#include <hyperapi/impl/Time.impl.hpp>
131
132#endif
An inserter.
Definition Inserter.hpp:24
A timestamp data value with an offset to UTC.
A time data value.
Definition Time.hpp:18
Time() noexcept
Default constructor.
Definition Time.hpp:23
std::int8_t getSecond() const noexcept
Gets the second.
std::int32_t getMicrosecond() const noexcept
Gets the microsecond.
friend std::ostream & operator<<(std::ostream &os, const Time &obj)
Stream output operator.
Definition Time.hpp:102
std::int8_t getMinute() const noexcept
Gets the minute.
std::string toString() const
Gets a string representation for debugging.
friend bool operator<(const Time &a, const Time &b) noexcept
Less than operator.
Definition Time.hpp:91
friend bool operator>=(const Time &a, const Time &b) noexcept
Greater or equal operator.
Definition Time.hpp:99
std::int8_t getHour() const noexcept
Gets the hour.
Time(int8_t hour, std::int8_t minute, std::int8_t second, std::int32_t microsecond=0) noexcept
Creates a time value from separate time components.
hyper_time_t getRaw() const noexcept
Gets the raw time value encoded as microseconds since midnight.
friend bool operator<=(const Time &a, const Time &b) noexcept
Less than or equal operator.
Definition Time.hpp:95
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