]> git.lyx.org Git - lyx.git/blobdiff - src/changes.h
* src/tabular.[Ch]: simplify plaintext methods, because there
[lyx.git] / src / changes.h
index e0ccc794dff41dbfede15665996bdb0ae5b87d68..967a9a6c8d7bc6308827ba632a311068b3c778b4 100644 (file)
@@ -33,9 +33,12 @@ public:
                DELETED // deleted text
        };
 
-       explicit Change(Type t, int a = 0, time_type ct = 0)
+       explicit Change(Type t, int a = 0, time_type ct = current_time())
                : type(t), author(a), changetime(ct) {}
 
+       /// is the change similar to the given change such that both can be merged?
+       bool isSimilarTo(Change const & change);
+
        Type type;
 
        int author;
@@ -64,7 +67,7 @@ public:
        ///
 
        /// return the change at the given pos
-       Change const lookup(pos_type pos) const;
+       Change const lookup(pos_type pos) const;
 
        /// return true if there is a change in the given range (excluding end)
        bool isChanged(pos_type start, pos_type end) const;
@@ -73,12 +76,12 @@ public:
 
        /// output latex to mark a transition between two change types
        /// returns length of text outputted
-       static int latexMarkChange(odocstream & os, Change::Type old,
-               Change::Type change, bool const & output);
+       static int latexMarkChange(odocstream & os, Change::Type oldChangeType,
+               Change::Type changeType, bool const & output);
 
        /// output .lyx file format for transitions between changes
        static void lyxMarkChange(std::ostream & os, int & column,
-               time_type curtime, Change const & old, Change const & change);
+               Change const & old, Change const & change);
 
 private:
        class Range {
@@ -86,11 +89,15 @@ private:
                Range(pos_type s, pos_type e)
                        : start(s), end(e) {}
 
-               // does this range contain r ?
-               bool contains(Range const & r) const;
+               // does this range contain r ? (inlined as the result of profiling)
+               bool contains(Range const & r) const {
+                       return r.start >= start && r.end <= end;
+               }
 
-               // does this range contain pos ?
-               bool contains(pos_type pos) const;
+               // does this range contain pos ? (inlined as the result of profiling)
+               bool contains(pos_type pos) const {
+                       return pos >= start && pos < end;
+               }
 
                // do the ranges intersect ?
                bool intersects(Range const & r) const;