plugify  1.0.0.0
load_flag.hpp
1 #pragma once
2 
3 #include <type_traits>
4 
5 namespace plugify {
10  enum class LoadFlag {
11  Default = 0,
12 
13  // Unix specific.
14  Lazy = 1 << 0,
15  Now = 1 << 1,
16  Global = 1 << 2,
17  Local = 1 << 3,
18  Nodelete = 1 << 4,
19  Noload = 1 << 5,
20  Deepbind = 1 << 6,
21 
22  // Windows specific.
23  DontResolveDllReferences = 1 << 7,
24  AlteredSearchPath = 1 << 8,
25  AsDatafile = 1 << 9,
26  AsDatafileExclusive = 1 << 10,
27  AsImageResource = 1 << 11,
28  SearchApplicationDir = 1 << 12,
29  SearchDefaultDirs = 1 << 13,
30  SearchDllLoadDir = 1 << 14,
31  SearchSystem32 = 1 << 15,
32  SearchUserDirs = 1 << 16,
33  RequireSignedTarget = 1 << 17,
34  IgnoreAuthzLevel = 1 << 18,
35  SafeCurrentDirs = 1 << 19,
36  PinInMemory = 1 << 20
37  };
38 
45  inline LoadFlag operator|(LoadFlag lhs, LoadFlag rhs) noexcept {
46  using underlying = typename std::underlying_type<LoadFlag>::type;
47  return static_cast<LoadFlag>(
48  static_cast<underlying>(lhs) | static_cast<underlying>(rhs)
49  );
50  }
51 
58  inline bool operator&(LoadFlag lhs, LoadFlag rhs) noexcept {
59  using underlying = typename std::underlying_type<LoadFlag>::type;
60  return static_cast<underlying>(lhs) & static_cast<underlying>(rhs);
61  }
62 
69  inline LoadFlag& operator|=(LoadFlag& lhs, LoadFlag rhs) noexcept {
70  lhs = lhs | rhs;
71  return lhs;
72  }
73 }