Add Chromium-only Blender WebEngine parity work
This commit is contained in:
65
blender-5.2.0/intern/cycles/graph/node_enum.h
Normal file
65
blender-5.2.0/intern/cycles/graph/node_enum.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "util/map.h"
|
||||
#include "util/param.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* Enum
|
||||
*
|
||||
* Utility class for enum values. */
|
||||
|
||||
struct NodeEnum {
|
||||
bool empty() const
|
||||
{
|
||||
return left.empty();
|
||||
}
|
||||
void insert(const char *x, const int y)
|
||||
{
|
||||
const ustring ustr_x(x);
|
||||
|
||||
left[ustr_x] = y;
|
||||
right[y] = ustr_x;
|
||||
}
|
||||
|
||||
bool exists(ustring x) const
|
||||
{
|
||||
return left.contains(x);
|
||||
}
|
||||
bool exists(const int y) const
|
||||
{
|
||||
return right.contains(y);
|
||||
}
|
||||
|
||||
int operator[](const char *x) const
|
||||
{
|
||||
return left.find(ustring(x))->second;
|
||||
}
|
||||
int operator[](ustring x) const
|
||||
{
|
||||
return left.find(x)->second;
|
||||
}
|
||||
ustring operator[](int y) const
|
||||
{
|
||||
return right.find(y)->second;
|
||||
}
|
||||
|
||||
unordered_map<ustring, int>::const_iterator begin() const
|
||||
{
|
||||
return left.begin();
|
||||
}
|
||||
unordered_map<ustring, int>::const_iterator end() const
|
||||
{
|
||||
return left.end();
|
||||
}
|
||||
|
||||
private:
|
||||
unordered_map<ustring, int> left;
|
||||
unordered_map<int, ustring> right;
|
||||
};
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
Reference in New Issue
Block a user