From 8157678eba97d7de5c53b424a9866d327392bbd9 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Mon, 31 May 2021 12:27:58 -0700 Subject: Fix standard incompetence found by MSVC - requires-expression still not working, because they aren't supported yet outside of a concept --- core/src/Model/Template/TableTemplate.cpp | 17 ++++++++++++++--- core/src/Model/Template/TableTemplate.hpp | 23 +++++++++++++---------- core/src/Model/Template/Template.hpp | 4 ++-- core/src/Model/Template/Template_Main.cpp | 2 ++ 4 files changed, 31 insertions(+), 15 deletions(-) (limited to 'core/src/Model/Template') diff --git a/core/src/Model/Template/TableTemplate.cpp b/core/src/Model/Template/TableTemplate.cpp index 0ad1cca..b8444b7 100644 --- a/core/src/Model/Template/TableTemplate.cpp +++ b/core/src/Model/Template/TableTemplate.cpp @@ -1,6 +1,7 @@ #include "TableTemplate.hpp" #include +#include #include bool TableCell::IsDataHoldingCell() const @@ -189,14 +190,14 @@ TableTemplate::BreakCellsResult TableTemplate::BreakCells(Vec2i topLeft) return BCR_Success; } -lxw_workbook* TableTemplate::InstanciateToExcelWorkbook(const TableInstanciationParameters& params) const +lxw_workbook* TableTemplate::InstantiateToExcelWorkbook(const TableInstanciationParameters& params) const { auto workbook = workbook_new("Table.xlsx"); - InstanciateToExcelWorksheet(workbook, params); + InstantiateToExcelWorksheet(workbook, params); return workbook; } -lxw_worksheet* TableTemplate::InstanciateToExcelWorksheet(lxw_workbook* workbook, const TableInstanciationParameters& params) const +lxw_worksheet* TableTemplate::InstantiateToExcelWorksheet(lxw_workbook* workbook, const TableInstanciationParameters& params) const { auto worksheet = workbook_add_worksheet(workbook, "CpltExport.xlsx"); @@ -301,3 +302,13 @@ lxw_worksheet* TableTemplate::InstanciateToExcelWorksheet(lxw_workbook* workbook return worksheet; } +Template::ReadResult TableTemplate::ReadFrom(std::istream& stream) +{ + // TODO + return ReadResult::RR_Success; +} + +void TableTemplate::WriteTo(std::ostream& stream) const +{ + // TODO +} diff --git a/core/src/Model/Template/TableTemplate.hpp b/core/src/Model/Template/TableTemplate.hpp index 688192a..f7a79e9 100644 --- a/core/src/Model/Template/TableTemplate.hpp +++ b/core/src/Model/Template/TableTemplate.hpp @@ -34,12 +34,12 @@ public: Vec2i Location; /// Location of the primary (top left) cell, if this cell is a part of a merged group. /// Otherwise, either component of this field shall be -1. - Vec2i PrimaryCellLocation; - int SpanX; - int SpanY; - TextAlignment HorizontalAlignment = AlignAxisMin; - TextAlignment VerticalAlignment = AlignAxisMin; - CellType Type; + Vec2i PrimaryCellLocation{ -1, -1 }; + int SpanX = 0; + int SpanY = 0; + TextAlignment HorizontalAlignment = AlignCenter; + TextAlignment VerticalAlignment = AlignCenter; + CellType Type = ConstantCell; /// The id of the group description object, if this cell isn't a constant or singluar parameter cell. Otherwise, this value is -1. int DataId = -1; @@ -56,7 +56,7 @@ public: // TODO support horizontal filling order /// Parameter group information for a grouped array of cells. When instanciated, an array of 0 or more /// elements shall be provided by the user, which will replace the group of templated cells with a list -/// of rows, each instanciated with the n-th element in the provided array. +/// of rows, each instantiated with the n-th element in the provided array. /// \code /// [["foo", "bar", "foobar"], /// ["a", "b", c"], @@ -124,7 +124,7 @@ public: const TableTemplate& GetTable() const; }; -/// A table template, where individual cells can be filled by workflows instanciating this template. Merged cells, +/// A table template, where individual cells can be filled by workflows instantiating this template. Merged cells, /// parametric rows/columns, and grids are also supported. /// /// This current supports exporting to xlsx files. @@ -163,6 +163,9 @@ public: }; BreakCellsResult BreakCells(Vec2i topLeft); - lxw_workbook* InstanciateToExcelWorkbook(const TableInstanciationParameters& params) const; - lxw_worksheet* InstanciateToExcelWorksheet(lxw_workbook* workbook, const TableInstanciationParameters& params) const; + lxw_workbook* InstantiateToExcelWorkbook(const TableInstanciationParameters& params) const; + lxw_worksheet* InstantiateToExcelWorksheet(lxw_workbook* workbook, const TableInstanciationParameters& params) const; + + virtual ReadResult ReadFrom(std::istream& stream) override; + virtual void WriteTo(std::ostream& stream) const override; }; diff --git a/core/src/Model/Template/Template.hpp b/core/src/Model/Template/Template.hpp index 0901a1b..f7dd898 100644 --- a/core/src/Model/Template/Template.hpp +++ b/core/src/Model/Template/Template.hpp @@ -29,8 +29,8 @@ public: RR_Success, RR_InvalidFormat, }; - ReadResult ReadFrom(std::istream& stream) = 0; - void WriteTo(std::ostream& stream) const = 0; + virtual ReadResult ReadFrom(std::istream& stream) = 0; + virtual void WriteTo(std::ostream& stream) const = 0; }; class TemplateInfo diff --git a/core/src/Model/Template/Template_Main.cpp b/core/src/Model/Template/Template_Main.cpp index eeb6871..08437b7 100644 --- a/core/src/Model/Template/Template_Main.cpp +++ b/core/src/Model/Template/Template_Main.cpp @@ -2,4 +2,6 @@ std::unique_ptr