]> git.lyx.org Git - lyx.git/blob - src/vc-backend.h
prepare for 1.1.6pre2
[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 status() const { return vcstatus; }
51 protected:
52         ///
53         static int doVCCommand(string const &, 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 vcstatus;
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         explicit
80         RCS(string const & m);
81         ///
82         static string const find_file(string const & file);
83         ///
84         static void retrive(string const & file);
85         ///
86         virtual void scanMaster();
87         ///
88         virtual void registrer(string const & msg);
89         ///
90         virtual void checkIn(string const & msg);
91         ///
92         virtual void checkOut();
93         ///
94         virtual void revert();
95         ///
96         virtual void undoLast();
97         ///
98         virtual void getLog(string const &);
99 };
100
101
102 ///
103 class CVS : public VCS {
104 public:
105         ///
106         explicit
107         CVS(string const & m, string const & f);
108         ///
109         static string const find_file(string const & file);
110         ///
111         virtual void scanMaster();
112         ///
113         virtual void registrer(string const & msg);
114         ///
115         virtual void checkIn(string const & msg);
116         ///
117         virtual void checkOut();
118         ///
119         virtual void revert();
120         ///
121         virtual void undoLast();
122         ///
123         virtual void getLog(string const &);
124 private:
125         string file_;
126 };
127 #endif