Prepare for following commits.
This prevent's forward-declaration, but including the TexRow header should be
inexpensive.
void Buffer::bufferErrors(TeXErrors const & terr, ErrorList & errorList) const
{
for (auto const & err : terr) {
void Buffer::bufferErrors(TeXErrors const & terr, ErrorList & errorList) const
{
for (auto const & err : terr) {
- TextEntry start, end = TexRow::text_none;
+ TexRow::TextEntry start, end = TexRow::text_none;
int errorRow = err.error_in_line;
Buffer const * buf = 0;
Impl const * p = d;
int errorRow = err.error_in_line;
Buffer const * buf = 0;
Impl const * p = d;
bool BufferView::setCursorFromRow(int row)
{
bool BufferView::setCursorFromRow(int row)
{
+ TexRow::TextEntry start, end;
tie(start,end) = buffer_.texrow().getEntriesFromRow(row);
LYXERR(Debug::LATEX,
"setCursorFromRow: for row " << row << ", TexRow has found "
tie(start,end) = buffer_.texrow().getEntriesFromRow(row);
LYXERR(Debug::LATEX,
"setCursorFromRow: for row " << row << ", TexRow has found "
-bool BufferView::setCursorFromEntries(TextEntry start, TextEntry end)
+bool BufferView::setCursorFromEntries(TexRow::TextEntry start,
+ TexRow::TextEntry end)
{
DocIterator dit_start, dit_end;
tie(dit_start,dit_end) =
{
DocIterator dit_start, dit_end;
tie(dit_start,dit_end) =
#define BUFFER_VIEW_H
#include "DocumentClassPtr.h"
#define BUFFER_VIEW_H
#include "DocumentClassPtr.h"
#include "update_flags.h"
#include "support/strfwd.h"
#include "update_flags.h"
#include "support/strfwd.h"
class Point;
class TexRow;
class Text;
class Point;
class TexRow;
class Text;
class TextMetrics;
enum CursorStatus {
class TextMetrics;
enum CursorStatus {
/// set the cursor based on the given TeX source row.
bool setCursorFromRow(int row);
/// set the cursor based on the given start and end TextEntries.
/// set the cursor based on the given TeX source row.
bool setCursorFromRow(int row);
/// set the cursor based on the given start and end TextEntries.
- bool setCursorFromEntries(TextEntry start, TextEntry end);
+ bool setCursorFromEntries(TexRow::TextEntry start, TexRow::TextEntry end);
/// set cursor to the given inset. Return true if found.
bool setCursorFromInset(Inset const *);
/// set cursor to the given inset. Return true if found.
bool setCursorFromInset(Inset const *);
/// A class to hold an error item
class ErrorItem {
public:
/// A class to hold an error item
class ErrorItem {
public:
+ typedef TexRow::TextEntry TextEntry;
docstring error;
docstring description;
// To generalise into RowEntries
docstring error;
docstring description;
// To generalise into RowEntries
Buffer const * buffer;
// With a start position and an end position
ErrorItem(docstring const & error, docstring const & description,
Buffer const * buffer;
// With a start position and an end position
ErrorItem(docstring const & error, docstring const & description,
- TextEntry start, TextEntry end,
- Buffer const * buf = 0);
+ TextEntry start, TextEntry end, Buffer const * buf = 0);
// Error outside the document body
ErrorItem(docstring const & error, docstring const & description,
Buffer const * buf = 0);
// Error outside the document body
ErrorItem(docstring const & error, docstring const & description,
Buffer const * buf = 0);
-TextEntry TexRow::RowEntryList::getTextEntry() const
+TexRow::TextEntry TexRow::RowEntryList::getTextEntry() const
{
if (!isNone(text_entry_))
return text_entry_;
{
if (!isNone(text_entry_))
return text_entry_;
-TextEntry const TexRow::text_none = { -1, 0 };
-RowEntry const TexRow::row_none = { false, { TexRow::text_none } };
+TexRow::TextEntry const TexRow::text_none = { -1, 0 };
+TexRow::RowEntry const TexRow::row_none = { false, { TexRow::text_none } };
-RowEntry TexRow::textEntry(int id, pos_type pos)
+TexRow::RowEntry TexRow::textEntry(int id, pos_type pos)
{
RowEntry entry;
entry.is_math = false;
{
RowEntry entry;
entry.is_math = false;
-RowEntry TexRow::mathEntry(uid_type id, idx_type cell)
+TexRow::RowEntry TexRow::mathEntry(uid_type id, idx_type cell)
{
RowEntry entry;
entry.is_math = true;
{
RowEntry entry;
entry.is_math = true;
-bool operator==(RowEntry entry1, RowEntry entry2)
+bool operator==(TexRow::RowEntry entry1, TexRow::RowEntry entry2)
{
return entry1.is_math == entry2.is_math
&& (entry1.is_math
{
return entry1.is_math == entry2.is_math
&& (entry1.is_math
-pair<TextEntry, TextEntry> TexRow::getEntriesFromRow(int const row) const
+pair<TexRow::TextEntry, TexRow::TextEntry>
+TexRow::getEntriesFromRow(int const row) const
{
LYXERR(Debug::LATEX, "getEntriesFromRow: row " << row << " requested");
// check bounds for row - 1, our target index
{
LYXERR(Debug::LATEX, "getEntriesFromRow: row " << row << " requested");
// check bounds for row - 1, our target index
-RowEntry TexRow::rowEntryFromCursorSlice(CursorSlice const & slice)
+TexRow::RowEntry TexRow::rowEntryFromCursorSlice(CursorSlice const & slice)
{
RowEntry entry;
InsetMath * insetMath = slice.asInsetMath();
{
RowEntry entry;
InsetMath * insetMath = slice.asInsetMath();
-/// an individual par id/pos <=> row mapping
-struct TextEntry { int id; pos_type pos; };
-
-/// an individual math id/cell <=> row mapping
-struct MathEntry { uid_type id; idx_type cell; };
-
-/// a container for passing entries around
-struct RowEntry {
- bool is_math;// true iff the union is a math
- union {
- struct TextEntry text;
- struct MathEntry math;
- };
-};
-
-
/// Represents the correspondence between paragraphs and the generated
/// LaTeX file
class TexRow {
/// Represents the correspondence between paragraphs and the generated
/// LaTeX file
class TexRow {
+public:
+ /// an individual par id/pos <=> row mapping
+ struct TextEntry { int id; pos_type pos; };
+
+ /// an individual math id/cell <=> row mapping
+ struct MathEntry { uid_type id; idx_type cell; };
+
+ /// a container for passing entries around
+ struct RowEntry {
+ bool is_math;// true iff the union is a math
+ union {
+ struct TextEntry text;
+ struct MathEntry math;
+ };
+ };
+
+private:
/// id/pos correspondence for a single row
class RowEntryList;
/// id/pos correspondence for a single row
class RowEntryList;
-bool operator==(RowEntry entry1, RowEntry entry2);
+bool operator==(TexRow::RowEntry entry1, TexRow::RowEntry entry2);
void Tabular::latex(otexstream & os, OutputParams const & runparams) const
{
bool const is_tabular_star = !tabular_width.zero();
void Tabular::latex(otexstream & os, OutputParams const & runparams) const
{
bool const is_tabular_star = !tabular_width.zero();
- RowEntry pos = TexRow::textEntry(runparams.lastid, runparams.lastpos);
+ TexRow::RowEntry pos = TexRow::textEntry(runparams.lastid, runparams.lastpos);
//+---------------------------------------------------------------------
//+ first the opening preamble +
//+---------------------------------------------------------------------
//+ first the opening preamble +
for (col_type col = beg_col; col < end_col;) {
int nccols = 1;
idx_type const idx = index(row, col);
for (col_type col = beg_col; col < end_col;) {
int nccols = 1;
idx_type const idx = index(row, col);
- RowEntry entry = TexRow::mathEntry(id(),idx);
+ TexRow::RowEntry entry = TexRow::mathEntry(id(),idx);
os.texrow().start(entry);
if (col >= lastcol) {
++col;
os.texrow().start(entry);
if (col >= lastcol) {
++col;
output_(output), pendingspace_(false), pendingbrace_(false),
textmode_(false), locked_(0), ascii_(0), canbreakline_(true),
mathsout_(false), ulemcmd_(NONE), line_(0), encoding_(encoding),
output_(output), pendingspace_(false), pendingbrace_(false),
textmode_(false), locked_(0), ascii_(0), canbreakline_(true),
mathsout_(false), ulemcmd_(NONE), line_(0), encoding_(encoding),
- row_entry_(make_unique<RowEntry>(TexRow::row_none))
+ row_entry_(TexRow::row_none)
-Changer WriteStream::changeRowEntry(RowEntry entry)
+Changer WriteStream::changeRowEntry(TexRow::RowEntry entry)
- return make_change(*row_entry_, entry);
+ return make_change(row_entry_, entry);
}
bool WriteStream::startOuterRow()
{
}
bool WriteStream::startOuterRow()
{
- if (TexRow::isNone(*row_entry_))
+ if (TexRow::isNone(row_entry_))
- return texrow().start(*row_entry_);
+ return texrow().start(row_entry_);
#define MATH_MATHMLSTREAM_H
#include "InsetMath.h"
#define MATH_MATHMLSTREAM_H
#include "InsetMath.h"
#include "texstream.h"
#include "support/Changer.h"
#include "texstream.h"
#include "support/Changer.h"
class InsetMath;
class MathAtom;
class MathData;
class InsetMath;
class MathAtom;
class MathData;
Encoding const * encoding() const { return encoding_; }
/// Temporarily change the TexRow information about the outer row entry.
Encoding const * encoding() const { return encoding_; }
/// Temporarily change the TexRow information about the outer row entry.
- Changer changeRowEntry(RowEntry entry);
+ Changer changeRowEntry(TexRow::RowEntry entry);
/// TexRow::starts the innermost outer math inset
/// returns true if the outer row entry will appear at this line
bool startOuterRow();
/// TexRow::starts the innermost outer math inset
/// returns true if the outer row entry will appear at this line
bool startOuterRow();
///
Encoding const * encoding_;
/// Row entry we are in
///
Encoding const * encoding_;
/// Row entry we are in
- /// (it is a pointer to allow forward-declaration)
- unique_ptr<RowEntry> row_entry_;
+ TexRow::RowEntry row_entry_;