Blender V5.3
NOD_menu_value.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "BLI_hash.hh"
12#include "BLI_unique_hash.hh"
13
14namespace blender::nodes {
15
20struct MenuValue {
21 int value = 0;
22
23 MenuValue() = default;
24 explicit MenuValue(const int value) : value(value) {}
25
26 template<typename EnumT>
27 MenuValue(const EnumT value)
28 requires(std::is_enum_v<EnumT>)
29 : value(int(value))
30 {
31 }
32
33 uint64_t hash() const
34 {
35 return get_default_hash(this->value);
36 }
37
39 {
41 }
42
43 friend bool operator==(const MenuValue &a, const MenuValue &b) = default;
44};
45
46} // namespace blender::nodes
unsigned __int64 uint64_t
Definition BKE_text.h:91
void hash_unique_default(const T &value, UniqueHashBytes &hash)
constexpr uint64_t get_default_hash(const T &v, const Args &...args)
Definition BLI_hash.hh:252
friend bool operator==(const MenuValue &a, const MenuValue &b)=default
MenuValue(const EnumT value)
void hash_unique(UniqueHashBytes &hash) const