QuasarEngine
Cross-platform 3D engine and editor
Loading...
Searching...
No Matches
Base.h File Reference

Contains the base definitions and utilities for the Quasar engine. More...

#include <cstdint>
#include <memory>
#include <utility>
#include <quasar/core/Log.h>
#include <quasar/core/PlatformDetection.h>

Go to the source code of this file.

Namespaces

namespace  Quasar
 Contains all the engine code.

Macros

#define QUASAR_DEBUGBREAK()
 Stops the program at this line in the debugger.
#define QUASAR_FORCE_INLINE   [[gnu::always_inline]] inline
 Asks the compiler to always inline a function.
#define QUASAR_CONCAT_IMPL(a, b)
 Joins two tokens with ##. Use QUASAR_CONCAT() instead, which expands the macros first.
#define QUASAR_CONCAT(a, b)
 Joins two tokens into one, after expanding the macros they contain.
#define QUASAR_ENGINE_ASSERT(condition, ...)
 Checks a condition that must always be true in the engine code.

Typedefs

template<typename T>
using Quasar::Scope = std::unique_ptr<T>
 Pointer with a single owner. Alias of std::unique_ptr.
template<typename T>
using Quasar::Ref = std::shared_ptr<T>
 Pointer with shared ownership: the object is destroyed with its last Ref. Alias of std::shared_ptr.

Functions

template<typename T, typename... Args>
Scope< T > Quasar::CreateScope (Args &&... args)
 Creates an object owned by a Scope. Same as std::make_unique.
template<typename T, typename... Args>
Ref< T > Quasar::CreateRef (Args &&... args)
 Creates an object owned by a Ref. Same as std::make_shared.
constexpr std::uint32_t Quasar::Bit (std::uint32_t index)
 Returns a value where only the bit at the given index is set, for example Bit(3) is 8.

Detailed Description

Contains the base definitions and utilities for the Quasar engine.

Author
Kurogenshi
Date
2026-10-19

Macro Definition Documentation

◆ QUASAR_DEBUGBREAK

#define QUASAR_DEBUGBREAK ( )
Value:
static_cast<void>(std::raise(SIGTRAP))

Stops the program at this line in the debugger.

Without a debugger, the program is terminated.

◆ QUASAR_CONCAT_IMPL

#define QUASAR_CONCAT_IMPL ( a,
b )
Value:
a##b

Joins two tokens with ##. Use QUASAR_CONCAT() instead, which expands the macros first.

◆ QUASAR_CONCAT

#define QUASAR_CONCAT ( a,
b )
Value:
#define QUASAR_CONCAT_IMPL(a, b)
Joins two tokens with ##. Use QUASAR_CONCAT() instead, which expands the macros first.
Definition Base.h:58

Joins two tokens into one, after expanding the macros they contain.

QUASAR_CONCAT(timer, __LINE__) gives timer42 on line 42. Writing timer##__LINE__ directly would give timer__LINE__, because ## joins the tokens before __LINE__ is replaced by its value.

◆ QUASAR_ENGINE_ASSERT

#define QUASAR_ENGINE_ASSERT ( condition,
... )
Value:
((void)[&] { return !(condition); })

Checks a condition that must always be true in the engine code.

In Debug, when the condition is false, the condition, the file and the line are logged as an error, followed by the optional message, then the program stops with QUASAR_DEBUGBREAK(). The message uses the fmt syntax: QUASAR_ENGINE_ASSERT(index < count, "Index {} is out of range", index).

In Release, the condition is not evaluated, so it must not have side effects.