* de/Tutorial.lyx: minor corrections reported on lyx-docs.
[lyx.git] / src / LyXVC.h
blob1d576f93d057a407dbeccc69061889f909fa07ff
1 // -*- C++ -*-
2 /**
3 * \file LyXVC.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 LYX_VC_H
13 #define LYX_VC_H
15 #include <boost/scoped_ptr.hpp>
17 #include <string>
20 namespace lyx {
22 namespace support { class FileName; }
24 class VCS;
25 class Buffer;
27 /** Version Control for LyX.
28 This is the class giving the verison control features to LyX. It is
29 intended to support different kinds of version control.
30 The support in LyX is based loosely upon the version control in GNU Emacs,
31 but is not as extensive as that one. See Extended Manual for a simple
32 tutorial and manual for the use of the version control system in LyX.
34 LyXVC use this algorithm when it searches for VC files:
35 for RCS it searches for <filename>,v and RCS/<filename>,v similarly
36 CVS/Entries for cvs and .svn/entries. By doing this there doesn't need to be any
37 special support for VC in the lyx format, and this is especially good
38 when the lyx format will be a subset of LaTeX.
40 class LyXVC {
41 public:
42 ///
43 LyXVC();
44 ///
45 ~LyXVC();
46 /** Not a good name perhaps. This function should be called whenever
47 LyX loads a file. This function then checks for a master VC file (for
48 RCS this is *,v or RCS/ *,v ; for CVS this is CVS/Entries and .svn/entries
49 for SVN) if this file or entry is found, the loaded file is assumed to be
50 under controll by VC, and the appropiate actions is taken.
51 Returns true if the file is under control by a VCS.
53 bool file_found_hook(support::FileName const & fn);
55 /** This function should be run when a file is requested for loading,
56 but it does not exist. This function will then check for a VC master
57 file with the same name (see above function). If this exists the
58 user should be asked if he/her wants to checkout a version for
59 viewing/editing. Returns true if the file is under control by a VCS
60 and the user wants to view/edit it.
62 static bool file_not_found_hook(support::FileName const & fn);
64 ///
65 void setBuffer(Buffer *);
67 /// Register the document as an VC file.
68 bool registrer();
70 /// Unlock and commit changes. Returns log.
71 std::string checkIn();
72 /// Does the current VC supports this operation?
73 bool checkInEnabled();
75 /// Lock/update and prepare to edit document. Returns log.
76 std::string checkOut();
77 /// Does the current VC supports this operation?
78 bool checkOutEnabled();
80 /**
81 * Toggle locking property of the edited file,
82 * i.e. whether the file uses locking mechanism.
84 std::string lockingToggle();
85 /// Does the current VC supports this operation?
86 bool lockingToggleEnabled();
88 /// Revert to last version
89 void revert();
91 /// Undo last check-in.
92 void undoLast();
93 /// Does the current VC supports this operation?
94 bool undoLastEnabled();
96 /**
97 * Generate a log file and return the filename.
98 * It is the caller's responsibility to remove the
99 * file after use.
101 const std::string getLogFile() const;
104 void toggleReadOnly();
106 /// Is the document under administration by VCS?
107 bool inUse();
109 /// Returns the version number.
110 //std::string const & version() const;
111 /// Returns the version number.
112 std::string const versionString() const;
114 /// Returns the userid of the person who has locked the doc.
115 std::string const & locker() const;
117 private:
119 Buffer * owner_;
122 boost::scoped_ptr<VCS> vcs;
126 } // namespace lyx
128 #endif