Blender
V5.0
source
blender
blenlib
BLI_generic_key_string.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
5
#pragma once
6
7
#include "
BLI_generic_key.hh
"
8
#include "
BLI_string_ref.hh
"
9
#include "
BLI_struct_equality_utils.hh
"
10
#include "
BLI_utility_mixins.hh
"
11
12
namespace
blender
{
13
15
class
GenericStringKey
:
public
GenericKey
,
NonMovable
{
16
private
:
17
std::string value_;
19
StringRef
value_ref_;
20
21
public
:
22
GenericStringKey
(
StringRef
value) : value_ref_(value) {}
23
24
uint64_t
hash
()
const override
25
{
26
return
get_default_hash
(value_ref_);
27
}
28
29
BLI_STRUCT_EQUALITY_OPERATORS_1
(
GenericStringKey
, value_ref_)
30
31
bool
equal_to
(const
GenericKey
&other)
const override
32
{
33
if
(
const
auto
*other_typed =
dynamic_cast<
const
GenericStringKey
*
>
(&other)) {
34
return
value_ref_ == other_typed->value_ref_;
35
}
36
return
false
;
37
}
38
39
std::unique_ptr<GenericKey>
to_storable
()
const override
40
{
41
auto
storable_key = std::make_unique<GenericStringKey>(
""
);
42
storable_key->value_ = value_ref_;
43
storable_key->value_ref_ = storable_key->value_;
44
return
storable_key;
45
}
46
};
47
48
}
// namespace blender
BLI_generic_key.hh
BLI_string_ref.hh
BLI_struct_equality_utils.hh
BLI_STRUCT_EQUALITY_OPERATORS_1
#define BLI_STRUCT_EQUALITY_OPERATORS_1(Type, m)
Definition
BLI_struct_equality_utils.hh:26
BLI_utility_mixins.hh
uint64_t
unsigned long long int uint64_t
Definition
btConvexHullComputer.cpp:33
blender::GenericKey
Definition
BLI_generic_key.hh:26
blender::GenericStringKey
Definition
BLI_generic_key_string.hh:15
blender::GenericStringKey::hash
uint64_t hash() const override
Definition
BLI_generic_key_string.hh:24
blender::GenericStringKey::GenericStringKey
GenericStringKey(StringRef value)
Definition
BLI_generic_key_string.hh:22
blender::GenericStringKey::to_storable
std::unique_ptr< GenericKey > to_storable() const override
Definition
BLI_generic_key_string.hh:39
blender::GenericStringKey::equal_to
bool equal_to(const GenericKey &other) const override
Definition
BLI_generic_key_string.hh:31
blender::NonMovable::NonMovable
NonMovable(NonMovable &&other)=delete
blender::StringRef
Definition
BLI_string_ref.hh:150
blender
Definition
ANIM_action.hh:36
blender::get_default_hash
uint64_t get_default_hash(const T &v, const Args &...args)
Definition
BLI_hash.hh:233
Generated on
for Blender by
doxygen
1.16.1