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