Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarConfig.hpp
blob: fffc7da8ff820fc940bf9800dae75ae9b621b69e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#pragma once

#include "StarPch.hpp"

namespace Star {

// Some really common std namespace includes

using std::size_t;

using std::swap;
using std::move;

using std::unique_ptr;
using std::shared_ptr;
using std::weak_ptr;
using std::make_shared;
using std::make_unique;
using std::static_pointer_cast;
using std::dynamic_pointer_cast;
using std::const_pointer_cast;
using std::enable_shared_from_this;

using std::pair;
using std::make_pair;

using std::tuple;
using std::make_tuple;
using std::tuple_element;
using std::get;
using std::tie;
using std::ignore;

using std::initializer_list;

using std::min;
using std::max;

using std::bind;
using std::function;
using std::forward;
using std::mem_fn;
using std::ref;
using std::cref;
using namespace std::placeholders;
using namespace std::string_literals;

using std::prev;
// using std::next;

using std::atomic;
using std::atomic_flag;
using std::atomic_load;
using std::atomic_store;

#ifndef NDEBUG
#define STAR_DEBUG 1
constexpr bool DebugEnabled = true;
#else
constexpr bool DebugEnabled = false;
#endif

// A version of string::npos that's used in general to mean "not a position"
// and is the largest value for size_t.
size_t const NPos = (size_t)(-1);

typedef int64_t StreamOffset;

// Convenient way to purposefully mark a variable as unused to avoid warning
#define _unused(x) ((void)x)

// Forward declare a class or struct, and define a lot of typedefs for
// different pointer types all at once.

#define STAR_CLASS(ClassName)                                     \
  class ClassName;                                                \
  using ClassName##Ptr = std::shared_ptr<ClassName>;              \
  using ClassName##ConstPtr = std::shared_ptr<const ClassName>;   \
  using ClassName##WeakPtr = std::weak_ptr<ClassName>;            \
  using ClassName##ConstWeakPtr = std::weak_ptr<const ClassName>; \
  using ClassName##UPtr = std::unique_ptr<ClassName>;             \
  using ClassName##ConstUPtr = std::unique_ptr<const ClassName>

#define STAR_STRUCT(StructName)                                     \
  struct StructName;                                                \
  using StructName##Ptr = std::shared_ptr<StructName>;              \
  using StructName##ConstPtr = std::shared_ptr<const StructName>;   \
  using StructName##WeakPtr = std::weak_ptr<StructName>;            \
  using StructName##ConstWeakPtr = std::weak_ptr<const StructName>; \
  using StructName##UPtr = std::unique_ptr<StructName>;             \
  using StructName##ConstUPtr = std::unique_ptr<const StructName>

#define STAR_QUOTE(name) #name
#define STAR_STR(macro) STAR_QUOTE(macro)

}