# HG changeset patch # User František Kučera # Date 1650394807 -7200 # Node ID 9e16e31fa756b8cd2a6de07f59d7f58b9b9e191f # Parent d2ba14aa4e2071f0382111381eb12589edf3b317 typed values instead of mere strings in the handler + check number of attributes at the end diff -r d2ba14aa4e20 -r 9e16e31fa756 src/SerializeHandler.h --- a/src/SerializeHandler.h Sun Apr 17 16:39:29 2022 +0200 +++ b/src/SerializeHandler.h Tue Apr 19 21:00:07 2022 +0200 @@ -37,7 +37,7 @@ namespace tr { namespace serialize { -class SerializeHandler : public relpipe::reader::handlers::RelationalReaderStringHandler { +class SerializeHandler : public relpipe::reader::handlers::RelationalReaderValueHandler { private: Configuration configuration; shared_ptr writer; @@ -92,14 +92,14 @@ } } - void attribute(const relpipe::common::type::StringX& value) override { + void attribute(const void* value, const std::type_info& type) override { if (recordContext.attributeIndex == 0) { recordContext = RecordContext(); recordContext.writer.reset(relpipe::writer::Factory::create(recordContext.buffer)); recordContext.writer->startRelation(relationContext.name, relationContext.writerMetadata, true); } - recordContext.writer->writeAttribute(value); // TODO: typed values instead of strings + recordContext.writer->writeAttribute(value, type); recordContext.attributeIndex++; if (recordContext.attributeIndex % relationContext.readerMetadata.size() == 0) { @@ -109,7 +109,7 @@ } void endOfPipe() { - // TODO: check number of attribute values + if (recordContext.attributeIndex != 0) throw relpipe::reader::RelpipeReaderException(L"Invalid number of attributes at the end of the pipe – incomplete record."); } };