]> git.lyx.org Git - features.git/commitdiff
Move class definitions inside main class
authorGuillaume Munch <gm@lyx.org>
Tue, 11 Oct 2016 10:09:38 +0000 (12:09 +0200)
committerGuillaume Munch <gm@lyx.org>
Sat, 22 Oct 2016 21:24:01 +0000 (23:24 +0200)
Prepare for following commits.

This prevent's forward-declaration, but including the TexRow header should be
inexpensive.

src/Buffer.cpp
src/BufferView.cpp
src/BufferView.h
src/ErrorList.h
src/TexRow.cpp
src/TexRow.h
src/insets/InsetTabular.cpp
src/mathed/InsetMathGrid.cpp
src/mathed/MathStream.cpp
src/mathed/MathStream.h

index 649c74ba7a4cc7877ca634895414186e78f3ea11..d6977e642e8fe3426a63e9a8de9119d027aedb71 100644 (file)
@@ -4472,7 +4472,7 @@ Buffer::ReadStatus Buffer::loadThisLyXFile(FileName const & fn)
 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;
index 862344c3be83cc79e06dc656cdf24340f11e158a..a9ce9a1092270f41e802100bb3d620ddad898b10 100644 (file)
@@ -2345,7 +2345,7 @@ int BufferView::scrollUp(int offset)
 
 bool BufferView::setCursorFromRow(int row)
 {
 
 bool BufferView::setCursorFromRow(int row)
 {
-       TextEntry start, end;
+       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 "
@@ -2355,7 +2355,8 @@ bool BufferView::setCursorFromRow(int row)
 }
 
 
 }
 
 
-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) =
index 016423f87bfcf53faca39ee1c10925aa0f1a6a95..ee2de8276e3a597c258d14ea65d8de435068b6ea 100644 (file)
@@ -16,6 +16,7 @@
 #define BUFFER_VIEW_H
 
 #include "DocumentClassPtr.h"
 #define BUFFER_VIEW_H
 
 #include "DocumentClassPtr.h"
+#include "TexRow.h"
 #include "update_flags.h"
 
 #include "support/strfwd.h"
 #include "update_flags.h"
 
 #include "support/strfwd.h"
@@ -46,7 +47,6 @@ class ParagraphMetrics;
 class Point;
 class TexRow;
 class Text;
 class Point;
 class TexRow;
 class Text;
-struct TextEntry;
 class TextMetrics;
 
 enum CursorStatus {
 class TextMetrics;
 
 enum CursorStatus {
@@ -165,7 +165,7 @@ public:
        /// 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 *);
index 41c65fc24a533de59827b29c617362e6a3fe7e6e..35294476dccdb4a27fdb198e8e01d25ee06dd89a 100644 (file)
@@ -27,6 +27,7 @@ class Buffer;
 /// 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
@@ -35,8 +36,7 @@ public:
        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);
index 68843b558616fbfb9347c898c502765f188d2f75..2884cda664973f4b5ca1e773efa528c3d16c377d 100644 (file)
@@ -84,7 +84,7 @@ void TexRow::RowEntryList::forceAddEntry(RowEntry entry)
 }
 
 
 }
 
 
-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_;
@@ -106,8 +106,8 @@ TexRow::TexRow()
 }
 
 
 }
 
 
-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 } };
 
 
 //static
 
 
 //static
@@ -138,7 +138,7 @@ TexRow::RowEntryList & TexRow::currentRow()
 
 
 //static
 
 
 //static
-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;
@@ -149,7 +149,7 @@ RowEntry TexRow::textEntry(int id, pos_type pos)
 
 
 //static
 
 
 //static
-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;
@@ -159,7 +159,7 @@ RowEntry TexRow::mathEntry(uid_type id, idx_type cell)
 }
 
 
 }
 
 
-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
@@ -217,7 +217,8 @@ void TexRow::append(TexRow other)
 }
 
 
 }
 
 
-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
@@ -312,7 +313,7 @@ FuncRequest TexRow::goToFuncFromRow(int const row) const
 
 
 //static
 
 
 //static
-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();
index 7697761987d48387df871913eefa3eee3e31a979..57c01ddb9ef6d2f6bb95b7e914885b88d11ec4c3 100644 (file)
@@ -47,26 +47,27 @@ typedef void const * uid_type;
 typedef size_t idx_type;
 
 
 typedef size_t idx_type;
 
 
-/// 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;
 
@@ -286,7 +287,7 @@ public:
 };
 
 
 };
 
 
-bool operator==(RowEntry entry1, RowEntry entry2);
+bool operator==(TexRow::RowEntry entry1, TexRow::RowEntry entry2);
 
 
 } // namespace lyx
 
 
 } // namespace lyx
index 3a16c815d4f7d4bbb2a870d8a3cdd13747674d8b..bf21ae73f148c7b3288663f975186e23b4e02c8d 100644 (file)
@@ -2708,7 +2708,7 @@ void Tabular::TeXRow(otexstream & os, row_type row,
 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                    +
index a0269c511fcc13432f6918e0887c3442553d22bc..053958d1c57710a10ac960a40e3d466c97ab77fa 100644 (file)
@@ -1276,7 +1276,7 @@ void InsetMathGrid::write(WriteStream & os,
                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;
index e2b65662de62cd7aa752fed8e9aeb2fc7abd21d8..ee6583530e80a03202785cc0494646bfc4dbd969 100644 (file)
@@ -131,7 +131,7 @@ WriteStream::WriteStream(otexrowstream & os, bool fragile, bool latex,
          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)
 {}
 
 
 {}
 
 
@@ -180,17 +180,17 @@ void WriteStream::asciiOnly(bool ascii)
 }
 
 
 }
 
 
-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 false;
                return false;
-       return texrow().start(*row_entry_);
+       return texrow().start(row_entry_);
 }
 
 
 }
 
 
index 996525bc3e2f2e68fbff7084b3fc05e02dd682a1..2a4d4d7cbeb0fa882290edad3faec1226e86f0e7 100644 (file)
@@ -13,6 +13,8 @@
 #define MATH_MATHMLSTREAM_H
 
 #include "InsetMath.h"
 #define MATH_MATHMLSTREAM_H
 
 #include "InsetMath.h"
+
+#include "TexRow.h"
 #include "texstream.h"
 
 #include "support/Changer.h"
 #include "texstream.h"
 
 #include "support/Changer.h"
@@ -26,7 +28,6 @@ class Encoding;
 class InsetMath;
 class MathAtom;
 class MathData;
 class InsetMath;
 class MathAtom;
 class MathData;
-struct RowEntry;
 
 //
 // LaTeX/LyX
 
 //
 // LaTeX/LyX
@@ -104,7 +105,7 @@ public:
        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();
@@ -140,8 +141,7 @@ private:
        ///
        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_;
 };
 
 ///
 };
 
 ///