diff options
author | Manoj Srivastava <srivasta@debian.org> | 2020-05-22 19:57:41 -0700 |
---|---|---|
committer | Manoj Srivastava <srivasta@debian.org> | 2020-05-22 20:02:19 -0700 |
commit | c3d2579ad8d7eb33059aa8fdbaf5b564411a57f2 (patch) | |
tree | 1570cda0676fdcf4171a69a7fe313c1b89a52b0c /src/object_flag_meta.cc | |
parent | 986b7742bf244b4073ecca0723615f70be8a1ab6 (diff) | |
parent | 4e9b9c402ed95bf9a17fd6d795bc49bb4128a6fa (diff) |
Merge branch 'upstream' into debian-cmake-fixes
Diffstat (limited to 'src/object_flag_meta.cc')
-rw-r--r-- | src/object_flag_meta.cc | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/object_flag_meta.cc b/src/object_flag_meta.cc new file mode 100644 index 00000000..89b91fea --- /dev/null +++ b/src/object_flag_meta.cc @@ -0,0 +1,59 @@ +#include "object_flag_meta.hpp" + +#include "object_flag.hpp" + +std::vector<object_flag_meta const *> const &object_flags_meta() +{ + static std::vector<object_flag_meta const *> instance; + + if (instance.empty()) + { +#define NUMERIC 'n' +#define BINARY 'b' +#define TERNARY(n) ((n == 1) ? '+' : ((n == 2) ? '*' : '?')) +#define FIXED(n) ((n == 1) ? '1' : ((n == 2) ? '2' : ((n == 3) ? '3' : '?'))) +#define TR(tier, index, name, e_name, c_name, c_page, c_col, c_row, c_type, c_prio, is_pval, is_esp) \ + instance.emplace_back(new object_flag_meta { \ + name, \ + #name, \ + #e_name, \ + c_name, \ + c_page, \ + c_col, \ + c_row, \ + c_type, \ + c_prio, \ + is_pval, \ + is_esp \ + }); +#include "object_flag_list.hpp" +#undef TR +#undef FIXED +#undef TERNARY +#undef BINARY +#undef NUMERIC + }; + + return instance; +} + +object_flag_set const &object_flags_esp() +{ + static object_flag_set instance; + static bool initialized = false; + + if (!initialized) + { + for (auto const object_flag_meta: object_flags_meta()) + { + if (object_flag_meta->is_esp) + { + instance |= object_flag_meta->flag_set; + } + } + + initialized = true; + } + + return instance; +} |