| 14 | constexpr char magic[] = "\x00\x61\x73\x6d\x01\x00\x00\x00"; |
| 15 | |
| 16 | class Section { |
| 17 | public: |
| 18 | void write(std::ostream& stream); |
| 19 | protected: |
| 20 | Section(const byte_t id); |
| 21 | const byte_t id; |
| 22 | std::stringstream buffer; |
| 23 | |
| 24 | struct Stream { |
| 25 | Stream(std::ostream& stream); |
| 26 | |
| 27 | template <typename T> |
| 28 | Stream& operator<<(T value); |
| 29 | |
| 30 | template <typename T> |
| 31 | Stream& operator<<(const std::vector<T> values){ |
| 32 | *this << (u32_t)values.size(); |
| 33 | for(T value : values){ |
| 34 | *this << value; |
| 35 | } |
| 36 | return *this; |
| 37 | } |
| 38 | |
| 39 | Stream& operator<<(std::stringstream& value); |
| 40 | private: |
| 41 | std::ostream& stream; |
| 42 | }; |
| 43 | }; |
| 44 | |
| 45 | struct Type : public Section { |
| 46 | Type(const std::vector<FuncType>& types); |