aboutsummaryrefslogtreecommitdiff
path: root/core/src/Model/Template/TableTemplate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/Model/Template/TableTemplate.cpp')
-rw-r--r--core/src/Model/Template/TableTemplate.cpp56
1 files changed, 51 insertions, 5 deletions
diff --git a/core/src/Model/Template/TableTemplate.cpp b/core/src/Model/Template/TableTemplate.cpp
index adf79fe..a5745c7 100644
--- a/core/src/Model/Template/TableTemplate.cpp
+++ b/core/src/Model/Template/TableTemplate.cpp
@@ -1,7 +1,14 @@
#include "TableTemplate.hpp"
+#include "Utils/IO/StringIntegration.hpp"
+#include "Utils/IO/TslArrayIntegration.hpp"
+#include "Utils/IO/VectorIntegration.hpp"
+
#include <xlsxwriter.h>
+#include <algorithm>
#include <charconv>
+#include <cstddef>
+#include <cstdint>
#include <iostream>
#include <map>
@@ -20,6 +27,23 @@ bool TableCell::IsMergedCell() const
return PrimaryCellLocation.x == -1 || PrimaryCellLocation.y == -1;
}
+template <class TProxy>
+void TableCell::OperateIOProxy(TProxy& proxy)
+{
+ proxy.template ObjectAdapted<DataStreamAdapters::String>(Content);
+ proxy.Object(Location);
+ proxy.Object(PrimaryCellLocation);
+ proxy.Value(SpanX);
+ proxy.Value(SpanY);
+ proxy.Value(HorizontalAlignment);
+ proxy.Value(VerticalAlignment);
+ proxy.Value(Type);
+ proxy.Value(DataId);
+}
+
+template void TableCell::OperateIOProxy(InputDataStream& adapter);
+template void TableCell::OperateIOProxy(OutputDataStream& adapter);
+
Vec2i TableArrayGroup::GetLeftCell() const
{
return { Row, LeftCell };
@@ -62,6 +86,17 @@ bool TableArrayGroup::UpdateCellName(std::string_view oldName, std::string_view
return ::UpdateElementName(mName2Cell, oldName, newName);
}
+template <class TProxy>
+void TableArrayGroup::OperateIOProxy(TProxy& proxy)
+{
+ proxy.Value(Row);
+ proxy.Value(LeftCell);
+ proxy.Value(RightCell);
+}
+
+template void TableArrayGroup::OperateIOProxy(InputDataStream& adapter);
+template void TableArrayGroup::OperateIOProxy(OutputDataStream& adapter);
+
TableInstantiationParameters::TableInstantiationParameters(const TableTemplate& table)
: mTable{ &table }
{
@@ -513,13 +548,24 @@ lxw_worksheet* TableTemplate::InstantiateToExcelWorksheet(lxw_workbook* workbook
return worksheet;
}
-Template::ReadResult TableTemplate::ReadFrom(std::istream& stream)
+
+void TableTemplate::ReadFromDataStream(InputDataStream& stream)
+{
+ OperateIOProxy(stream);
+}
+
+void TableTemplate::WriteToDataStream(OutputDataStream& stream)
{
- // TODO
- return ReadResult::RR_Success;
+ OperateIOProxy(stream);
}
-void TableTemplate::WriteTo(std::ostream& stream) const
+template <class TProxy>
+void TableTemplate::OperateIOProxy(TProxy& proxy)
{
- // TODO
+ proxy.template ObjectAdapted<DataStreamAdapters::Vector<>>(mColumnWidths);
+ proxy.template ObjectAdapted<DataStreamAdapters::Vector<>>(mRowHeights);
+ proxy.template ObjectAdapted<DataStreamAdapters::Vector<>>(mCells);
+ proxy.template ObjectAdapted<DataStreamAdapters::Vector<>>(mArrayGroups);
+ proxy.template ObjectAdapted<DataStreamAdapters::TslArrayMap<>>(mName2Parameters);
+ proxy.template ObjectAdapted<DataStreamAdapters::TslArrayMap<>>(mName2ArrayGroups);
}