Disk ARchive  2.5.18
Full featured and portable backup and archiving tool
entrepot_local.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2052 Denis Corbin
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (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, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 // to contact the author : http://dar.linux.free.fr/email.html
20 /*********************************************************************/
21 // $Id: entrepot.hpp,v 1.1 2012/04/27 11:24:30 edrusb Exp $
22 //
23 /*********************************************************************/
24 
25 
36 
38 
39 #ifndef ENTREPOT_LOCAL_HPP
40 #define ENTREPOT_LOCAL_HPP
41 
42 #include "../my_config.h"
43 
44 #include <string>
45 #include "infinint.hpp"
46 #include "generic_file.hpp"
47 #include "user_interaction.hpp"
48 #include "entrepot.hpp"
49 #include "fichier_global.hpp"
50 #include "hash_fichier.hpp"
51 #include "etage.hpp"
52 #include "path.hpp"
53 
54 namespace libdar
55 {
58 
62 
63  class entrepot_local : public entrepot
64  {
65  public:
66  entrepot_local(const std::string & user, const std::string & group, bool x_furtive_mode);
67  entrepot_local(const entrepot_local & ref): entrepot(ref) { copy_from(ref); };
68  entrepot_local & operator = (const entrepot_local & ref);
69  ~entrepot_local() { detruit(); };
70 
71  std::string get_url() const { return std::string("file://") + get_full_path().display(); };
72 
73  void read_dir_reset();
74  bool read_dir_next(std::string & filename);
75 
76  entrepot *clone() const { return new (get_pool()) entrepot_local(*this); };
77 
78  protected:
79  fichier_global *inherited_open(user_interaction & dialog,
80  const std::string & filename,
81  gf_mode mode,
82  bool force_permission,
83  U_I permission,
84  bool fail_if_exists,
85  bool erase) const;
86 
87  void inherited_unlink(const std::string & filename) const;
88  void read_dir_flush() { detruit(); };
89 
90  private:
91  bool furtive_mode;
92  etage *contents;
93 
94  void copy_from(const entrepot_local & ref) { furtive_mode = ref.furtive_mode; contents = nullptr; };
95  void detruit() { if(contents != nullptr) { delete contents; contents = nullptr; } };
96  };
97 
99 
100 } // end of namespace
101 
102 #endif
defines the entrepot interface. Entrepot interface defines a generic way to interact with files (slic...
memory_pool * get_pool() const
Definition: on_pool.hpp:144
class generic_file is defined here as well as class fichierthe generic_file interface is widely used ...
This is a pure virtual class that is used by libdar when interaction with the user is required...
void read_dir_reset()
routines to read existing files in the current directory (see set_location() / set_root() methods) ...
gf_mode
generic_file openning modes
entrepot()
constructor
defines the interaction between libdar and the user.Three classes are defined
here is the definition of the path classthe path class handle path and provide several operation on t...
definition of the etage structure is done here
class fichier_global definition. This class is a pure virtual class class fichier_global is an abstra...
abstraction of filesystem files for entrepot
switch module to limitint (32 ou 64 bits integers) or infinint
class hash_fichier definition.This is an inherited class from class fichier Objects of that class are...
the etage structure keep trace of directory contents
Definition: etage.hpp:47
the Entrepot interface
Definition: entrepot.hpp:61
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47
std::string display() const
convert back a path to a string