![]() |
Disk ARchive
2.5.2
Full featured and portable backup and archiving tool
|
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 : http://dar.linux.free.fr/email.html 00020 /*********************************************************************/ 00021 00027 00029 00030 #ifndef FICHIER_GLOBAL_HPP 00031 #define FICHIER_GLOBAL_HPP 00032 00033 00034 #include "../my_config.h" 00035 00036 extern "C" 00037 { 00038 #if HAVE_UNISTD_H 00039 #include <unistd.h> 00040 #endif 00041 } // end extern "C" 00042 00043 #include "integers.hpp" 00044 #include "thread_cancellation.hpp" 00045 #include "label.hpp" 00046 #include "crc.hpp" 00047 #include "user_interaction.hpp" 00048 #include "mem_ui.hpp" 00049 00050 #include <string> 00051 00052 namespace libdar 00053 { 00054 00057 00058 class fichier_global : public generic_file, public thread_cancellation, public mem_ui 00059 { 00060 public : 00061 enum advise 00062 { 00063 advise_normal, //< no advise given by the application 00064 advise_sequential, //< application expect to read the data sequentially 00065 advise_random, //< application expect to read the data in random order 00066 advise_noreuse, //< application does not expect to read the data more than once 00067 advise_willneed, //< application expect to read the data again in near future 00068 advise_dontneed //< application will not read the data in near future 00069 }; 00070 00075 fichier_global(const user_interaction & dialog, gf_mode mode): generic_file(mode), mem_ui(dialog) {}; 00076 fichier_global(const fichier_global & ref) : generic_file(ref), thread_cancellation(ref), mem_ui(ref) {}; 00077 00078 // default assignment operator is fine here 00079 // default destructor is fine too here 00080 00082 virtual void change_ownership(const std::string & user, const std::string & group) = 0; 00083 00085 virtual void change_permission(U_I perm) = 0; 00086 00088 virtual infinint get_size() const = 0; 00089 00091 virtual void fadvise(advise adv) const = 0; 00092 00093 protected : 00104 virtual U_I fichier_global_inherited_write(const char *a, U_I size) = 0; 00105 00106 00117 virtual bool fichier_global_inherited_read(char *a, U_I size, U_I & read, std::string & message) = 0; 00118 00119 private: 00120 00121 // inherited from generic_file class and relocated as private methods 00122 void inherited_write(const char *a, U_I size); 00123 U_I inherited_read(char *a, U_I size); 00124 }; 00125 00126 00128 00129 } // end of namespace 00130 00131 #endif