/
thomas-king
/
ArgumentsParser
Обзор
Документация
Войти
/
thomas-king
/
ArgumentsParser
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
lib/Manual/Models/Table.cpp
67 строк
1 KB
Ace Rodstin
Update header files
22 ноя 2023, 03:04
22 ноя 2023, 03:04
e102d33
Код
Авторство
О чём код?
// // Table.cpp // Manual // // Created by Ace Rodstin on 11/20/23. // Updated by Ace Rodstin on 11/20/23. // // Copyright (C) 2023 Ace Rodstin. All rights reserved. // #include "Manual/Models/Table.h" using namespace manual; Table::Table(initializer_list<Column> columns): columns { columns } {} vector<Column> Table::getColumns() const { return columns; } Table::Shape Table::getShape() const { int columnCounter = 0; int lineCounter = 0; for (auto column : columns) { auto cells = column.getCells(); auto cellsCount = cells.size(); if (lineCounter < cellsCount) { lineCounter = cellsCount; } columnCounter++; } return Shape { columnCounter, lineCounter }; } vector<Cell::Size> Table::getSize() const { vector<Cell::Size> result; for (auto column : columns) { auto cells = column.getCells(); Cell::Size columnSize = 0; for (auto cell : cells) { auto cellSize = cell.getSize(); if (columnSize < cellSize) { columnSize = cellSize; } } result.push_back(columnSize); } return result; } Cell::Value Table::operator [](Location location) const { auto column = columns[location.column]; auto cells = column.getCells(); auto cell = cells[location.line]; return cell.getValue(); }