]> git.lyx.org Git - lyx.git/blob - src/lyxvc.h
remove mention of lyxrc from the splash
[lyx.git] / src / lyxvc.h
1 // -*- C++ -*-
2
3 #ifndef LYX_VC_H
4 #define LYX_VC_H
5
6 #include "LString.h"
7
8 class VCS;
9 class Buffer;
10
11 /** Version Control for LyX.
12     This is the class giving the verison control features to LyX. It is
13     intended to support different kinds of version control, but at this point
14     we will only support RCS. Later CVS is a likely candidate for support.
15     The support in LyX is based loosely upon the version control in GNU Emacs,
16     but is not as extensive as that one. See examples/VC.lyx for a simple
17     tutorial and manual for the use of the version control system in LyX.
18
19     LyXVC use this algorithm when it searches for VC files:
20     for RCS it searches for <filename>,v and RCS/<filename>,v similar
21     should be done for CVS. By doing this there doesn't need to be any
22     special support for VC in the lyx format, and this is especially good
23     when the lyx format will be a subset of LaTeX.
24 */
25 class LyXVC {
26 public:
27         ///
28         LyXVC();
29         ///
30         ~LyXVC();
31         /** Not a good name perhaps. This function should be called whenever
32           LyX loads a file. This function then checks for a master VC file
33           (for RCS this is *,v or RCS/ *,v) if this file is found, the loaded
34           file is assumed to be under controll by VC (only RCS so far), and
35           the appropiate actions is taken. Returns true if the file is under
36           control by a VCS.
37           */
38         bool file_found_hook(string const & fn);
39
40         /** This function should be run when a file is requested for loading,
41           but it does not exist. This function will then check for a VC master
42           file with the same name (see above function). If this exists the
43           user should be asked if he/her wants to checkout a version for
44           viewing/editing. Returns true if the file is under control by a VCS
45           and the user wants to view/edit it.
46           */
47         static bool file_not_found_hook(string const & fn);
48
49         ///
50         void buffer(Buffer *);
51
52         /// Register the document as an VC file.
53         void registrer();
54
55         /// Unlock and commit changes.
56         void checkIn();
57
58         /// Lock and prepare to edit document.
59         void checkOut();
60
61         /// Revert to last version
62         void revert();
63
64         /// Undo last check-in.
65         void undoLast();
66
67         /**
68          * Generate a log file and return the filename.
69          * It is the caller's responsibility to unlink the
70          * file after use.
71          */
72         const string getLogFile() const;
73
74         ///
75         void toggleReadOnly();
76
77         /// Is the document under administration by RCS?
78         bool inUse();
79
80         /// Returns the version number.
81         //string const & version() const;
82         /// Returns the version number.
83         string const versionString() const;
84
85         /// Returns the userid of the person who has locked the doc.
86         string const & locker() const;
87
88 private:
89         /// returns false if still not clean
90         bool ensureClean();
91         
92         ///
93         Buffer * owner_;
94
95         ///
96         VCS * vcs;
97 };
98
99 #endif