Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cTypeInfo.h
Go to the documentation of this file.
1 //
5 //
6 #ifndef _INC_cTypeInfo_H
7 #define _INC_cTypeInfo_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "GrayCore.h"
13 #include "cUnitTestDecl.h"
14 
15 #ifndef UNDER_CE
16 #include <typeinfo> // type_info& typeid(class type) std:: // doe sthis always need _CPPRTTI ??
17 #endif
18 
19 namespace Gray
20 {
21 
22 #ifdef UNDER_CE // no TYPEINFO_t in UNDER_CE. stub this out.
23  typedef struct TYPEINFO_t { BYTE notused; };
24 #define typeid(x) 0 // stub this out.
25 #elif defined(_MSC_VER)
26  typedef ::type_info TYPEINFO_t; // Info from typeid()
27 #pragma warning(disable:4275) // non dll-interface class 'type_info' used as base for dll-interface class. http://msdn.microsoft.com/en-us/library/3tdb471s.aspx
28 #else // __GNUC__
29  typedef std::type_info TYPEINFO_t; // Info from typeid()
30 #endif
31 
33  {
39 
40  public:
41  size_t get_HashCode() const noexcept
42  {
43  // HASHCODE_t
44 #ifdef _MSC_VER
45  return hash_code();
46 #else
47  return (size_t) this;
48 #endif
49  }
50  const char* get_Name() const noexcept
51  {
52  // Get the user friendly version of the name.
53  return name();
54  }
55 
56  const char* GetMemberName(int i) const;
57 
59  };
60 }
61 #endif
#define GRAYCORE_LINK
Definition: GrayCore.h:47
#define UNITTEST_FRIEND(n)
Define this in the class body to be unit tested. Allow the unit test to access private/protected stuf...
Definition: cUnitTestDecl.h:17
Definition: cTypeInfo.h:33
size_t get_HashCode() const noexcept
Definition: cTypeInfo.h:41
const char * get_Name() const noexcept
Definition: cTypeInfo.h:50
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
std::type_info TYPEINFO_t
Definition: cTypeInfo.h:29