OCILIB (C and C++ Driver for Oracle)  4.7.6
Open source and cross platform Oracle Driver delivering efficient access to Oracle databases.
Enum.hpp
1 /*
2  * OCILIB - C Driver for Oracle (C Wrapper for Oracle OCI)
3  *
4  * Website: http://www.ocilib.net
5  *
6  * Copyright (c) 2007-2023 Vincent ROGIER <vince.rogier@ocilib.net>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #pragma once
22 
23 #include "ocilibcpp/core.hpp"
24 
25 namespace ocilib
26 {
27  namespace core
28  {
29  template<class T>
30  Enum<T>::Enum() : _value(static_cast<T>(0))
31  {
32  }
33 
34  template<class T>
35  Enum<T>::Enum(T value) : _value(value)
36  {
37  }
38 
39  template<class T>
40  T Enum<T>::GetValue()
41  {
42  return _value;
43  }
44 
45  template<class T>
46  Enum<T>::operator T ()
47  {
48  return GetValue();
49  }
50 
51  template<class T>
52  Enum<T>::operator unsigned int() const
53  {
54  return static_cast<unsigned int>(_value);
55  }
56 
57  template<class T>
58  bool Enum<T>::operator == (const Enum& other) const
59  {
60  return other._value == _value;
61  }
62 
63  template<class T>
64  bool Enum<T>::operator != (const Enum& other) const
65  {
66  return !(*this == other);
67  }
68 
69  template<class T>
70  bool Enum<T>::operator == (const T& other) const
71  {
72  return other == _value;
73  }
74 
75  template<class T>
76  bool Enum<T>::operator != (const T& other) const
77  {
78  return !(*this == other);
79  }
80 
81  }
82 }
OCILIB ++ Namespace.