Add missing include, due to André LASSERT change
[lyx.git] / src / VCBackend.h
blob551874f3d161bfdf618c1ad85b7a3636408505d3
1 // -*- C++ -*-
2 /**
3 * \file VCBackend.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
12 #ifndef VC_BACKEND_H
13 #define VC_BACKEND_H
15 #include "support/FileName.h"
17 #include <string>
20 namespace lyx {
22 class Buffer;
24 /// A simple version control system interface
25 class VCS {
26 public:
27 /// the status of the managed file
28 enum VCStatus {
29 UNLOCKED,
30 LOCKED
33 virtual ~VCS() {}
35 /// register a file for version control
36 virtual void registrer(std::string const & msg) = 0;
37 /// check in the current revision
38 virtual void checkIn(std::string const & msg) = 0;
39 /// check out for editing
40 virtual void checkOut() = 0;
41 /// revert current edits
42 virtual void revert() = 0;
43 /// FIXME
44 virtual void undoLast() = 0;
45 /**
46 * getLog - read the revision log into the given file
47 * @param fname file name to read into
49 virtual void getLog(support::FileName const &) = 0;
50 /// return the current version description
51 virtual std::string const versionString() const = 0;
52 /// return the current version
53 std::string const & version() const { return version_; }
54 /// return the user who has locked the file
55 std::string const & locker() const { return locker_; }
56 /// set the owning buffer
57 void owner(Buffer * b) { owner_ = b; }
58 /// return the owning buffer
59 Buffer * owner() const { return owner_; }
60 /// return the lock status of this file
61 VCStatus status() const { return vcstatus; }
62 protected:
63 /// parse information from the version file
64 virtual void scanMaster() = 0;
66 /**
67 * doVCCommand - call out to the version control utility
68 * @param cmd the command to execute
69 * @param path the path from which to execute
70 * @return exit status
72 static int doVCCommand(std::string const & cmd, support::FileName const & path);
74 /**
75 * The master VC file. For RCS this is *,v or RCS/ *,v. master should
76 * have full path.
78 support::FileName master_;
80 /// The status of the VC controlled file.
81 VCStatus vcstatus;
83 /**
84 * The version of the VC file. I am not sure if this can be a
85 * string or if it must be a float/int.
87 std::string version_;
89 /// The user currently keeping the lock on the VC file.
90 std::string locker_;
91 /// The buffer using this VC
92 Buffer * owner_;
96 ///
97 class RCS : public VCS {
98 public:
100 explicit
101 RCS(support::FileName const & m);
103 /// return the revision file for the given file, if found
104 static support::FileName const findFile(support::FileName const & file);
106 static void retrieve(support::FileName const & file);
108 virtual void registrer(std::string const & msg);
110 virtual void checkIn(std::string const & msg);
112 virtual void checkOut();
114 virtual void revert();
116 virtual void undoLast();
118 virtual void getLog(support::FileName const &);
120 virtual std::string const versionString() const {
121 return "RCS: " + version_;
124 protected:
125 virtual void scanMaster();
130 class CVS : public VCS {
131 public:
133 explicit
134 CVS(support::FileName const & m, support::FileName const & f);
136 /// return the revision file for the given file, if found
137 static support::FileName const findFile(support::FileName const & file);
139 virtual void registrer(std::string const & msg);
141 virtual void checkIn(std::string const & msg);
143 virtual void checkOut();
145 virtual void revert();
147 virtual void undoLast();
149 virtual void getLog(support::FileName const &);
151 virtual std::string const versionString() const {
152 return "CVS: " + version_;
155 protected:
156 virtual void scanMaster();
158 private:
159 support::FileName file_;
162 } // namespace lyx
164 #endif // VCBACKEND_H