Blender  V2.93
node_enum.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include "util/util_map.h"
20 #include "util/util_param.h"
21 
23 
24 /* Enum
25  *
26  * Utility class for enum values. */
27 
28 struct NodeEnum {
29  bool empty() const
30  {
31  return left.empty();
32  }
33  void insert(const char *x, int y)
34  {
35  left[ustring(x)] = y;
36  right[y] = ustring(x);
37  }
38 
39  bool exists(ustring x) const
40  {
41  return left.find(x) != left.end();
42  }
43  bool exists(int y) const
44  {
45  return right.find(y) != right.end();
46  }
47 
48  int operator[](const char *x) const
49  {
50  return left.find(ustring(x))->second;
51  }
52  int operator[](ustring x) const
53  {
54  return left.find(x)->second;
55  }
56  ustring operator[](int y) const
57  {
58  return right.find(y)->second;
59  }
60 
61  unordered_map<ustring, int, ustringHash>::const_iterator begin() const
62  {
63  return left.begin();
64  }
65  unordered_map<ustring, int, ustringHash>::const_iterator end() const
66  {
67  return left.end();
68  }
69 
70  private:
71  unordered_map<ustring, int, ustringHash> left;
72  unordered_map<int, ustring> right;
73 };
74 
_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
ustring operator[](int y) const
Definition: node_enum.h:56
int operator[](ustring x) const
Definition: node_enum.h:52
unordered_map< ustring, int, ustringHash >::const_iterator begin() const
Definition: node_enum.h:61
bool empty() const
Definition: node_enum.h:29
void insert(const char *x, int y)
Definition: node_enum.h:33
unordered_map< ustring, int, ustringHash >::const_iterator end() const
Definition: node_enum.h:65
int operator[](const char *x) const
Definition: node_enum.h:48
bool exists(ustring x) const
Definition: node_enum.h:39
bool exists(int y) const
Definition: node_enum.h:43