NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
filerevisions.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2019 Erik Haenel et al.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17******************************************************************************/
18
19#ifndef FILEREVISIONS_HPP
20#define FILEREVISIONS_HPP
21
22#include <wx/wx.h>
23#include <wx/filename.h>
24#include <vector>
25
27{
28 private:
29 wxFileName m_revisionPath;
30 std::vector<wxString> vectorize(wxString fileContent);
31 wxString convertLineEndings(const wxString& content);
32 wxString readRevision(const wxString& revString);
33 wxString getLastContentModification(const wxString& revString);
34 wxString getLastRevisionRoot(const wxString& revString);
35 wxString diff(const wxString& revision1, const wxString& revisionID1, const wxString& revision2, const wxString& revisionID2);
36 wxString createDiff(const wxString& revisionContent);
37 wxString createMerge(const wxString& diffFile);
38 wxString readExternalFile(const wxString& filePath);
39 size_t createNewRevision(const wxString& revContent, const wxString& comment);
40 size_t createNewTag(const wxString& revString, const wxString& comment);
41 void fileMove(const wxString& newRevPath, const wxString& comment);
42 size_t getMaxDiffFileSize(size_t nFileSize);
43
44 public:
45 FileRevisions(const wxString& revisionPath);
46 size_t getRevisionCount();
47 wxArrayString getRevisionList();
48 wxString getCurrentRevision();
49
50 size_t addRevision(const wxString& revisionContent);
51 size_t addExternalRevision(const wxString& filePath);
52 void undoRevision();
53 void renameFile(const wxString& oldName, const wxString& newName, const wxString& newRevPath);
54 void moveFile(const wxString& oldPath, const wxString& newPath, const wxString& newRevPath);
55
56 wxString getRevision(size_t nRevision);
57 wxString getRevision(wxString revString);
58
59 wxString compareRevisions(const wxString& rev1, const wxString& rev2);
60
61 void restoreRevision(size_t nRevision, const wxString& targetFile);
62 void restoreRevision(const wxString& revString, const wxString& targetFile);
63
64 size_t tagRevision(size_t nRevision, const wxString& tagComment);
65 size_t tagRevision(const wxString& revString, const wxString& tagComment);
66};
67
68
69#endif // FILEREVISIONS_HPP
70
71
wxString getRevision(size_t nRevision)
Returns the contents of the selected revision.
size_t addRevision(const wxString &revisionContent)
This method adds a new revision.
void renameFile(const wxString &oldName, const wxString &newName, const wxString &newRevPath)
This method handles renames of the corresponding file.
size_t getRevisionCount()
Returns the number of available revisions.
void restoreRevision(size_t nRevision, const wxString &targetFile)
This method will restore the contents of the selected revision.
wxArrayString getRevisionList()
This method returns a log-like list of revisions.
wxString createMerge(const wxString &diffFile)
This method merges the diff file into the current revision root.
FileRevisions(const wxString &revisionPath)
Constructor. Will try to create the missing folders on-the-fly.
size_t createNewTag(const wxString &revString, const wxString &comment)
This method creates a new tag for the passed revision.
wxString convertLineEndings(const wxString &content)
This method converts line end characters.
size_t createNewRevision(const wxString &revContent, const wxString &comment)
This method creates a new revision.
wxFileName m_revisionPath
size_t tagRevision(size_t nRevision, const wxString &tagComment)
Allows the user to tag a selected revision with the passed comment.
wxString diff(const wxString &revision1, const wxString &revisionID1, const wxString &revision2, const wxString &revisionID2)
This method calculates the differences between two files.
wxString readRevision(const wxString &revString)
This method returns the contents of the selected revision.
wxString getLastContentModification(const wxString &revString)
This method returns the last modification revision identifier.
void undoRevision()
This method removes the last added revision.
wxString compareRevisions(const wxString &rev1, const wxString &rev2)
This member function compares two revisions with each other and returns the differnces as unified dif...
wxString getLastRevisionRoot(const wxString &revString)
This method returns the revision identifier of the last revision root.
void moveFile(const wxString &oldPath, const wxString &newPath, const wxString &newRevPath)
This method handles moves of the corresponding file.
wxString readExternalFile(const wxString &filePath)
This method reads an external file into a string.
std::vector< wxString > vectorize(wxString fileContent)
Converts a single-string file into a vector of strings.
void fileMove(const wxString &newRevPath, const wxString &comment)
This method handles all file move operations.
size_t addExternalRevision(const wxString &filePath)
This method adds an external modification as new revision.
wxString createDiff(const wxString &revisionContent)
This method creates the file differences between the file contents and the current revision root.
wxString getCurrentRevision()
This method returns the revision identifier of the current revision.
size_t getMaxDiffFileSize(size_t nFileSize)
This member function returns the maximal Diff file size.