qxLib
priority.h
Go to the documentation of this file.
1 /**
2 
3  @file priority.h
4  @author Khrapov
5  @date 3.12.2023
6  @copyright © Nick Khrapov, 2023. All right reserved.
7 
8 **/
9 #pragma once
10 
11 #include <qx/containers/flags.h>
12 #include <qx/typedefs.h>
13 
14 namespace qx
15 {
16 
17 /**
18  @enum priority
19  @brief User may use the predefined values or the custom ones, for ex. "normal - 1",
20  this type is supposed to be compared relatively and not for equality
21  @note The base type of this enum is u8,
22  and lowest will always be the lowest value and highest will be the highest.
23  You should use std::greater<qx::priority> as a predicate in ordered containers to iterate them with decreasing priority.
24 **/
25 enum class priority : u8
26 {
27  lowest = 0,
28  very_low = 32,
29  low = 64,
30  normal = 128,
31  high = 160,
32  very_high = 224,
33  highest = 255,
34 };
35 
36 enum class status
37 {
38  default_value = 0,
39  disabled = 1 << 0,
40 };
41 
42 } // namespace qx
43 
44 constexpr auto operator<=>(qx::priority eLeft, qx::priority eRight)
45 {
46  return static_cast<u8>(eLeft) <=> static_cast<u8>(eRight);
47 }
48 
#define QX_FLAGS_ENUM_CLASS(enumName)
Define to let to use this enum class in different binary operations returning qx::flags.
Definition: flags.h:20
priority
User may use the predefined values or the custom ones, for ex. "normal - 1", this type is supposed to...
Definition: priority.h:26
uint8_t u8
0 .. 65 535
Definition: typedefs.h:20