Blender  V3.3
node_enum.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #pragma once
5 
6 #include "util/map.h"
7 #include "util/param.h"
8 
10 
11 /* Enum
12  *
13  * Utility class for enum values. */
14 
15 struct NodeEnum {
16  bool empty() const
17  {
18  return left.empty();
19  }
20  void insert(const char *x, int y)
21  {
22  ustring ustr_x(x);
23 
24  left[ustr_x] = y;
25  right[y] = ustr_x;
26  }
27 
28  bool exists(ustring x) const
29  {
30  return left.find(x) != left.end();
31  }
32  bool exists(int y) const
33  {
34  return right.find(y) != right.end();
35  }
36 
37  int operator[](const char *x) const
38  {
39  return left.find(ustring(x))->second;
40  }
41  int operator[](ustring x) const
42  {
43  return left.find(x)->second;
44  }
45  ustring operator[](int y) const
46  {
47  return right.find(y)->second;
48  }
49 
50  unordered_map<ustring, int, ustringHash>::const_iterator begin() const
51  {
52  return left.begin();
53  }
54  unordered_map<ustring, int, ustringHash>::const_iterator end() const
55  {
56  return left.end();
57  }
58 
59  private:
60  unordered_map<ustring, int, ustringHash> left;
61  unordered_map<int, ustring> right;
62 };
63 
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
ustring operator[](int y) const
Definition: node_enum.h:45
int operator[](ustring x) const
Definition: node_enum.h:41
unordered_map< ustring, int, ustringHash >::const_iterator begin() const
Definition: node_enum.h:50
bool empty() const
Definition: node_enum.h:16
void insert(const char *x, int y)
Definition: node_enum.h:20
unordered_map< ustring, int, ustringHash >::const_iterator end() const
Definition: node_enum.h:54
int operator[](const char *x) const
Definition: node_enum.h:37
bool exists(ustring x) const
Definition: node_enum.h:28
bool exists(int y) const
Definition: node_enum.h:32