]> git.lyx.org Git - lyx.git/blob - src/vc-backend.h
Angus insetindex patch + protect patch from Dekel
[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 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 private:
100 };
101
102
103 ///
104 class CVS : public VCS {
105 public:
106         ///
107         explicit
108         CVS(string const & m, string const & f);
109         ///
110         static string find_file(string const & file);
111         ///
112         virtual void scanMaster();
113         ///
114         virtual void registrer(string const & msg);
115         ///
116         virtual void checkIn(string const & msg);
117         ///
118         virtual void checkOut();
119         ///
120         virtual void revert();
121         ///
122         virtual void undoLast();
123         ///
124         virtual void getLog(string const &);
125 private:
126         string file_;
127 };
128 #endif