Sleeping Wombat GUI  0.100
swGUI
TypesDefinitions.h
Go to the documentation of this file.
1 #pragma once
2 
21 #include <cstdint>
22 #include <memory>
23 
24 
25 
26 typedef int8_t int8;
27 typedef uint8_t uint8;
28 typedef int16_t int16;
29 typedef uint16_t uint16;
30 typedef int32_t int32;
31 typedef uint32_t uint32;
32 typedef int64_t int64;
33 typedef uint64_t uint64;
34 
35 typedef size_t Size;
36 
37 typedef ptrdiff_t PtrOffset;
38 
39 typedef double TimeType;
40 
41 
42 namespace rttr
43 {
44  class type;
45 }
46 
47 
48 typedef rttr::type ActorType;
49 
51 template< typename PtrType >
52 using UPtr = std::shared_ptr< PtrType >;
53 
54 template< typename PtrType >
55 using Ptr = std::shared_ptr< PtrType >;
56 
60 template< typename PtrType >
61 using OPtr = std::unique_ptr< PtrType >;
62 
63 template< typename PtrType, typename... Args >
64 Ptr< PtrType > MakePtr ( Args&&... args )
65 {
66  return std::make_shared< PtrType >( args... );
67 }
68 
69 template< typename PtrType, typename... Args >
70 UPtr< PtrType > MakeUPtr ( Args... args )
71 {
72  return std::make_unique< PtrType >( args... );
73 }
74 
75 
76 template< typename PtrType, typename... Args >
77 UPtr< PtrType > MakeOPtr ( Args... args )
78 {
79  return std::make_unique< PtrType >( args... );
80 }
81 
82 
83 #define DEFINE_PTR_TYPE( type ) typedef Ptr< type > type ## Ptr;
84 #define DEFINE_UPTR_TYPE( type ) typedef UPtr< type > type ## UPtr;
85 #define DEFINE_WPTR_TYPE( type ) typedef std::weak_ptr< type > type ## WPtr;
86 #define DEFINE_OPTR_TYPE( type ) typedef OPtr< type > type ## OPtr;
87 
88 
89 #define CLASS_TESTER( type ) __ ## type ## __Tester
90 #define FRIEND_CLASS_TESTER( type ) friend class CLASS_TESTER( type );
Definition: ResourcePtr.h:116
uint16_t uint16
Definition: TypesDefinitions.h:29
rttr::type ActorType
Definition: TypesDefinitions.h:48
Definition: UPtr.h:10
ptrdiff_t PtrOffset
Definition: TypesDefinitions.h:37
int8_t int8
Definition: TypesDefinitions.h:26
uint64_t uint64
Definition: TypesDefinitions.h:33
int64_t int64
Definition: TypesDefinitions.h:32
uint32_t uint32
Definition: TypesDefinitions.h:31
size_t Size
Definition: TypesDefinitions.h:35
uint8_t uint8
Definition: TypesDefinitions.h:27
std::shared_ptr< PtrType > Ptr
Definition: TypesDefinitions.h:55
double TimeType
Definition: TypesDefinitions.h:39
int32_t int32
Definition: TypesDefinitions.h:30
std::unique_ptr< PtrType > OPtr
Definition: TypesDefinitions.h:61
UPtr< PtrType > MakeUPtr(Args...args)
Definition: TypesDefinitions.h:70
int16_t int16
Definition: TypesDefinitions.h:28
Ptr< PtrType > MakePtr(Args &&...args)
Definition: TypesDefinitions.h:64
UPtr< PtrType > MakeOPtr(Args...args)
Definition: TypesDefinitions.h:77