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