database.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00027
00028
00029 #ifndef DATABASE_HPP
00030 #define DATABASE_HPP
00031
00032 #include "../my_config.h"
00033
00034 #include <list>
00035
00036 #include "archive.hpp"
00037 #include "generic_file.hpp"
00038 #include "data_tree.hpp"
00039 #include "storage.hpp"
00040
00041 namespace libdar
00042 {
00044
00049 class database
00050 {
00051 public:
00053 database();
00054
00056
00061 database(user_interaction & dialog, const std::string & base, bool partial);
00062
00064 ~database();
00065
00067
00071 void dump(user_interaction & dialog, const std::string & filename, bool overwrite) const;
00072
00073
00074
00076
00081 void add_archive(const archive & arch, const std::string & chemin, const std::string & basename);
00082
00084
00090 void remove_archive(archive_num min, archive_num max);
00091
00093
00097 void set_permutation(archive_num src, archive_num dst);
00098
00100
00103 void change_name(archive_num num, const std::string & basename);
00104
00106
00109 void set_path(archive_num num, const std::string & chemin);
00110
00112
00117 void set_options(const std::vector<std::string> &opt) { options_to_dar = opt; };
00118
00120
00123 void set_dar_path(const std::string & chemin) { dar_path = chemin; };
00124
00125
00126
00127
00129
00132 void show_contents(user_interaction & dialog) const;
00133
00135 std::vector<std::string> get_options() const { return options_to_dar; };
00136
00138
00141 std::string get_dar_path() const { return dar_path; };
00142
00144
00149 void show_files(user_interaction & dialog, archive_num num) const;
00150
00152
00156 void show_version(user_interaction & dialog, path chemin) const;
00157
00159
00162 void show_most_recent_stats(user_interaction & dialog) const;
00163
00164
00165
00167
00178 void restore(user_interaction & dialog,
00179 const std::vector<std::string> & filename,
00180 bool early_release,
00181 const std::vector<std::string> & extra_options_for_dar,
00182 const infinint & date = 0);
00183
00184 private:
00185
00187 struct archive_data
00188 {
00189 std::string chemin;
00190 std::string basename;
00191 };
00192
00193 std::vector<struct archive_data> coordinate;
00194 std::vector<std::string> options_to_dar;
00195 std::string dar_path;
00196 data_dir *files;
00197 storage *data_files;
00198
00199 void build(generic_file & f, bool partial);
00200 };
00201
00202 }
00203
00204 #endif