]> git.lyx.org Git - features.git/blobdiff - src/paragraph_funcs.C
change "support/std_sstream.h" to <sstream>
[features.git] / src / paragraph_funcs.C
index ff7d32fd01faeb2a17d09785a9ef20b53641ab5f..b2794d996adbd7bd655db5053a041450d99551f4 100644 (file)
 #include "debug.h"
 #include "encoding.h"
 #include "gettext.h"
-#include "iterators.h"
 #include "language.h"
 #include "lyxtext.h"
 #include "outputparams.h"
 #include "paragraph_pimpl.h"
+#include "pariterator.h"
 #include "sgml.h"
 #include "texrow.h"
 #include "vspace.h"
@@ -30,8 +30,8 @@
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/lyxlib.h"
-#include "support/std_sstream.h"
 
+#include <sstream>
 #include <vector>
 
 using lyx::pos_type;
@@ -126,18 +126,14 @@ void breakParagraph(BufferParams const & bparams,
                // copy everything behind the break-position
                // to the new paragraph
 
-#ifdef WITH_WARNINGS
-#warning this seems wrong
-#endif
-               /* FIXME: if !keepempty, empty() == true, then we reach
-                * here with size() == 0. So pos_end becomes - 1. Why
-                * doesn't this cause problems ???
+               /* Note: if !keepempty, empty() == true, then we reach
+                * here with size() == 0. So pos_end becomes - 1. This
+                * doesn't cause problems because both loops below
+                * enforce pos <= pos_end and 0 <= pos
                 */
                pos_type pos_end = pars[par].size() - 1;
-               pos_type i = pos;
-               pos_type j = pos;
 
-               for (; i <= pos_end; ++i) {
+               for (pos_type i = pos, j = pos; i <= pos_end; ++i) {
                        Change::Type change = pars[par].lookupChange(i);
                        if (moveItem(pars[par], *tmp, bparams, i, j - pos)) {
                                tmp->setChange(j - pos, change);
@@ -145,7 +141,7 @@ void breakParagraph(BufferParams const & bparams,
                        }
                }
 
-               for (i = pos_end; i >= pos; --i)
+               for (pos_type i = pos_end; i >= pos; --i)
                        pars[par].eraseIntern(i);
        }
 
@@ -310,8 +306,8 @@ par_type outerPar(Buffer const & buf, InsetBase const * inset)
                        if (&text->paragraphs() == &pit.plist())
                                return pit.outerPar();
 
-               InsetList::iterator ii = pit->insetlist.begin();
-               InsetList::iterator iend = pit->insetlist.end();
+               InsetList::const_iterator ii = pit->insetlist.begin();
+               InsetList::const_iterator iend = pit->insetlist.end();
                for ( ; ii != iend; ++ii)
                        if (ii->inset == inset)
                                return pit.outerPar();
@@ -345,7 +341,7 @@ Paragraph const & ownerPar(Buffer const & buf, InsetBase const * inset)
 }
 
 
-/// return the range of pars [beg, end[ owning the range of y [ystart, yend] 
+/// return the range of pars [beg, end[ owning the range of y [ystart, yend]
 void getParsInRange(ParagraphList & pars, int ystart, int yend,
        par_type & beg, par_type & end)
 {