1 #ifndef BLANK_WORLD_BLOCKTYPEREGISTRY_HPP_
2 #define BLANK_WORLD_BLOCKTYPEREGISTRY_HPP_
4 #include "BlockType.hpp"
11 class BlockTypeRegistry {
14 using size_type = std::vector<BlockType>::size_type;
15 using reference = std::vector<BlockType>::reference;
16 using const_reference = std::vector<BlockType>::const_reference;
17 using iterator = std::vector<BlockType>::iterator;
18 using const_iterator = std::vector<BlockType>::const_iterator;
23 Block::Type Add(const BlockType &);
25 size_t size() const noexcept { return types.size(); }
27 iterator begin() noexcept { return types.begin(); }
28 const_iterator begin() const noexcept { return types.begin(); }
29 iterator end() noexcept { return types.end(); }
30 const_iterator end() const noexcept { return types.end(); }
32 BlockType &operator [](Block::Type id) { return types[id]; }
33 const BlockType &operator [](Block::Type id) const { return types[id]; }
35 BlockType &Get(Block::Type id) { return types[id]; }
36 const BlockType &Get(Block::Type id) const { return types[id]; }
39 std::vector<BlockType> types;