]> git.lyx.org Git - lyx.git/blobdiff - src/DocIterator.cpp
Embedding: saving inzip name to .lyx file so that embedded files can always be found...
[lyx.git] / src / DocIterator.cpp
index 0d8c1002110d46e1fba0e0eb52cac64f1ab25601..51d21921a0990be19c59106f7823b209b5b3f9f9 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "DocIterator.h"
 
-#include "debug.h"
+#include "support/debug.h"
 #include "InsetList.h"
 #include "Paragraph.h"
 #include "Text.h"
 #include "insets/InsetTabular.h"
 
 #include <boost/assert.hpp>
-#include <boost/current_function.hpp>
 
-using std::endl;
+#include <ostream>
 
+using namespace std;
 
 namespace lyx {
 
@@ -59,13 +59,20 @@ DocIterator doc_iterator_end(Inset & inset)
 }
 
 
+LyXErr & operator<<(LyXErr & os, DocIterator const & it)
+{
+       os.stream() << it;
+       return os;
+}
+
+
 Inset * DocIterator::nextInset() const
 {
        BOOST_ASSERT(!empty());
        if (pos() == lastpos())
                return 0;
        if (pos() > lastpos()) {
-               lyxerr << "Should not happen, but it does. " << endl;
+               LYXERR0("Should not happen, but it does. ");
                return 0;
        }
        if (inMathed())
@@ -131,7 +138,7 @@ Text * DocIterator::text() const
 Paragraph & DocIterator::paragraph() const
 {
        if (!inTexted())
-               lyxerr << *this << endl;
+               LYXERR0(*this);
        BOOST_ASSERT(inTexted());
        return top().paragraph();
 }
@@ -490,9 +497,9 @@ DocIterator::idx_type DocIterator::find(InsetMath const * inset) const
 }
 
 
-void DocIterator::cutOff(DocIterator::idx_type above, std::vector<CursorSlice> & cut)
+void DocIterator::cutOff(DocIterator::idx_type above, vector<CursorSlice> & cut)
 {
-       cut = std::vector<CursorSlice>(slices_.begin() + above + 1, slices_.end());
+       cut = vector<CursorSlice>(slices_.begin() + above + 1, slices_.end());
        slices_.resize(above + 1);
 }
 
@@ -503,7 +510,7 @@ void DocIterator::cutOff(DocIterator::idx_type above)
 }
 
 
-void DocIterator::append(std::vector<CursorSlice> const & x) 
+void DocIterator::append(vector<CursorSlice> const & x) 
 {
        slices_.insert(slices_.end(), x.begin(), x.end());
 }
@@ -517,7 +524,7 @@ void DocIterator::append(DocIterator::idx_type idx, pos_type pos)
 }
 
 
-std::ostream & operator<<(std::ostream & os, DocIterator const & dit)
+ostream & operator<<(ostream & os, DocIterator const & dit)
 {
        for (size_t i = 0, n = dit.depth(); i != n; ++i)
                os << " " << dit[i] << "\n";
@@ -525,29 +532,6 @@ std::ostream & operator<<(std::ostream & os, DocIterator const & dit)
 }
 
 
-bool operator<(DocIterator const & p, DocIterator const & q)
-{
-       size_t depth = std::min(p.depth(), q.depth());
-       for (size_t i = 0 ; i < depth ; ++i) {
-               if (p[i] != q[i])
-                       return p[i] < q[i];
-       }
-       return p.depth() < q.depth();
-}
-
-
-bool operator>(DocIterator const & p, DocIterator const & q)
-{
-       return q < p;
-}
-
-
-bool operator<=(DocIterator const & p, DocIterator const & q)
-{
-       return !(q < p);
-}
-
-
 ///////////////////////////////////////////////////////
 
 StableDocIterator::StableDocIterator(DocIterator const & dit)
@@ -566,11 +550,11 @@ DocIterator StableDocIterator::asDocIterator(Inset * inset) const
        for (size_t i = 0, n = data_.size(); i != n; ++i) {
                if (inset == 0) {
                        // FIXME
-                       lyxerr << BOOST_CURRENT_FUNCTION
-                              << " Should not happen, but does e.g. after C-n C-l C-z S-C-z\n"
-                                  << " or when a Buffer has been concurently edited by two views"
+                       LYXERR0(" Should not happen, but does e.g. after "
+                               "C-n C-l C-z S-C-z\n"
+                               << " or when a Buffer has been concurrently edited by two views"
                                << '\n' << "dit: " << dit << '\n'
-                               << " lastpos: " << dit.lastpos() << endl;
+                               << " lastpos: " << dit.lastpos());
                        dit.fixIfBroken();
                        break;
                }
@@ -586,7 +570,7 @@ DocIterator StableDocIterator::asDocIterator(Inset * inset) const
 }
 
 
-std::ostream & operator<<(std::ostream & os, StableDocIterator const & dit)
+ostream & operator<<(ostream & os, StableDocIterator const & dit)
 {
        for (size_t i = 0, n = dit.data_.size(); i != n; ++i)
                os << " " << dit.data_[i] << "\n";