forked from cel-expr/cel-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunknown.h
More file actions
49 lines (37 loc) · 1.05 KB
/
Copy pathunknown.h
File metadata and controls
49 lines (37 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef THIRD_PARTY_CEL_CPP_COMMON_UNKNOWN_H_
#define THIRD_PARTY_CEL_CPP_COMMON_UNKNOWN_H_
#include "absl/types/span.h"
#include "common/id.h"
namespace google {
namespace api {
namespace expr {
namespace common {
/** An unknown CEL value. */
class Unknown {
public:
explicit Unknown(Id id);
explicit Unknown(absl::Span<const Id> ids);
const std::set<Id>& ids() const { return ids_; }
inline bool operator==(const Unknown& rhs) const {
return this == &rhs || ids_ == rhs.ids_;
}
inline bool operator!=(const Unknown& rhs) const { return !(*this == rhs); }
/** The hash code for this value. */
std::size_t hash_code() const;
/**
* A string useful for debugging.
*
* Format may change, and computation may be expensive.
*/
std::string ToString() const;
private:
std::set<Id> ids_;
};
inline std::ostream& operator<<(std::ostream& os, const Unknown& value) {
return os << value.ToString();
}
} // namespace common
} // namespace expr
} // namespace api
} // namespace google
#endif // THIRD_PARTY_CEL_CPP_COMMON_UNKNOWN_H_