]> git.lyx.org Git - lyx.git/blob - src/vc-backend.h
77e6c6cd1e68b56fd4444e9b0743d6dad6fdae74
[lyx.git] / src / vc-backend.h
1 // -*- C++ -*-
2
3 #ifndef VC_BACKEND_H
4 #define VC_BACKEND_H
5
6 #ifdef __GNUG__
7 #pragma interface
8 #endif
9
10 #include "LString.h"
11 #include "support/syscall.h"
12
13 class Buffer;
14
15 ///
16 class VCS {
17 public:
18         ///
19         enum VCStatus {
20                 ///
21                 UNLOCKED,
22                 ///
23                 LOCKED
24         };
25         ///
26         virtual ~VCS() {}
27         ///
28         virtual void scanMaster() = 0;
29         ///
30         virtual void registrer(string const & msg) = 0;
31         ///
32         virtual void checkIn(string const & msg) = 0;
33         ///
34         virtual void checkOut() = 0;
35         ///
36         virtual void revert() = 0;
37         ///
38         virtual void undoLast() = 0;
39         ///
40         virtual void getLog(string const &) = 0;
41         ///
42         string const & version() const { return version_; }
43         ///
44         string const & locker() const { return locker_; }
45         ///
46         void owner(Buffer * b) { owner_ = b; }
47         ///
48         Buffer * owner() const { return owner_; }
49         ///
50         VCStatus stat() const { return vcstat; }
51 protected:
52         ///
53         int doVCCommand(string const &);
54
55         /** The master VC file. For RCS this is *,v or RCS/ *,v. master should
56             have full path.
57         */
58         string master_;
59         
60         /// The status of the VC controlled file.
61         VCStatus vcstat;
62         
63         /** The version of the VC file. I am not sure if this can be a
64             string of if it must be a
65             float/int. */
66         string version_;
67         
68         /// The user currently keeping the lock on the VC file.
69         string locker_;
70         /// The buffer using this VC
71         Buffer * owner_;
72 };
73
74
75 ///
76 class RCS : public VCS {
77 public:
78         ///
79         RCS(string const & m);
80         ///
81         static string find_file(string const & file);
82         ///
83         virtual void scanMaster();
84         ///
85         virtual void registrer(string const & msg);
86         ///
87         virtual void checkIn(string const & msg);
88         ///
89         virtual void checkOut();
90         ///
91         virtual void revert();
92         ///
93         virtual void undoLast();
94         ///
95         virtual void getLog(string const &);
96 private:
97 };
98
99
100 ///
101 class CVS : public VCS {
102 public:
103         ///
104         CVS(string const & m, string const & f);
105         ///
106         static string find_file(string const & file);
107         ///
108         virtual void scanMaster();
109         ///
110         virtual void registrer(string const & msg);
111         ///
112         virtual void checkIn(string const & msg);
113         ///
114         virtual void checkOut();
115         ///
116         virtual void revert();
117         ///
118         virtual void undoLast();
119         ///
120         virtual void getLog(string const &);
121 private:
122         string file_;
123 };
124 #endif