scramble email addresses
[lyx.git] / src / LyXVC.h
blob9e4b7c44317314edf741e6d53e50f22cc70c53a0
1 // -*- C++ -*-
2 /**
3 * \file LyXVC.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
12 #ifndef LYX_VC_H
13 #define LYX_VC_H
15 #include <boost/scoped_ptr.hpp>
17 #include <string>
20 namespace lyx {
22 namespace support { class FileName; }
24 class VCS;
25 class Buffer;
27 /** Version Control for LyX.
28 This is the class giving the verison control features to LyX. It is
29 intended to support different kinds of version control, but at this point
30 we will only support RCS. Later CVS is a likely candidate for support.
31 The support in LyX is based loosely upon the version control in GNU Emacs,
32 but is not as extensive as that one. See examples/VC.lyx for a simple
33 tutorial and manual for the use of the version control system in LyX.
35 LyXVC use this algorithm when it searches for VC files:
36 for RCS it searches for <filename>,v and RCS/<filename>,v similar
37 should be done for CVS. By doing this there doesn't need to be any
38 special support for VC in the lyx format, and this is especially good
39 when the lyx format will be a subset of LaTeX.
41 class LyXVC {
42 public:
43 ///
44 LyXVC();
45 ///
46 ~LyXVC();
47 /** Not a good name perhaps. This function should be called whenever
48 LyX loads a file. This function then checks for a master VC file
49 (for RCS this is *,v or RCS/ *,v) if this file is found, the loaded
50 file is assumed to be under controll by VC (only RCS so far), and
51 the appropiate actions is taken. Returns true if the file is under
52 control by a VCS.
54 bool file_found_hook(support::FileName const & fn);
56 /** This function should be run when a file is requested for loading,
57 but it does not exist. This function will then check for a VC master
58 file with the same name (see above function). If this exists the
59 user should be asked if he/her wants to checkout a version for
60 viewing/editing. Returns true if the file is under control by a VCS
61 and the user wants to view/edit it.
63 static bool file_not_found_hook(support::FileName const & fn);
65 ///
66 void setBuffer(Buffer *);
68 /// Register the document as an VC file.
69 void registrer();
71 /// Unlock and commit changes.
72 void checkIn();
74 /// Lock and prepare to edit document.
75 void checkOut();
77 /// Revert to last version
78 void revert();
80 /// Undo last check-in.
81 void undoLast();
83 /**
84 * Generate a log file and return the filename.
85 * It is the caller's responsibility to unlink the
86 * file after use.
88 const std::string getLogFile() const;
90 ///
91 void toggleReadOnly();
93 /// Is the document under administration by RCS?
94 bool inUse();
96 /// Returns the version number.
97 //std::string const & version() const;
98 /// Returns the version number.
99 std::string const versionString() const;
101 /// Returns the userid of the person who has locked the doc.
102 std::string const & locker() const;
104 private:
106 Buffer * owner_;
109 boost::scoped_ptr<VCS> vcs;
113 } // namespace lyx
115 #endif