more const correctness

The const_cast shows the place where const correctness is violated, this is
no longer hidden by lying member functions.
This commit is contained in:
Georg Baum 2016-06-21 21:09:50 +02:00
parent 539258273d
commit c4ab621088
2 changed files with 15 additions and 5 deletions

View File

@ -1668,7 +1668,13 @@ bool Tabular::hasMultiColumn(col_type c) const
}
Tabular::CellData & Tabular::cellInfo(idx_type cell) const
Tabular::CellData const & Tabular::cellInfo(idx_type cell) const
{
return cell_info[cellRow(cell)][cellColumn(cell)];
}
Tabular::CellData & Tabular::cellInfo(idx_type cell)
{
return cell_info[cellRow(cell)][cellColumn(cell)];
}
@ -2606,7 +2612,7 @@ void Tabular::TeXRow(otexstream & os, row_type row,
if (getAlignment(cell) == LYX_ALIGN_DECIMAL) {
// copy cell and split in 2
InsetTableCell head = InsetTableCell(*cellInset(cell));
head.setBuffer(buffer());
head.setBuffer(const_cast<Buffer &>(buffer()));
DocIterator dit = cellInset(cell)->getText(0)->macrocontextPosition();
dit.pop_back();
dit.push_back(CursorSlice(head));

View File

@ -24,7 +24,6 @@
#ifndef INSET_TABULAR_H
#define INSET_TABULAR_H
#include "Inset.h"
#include "InsetText.h"
#include "Length.h"
@ -677,7 +676,10 @@ public:
///
shared_ptr<InsetTableCell> inset;
};
CellData & cellInfo(idx_type cell) const;
///
CellData const & cellInfo(idx_type cell) const;
///
CellData & cellInfo(idx_type cell);
///
typedef std::vector<CellData> cell_vector;
///
@ -832,7 +834,9 @@ public:
/// change associated Buffer
void setBuffer(Buffer & buffer);
/// retrieve associated Buffer
Buffer & buffer() const { return *buffer_; }
Buffer const & buffer() const { return *buffer_; }
/// retrieve associated Buffer
Buffer & buffer() { return *buffer_; }
private:
Buffer * buffer_;