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