Disk ARchive
2.4.5
|
00001 /*********************************************************************/ 00002 // dar - disk archive - a backup/restoration program 00003 // Copyright (C) 2002-2052 Denis Corbin 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 // 00019 // to contact the author : dar.linux@free.fr 00020 /*********************************************************************/ 00021 // $Id$ 00022 // 00023 /*********************************************************************/ 00024 00025 00026 #ifndef DATABASE_HPP 00027 #define DATABASE_HPP 00028 00029 #include "catalogue.hpp" 00030 #include "generic_file.hpp" 00031 #include "data_tree.hpp" 00032 #include <list> 00033 00034 00035 class database 00036 { 00037 public: 00038 database(); // build an empty database 00039 database(generic_file & f); // build a database from a file 00040 ~database(); 00041 00042 void dump(generic_file & f) const; // write a database to a file 00043 00044 // SETTINGS 00045 // 00046 void add_archive(const catalogue & cat, const string & chemin, const string & basename); 00047 void remove_archive(archive_num num); 00048 void change_name(archive_num num, const string & basename); 00049 void set_path(archive_num num, const string & chemin); 00050 void set_options(const vector<string> &opt) { options_to_dar = opt; }; 00051 void set_dar_path(const string & chemin) { dar_path = chemin; }; 00052 void set_permutation(archive_num src, archive_num dst); 00053 00054 // "GETTINGS" 00055 // 00056 void show_contents() const; // displays all archive information 00057 vector<string> get_options() const { return options_to_dar; }; // show option passed to dar 00058 string get_dar_path() const { return dar_path; }; // show path to dar command 00059 void show_files(archive_num num) const; // 0 displays all files else files related to archive number 00060 void show_version(path chemin) const; // list archive where the given file is saved 00061 void show_most_recent_stats() const; // display the most recent version statistics (number of files by archive) 00062 00063 // ACTION 00064 // 00065 void restore(const vector<string> & filename); 00066 00067 private: 00068 struct archive_data 00069 { 00070 string chemin; 00071 string basename; 00072 }; 00073 00074 vector<struct archive_data> coordinate; 00075 vector<string> options_to_dar; 00076 string dar_path; 00077 data_dir *files; 00078 }; 00079 00080 #endif