20#include "../utils/tools.hpp"
269 head += _sHead +
'\n';
321 if (!_sValue.length())
431 int nHeadlineCount = 1;
434 for (
size_t j = 0; j <
vTableData.size(); j++)
440 if (
vTableData[j]->m_sHeadLine.find(
'\n') == std::string::npos)
446 for (
unsigned int n = 0; n <
vTableData[j]->m_sHeadLine.length() - 2; n++)
453 if (nLinebreak + 1 > nHeadlineCount)
454 nHeadlineCount = nLinebreak + 1;
457 return nHeadlineCount;
515 if (head.find(
'\n') == string::npos)
525 for (
size_t j = 0; j < head.length(); j++)
530 return head.substr(pos, j - pos);
540 return head.substr(pos);
588 return vTableData[j]->getValueAsStringLiteral(i);
642 if (col && col->size() > lines)
690 col->insertElements(nPos, nNum);
709 col->appendElements(nNum);
732 col->removeElements(nPos, nNum);
751 vTableData.insert(
vTableData.begin()+nPos, std::make_move_iterator(arr.begin()), std::make_move_iterator(arr.end()));
766 vTableData.insert(
vTableData.end(), std::make_move_iterator(arr.begin()), std::make_move_iterator(arr.end()));
This data container is a copy- efficient table to interchange data between Kernel and GUI.
bool insertLines(size_t nPos=0, size_t nNum=1)
This member function inserts lines at the desired position.
TableColumn::ColumnType getColumnType(size_t j) const
Returns the type of the selected column.
void setName(const std::string &_sName)
Setter function for the table name.
void Clear()
This member function cleares the contents of this table.
bool appendLines(size_t nNum=1)
This member function appends lines.
bool isEmpty() const
Return, whether the table is empty.
std::string getValueAsString(size_t i, size_t j) const
Getter function for the value of the selected cell. The value is converted into a string.
bool deleteCols(size_t nPos=0, size_t nNum=1)
This member function delets columns at the desired position.
void setComment(const std::string &_comment)
Setter function for the table comment.
void setValue(size_t i, size_t j, const mu::value_type &_dValue)
This member function sets the data to the table. It will resize the table automatically,...
void setSize(size_t i, size_t j)
This member function simply redirects the control to setMinSize().
void setColumn(size_t j, TableColumn *column)
Assigns a whole column to the internal array.
std::string getCleanHeadPart(size_t i, size_t part=0) const
Getter function for the selected part of the selected column's headline. Underscores and masked headl...
bool insertCols(size_t nPos=0, size_t nNum=1)
This member function inserts columns at the desired position.
Table()
Default constructor.
std::string getHead(size_t i) const
Getter function for the selected column's headline.
std::string getName() const
Getter function for the table name.
int getHeadCount() const
Getter function for the needed number of headlines (depending on the number of linebreaks found in th...
void setHead(size_t i, const std::string &_sHead)
Setter function for the selected column headline. Will create missing headlines automatically.
Table & operator=(Table _table)
Move assignment operator.
size_t getCols() const
Get the number of columns.
TableMetaData getMetaData() const
Getter function for the table meta data.
void setValueAsString(size_t i, size_t j, const std::string &_sValue)
This member function sets the data, which is passed as a string, to the table. If the data is not a n...
std::string getComment() const
Getter function for the table comment.
bool isNumerical(const std::string &sValue) const
This member function is a simple helper function to determine, whether a passed value may be parsed i...
void setMetaData(const TableMetaData &meta)
Setter function for the table meta data.
size_t getLines() const
Get the number of lines.
mu::value_type getValue(size_t i, size_t j) const
Getter function for the value of the selected cell.
bool setColumnType(size_t j, TableColumn::ColumnType _type)
Tries to change the column type of the selected column.
bool deleteLines(size_t nPos=0, size_t nNum=1)
This member function deletes lines at the desired position.
void setMinSize(size_t i, size_t j)
This member function prepares a table with the minimal size of the selected lines and columns.
bool appendCols(size_t nNum=1)
This member function appends columns.
void setHeadPart(size_t i, size_t part, const std::string &_sHead)
Setter function for the selected column headline and the selected part of the headline (split using l...
TableColumn * getColumn(size_t j) const
Returns a copy of the internal column array or a nullptr, if the column does not exist or is empty.
TableColumnArray vTableData
std::string getCleanHead(size_t i) const
Getter function for the selected column's headline. Underscores and masked headlines are replaced on-...
A table column containing only numerical values.
This class abstracts all the index logics, i.e. the logical differences between single indices and in...
MUP_BASETYPE value_type
The numeric datatype used by the parser.
Abstract table column, which allows using it to compose the data table in each Memory instance.
static std::string getDefaultColumnHead(size_t colNo)
Creates a default column headline for a column, which can be used without an instance of this class.
std::unique_ptr< TableColumn > TblColPtr
Typedef for simplifying the usage of a smart pointer in combination with a TableColumn instance.
std::vector< TblColPtr > TableColumnArray
This typedef represents the actual table, which is implemented using a std::vector.
void convert_if_empty(TblColPtr &col, size_t colNo, TableColumn::ColumnType type)
Tries to convert a column if the column does not contain any data (with the exception of the header).
bool convert_if_needed(TblColPtr &col, size_t colNo, TableColumn::ColumnType type)
Tries to convert a column into the selected column, if possible.