HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_Thing.h
Go to the documentation of this file.
1 #ifndef __UT_Thing__
2 #define __UT_Thing__
3 
4 #include "UT_API.h"
5 
6 #include <SYS/SYS_Deprecated.h>
7 
9 
11 public:
12  UT_Thing(void *v=0) { value.voidp = v; }
13  UT_Thing(long v) { value.longv = v; }
14 
15  operator void *() const { return value.voidp; }
16  operator long () const { return value.longv; }
17 
18  template <typename T> T *asPointer() const { return (T *)value.voidp; }
19  long asLong() const { return value.longv; }
20 
21  UT_Thing &operator=(void *v) { value.voidp = v; return *this; }
22  UT_Thing &operator=(long v) { value.longv = v; return *this; }
23 
24  UT_Thing &operator=(const UT_Thing &v)
25  {
26  value.voidp = v.value.voidp;
27  return *this;
28  }
29 
30  union {
31  void *voidp;
32  long longv;
33  } value;
34 
35 private:
36  // This is to prevent accidental assignments of a UT_Thing * to a UT_Thing
37  // parameter, which will happily compile but produce incorrect results.
38  UT_Thing(UT_Thing *) { ; }
39 };
40 
42 
43 #endif
#define SYS_DEPRECATED(__V__)
#define SYS_DEPRECATED_PUSH_DISABLE()
const GLdouble * v
Definition: glcorearb.h:836
#define SYS_DEPRECATED_POP_DISABLE()
#define UT_API
Definition: UT_API.h:12
union UT_Thing::@519 value
void * voidp
Definition: UT_Thing.h:31
UT_Thing(void *v=0)
Definition: UT_Thing.h:12
long longv
Definition: UT_Thing.h:32
UT_Thing & operator=(long v)
Definition: UT_Thing.h:22
UT_Thing & operator=(const UT_Thing &v)
Definition: UT_Thing.h:24
UT_Thing(long v)
Definition: UT_Thing.h:13
GLsizei const GLfloat * value
Definition: glcorearb.h:823
long asLong() const
Definition: UT_Thing.h:19
T * asPointer() const
Definition: UT_Thing.h:18
UT_Thing & operator=(void *v)
Definition: UT_Thing.h:21