Spicy
time.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <utility>
6 
7 #include <hilti/rt/types/time.h>
8 
9 #include <hilti/ast/ctor.h>
10 #include <hilti/ast/types/time.h>
11 
12 namespace hilti {
13 namespace ctor {
14 
16 class Time : public NodeBase, public hilti::trait::isCtor {
17 public:
18  using Value = hilti::rt::Time;
19 
20  Time(const Value& time, Meta m = Meta()) : NodeBase(std::move(m)), _time(time) {}
21 
22  const auto& value() const { return _time; }
23 
24  bool operator==(const Time& other) const { return value() == other.value(); }
25 
27  auto type() const { return type::Time(meta()); }
29  bool isConstant() const { return true; }
31  auto isLhs() const { return false; }
33  auto isTemporary() const { return true; }
35  auto isEqual(const Ctor& other) const { return node::isEqual(this, other); }
37  auto properties() const { return node::Properties{{"time", to_string(_time)}}; }
38 
39 private:
40  Value _time;
41 };
42 
43 } // namespace ctor
44 } // namespace hilti
auto isLhs() const
Definition: time.h:31
auto isEqual(const Ctor &other) const
Definition: time.h:35
auto properties() const
Definition: time.h:37
Definition: time.h:13
Definition: meta.h:18
Definition: time.h:16
bool isConstant() const
Definition: time.h:29
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:83
Definition: ctor.h:15
auto isTemporary() const
Definition: time.h:33
Definition: time.h:20
auto & meta() const
Definition: node.h:449
auto type() const
Definition: time.h:27
Definition: node.h:318