Leviathan  0.8.0.0
Leviathan game engine
AccessMask.h
Go to the documentation of this file.
1 // Leviathan Game Engine
2 // Copyright (c) 2012-2018 Henri Hyyryläinen
4 #pragma once
5 #include "Define.h"
6 // ------------------------------------ //
7 #include <string_view>
8 
9 namespace Leviathan {
10 
12 enum class ScriptAccess : uint32_t{
13 
15  Nothing = 0x0,
16 
18  Builtin = 0x1,
19 
21  DefaultEngine = 0x2,
22  FullFileSystem = 0x4,
23  // 0x8
24  // 0x10
25  // 0x20
26  //0x40
27  //0x80 // first byte full
28  //0x100
29  //0x200
30  //0x400
31  //0x800
32  //0x1000
33  //0x2000
34  //0x4000
35  //0x8000 // second byte full (int range might stop here(
36  //0x10000
37  //0x20000
38  //0x40000
39  //0x80000
40  //0x100000
41  //0x200000
42  //0x400000
43  //0x800000 // third byte full
44  //0x1000000
45  //0x2000000
46  //0x4000000
47  //0x8000000
48  //0x10000000
49  //0x20000000
50  //0x40000000
51  //0x80000000 // fourth byte full. Last valid flag for angelscript
52 };
53 
56  static_cast<uint32_t>(ScriptAccess::Builtin);
57 
58 // Convenience operators
59 inline bool operator==(const ScriptAccess &lhs, const AccessFlags &rhs){
60  return static_cast<AccessFlags>(lhs) == rhs;
61 }
62 
63 inline bool operator==(const AccessFlags &lhs, const ScriptAccess &rhs){
64  return rhs == static_cast<AccessFlags>(lhs);
65 }
66 
71 DLLEXPORT AccessFlags ParseScriptAccess(std::string_view flagstring);
72 
75 DLLEXPORT AccessFlags StringToScriptAccess(std::string_view str);
76 
77 } // namespace Leviathan
Access to the builtin types like string and math functions.
Can access none of the bound functions or "inbuilt" math and string types.
uint32_t AccessFlags
Definition: AccessMask.h:54
bool operator==(const ScriptAccess &lhs, const AccessFlags &rhs)
Definition: AccessMask.h:59
constexpr AccessFlags DefaultAccessFlags
Definition: AccessMask.h:55
Default mask for engine classes (some things are accessible even with this off)
#define DLLEXPORT
Definition: Include.h:115
DLLEXPORT AccessFlags ParseScriptAccess(std::string_view flagstring)
Parses a string for access flags.
Definition: AccessMask.cpp:7
The access mask controls which registered functions and classes a script sees.
Definition: GameModule.h:12
unsigned int uint32_t
Definition: core.h:40
DLLEXPORT AccessFlags StringToScriptAccess(std::string_view str)
Returns ScriptAccess matching string.
Definition: AccessMask.cpp:48