]> git.lyx.org Git - lyx.git/blobdiff - src/Changes.h
char * for string literals is deprecated...
[lyx.git] / src / Changes.h
index d7041480cb6e32639bdbceea3e4ad8302222994c..631419bc3065d71963d4ae9957c36c79aa934f68 100644 (file)
 #ifndef CHANGES_H
 #define CHANGES_H
 
-#include "support/docstream.h"
+#include "ColorCode.h"
+
+#include "support/strfwd.h"
+#include "support/types.h"
 #include "support/lyxtime.h"
 
 #include <vector>
@@ -23,6 +26,7 @@
 
 namespace lyx {
 
+class AuthorList;
 
 class Change {
 public:
@@ -33,17 +37,31 @@ public:
                DELETED // deleted text
        };
 
-       explicit Change(Type t, int a = 0, time_type ct = current_time())
+       explicit Change(Type t = UNCHANGED, int a = 0, time_t 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);
+       bool isSimilarTo(Change const & change) const;
+       /// The color of this change on screen
+       ColorCode color() const;
+       ///
+       bool changed() const { return type != UNCHANGED; }
+       ///
+       void setUnchanged() { type = UNCHANGED; }
+       ///
+       bool inserted() const { return type == INSERTED; }
+       ///
+       void setInserted() { type = INSERTED; }
+       ///
+       bool deleted() const { return type == DELETED; }
+       ///
+       void setDeleted() { type = DELETED; }
 
        Type type;
 
        int author;
 
-       time_type changetime;
+       time_t changetime;
 };
 
 bool operator==(Change const & l, Change const & r);
@@ -79,12 +97,15 @@ public:
        /// output latex to mark a transition between two change types
        /// returns length of text outputted
        static int latexMarkChange(odocstream & os, BufferParams const & bparams,
-                                  Change const & oldChange, Change const & change);
+                                  Change const & oldChange, Change const & change);
 
        /// output .lyx file format for transitions between changes
        static void lyxMarkChange(std::ostream & os, int & column,
                Change const & old, Change const & change);
 
+       ///
+       void checkAuthors(AuthorList const & authorList);
+
 private:
        class Range {
        public: