int serialize(char *const buffer, int const bufLeft, T const &src, uint16_t const dataType) const { BinRec *const bin = (BinRec *) buffer; int const dataLen = Wiresize(src); if (bufLeft < REC_MINSIZE + dataLen) { return -1; } bin->type = htons(dataType); bin->len = htons(dataLen); if (!serializer_(*bin, src)) { return -1; } return REC_MINSIZE + dataLen; }
void excel_serializer::write_worksheets() { std::size_t index = 0; for (auto ws : workbook_) { for (auto relationship : workbook_.get_relationships()) { if (relationship.get_type() == relationship::type::worksheet && workbook::index_from_ws_filename(relationship.get_target_uri()) == index) { worksheet_serializer serializer_(ws); std::string ws_filename = (relationship.get_target_uri().substr(0, 3) != "xl/" ? "xl/" : "") + relationship.get_target_uri(); archive_.writestr(ws_filename, serializer_.write_worksheet().to_string()); break; } } index++; } }