| 1065 | /// @param[in] file_identifier If a `file_identifier` is given, the buffer |
| 1066 | /// will be prefixed with a standard FlatBuffers file header. |
| 1067 | template<typename T> void Finish(Offset<T> root, |
| 1068 | const char *file_identifier = nullptr) { |
| 1069 | NotNested(); |
| 1070 | // This will cause the whole buffer to be aligned. |
| 1071 | PreAlign(sizeof(uoffset_t) + (file_identifier ? kFileIdentifierLength : 0), |
| 1072 | minalign_); |
| 1073 | if (file_identifier) { |
| 1074 | assert(strlen(file_identifier) == kFileIdentifierLength); |
| 1075 | buf_.push(reinterpret_cast<const uint8_t *>(file_identifier), |
| 1076 | kFileIdentifierLength); |
| 1077 | } |
| 1078 | PushElement(ReferTo(root.o)); // Location of root. |
| 1079 | finished = true; |
| 1080 | } |
| 1081 | |
| 1082 | private: |
| 1083 | // You shouldn't really be copying instances of this class. |