Provides commonly used macros along with project wide typedefs.
More...
Go to the source code of this file.
|
| #define | BIT(x) |
| | Macro to shift 1 by x positions to create a bitmask.
|
| #define | VZ_BIND_EVENT_FN(fn) |
| | Binds a member function as an event handler.
|
| #define | BIND_EVENT_FN(x) |
| | Binds the given member function of the Application class as an event handler.
|
| #define | EVENT_CLASS_TYPE(type) |
| | Macro to define event type in event subclasses.
|
| #define | EVENT_CLASS_CATEGORY(category) |
| | Macro to define event category in event subclasses.
|
|
| template<typename T> |
| using | Vesper::Scope = std::unique_ptr<T> |
| | A smart pointer type representing exclusive ownership of an object.
|
| template<typename T> |
| using | Vesper::Ref = std::shared_ptr<T> |
| | A smart pointer type representing shared ownership of an object.
|
|
| template<typename T, typename... Args> |
| constexpr Scope< T > | Vesper::CreateScope (Args &&... args) |
| | Creates a Scope (unique_ptr) for the given type and constructor arguments.
|
| template<typename T, typename... Args> |
| constexpr Ref< T > | Vesper::CreateRef (Args &&... args) |
| | Creates a Ref (shared_ptr) for the given type and constructor arguments.
|
Provides commonly used macros along with project wide typedefs.
- Author
- Damon S. Green II
◆ BIND_EVENT_FN
| #define BIND_EVENT_FN |
( |
| x | ) |
|
Value:std::bind(&Application::x, this, std::placeholders::_1)
Binds the given member function of the Application class as an event handler.
- Parameters
-
| x | The member function to bind. |
◆ BIT
Value:
Macro to shift 1 by x positions to create a bitmask.
- Parameters
-
| x | The number of positions to shift. |
- Returns
- The resulting bitmask.
- Note
- This macro is typically used for defining event categories.
- Warning
- Be cautious when using this macro with values greater than or equal to the number of bits in an integer, as it may lead to undefined behavior.
- Attention
- This macro is not type-safe; consider using constexpr functions or enum classes for better type safety.
◆ EVENT_CLASS_CATEGORY
| #define EVENT_CLASS_CATEGORY |
( |
| category | ) |
|
Value:virtual int GetCategoryFlags() const override { return category; }
Macro to define event category in event subclasses.
- Parameters
-
| category | The event category to define. |
◆ EVENT_CLASS_TYPE
| #define EVENT_CLASS_TYPE |
( |
| type | ) |
|
Value:static EventType GetStaticType() { return EventType::##type; }\
virtual EventType GetEventType() const override { return GetStaticType(); }\
virtual const char* GetName() const override { return #type; }
Macro to define event type in event subclasses.
- Parameters
-
| type | The event type to define. |
25#define EVENT_CLASS_TYPE(type) static EventType GetStaticType() { return EventType::##type; }\
26 virtual EventType GetEventType() const override { return GetStaticType(); }\
27 virtual const char* GetName() const override { return #type; }
◆ VZ_BIND_EVENT_FN
| #define VZ_BIND_EVENT_FN |
( |
| fn | ) |
|
Value:[this](auto&&... args) -> decltype(auto) { return this->fn(std::forward<decltype(args)>(args)...); }
Binds a member function as an event handler.
- Parameters
-
| fn | The member function to bind. |