Spicy
bytes.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/ast/type.h>
8 #include <hilti/ast/types/integer.h>
9 
10 namespace hilti::type {
11 
12 namespace bytes {
13 
15 class Iterator : public TypeBase,
21 public:
22  Iterator(Meta m = Meta()) : TypeBase(nodes(Type(type::UnsignedInteger(8))), std::move(m)) {}
23 
24  bool operator==(const Iterator& /* other */) const { return true; }
25 
27  auto isEqual(const Type& other) const { return node::isEqual(this, other); }
29  auto _isResolved(ResolvedState* rstate) const { return true; }
31  const Type& dereferencedType() const { return child<Type>(0); }
33  auto properties() const { return node::Properties{}; }
34 };
35 
36 } // namespace bytes
37 
39 class Bytes : public TypeBase,
45 public:
46  Bytes(const Meta& m = Meta()) : TypeBase(nodes(Type(type::UnsignedInteger(8)), Type(bytes::Iterator(m))), m) {}
47 
48  bool operator==(const Bytes& /* other */) const { return true; }
49 
51  auto isEqual(const Type& other) const { return node::isEqual(this, other); }
53  auto _isResolved(ResolvedState* rstate) const { return true; }
55  const Type& elementType() const { return child<Type>(0); }
56 
58  const Type& iteratorType(bool /* const */) const { return child<Type>(1); }
60  auto properties() const { return node::Properties{}; }
61 };
62 
63 } // namespace hilti::type
const Type & elementType() const
Definition: bytes.h:55
Definition: type.h:34
auto isEqual(const Type &other) const
Definition: bytes.h:27
auto properties() const
Definition: bytes.h:60
Definition: type.h:37
Definition: type.h:38
Definition: meta.h:19
auto _isResolved(ResolvedState *rstate) const
Definition: bytes.h:29
Definition: integer.h:53
Definition: bytes.h:39
Definition: type.h:160
Definition: bytes.h:15
Definition: type.h:36
auto properties() const
Definition: bytes.h:33
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:97
const Type & iteratorType(bool) const
Definition: bytes.h:58
Definition: type.h:206
Definition: type.h:33
auto _isResolved(ResolvedState *rstate) const
Definition: bytes.h:53
auto isEqual(const Type &other) const
Definition: bytes.h:51
const Type & dereferencedType() const
Definition: bytes.h:31
Definition: type.h:26